Skip to content

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

fix: the vault zip shipped a file left behind by a test (#191)

Brenno Ferrari9b394298aa43
diff --git a/.claude/scripts/tests/mcp-caller.test.ts b/.claude/scripts/tests/mcp-caller.test.ts
index b95999e..93902cc 100644
--- a/.claude/scripts/tests/mcp-caller.test.ts
+++ b/.claude/scripts/tests/mcp-caller.test.ts
@@ -284,8 +284,29 @@ describe("the audit log", () => {
test("an unwritable log NEVER breaks the caller", () => {
// A control that can take the server down is a liability, not a control.
- const audit = createAuditor(join("Z:", "definitely", "not", "here.jsonl"), () => "x");
- assert.doesNotThrow(() => audit("search", { query: "q" }));
+ withDir((dir) => {
+ // The unwritable path is one whose PARENT is a regular file. The auditor
+ // mkdir -p's that parent, and a file cannot become a directory on any
+ // platform, so the failure path is the one taken EVERYWHERE.
+ //
+ // Why not a drive letter: this asserted against `Z:/definitely/not/` for
+ // four releases. `join` builds that from a drive letter only on Windows;
+ // on POSIX it is an ordinary RELATIVE directory, so the Linux runner
+ // created it, wrote the log, and passed by exercising the SUCCESS path.
+ // It also shipped — `zip -r .` packaged the residue into the v8.1.1 and
+ // v8.3.0 vault zips. A fixture that means different things on different
+ // platforms tests the property it names on neither.
+ const occupied = join(dir, "occupied");
+ writeFileSync(occupied, "");
+ const logPath = join(occupied, "here.jsonl");
+
+ const audit = createAuditor(logPath, () => "x");
+ assert.doesNotThrow(() => audit("search", { query: "q" }));
+
+ // The teeth. Without this the test also passes when the write SUCCEEDS,
+ // which is exactly how the drive-letter version passed on Linux.
+ assert.equal(existsSync(logPath), false, "the log must not have been written");
+ });
});
test("the log rotates instead of growing without bound", () => {
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 1de78d8..2a07040 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -180,7 +180,21 @@ jobs:
run: |
ZIP_NAME="obsidian-mind-${VERSION}.zip"
- zip -r "$ZIP_NAME" . \
+ # Zip the TAGGED TREE, never the working tree. `zip -r .` packaged
+ # whatever earlier steps had left lying around, and a denylist cannot
+ # enumerate residue nobody has created yet: v8.1.1 and v8.3.0 both
+ # shipped `Z:/definitely/not/here.jsonl`, an audit-log fixture written
+ # by a test whose "unwritable" path is a drive letter on Windows and an
+ # ordinary relative directory on the Linux runner. Exporting the tag can
+ # only contain what was committed, which closes the class rather than
+ # this one instance. Verified against v8.3.0: that residue was the SOLE
+ # difference between the shipped zip and the tag, so nothing is lost.
+ EXPORT="$RUNNER_TEMP/vault-export"
+ rm -rf "$EXPORT" && mkdir -p "$EXPORT"
+ git archive "$VERSION" | tar -x -C "$EXPORT"
+ cd "$EXPORT"
+
+ zip -r "$GITHUB_WORKSPACE/$ZIP_NAME" . \
-x ".git/*" \
-x ".github/*" \
-x ".claude/scripts/tests/*" \
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 30be6b6..2186bbf 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -42,3 +42,20 @@ jobs:
working-directory: .claude/scripts
run: npm test
+ # A test that writes outside its temp dir is a bug wherever it lands, but
+ # the release job is where it becomes the user's problem: it zipped the
+ # working tree, so residue shipped inside the vault (v8.1.1 and v8.3.0 both
+ # carried `Z:/definitely/not/here.jsonl`). The zip now comes from the tag,
+ # which makes residue harmless — this makes it VISIBLE, at the source, on
+ # the OS that produced it. Untracked output from a test run is never
+ # expected; node_modules and the CI-only typecheck deps are gitignored.
+ - name: No test wrote outside its temp dir
+ shell: bash
+ run: |
+ residue=$(git status --porcelain --untracked-files=all)
+ if [ -n "$residue" ]; then
+ echo "::error::the test run left files behind in the working tree"
+ echo "$residue"
+ exit 1
+ fi
+