singularity-forge/src/resources
Iouri Goussev a436f06e2d fix(gsd): wire setLogBasePath into engine init to resurrect audit log (#2745)
* fix: wire setLogBasePath into engine init to resurrect audit log

_auditBasePath was always null — setLogBasePath() existed but was never
called from any production code path. Every logWarning/logError call hit
the if (_auditBasePath) guard as false, so nothing was ever written to
.gsd/audit-log.jsonl.

Two independent fixes:
1. Remove _auditBasePath = null from _resetLogs() — the base path must
   survive unit resets, it's stable for process lifetime
2. Call setLogBasePath(base) after s.basePath = base in both the fresh-
   start path (bootstrapAutoSession) and the resume path (startAuto)

Adds two tests verifying disk persistence and that _resetLogs doesn't
kill the audit path.

Fixes #2722

* refactor: clean up audit log tests and avoid redundant mkdirSync

- Use makeTempDir/cleanup from test-utils.ts instead of inline mkdtempSync/rmSync
- Add afterEach in audit describe block to reset _auditBasePath via
  setLogBasePath("") — prevents state bleed into subsequent tests since
  _resetLogs() no longer clears it
- Drop four raw imports (mkdtempSync, rmSync, tmpdir — join was already used)
- Guard mkdirSync in _push() with _auditDirEnsured flag — was calling
  mkdirSync on every log entry; now called once per base path

* revert: remove _auditDirEnsured flag

mkdirSync({ recursive: true }) on an existing dir is a cheap stat, not
meaningful overhead on a low-frequency warn/error path. The flag added
mutable state for no real gain.
2026-03-26 16:06:48 -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): wire setLogBasePath into engine init to resurrect audit log (#2745) 2026-03-26 16:06:48 -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