FORGE-88: guard readiness transitions, bootstrap and manual receipts (Phase 3 step 4b) #740
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
gmackie/ForgeGraph!740
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "FORGE-88-guards-b"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
FORGE-88 step 4b (FORGE-69 D1 migration, Phase 3): GUARD conversions on top of main, independent of #736/#737.
atomic()batch: a conditional verdict UPDATE stamps a newwork_item_links.readiness_token, an assertion checks our token, then the outbox row is inserted. A caller whose UPDATE matched nothing aborts before writing an intent. Race coverage comes from the existingnotification-outbox.concurrency.test.ts(two concurrent initial transitions → one intent), which fails if the assertion checks the verdict instead of the token. Migration 0123 (ADD COLUMN IF NOT EXISTS readiness_token).resource_locksmarker plusNOT EXISTS (users)makes the first-admin batch exclusive. Any other request aborts and leaves no admin, token or marker; a database test checks this. Before, two parallel requests could both count zero users and both insert.FOR UPDATEondeployment_targetsafter the T1–T43 doc was written. A replay is answered from its fixed-identity row. A new invocation runs: assert nothing newer serves the lane, retire the server, insert. A stale receipt aborts, and a racing one hits the primary key ordeployment_active_unique_idx; both are answered from what was recorded.classifyDbError()(from #706) now recognises CHECK violations: Postgres 23514, and SQLiteCHECK constraint failed: <name>, plain or D1-wrapped.atomic()uses it to detectassertInBatch()failures.atomic()accepts any thenable. This is the same hunk as in #736, so it merges cleanly in either order.Local, on real Postgres 17: api database lane 49 files / 372 tests, concurrency lane 18/18, web database lane 13 files / 53 tests, web unit 256 files / 1771 tests, db unit 128. api, db and web
tscare clean.🤖 Generated with Claude Code
b529fdafe0fe7361feb0fe7361feb0bf072d227fbf072d227fedca74f691