Release: develop -> main#4317
Merged
Merged
Conversation
…booking wedge) (#4309) * fix(accounting): re-run the idempotent CoA bootstrap after cutover The Chart-of-Accounts bootstrap only ran inside the one-time ledger cutover. Custody assets created after the cutover (e.g. the Bank Frick assets from #4252, prod-live three days after the cutover completed) never get an ASSET ledger account, so the first bank_tx referencing them wedges the BankTxConsumer fail-loud ('CoA bootstrap missing'), stalls the booking watermark and floods the log (~120 errors/h since 2026-07-22 12:16 UTC on bank_tx 207473, Frick/EUR). Register a recurring 5-minute @DfxCron wrapper (own kill-switch Process.LEDGER_COA_BOOTSTRAP, gated on isLedgerReady) that re-runs the idempotent bootstrap, and add a rename-guard in bootstrapAssetAccounts: UNIQUE is on name only, so after a uniqueName change findOrCreate(name) would create a second account for the same asset and make findByAssetId ambiguous — the existing account wins. * fix(accounting): fail loud on CoA account name collision After a uniqueName rename, the old name can be reused by a new asset; findOrCreate then name-hits the foreign account and returns it without creating anything — the recurring bootstrap would silently no-op on the exact case it exists to heal. Log an error instead (re-fires every run, persistent signal). Also cover the guard-skip loop continuation with a mixed two-asset spec. * test(accounting): restore the DfxLogger prototype spy after the collision spec The prototype-level mock outlives beforeEach's createMock rebuilds and would leak call history into later tests (repo convention restores it, cf. crypto-input.consumer.spec.ts). * fix(accounting): create CoA accounts active and isolate per-asset bootstrap failures Asset.isActive measures user tradability (all custody/bank assets are false), not account liveness - deriving ledger_account.active from it made every bootstrap-created ASSET account invisible to the reconciliation safety net while still being booked. findOrCreate now always creates live accounts; active=false stays a manual marker. A failing asset no longer aborts the whole recurring run: log and continue, so later assets and the transit/named sections still get their accounts. The collision check now also catches name-hits on NULL-assetId rows, and a real creation logs an info line as the post-deploy signal that the recurring bootstrap did its work. * test(accounting): assert cron schedule and lock timeout of the ledger job wrappers * fix(accounting): activate the bootstrap-created ASSET ledger accounts The bootstrap derived ledger_account.active from Asset.isActive, which is false for every custody/bank asset - so ALL asset-backed accounts created at cutover are invisible to the daily reconciliation while still being booked. The code fix stops the derivation for new accounts; this migration repairs the existing rows so the reconciliation safety net actually covers them.
github-actions
Bot
requested review from
TaprootFreak and
davidleomay
as code owners
July 22, 2026 18:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automatic Release PR
This PR was automatically created after changes were pushed to develop.
Commits: 1 new commit(s)
Checklist