From dded5bbf1d9c750f5d3e830ff3d53e5214e97175 Mon Sep 17 00:00:00 2001 From: Amanjyot-P Date: Thu, 27 Aug 2026 11:00:09 +0530 Subject: [PATCH] fix(ce-compound): name search base in repo-scoped path flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit validate-doc-claims.py resolves cited paths against a single repo root, but the FLAG message for an unresolved path said only "not found in working tree" — indistinguishable from "this path is wrong" even when the citation is valid in another store on the same machine. Name the search base in the message and state that the check is repo-scoped, so the agent adjudicating the flag knows to check other stores before treating the citation as wrong. Relates to EveryInc/compound-engineering-plugin#1545 --- .../scripts/validate-doc-claims.py | 7 +++-- .../scripts/validate-doc-claims.py | 7 +++-- tests/doc-claims-validator.test.ts | 29 ++++++++++++++----- 3 files changed, 32 insertions(+), 11 deletions(-) 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", () => {