test: coverage-audit additions for the fix wave

Ship Step 7 gap-fill (all passing, 248 tests across the touched suites):
memory + dream stage probe-timeout proceeds, gbrain-detect override paths,
stale-flag passthrough, 200-body-missing-.security fail-closed case,
telemetry redaction edges, and credential-pattern edge cases.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-06-11 23:08:54 -07:00
co-authored by Claude Fable 5
parent 028cb52ca8
commit 88ca684929
6 changed files with 168 additions and 0 deletions
+14
View File
@@ -391,6 +391,20 @@ describe("lib/gbrain-local-status — cache behavior", () => {
expect(localEngineStatus({ noCache: false })).toBe("ok");
});
it("invalidates cache when GBRAIN_HOME changes (key invariant, codex D11)", () => {
env = makeEnv({ withGbrain: true, gbrainBehavior: "ok", withConfig: true });
restoreEnv = applyEnv(env);
expect(localEngineStatus({ noCache: false })).toBe("ok");
// Point GBRAIN_HOME at an empty dir: a stale cached "ok" must not win —
// gbrain_home is part of the cache key, so this re-probes and finds no
// config at the new location.
const altHome = join(env.tmp, "alt-gbrain-empty");
mkdirSync(altHome, { recursive: true });
process.env.GBRAIN_HOME = altHome;
expect(localEngineStatus({ noCache: false })).toBe("missing-config");
});
it("invalidates cache when HOME changes (key invariant)", () => {
env = makeEnv({ withGbrain: true, gbrainBehavior: "ok", withConfig: true });
restoreEnv = applyEnv(env);