A self-organizing Obsidian vault that gives AI coding agents persistent memory.
TypeScript ai-agentsclaude-codecodex-cligemini-cliknowledge-managementobsidianobsidian-vaultpersistent-memorysecond-braintemplate
fix: keep hook tests off the real QMD sentinel (#277)
Brenno Ferrarid1e64efa5273
diff --git a/.claude/scripts/tests/_helpers.ts b/.claude/scripts/tests/_helpers.tsindex 0776390..a2aa096 100644--- a/.claude/scripts/tests/_helpers.ts+++ b/.claude/scripts/tests/_helpers.ts@@ -18,10 +18,22 @@* about timing rather than defects in what was under test: a cleanup that* cannot delete a temp tree, and a fixed sleep standing in for a condition.* Both shapes recur across suites, so the reasoning lives here once.+ *+ * Every hook that writes or stops refreshes QMD through a debounce sentinel+ * beside the scripts. A test that names no sentinel of its own gets+ * TEST_SENTINEL instead, touched before each spawn: the real one is never+ * written, and a sentinel that fresh keeps the refresh debounced, so no test+ * starts a real index update of the checkout it runs in.*/import { spawnSync } from "node:child_process";-import { rmSync } from "node:fs";+import { mkdtempSync, rmSync, writeFileSync } from "node:fs";+import { tmpdir } from "node:os";+import { join } from "node:path";++const SENTINEL_DIR = mkdtempSync(join(tmpdir(), "om-test-sentinel-"));+export const TEST_SENTINEL = join(SENTINEL_DIR, ".qmd-refresh-sentinel");+process.on("exit", () => rmSync(SENTINEL_DIR, { recursive: true, force: true }));import { resolve } from "node:path";export function hostPath(literal: string): string {@@ -45,6 +57,8 @@ export function runScript(: typeof stdin === "string"? stdin: JSON.stringify(stdin);+ const env = { ...process.env, QMD_REFRESH_SENTINEL: TEST_SENTINEL, ...envOverrides };+ if (env.QMD_REFRESH_SENTINEL === TEST_SENTINEL) writeFileSync(TEST_SENTINEL, "");const proc = spawnSync(process.execPath,[@@ -56,9 +70,7 @@ export function runScript(input,encoding: "utf-8",timeout: 10_000,- env: envOverrides- ? { ...process.env, ...envOverrides }- : process.env,+ env,},);return {diff --git a/.github/workflows/test.yml b/.github/workflows/test.ymlindex 2186bbf..87ac548 100644--- a/.github/workflows/test.yml+++ b/.github/workflows/test.yml@@ -52,7 +52,10 @@ jobs:- name: No test wrote outside its temp dirshell: bashrun: |- residue=$(git status --porcelain --untracked-files=all)+ # --ignored too: the QMD debounce sentinel is gitignored, so a test+ # that wrote the real one would pass a plain status. node_modules is+ # the CI-only typecheck install, the one ignored tree a run may leave.+ residue=$(git status --porcelain --untracked-files=all --ignored | grep -v '/node_modules/' || true)if [ -n "$residue" ]; thenecho "::error::the test run left files behind in the working tree"echo "$residue"