Skip to content

fix(core): harden ledger concurrency for production gate Q4 - #8

Open
Dukeabaddon wants to merge 5 commits into
mainfrom
feat/production-phase-4-ledger
Open

fix(core): harden ledger concurrency for production gate Q4#8
Dukeabaddon wants to merge 5 commits into
mainfrom
feat/production-phase-4-ledger

Conversation

@Dukeabaddon

Copy link
Copy Markdown
Owner

Summary

  • Replace the fixed 100ms sleep in multi-worker ledger tests with a SharedArrayBuffer contention barrier so all workers reach the SQLite write path before the test lock releases.
  • Extract the shared harness to test/helpers/blocked-sqlite-workers.ts and reuse it from ledger.test.ts and pipeline.e2e.test.ts.
  • Recover from concurrent UNIQUE inserts in appendSupportingArtifact by reconciling the existing row (idempotent replay or deterministic conflict) instead of surfacing raw SQLite errors.

Dependency note

Branched from latest main (9a92922). Phase 3 controller split (feat/production-phase-3a-evidence, feat/production-phase-3b-cross-artifact) is not merged yet; this PR is independent and targets main directly per the production plan.

Test plan

  • npm test -- packages/core/src/ledger.test.ts packages/mcp/src/pipeline.e2e.test.ts
  • npm test -- --coverage three consecutive green runs
  • npm test (401/401)

Closes PRODUCTION_GATE Q4 (coverage run stable with ledger concurrency).

Replace the fixed 100ms worker sleep with a SharedArrayBuffer barrier so
all workers reach contention before the test lock releases. Recover from
concurrent UNIQUE inserts in appendSupportingArtifact by reconciling the
existing row instead of surfacing raw SQLite errors.
@Dukeabaddon Dukeabaddon mentioned this pull request Aug 12, 2026
3 tasks
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