Skip to content

fix: refresh realm trade when bankruptcy changes - #203

Draft
ryanbarlow97 wants to merge 1 commit into
mainfrom
fix/bankruptcy-export-refresh
Draft

ryanbarlow97 wants to merge 1 commit into
mainfrom
fix/bankruptcy-export-refresh

Conversation

@ryanbarlow97

@ryanbarlow97 ryanbarlow97 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

A realm bank can become negative without marking province economics dirty. Its cached trade and production then survive recalculateIfNeeded, and quiet map publications export that old trade alongside the current negative bank. The offline planner correctly rejects the inconsistent snapshot.

Invalidate cached province economics when a realm treasury crosses the bankruptcy boundary, and refresh dirty economics before live exports. Changes within the same solvent/insolvent state keep the existing cache. Chronicle's existing prestige refresh then reads the refreshed trade; no settlement or bank mutation is introduced.

Validation: two regression tests fail on the original source (retained trade after bankruptcy; missing refresh before export). All 34 tests in ProvinceEconomyCoverageTest and MapPublicationCoverageTest pass with the fix, including bankruptcy recovery, unchanged-balance caching, saved breakdowns and unchanged bank balances. TFMC_MVN_REMOTE=0 tfmc-mvn -o -B clean verify passed all 8,507 tests with zero failures/errors/skips and all coverage checks (zero missed lines). Runtime JAR filename/embedded-version validation passed.

Live evidence: running 4.14.0 exported Khazabrar realm bank -11.23 d with trade power 1.0 across repeated whole captures. This patch is prepared against current main, including #202; that per-recalculation memo does not invalidate trade between recalculations. No live plugin or server has been changed. Main release staging requires the user's approval for this specific fix.

Documentation: TF-Minecraft/Docs#313

@coderabbitai

coderabbitai Bot commented Oct 21, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • 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.

@github-actions github-actions Bot added the size:S 10-29 effective changed lines (tests excluded in mixed PRs). label Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 effective changed lines (tests excluded in mixed PRs).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant