Skip to content

Give realm guilds an Infrastructure branch in place of Supply Lines - #108

Merged
Drefvelin merged 1 commit into
mainfrom
infra-5
Oct 3, 2026
Merged

Drefvelin merged 1 commit into
mainfrom
infra-5

Conversation

@Drefvelin

Copy link
Copy Markdown
Contributor

Summary

Realm guilds get an Infrastructure branch where Supply Lines used to be. Other guilds keep Supply Lines unchanged.

  • Infrastructure branch (realm guilds): 2 infrastructure per level at the realm capital, 1 denar a day per level in upkeep, and hub slots every 4 levels instead of every 2. Its hubs are as good as any other guild's.
  • Bureaucracy: adds 0.1 infrastructure per level.
  • Ledger: a new Infrastructure line shows the daily upkeep. The branch menu's income preview now counts that upkeep when it compares a level up or down.
  • Saved guilds: a realm guild saved on Supply Lines loads on Infrastructure at the same level. A server whose branches.yml still allows Supply Lines for realms is unaffected.
  • Hub upkeep: the base is now 1 a day per hub (it was 2 after Rebalance hub shares, hub upkeep and installation upkeep #105), on both branches.

Server files

Guilds/branches.yml on a server is not replaced by the jar. Until it is edited at release, realm guilds stay on Supply Lines and nothing changes for them.

Testing

mvn verify: 2,577 tests pass. New tests cover which branch each guild type gets, the modifier totals, hub limits by level on both branches, the saved-guild move, the ledger line and settlement, and the preview.

🤖 Generated with Claude Code

The branch adds infrastructure at the realm capital, costs a daily upkeep
per level, and gains hub slots more slowly. Bureaucracy adds a little
infrastructure too. A realm guild saved on Supply Lines moves to the new
branch at the same level. Hub upkeep now starts at 1 a day.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 857f8f8f-2864-4fd9-b6ca-9386583eeb3a
📥 Commits

Reviewing files that changed from the base of the PR and between 5da6095 and a0f8f31.

📒 Files selected for processing (10)
  • src/main/java/net/tfminecraft/simplefactions/enums/GuildModifier.java
  • src/main/java/net/tfminecraft/simplefactions/guild/Guild.java
  • src/main/java/net/tfminecraft/simplefactions/guild/income/BranchIncomePreview.java
  • src/main/java/net/tfminecraft/simplefactions/guild/income/Cashflow.java
  • src/main/java/net/tfminecraft/simplefactions/guild/income/Ledger.java
  • src/main/java/net/tfminecraft/simplefactions/loaders/BranchLoader.java
  • src/main/resources/Guilds/branches.yml
  • src/test/java/net/tfminecraft/simplefactions/guild/hub/SupplyHubServiceTest.java
  • src/test/java/net/tfminecraft/simplefactions/guild/income/BranchIncomePreviewTest.java
  • src/test/java/net/tfminecraft/simplefactions/loaders/SupplyHubBranchesTest.java

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.


📝 Summary

Summary by CodeRabbit

  • New Features
    • Realm guilds can now develop infrastructure, affecting hub capacity, trade, production and upkeep.
    • Infrastructure upkeep is reflected in guild income, net income and branch income previews.
    • Existing branches that are unavailable to a guild type are replaced with an allowed branch from the same group when loaded, where one is available.
  • Changes
    • Supply Lines now has a lower base hub-upkeep modifier.

Walkthrough

The change adds realm-only infrastructure branch modifiers, replaces disallowed branches during guild loading, and includes infrastructure upkeep in cashflow, net-income, dividend, settlement and branch-preview calculations. Tests cover hub limits, branch replacement and upkeep amounts.

Changes

Infrastructure branches and upkeep

Layer / File(s) Summary
Branch eligibility and hub modifiers
src/main/java/net/tfminecraft/simplefactions/loaders/BranchLoader.java, src/main/java/net/tfminecraft/simplefactions/guild/Guild.java, src/main/resources/Guilds/branches.yml, src/test/java/net/tfminecraft/simplefactions/loaders/SupplyHubBranchesTest.java, src/test/java/net/tfminecraft/simplefactions/guild/hub/SupplyHubServiceTest.java
Branch loading replaces a disallowed branch with an allowed branch from the same group when one is available. Branch definitions and hub-limit tests cover infrastructure modifiers and revised supply-lines upkeep.
Upkeep cashflow and preview calculations
src/main/java/net/tfminecraft/simplefactions/enums/GuildModifier.java, src/main/java/net/tfminecraft/simplefactions/guild/income/Cashflow.java, src/main/java/net/tfminecraft/simplefactions/guild/income/Ledger.java, src/main/java/net/tfminecraft/simplefactions/guild/income/BranchIncomePreview.java, src/test/java/net/tfminecraft/simplefactions/guild/income/BranchIncomePreviewTest.java, src/test/java/net/tfminecraft/simplefactions/guild/hub/SupplyHubServiceTest.java
Infrastructure upkeep is recorded as a negative cashflow and included in net income, dividends and settlement. Branch previews account for upkeep changes, with tests for upkeep values and preview deltas.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Ledger
  participant GuildModifierOverride
  participant Guild
  Ledger->>GuildModifierOverride: resolve INFRASTRUCTURE_UPKEEP modifier
  GuildModifierOverride-->>Ledger: modifier value
  Ledger->>Guild: record external balance delta at settlement
Loading

Suggested reviewers: ryanbarlow97

Merge Risk: ⚪ Minimal · up to a0f8f

Realm guilds move from Supply Lines to Infrastructure at the same level, and upkeep is deducted consistently in the ledger and previews. No concrete merge-blocking risk was found.

Security Architecture Review

Security architecture risk: 🔵 Low · up to a0f8f

The reviewed accounting preserves guild-scoped controls, and excess saved hubs remain dormant rather than bypassing the new limit. The main concern is rollback: restoring an older branch configuration after migration can reset saved Infrastructure levels. No new security vulnerability was established, but recovery behavior and effective server configuration are not fully verified.

Retained concerns

  • Medium · reliability · inferred: After migration is saved, restoring a branch configuration that omits infrastructure can reset the migrated branch level. Loading skips the now-unknown saved identifier, fills the missing group with an allowed branch at level zero, and subsequent saving persists that replacement. The level-preserving normalization only works while the saved branch definition is still resolvable. This is an administrator-triggered persistence rollback risk, not an established player attack path.
Security review details

Security Blast Radius

  • inferred — The demonstrated rollback exposure is limited to migrated guilds whose saved branch identifier is removed from the effective configuration. It can affect multiple realm guilds on the same server, but the evidence does not establish player control over that configuration or an escalation to server privileges.

Trust Boundaries and Controls

  • observed — Replacement eligibility comes from configured allowed types, and upkeep settlement retains the existing bankrupt-or-missing-bank guard. Normalization is not a universal rejection control: if no eligible replacement exists, it leaves the disallowed saved branch unchanged.

Resilience and Maintainability Implications

  • observed — Settlement aggregates guild deltas before applying deposits, but it is not transactional across guilds: individual runtime failures are logged and processing continues. Infrastructure upkeep inherits this existing mechanism; the PR comparison does not show a new recovery or authority bypass in that mechanism.

Hardening Proposals

  • proposed — Define a rollback procedure that preserves the Infrastructure definition until reverse migration completes, or restores matching configuration and saved-data backups together. An explicit reverse mapping could preserve levels before the identifier is removed.
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@Drefvelin
Drefvelin merged commit 2888237 into main Oct 3, 2026
2 checks passed
@Drefvelin
Drefvelin deleted the infra-5 branch October 3, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants