diff --git a/skills/ce-compound-refresh/scripts/validate-doc-claims.py b/skills/ce-compound-refresh/scripts/validate-doc-claims.py index 2f624bb70..0cf2e7a37 100644 --- a/skills/ce-compound-refresh/scripts/validate-doc-claims.py +++ b/skills/ce-compound-refresh/scripts/validate-doc-claims.py @@ -276,8 +276,11 @@ def head_has_path(path: str) -> bool: f"working tree or {upstream}" if upstream else "working tree" ) flags.append( - f"FLAG path `{token}`{loc} — not found in {where}. Fix the " - "citation, or annotate it as historical (e.g. removed by this fix)." + f"FLAG path `{token}`{loc} — not found in {where}, under " + f"{base}. This check only looks in this repository; check " + "other stores before treating the citation as wrong. " + "Otherwise, fix the citation, or annotate it as historical " + "(e.g. removed by this fix)." ) # --- 2. Cited commit SHAs ---------------------------------------------- diff --git a/skills/ce-compound/scripts/validate-doc-claims.py b/skills/ce-compound/scripts/validate-doc-claims.py index 2f624bb70..0cf2e7a37 100644 --- a/skills/ce-compound/scripts/validate-doc-claims.py +++ b/skills/ce-compound/scripts/validate-doc-claims.py @@ -276,8 +276,11 @@ def head_has_path(path: str) -> bool: f"working tree or {upstream}" if upstream else "working tree" ) flags.append( - f"FLAG path `{token}`{loc} — not found in {where}. Fix the " - "citation, or annotate it as historical (e.g. removed by this fix)." + f"FLAG path `{token}`{loc} — not found in {where}, under " + f"{base}. This check only looks in this repository; check " + "other stores before treating the citation as wrong. " + "Otherwise, fix the citation, or annotate it as historical " + "(e.g. removed by this fix)." ) # --- 2. Cited commit SHAs ---------------------------------------------- diff --git a/tests/doc-claims-validator.test.ts b/tests/doc-claims-validator.test.ts index c50a092df..aac9d0e21 100644 --- a/tests/doc-claims-validator.test.ts +++ b/tests/doc-claims-validator.test.ts @@ -1,6 +1,12 @@ import { beforeAll, describe, expect, test } from "bun:test" import { spawnSync } from "node:child_process" -import { mkdirSync, mkdtempSync, readFileSync, writeFileSync } from "node:fs" +import { + mkdirSync, + mkdtempSync, + readFileSync, + realpathSync, + writeFileSync, +} from "node:fs" import { tmpdir } from "node:os" import path from "node:path" @@ -66,7 +72,7 @@ function mixedShaPrefix(sha: string): string { } beforeAll(() => { - repo = mkdtempSync(path.join(tmpdir(), "doc-claims-repo-")) + repo = realpathSync(mkdtempSync(path.join(tmpdir(), "doc-claims-repo-"))) sh(repo, "git", ["init", "-b", "main"]) sh(repo, "git", ["config", "user.email", "test@example.com"]) sh(repo, "git", ["config", "user.name", "Test"]) @@ -140,14 +146,20 @@ describe("validate-doc-claims script", () => { expect(result.stdout).not.toContain("FLAG") }) - test("flags a cited path that exists nowhere", () => { + test("flags a cited path that exists nowhere, naming the search base", () => { const docPath = writeRepoDoc( "The handler is `src/does-not-exist.ts` in the tree.\n", ) const result = runValidator(skillDir, docPath) expect(result.code).toBe(1) expect(result.stdout).toContain("FLAG path `src/does-not-exist.ts`") - expect(result.stdout).toContain("not found") + expect(result.stdout).toContain( + `not found in working tree or origin/main, under ${repo}`, + ) + expect(result.stdout).toContain( + "This check only looks in this repository; check other stores " + + "before treating the citation as wrong.", + ) }) test("classifies a path that only exists upstream as stale-checkout", () => { @@ -176,8 +188,9 @@ describe("validate-doc-claims script", () => { ) const result = runValidator(skillDir, docPath) expect(result.code).toBe(1) - expect(result.stdout).toContain("FLAG path `src/nonexistent-helper`") - expect(result.stdout).toContain("not found") + expect(result.stdout).toContain( + `not found in working tree or origin/main, under ${repo}`, + ) }) test("ignores placeholder and URL-like tokens", () => { @@ -345,7 +358,9 @@ describe("validate-doc-claims script", () => { expect(result.stdout).toContain( "FLAG path `../best-practices/does-not-exist.md`", ) - expect(result.stdout).toContain("not found") + expect(result.stdout).toContain( + `not found in working tree or origin/main, under ${repo}`, + ) }) test("skips a `../` token that escapes the repository", () => {