singularity-forge/src/resources
mastertyko 6172246772 fix(gsd): write DB before disk in validate-milestone to match engine pattern (#2742)
* fix(gsd): write DB before disk in validate-milestone to match engine pattern

validate-milestone.ts wrote the VALIDATION.md file to disk before
inserting the assessment row into the DB. Every other handler in the
engine (complete-task, complete-slice) does DB-first, disk-second with
rollback compensation. The inverted order meant a crash between disk
write and DB insert would leave an orphaned file with no DB record —
a state that is harder to detect and recover from than the inverse
(DB row exists, file missing → projection rendering can regenerate).

Fix: reorder to DB-first, disk-second. On disk write failure, delete
the DB row via DELETE FROM assessments so state stays consistent.

Add two handler-level tests verifying:
1. Both DB row and disk file exist after success
2. DB row is rolled back (deleted) when disk write fails

Closes #2725

* fix(test): use file-as-directory to trigger disk failure cross-platform

chmod 0o444 does not prevent writes on Windows. Replace with
replacing the milestone directory with a regular file, so
saveFile's mkdirSync/write fails on all platforms.

Fixes windows-portability CI failure.
2026-03-26 16:09:32 -06:00
..
agents fix: type errors in claude-import.ts and marketplace-discovery.ts 2026-03-16 14:46:31 -04:00
extensions fix(gsd): write DB before disk in validate-milestone to match engine pattern (#2742) 2026-03-26 16:09:32 -06:00
skills fix: use GitHub Issue Types via GraphQL instead of classification labels 2026-03-25 22:18:26 -06:00
GSD-WORKFLOW.md feat: meaningful commit messages from task summaries (#803) 2026-03-16 23:30:33 -06:00