Skip to content

fix: clear guild trade after losing a capital - #200

Merged
ryanbarlow97 merged 1 commit into
mainfrom
fix/clear-landless-trade
Oct 21, 2026
Merged

ryanbarlow97 merged 1 commit into
mainfrom
fix/clear-landless-trade

Conversation

@ryanbarlow97

Copy link
Copy Markdown
Contributor

Summary

ProvinceManager skipped guilds without a capital before clearing their per-province trade and production, so a guild that lost its capital kept its old trade power and income in the saved economy.

Full, quiet (preview) and single-guild recalculation now reach the existing cleanup when capital = -1. Quiet recalculation keeps saved trade breakdowns; a saved recalculation clears them.

Tests

  • Three new regression tests in ProvinceManagerHubTransportTest failed on the old source and pass with this change.
  • ProvinceEconomyCoverageTest now checks the cleaned landless entries, recalculated prosperity and zero saved income.
  • mvn clean verify: 8,485 tests, no failures, errors or skips; coverage checks pass.

🤖 Generated with Claude Code

@github-actions github-actions Bot added the size:XS 0-9 effective changed lines (tests excluded in mixed PRs). label Oct 21, 2026
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

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: db2f60fa-89ea-4ded-82c2-e1f7b3514664
📥 Commits

Reviewing files that changed from the base of the PR and between 07ef4fa and ebf64e9.

📒 Files selected for processing: 3
  • src/main/java/net/tfminecraft/simplefactions/managers/ProvinceManager.java
  • src/test/java/net/tfminecraft/simplefactions/managers/ProvinceEconomyCoverageTest.java
  • src/test/java/net/tfminecraft/simplefactions/managers/ProvinceManagerHubTransportTest.java

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

📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Guild trade data is now recalculated correctly even when a guild has no capital.
    • Losing a guild capital now clears outdated trade and production data.
    • Province recalculations now reset stale income information when a guild becomes landless.
    • Quiet recalculations preserve the existing income breakdown while removing invalid province data; full recalculations also clear related trade power and income values.

Province recalculation now processes guilds without capitals, allowing stale trade and production data to be cleared. Production recalculation remains capital-dependent. Tests cover single-guild, quiet, and full recalculation, plus disabled-income behaviour.

Changes: Province recalculation

Layer / File(s) Summary
Recalculate guilds without capitals
src/main/java/net/tfminecraft/simplefactions/managers/ProvinceManager.java, src/test/java/net/tfminecraft/simplefactions/managers/ProvinceEconomyCoverageTest.java, src/test/java/net/tfminecraft/simplefactions/managers/ProvinceManagerHubTransportTest.java
Full, quiet, and single-guild recalculation now process guilds without capitals. Tests verify changes to stored trade, production, province data, and income.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: drefvelin

Merge Risk: ⚪ Minimal · up to ebf64

Capital-loss recalculation has no identified issue requiring correction before merge; normal checks remain appropriate.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@ryanbarlow97
ryanbarlow97 merged commit 81bca3b into main Oct 21, 2026
3 checks passed
@ryanbarlow97
ryanbarlow97 deleted the fix/clear-landless-trade branch October 21, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 effective changed lines (tests excluded in mixed PRs).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant