singularity-forge/src
Jeremy McSpadden 60dfaabe03 fix: use atomic writes for completed-units.json and invalidate caches in db-writer (#1069)
Addresses state safety issues found during #1062 deep dive:

1. completed-units.json writes in auto-worktree.ts and auto-worktree-sync.ts
   used plain writeFileSync which could produce truncated/corrupt files on
   crash, losing completion keys and causing unit re-dispatch. Switched to
   atomicWriteSync (temp file + rename) for crash safety.

2. Plan file checkbox reconciliation in auto-worktree.ts also switched to
   atomicWriteSync to prevent partial PLAN.md writes on crash.

3. db-writer.ts functions (saveDecisionToDb, updateRequirementInDb,
   saveArtifactToDb) wrote markdown files via saveFile() without invalidating
   caches afterward. Added targeted cache invalidation (state + path + parse)
   so deriveState() always sees fresh data. Uses individual invalidation
   functions rather than invalidateAllCaches() to avoid clearing the artifacts
   table that was just written to.
2026-03-17 22:01:08 -06:00
..
resources fix: use atomic writes for completed-units.json and invalidate caches in db-writer (#1069) 2026-03-17 22:01:08 -06:00
tests perf: skip initResources when version matches, consolidate startup I/O (#1052) 2026-03-17 21:57:13 -06:00
app-paths.ts Initial commit 2026-03-10 22:28:37 -06:00
bundled-extension-paths.ts Fix packaging verification and path portability (#378) 2026-03-14 12:28:14 -06:00
cli.ts perf: skip initResources when version matches, consolidate startup I/O (#1052) 2026-03-17 21:57:13 -06:00
extension-discovery.ts fix: unify extension discovery logic (#995) 2026-03-17 17:14:04 -06:00
headless-answers.ts refactor(headless): remove duplicate jsonLine, use serializeJsonLine from pi-coding-agent (#1039) 2026-03-17 18:35:00 -06:00
headless-context.ts refactor(headless): split 772-line god file into events, UI, and context modules (#1047) 2026-03-17 18:36:20 -06:00
headless-events.ts refactor(headless): split 772-line god file into events, UI, and context modules (#1047) 2026-03-17 18:36:20 -06:00
headless-query.ts feat: add gsd headless query for instant state inspection (#951) 2026-03-17 16:03:59 -06:00
headless-ui.ts refactor(headless): split 772-line god file into events, UI, and context modules (#1047) 2026-03-17 18:36:20 -06:00
headless.ts refactor(headless): split 772-line god file into events, UI, and context modules (#1047) 2026-03-17 18:36:20 -06:00
help-text.ts feat: add --events flag for JSONL stream filtering (#1000) 2026-03-17 17:35:44 -06:00
loader.ts perf: skip initResources when version matches, consolidate startup I/O (#1052) 2026-03-17 21:57:13 -06:00
logo.ts fix: abort squash-merge on conflict and stop auto-mode instead of looping (#merge-bug-fix) 2026-03-12 15:32:39 -06:00
mcp-server.ts feat: add VS Code extension scaffold and MCP server compiled module 2026-03-16 16:46:20 -05:00
models-resolver.ts refactor: remove unnecessary 'as any' casts, dead exports, and duplicate code (#786) 2026-03-16 21:47:04 -06:00
onboarding.ts fix(security): use execFile for browser URL opening to prevent shell injection (#1022) 2026-03-17 18:28:24 -06:00
pi-migration.ts Merge pull request #151 from dbachelder/fix/pi-provider-reuse-and-extension-loading 2026-03-12 22:25:15 -06:00
remote-questions-config.ts feat: add Telegram as remote questions channel (#645) (#655) 2026-03-16 11:09:39 -06:00
resource-loader.ts perf: skip initResources when version matches, consolidate startup I/O (#1052) 2026-03-17 21:57:13 -06:00
tool-bootstrap.ts fix: Phase 1 quick wins — bug fixes, security hardening, and performance 2026-03-16 13:18:02 -05:00
update-check.ts feat: add /gsd update slash command for in-session self-update (#964) 2026-03-17 16:13:02 -06:00
update-cmd.ts feat: add gsd update subcommand for self-update 2026-03-13 18:47:33 -03:00
wizard.ts fix: Phase 1 quick wins — bug fixes, security hardening, and performance 2026-03-16 13:18:02 -05:00