Skip to content

fix(test): synchronize private ledger lock-order assertions - #7441

Merged
bokelley merged 1 commit into
mainfrom
fix/private-ledger-lock-order-test
Sep 13, 2026
Merged

bokelley merged 1 commit into
mainfrom
fix/private-ledger-lock-order-test

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

The private-ledger lock-order integration test races recovery against the production 250 ms lock timeout. On a slower runner the writer correctly returns persistence_uncertain, but the test expects only unknown_exposure, blocking unrelated PRs including #7420.

Observe the actual writer table-gate query instead of sleeping for 75 ms, assert that the writer has neither acquired the gate nor requested its target row while recovery holds the table lock, and preserve the strict post-recovery result assertion. This ordering test uses bounded five-second database timeouts; the production timeouts and their separate timeout tests are unchanged. Cleanup releases the recovery barrier and drains both transactions even if an assertion fails.

Validation, run directly in Docker with PostgreSQL 16 and the ledger migrations:

  • The unchanged test reproduced the CI failure on origin/main (unknown_exposure expected, persistence_uncertain received).
  • All 36 ledger migration integration tests and 27 ledger state unit tests passed with the fix.
  • Negative control: temporarily removing the writer table gate makes the revised test fail at the gate-observation assertion. The mutation was reverted.
  • Full npm run typecheck passed, including the test-aware fixed-trace check.

This changes one integration test. No production code, migration, protocol surface, or changeset is included.

@bokelley
bokelley enabled auto-merge (squash) September 13, 2026 11:50

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — test-only fix to a private-ledger lock-order integration test.

Checked:

  • Single file changed (+39/-13): server/tests/integration/addie/fixed-trace-component-smoke-private-ledger-migration.test.ts. No production code, schema (static/schemas/source/**), docs, dist/** artifacts, migrations, or protocol surface touched — so no changeset is required and no schema↔docs / oneOf / immutability concerns apply.
  • The change correctly replaces a 75 ms sleep that raced the production 250 ms lock timeout with deterministic observation of the writer's table gate, bounds the ordering test's timeouts to 5s, and adds a finally block that drains both transactions even on assertion failure — a net reliability improvement.

Gate checks:

  • No no-auto-approve team match.
  • gated_paths: false (review_decision REVIEW_REQUIRED is therefore irrelevant to row 2).
  • high_risk: false; no deleted/modified sensitive files.
  • No critical/high/medium findings.

None of rows 1–8 fire → row 9 approve.

@bokelley
bokelley merged commit 102d53d into main Sep 13, 2026
30 checks passed
@bokelley
bokelley deleted the fix/private-ledger-lock-order-test branch September 13, 2026 11:58
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