forked from gsd-build/gsd-2
-
Notifications
You must be signed in to change notification settings - Fork 0
validate-milestone.ts writes disk before DB — crash inconsistency #13
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Summary
validate-milestone.ts writes assessment files to disk (line ~80) before writing to the DB (transaction at line ~104). Every other handler in the engine writes DB first, then disk. This inverts the recovery guarantee.
Impact
If the process crashes between the disk write and the DB transaction:
- Assessment file exists on disk
- DB has no record of it
- The system believes the assessment never happened
- Stale assessment file sits on disk, potentially picked up by a projection renderer expecting DB-backed content
Context
All other handlers follow the pattern: DB transaction → disk render → (if disk fails, compensate DB). This handler does: disk render → DB transaction → (if DB fails, orphaned file on disk).
Fix
Invert the order to match every other handler: write DB first, then render to disk. If disk render fails, compensate the DB write.
Files
src/resources/extensions/gsd/tools/validate-milestone.ts— lines ~80 (disk write), ~104 (DB transaction)
Confidence
82%
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working