singularity-forge/src/resources/extensions/gsd/tools
Claude 5e9196e5c9 refactor(gsd): enforce single-writer invariant for engine DB
Route every INSERT/UPDATE/DELETE/REPLACE against .gsd/gsd.db through typed
wrappers in gsd-db.ts and add a structural test that fails CI if a new
bypass appears. Previously 13 call sites across 10 modules reached into
_getAdapter() and issued raw write SQL, making the "single writer"
architecture unenforceable in-process.

New wrappers in gsd-db.ts: deleteDecisionById, deleteRequirementById,
deleteArtifactByPath, clearEngineHierarchy, insertOrIgnoreSlice,
insertOrIgnoreTask, setSliceReplanTriggeredAt, upsertQualityGate,
restoreManifest, bulkInsertLegacyHierarchy, readTransaction, and eight
memory-store helpers (insertMemoryRow, rewriteMemoryId, etc).

workflow-manifest.restore() is lifted verbatim into gsd-db.restoreManifest
with a type-only import of StateManifest to avoid circular runtime deps.
tools/workflow-tool-executors and workflow-manifest.snapshotState swap
their manual BEGIN DEFERRED/COMMIT/ROLLBACK dance for readTransaction().
unit-ownership.ts stays outside the invariant: it writes to a separate
.gsd/unit-claims.db by design.

tests/single-writer-invariant.test.ts walks every .ts file under gsd/
(excluding tests/ and the allowlist) and fails with a grouped violations
list on any regex match for .prepare/.exec raw writes, plus a positive
assertion that gsd-db.ts still exports each expected wrapper so the
structural test can't silently become a no-op.

https://claude.ai/code/session_01FZgXD3bjcddoFYsTEY6JhC
2026-04-14 18:28:24 +00:00
..
complete-milestone.ts fix(gsd): event log and reconciliation robustness (wave 2/5) 2026-04-07 12:14:46 -05:00
complete-slice.ts fix(gsd): route quality gates through a per-turn registry 2026-04-12 21:13:16 -05:00
complete-task.ts fix(gsd): route quality gates through a per-turn registry 2026-04-12 21:13:16 -05:00
plan-milestone.ts Merge pull request #3661 from Tibsfox/fix/verification-not-provided-default 2026-04-07 07:11:40 -05:00
plan-slice.ts fix: make enrichment tool params optional for limited-toolcall models (#3302) 2026-04-05 01:04:55 -04:00
plan-task.ts refactor(gsd): migrate all catch blocks to centralized workflow-logger 2026-04-04 13:42:55 -05:00
reassess-roadmap.ts fix(gsd): set slice sequence at all three insertion sites 2026-04-06 19:51:16 -07:00
reopen-milestone.ts fix(ci): replace empty catch blocks and raw stderr with logWarning 2026-04-07 07:36:15 -05:00
reopen-slice.ts fix(ci): replace empty catch blocks and raw stderr with logWarning 2026-04-07 07:36:15 -05:00
reopen-task.ts fix(ci): replace empty catch blocks and raw stderr with logWarning 2026-04-07 07:36:15 -05:00
replan-slice.ts refactor(gsd): migrate all catch blocks to centralized workflow-logger 2026-04-04 13:42:55 -05:00
validate-milestone.ts refactor(gsd): migrate all catch blocks to centralized workflow-logger 2026-04-04 13:42:55 -05:00
workflow-tool-executors.ts refactor(gsd): enforce single-writer invariant for engine DB 2026-04-14 18:28:24 +00:00