Skip to content

Fix bondClr SFC identity failure when all banks fail#35

Merged
speedcom merged 1 commit intomainfrom
fix/bondclr-all-banks-fail
Mar 3, 2026
Merged

Fix bondClr SFC identity failure when all banks fail#35
speedcom merged 1 commit intomainfrom
fix/bondclr-all-banks-fail

Conversation

@speedcom
Copy link
Contributor

@speedcom speedcom commented Mar 3, 2026

Summary

  • Root cause: resolveFailures() checked the zero-out branch before the absorber branch — when the absorber was itself failed (all-banks-fail), it was wiped before absorbing assets, destroying all gov bonds (Identity 5 break)
  • Fix: reorder branches (absorber FIRST, resurrected as bridge bank), transfer interbankNet to absorber (Identity 6), pick least-bad bank via maxBy(_.capital) when all fail
  • Tests: 4 new edge-case tests in KnfBfgSpec (1217 → 1221)

Test plan

  • sbt test — 1221 passed, 0 failed
  • Smoke test BDP=2000: bondClr=0,00 across 30 seeds × 120 months
  • Smoke test BDP=0: bondClr=0,00 across 30 seeds × 120 months (all 7 banks fail month 3)

resolveFailures() checked the zero-out branch before the absorber
branch, so when the absorber was itself a failed bank (all-banks-fail
scenario), it was wiped before it could absorb assets — destroying
all gov bonds and breaking Identity 5.

Reorder branches: absorber FIRST (resurrected as bridge bank), then
zero-out. Also transfer interbankNet to absorber for Identity 6, and
pick least-bad bank (maxBy capital) when all banks have failed.
@speedcom speedcom merged commit 9f71c26 into main Mar 3, 2026
2 of 3 checks passed
@speedcom speedcom deleted the fix/bondclr-all-banks-fail branch March 3, 2026 19:28
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.

1 participant