Skip to content

A self-organizing Obsidian vault that gives AI coding agents persistent memory.

fix: run the release job's tests as CI does, and stop two Stop tests depending on qmd (#317)

Brenno Ferrari65e2a37e21cf
diff --git a/.claude/scripts/lib/qmd-refresh.ts b/.claude/scripts/lib/qmd-refresh.ts
index 9f0b3d2..e05486e 100644
--- a/.claude/scripts/lib/qmd-refresh.ts
+++ b/.claude/scripts/lib/qmd-refresh.ts
@@ -330,6 +330,11 @@ export function triggerDebouncedRefresh(opts: {
readonly qmdAvailable?: () => boolean;
readonly spawnWorker?: (workerPath: string, args: readonly string[]) => void;
}): void {
+ // First, before any branch: "was a refresh requested?" must be answerable
+ // whatever happens next. A test that read it off a later line ("debounced")
+ // passed only where qmd was installed, since without qmd the trigger stops
+ // at the resolvability check first — the release job, with no qmd, failed.
+ debug(`${opts.logPrefix}: refresh requested`);
const now = Date.now();
const mtime = readSentinelMtime(opts.sentinelPath);
const pendingPath = pendingPathFor(opts.sentinelPath);
diff --git a/.claude/scripts/tests/shard-contract.test.ts b/.claude/scripts/tests/shard-contract.test.ts
index e950b48..6ee734d 100644
--- a/.claude/scripts/tests/shard-contract.test.ts
+++ b/.claude/scripts/tests/shard-contract.test.ts
@@ -15,8 +15,9 @@
* `.shardmind/shard.yaml` is a file we own, so a line-oriented scan is robust
* enough and keeps the test dependency-free (matching the JSON-reading
* `hook-config.test.ts`). Path resolution is CWD-independent (via
- * `import.meta.url`) so the test passes both under `npm test` (cwd
- * `.claude/scripts`) and under release.yml's repo-root invocation.
+ * `import.meta.url`) so the test passes under `npm test` (cwd
+ * `.claude/scripts`, as both CI and release.yml run it) and under a direct
+ * `node --test` from the repo root.
*/
import { test, describe } from "node:test";
diff --git a/.claude/scripts/tests/stop-checklist.test.ts b/.claude/scripts/tests/stop-checklist.test.ts
index 809b639..605e32d 100644
--- a/.claude/scripts/tests/stop-checklist.test.ts
+++ b/.claude/scripts/tests/stop-checklist.test.ts
@@ -502,11 +502,14 @@ describe("stop-checklist", () => {
*/
describe("stop-checklist — om_mod (a Claude Code mod)", () => {
const flagged = (session_id: string, om_mod: string) => ({ ...stop(session_id), om_mod });
- // The shared sentinel is fresh, so every refresh this file triggers is
- // debounced: nothing is spawned, and with HOOK_DEBUG=1 the call still
- // shows on stderr. That makes "was the refresh triggered?" observable.
+ // The shared sentinel is fresh, so no refresh this file triggers spawns
+ // an immediate worker, and with HOOK_DEBUG=1 the trigger logs
+ // "refresh requested" before it branches. That makes "was the refresh
+ // triggered?" observable on any machine. Reading it off "debounced"
+ // instead held only where qmd is installed: without qmd the trigger
+ // stops at its resolvability check, and the release job (no qmd) failed.
const DEBUG = { HOOK_DEBUG: "1" };
- const refreshed = (stderr: string) => stderr.includes("stop-checklist: debounced");
+ const refreshed = (stderr: string) => stderr.includes("stop-checklist: refresh requested");
// Re-touch the shared sentinel before each test: it was written once in
// before(), and on a slow runner the tests above can outlast the 30s
// debounce window, which would turn "debounced" into a real spawn.
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 301258f..beedb10 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -90,8 +90,16 @@ jobs:
# pushed last time.
git tag -f "$VERSION"
+ # Tests run exactly as test.yml runs them, so a release can never test
+ # something CI did not: the same qmd install, and `npm test` (the
+ # wrapper that keeps qmd out of the runner's folders, #307). A bare
+ # `node --test` with no qmd once failed a release that CI had passed.
+ - name: Install qmd globally (as CI does)
+ run: npm install -g @tobilu/[email protected]
+
- name: Run tests
- run: node --experimental-strip-types --test '.claude/scripts/tests/'*.test.ts
+ working-directory: .claude/scripts
+ run: npm test
- name: Generate changelog
run: |
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index a068748..920919e 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -30,6 +30,29 @@ on:
- '.github/workflows/test.yml'
jobs:
+ # qmd is optional for a vault, so the suite must pass on a machine without
+ # it. Every leg below installs qmd, so nothing caught a pair of tests that
+ # held only where qmd resolved, until the release job (which had no qmd)
+ # failed on them. This leg runs the bare `node --test` that job used, with
+ # no qmd installed.
+ test-without-qmd:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 22
+ - name: Confirm qmd is absent
+ shell: bash
+ run: |
+ if [ -d "$(npm root -g)/@tobilu/qmd" ] || command -v qmd >/dev/null; then
+ echo "::error::qmd is installed on this runner; the leg would not test its absence"
+ exit 1
+ fi
+ - name: Run hook tests without qmd
+ shell: bash
+ run: node --experimental-strip-types --test '.claude/scripts/tests/'*.test.ts
+
test:
strategy:
fail-fast: false