Skip to content

fix(scripts): the doc pointers these tools print name files that exist (TASK-087) - #1805

Merged
lilyshen0722 merged 1 commit into
mainfrom
kai/code-doc-pointer-repair
Sep 20, 2026
Merged

lilyshen0722 merged 1 commit into
mainfrom
kai/code-doc-pointer-repair

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

What

Five sites in three files print or name docs/…md paths that are not in the tree. Raised by Vera's read of scripts/test-discord.sh:44; a sweep of the class found the neighbours it did not mention (including the line directly above it).

file:line printed / named checked against main
scripts/test-discord.sh:31,43 docs/TEST_DISCORD_BOT.md absent — has never existed at that path
scripts/test-discord.sh:44 docs/design/DISCORD_INTEGRATION.md absent — the Discord docs live under docs/discord/
scripts/setup-demo.sh:153 docs/yc/DEMO_RECORDING.md absent — no docs/yc/ at all
backend/test-discord-integration.ts:236 docs/TEST_DISCORD_BOT.md absent

Repaired targets, each of which exists today and survives the docs wash (checked against #1802's head 488111f0):

  • docs/discord/DISCORD_SETUP.md — heading # Discord Integration Setup Guide
  • docs/discord/DISCORD_INTEGRATION_ARCHITECTURE.md — heading # Discord Integration Architecture
  • docs/DEMO_QUICKSTART.md — carries ## Recording tips (:263)

docs/discord/DISCORD_INTEGRATION.md is the closest name to one of the dead ones and is deliberately not used: #1802 deletes it. Pointing the fix at it would have created a dangling reference in the same motion as removing one.

The class, measured (not just the flagged line)

Every docs/<path>.md referenced from code under scripts/, backend/, cli/, frontend/ — 29 distinct paths — checked on main and on #1802's head:

docs/CODEX_OAUTH_SETUP.md                main=ok      after#1802=MISSING   (1 site, carried by #1804)
docs/agents/AGENT_CODING_CAPABILITY.md   main=ok      after#1802=MISSING   (1 site, carried by #1804)
docs/demo-verification.md                main=ok      after#1802=MISSING   (2 sites, carried by #1804)
docs/SKILL.md                            main=MISSING after#1802=MISSING   FALSE POSITIVE — a URL tail (.../servicenow-docs/SKILL.md), not a repo path
docs/TEST_DISCORD_BOT.md                 main=MISSING after#1802=MISSING   this PR
docs/design/DISCORD_INTEGRATION.md       main=MISSING after#1802=MISSING   this PR
docs/yc/DEMO_RECORDING.md                main=MISSING after#1802=MISSING   this PR

Two things fall out of that table. The five dead sites are pre-existing — nothing to do with the wash; they were already broken. And the three wash-deleted paths have exactly the four code references #1804 carries and no others, which extends Vera's "no inbound link survives the deletions" gate from README.md / docs/ / docs-site/ to code references as well.

Guard

backend/__tests__/unit/scripts/docReferences.test.js — every docs/<path>.md mentioned by a tracked file under scripts/, backend/, cli/, frontend/ with a source extension must exist. Scope is deliberately code-only: prose inside docs/ is the docs room's inventory to keep, and this suite has to stay green while that wash runs.

It caught something real before it was committed: the first draft of its own docstring quoted the three dead paths, and the guard flagged itself. A comment is a reference too — so the literals were removed from the source, not exempted from the scan, and they live in this body and on the row instead.

Evidence

Live run of the script whose block was fixed (bash scripts/test-discord.sh, harness backend on :5000, exit 0):

📚 Documentation:
   Setup Guide: docs/discord/DISCORD_SETUP.md
   Integration Design: docs/discord/DISCORD_INTEGRATION_ARCHITECTURE.md

Mutation ledger — each applied alone, suite output saved (never grep-filtered), sources restored byte-identically (verified per file):

mutation what it breaks result
M1 reverts the test-discord.sh setup-guide fix RED — scripts/test-discord.sh -> docs/TEST_DISCORD_BOT.md
M2 drops the boundary that excludes a URL tail RED — both the parser test and the existence test
M3 drops .sh from the scanned extensions RED — the "extracts references at all" control, which exists so a broken parser cannot pass every test
M4 reverts the setup-demo.sh recording-guide fix RED — scripts/setup-demo.sh -> docs/yc/DEMO_RECORDING.md
M5 reverts the test-discord-integration.ts fix RED — backend/test-discord-integration.ts -> docs/TEST_DISCORD_BOT.md

Survivors: none. Each guard failure prints file -> doc, so the person who reads the red run is told where to look rather than that something, somewhere, is wrong.

Also: bash -n clean on both scripts; eslint clean on the changed backend TypeScript (from backend/, the gated lint:ts scope); guard suite 3/3.

No version slot: scripts/, a backend test script and a test file — nothing under cli/src or commonly-mcp/src.

…exist (TASK-087)

`scripts/test-discord.sh` printed a "Documentation:" block naming
`docs/TEST_DISCORD_BOT.md` and `docs/design/DISCORD_INTEGRATION.md`; neither
has ever existed at those paths — the Discord docs live under `docs/discord/`.
`scripts/setup-demo.sh` pointed at `docs/yc/DEMO_RECORDING.md`, also absent,
and `backend/test-discord-integration.ts` carried the same dead setup-guide
path, so an operator who followed the tool's own output landed on nothing.

Every repaired target exists today and survives the docs wash:
`docs/discord/DISCORD_SETUP.md` ("Discord Integration Setup Guide"),
`docs/discord/DISCORD_INTEGRATION_ARCHITECTURE.md` ("Discord Integration
Architecture"), and `docs/DEMO_QUICKSTART.md` (which carries "## Recording
tips"). `docs/discord/DISCORD_INTEGRATION.md` is deliberately NOT the target
even though it is the closest name: #1802 deletes it.

Guarded by `backend/__tests__/unit/scripts/docReferences.test.js` — every
`docs/<path>.md` mentioned by code under `scripts/`, `backend/`, `cli/` or
`frontend/` must exist, which is the class this defect belongs to rather than
the three lines that happened to be found.
@samxu01
samxu01 force-pushed the kai/code-doc-pointer-repair branch from 63eb4b3 to 8b875c5 Compare September 20, 2026 02:25
@lilyshen0722
lilyshen0722 merged commit ec21853 into main Sep 20, 2026
14 checks passed
samxu01 pushed a commit that referenced this pull request Sep 20, 2026
… the guard could not look there

CLAUDE.md — the file an agent is told to read first — carried two dead
pointers in its Key Documentation list:

  - **Discord Integration**:  /docs/DISCORD_INTEGRATION_ARCHITECTURE.md
  - **PostgreSQL Migration**: /docs/POSTGRESQL_MIGRATION.md

Both files exist one level down (docs/discord/, docs/database/). This is
AX entry 57's shape: follow the pointer the front door gives you and find
nothing.

The guard that closed this class (#1805, TASK-087) could not see them,
for two independent reasons, and both are fixed here:

  1. its scope was code only — scripts/, backend/, cli/, frontend/ — so a
     pointer in CLAUDE.md was outside it. The repo-root CLAUDE.md is now
     scanned (AGENTS.md is a symlink to it, git mode 120000, so the
     target covers both without double-reporting each dead line).
  2. DOC_REF's boundary `(?<![A-Za-z0-9_/.-])` rejected a leading slash,
     which is the form that section writes every pointer in. `\/?` is now
     optional in front of `docs/`, and extractDocReferences strips it
     before resolving — a URL tail is still excluded, because the
     lookbehind fails on both positions it could match at.

The markdown scope stops at the root file: docs/ prose is still the docs
room's inventory, as the guard's own comment says.

Mutations (each new mechanism, one at a time, run against the real
harness):

  M1 the dead anchor is back in CLAUDE.md            RED  (end-to-end catch)
  M2 CLAUDE.md is no longer scanned                  RED
  M3 the boundary rejects a leading slash again      RED
  M4 the leading slash is not stripped before resolve RED
  restored, clean run rc=0, 5/5

Both dead-literal forms are kept out of the test file itself: the guard
scans its own test, so the absent-path fixture is assembled from parts
and the extraction fixture uses a doc that exists.
samxu01 pushed a commit that referenced this pull request Sep 20, 2026
… the guard could not look there

CLAUDE.md — the file an agent is told to read first — carried two dead
pointers in its Key Documentation list:

  - **Discord Integration**:  /docs/DISCORD_INTEGRATION_ARCHITECTURE.md
  - **PostgreSQL Migration**: /docs/POSTGRESQL_MIGRATION.md

Both files exist one level down (docs/discord/, docs/database/). This is
AX entry 57's shape: follow the pointer the front door gives you and find
nothing.

The guard that closed this class (#1805, TASK-087) could not see them,
for two independent reasons, and both are fixed here:

  1. its scope was code only — scripts/, backend/, cli/, frontend/ — so a
     pointer in CLAUDE.md was outside it. The repo-root CLAUDE.md is now
     scanned (AGENTS.md is a symlink to it, git mode 120000, so the
     target covers both without double-reporting each dead line).
  2. DOC_REF's boundary `(?<![A-Za-z0-9_/.-])` rejected a leading slash,
     which is the form that section writes every pointer in. `\/?` is now
     optional in front of `docs/`, and extractDocReferences strips it
     before resolving — a URL tail is still excluded, because the
     lookbehind fails on both positions it could match at.

The markdown scope stops at the root file: docs/ prose is still the docs
room's inventory, as the guard's own comment says.

Mutations (each new mechanism, one at a time, run against the real
harness):

  M1 the dead anchor is back in CLAUDE.md            RED  (end-to-end catch)
  M2 CLAUDE.md is no longer scanned                  RED
  M3 the boundary rejects a leading slash again      RED
  M4 the leading slash is not stripped before resolve RED
  restored, clean run rc=0, 5/5

Both dead-literal forms are kept out of the test file itself: the guard
scans its own test, so the absent-path fixture is assembled from parts
and the extraction fixture uses a doc that exists.
lilyshen0722 added a commit that referenced this pull request Sep 20, 2026
… the guard could not look there (#1807)

CLAUDE.md — the file an agent is told to read first — carried two dead
pointers in its Key Documentation list:

  - **Discord Integration**:  /docs/DISCORD_INTEGRATION_ARCHITECTURE.md
  - **PostgreSQL Migration**: /docs/POSTGRESQL_MIGRATION.md

Both files exist one level down (docs/discord/, docs/database/). This is
AX entry 57's shape: follow the pointer the front door gives you and find
nothing.

The guard that closed this class (#1805, TASK-087) could not see them,
for two independent reasons, and both are fixed here:

  1. its scope was code only — scripts/, backend/, cli/, frontend/ — so a
     pointer in CLAUDE.md was outside it. The repo-root CLAUDE.md is now
     scanned (AGENTS.md is a symlink to it, git mode 120000, so the
     target covers both without double-reporting each dead line).
  2. DOC_REF's boundary `(?<![A-Za-z0-9_/.-])` rejected a leading slash,
     which is the form that section writes every pointer in. `\/?` is now
     optional in front of `docs/`, and extractDocReferences strips it
     before resolving — a URL tail is still excluded, because the
     lookbehind fails on both positions it could match at.

The markdown scope stops at the root file: docs/ prose is still the docs
room's inventory, as the guard's own comment says.

Mutations (each new mechanism, one at a time, run against the real
harness):

  M1 the dead anchor is back in CLAUDE.md            RED  (end-to-end catch)
  M2 CLAUDE.md is no longer scanned                  RED
  M3 the boundary rejects a leading slash again      RED
  M4 the leading slash is not stripped before resolve RED
  restored, clean run rc=0, 5/5

Both dead-literal forms are kept out of the test file itself: the guard
scans its own test, so the absent-path fixture is assembled from parts
and the extraction fixture uses a doc that exists.
lilyshen0722 added a commit that referenced this pull request Sep 20, 2026
…ory retires (#1810)

The fixture for the root-relative form is the front door's own line, and it
named docs/discord/DISCORD_INTEGRATION.md — a file the docs inventory's verdict
deletes (#1802). This suite scans itself, so the fixture is a live reference
rather than inert text, and on #1802's head the run is 1 failed / 4 passed:

  backend/__tests__/unit/scripts/docReferences.test.js
    ✕ every referenced doc exists
      + "backend/__tests__/unit/scripts/docReferences.test.js -> docs/discord/DISCORD_INTEGRATION.md"

Retargeted (input, expected value, and the URL-tail case beside it) at the
surviving architecture doc — which is also what CLAUDE.md's Discord line names,
so the fixture stays a faithful miniature of the line it models.

Measured rather than assumed: across the 1274 files this guard scans on
#1802's head, this is the only reference it cannot resolve. Every product-code
pointer, #1805's repairs included, already names a surviving doc.

Mutations, run at #1802's head against the real harness:

  M1 fixture back on the retired doc          RED  every referenced doc exists
  M2 fixture on a doc that never existed      RED  every referenced doc exists
  M3 expectation no longer matches the input  RED  reads a real path…
  restored, clean, 5/5

Order matters: this must be on main before #1802, or main carries a red guard
in the window between them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant