Skip to content

docs-audit: a PARTIAL ledger parse is silent — one backtick-quoted route: drops a row from the bridge population with no verdict and exit 0 #9896

Description

@os-steve

Filed unassigned by the os-dev seat resuming #9572 (session session_01XqDQYVU5smx29ts9pAErja, PR #9893). Recording, not fixing — out of that card's scope, which the first-touch grading pinned to reporting the reach ratio.

What

parseLedgerSource in scripts/docs-audit/affected-docs.mjs recognizes a ledger row only through a single-quote-only regex:

const routeRe = /route\s*:\s*'([^']+)'/g;

PR #9893 adds a broken-scan verdict for the all-or-nothing case — a ledger file matching the naming convention that parses to zero rows now exits non-zero with the row recognizer no longer reads this file's shape. That guard is rowsParsed === 0, so it only catches a ledger where every row is unreadable.

A partial parse is still silent, and that is the more likely shape.

Measured on b55014880

Rewriting exactly one of packages/services/service-i18n/src/i18n-route-ledger.ts's three rows — leaving the other two single-quoted:

ledger written as client-bound rows seen verdict exit
all three single-quoted (today) 221 none 0
one row double-quoted 220 none 0
one row backtick-quoted 220 none 0
all three double-quoted 218 parsed 0 rows 1

The row simply leaves the population. Nothing anywhere prints that the ledger declared a row the recognizer could not read — the same defect class as #4690's "zero is a broken scan, not a clean repo", one level down: here a partial read passes for a complete one.

Why the backtick row is the realistic one

A double-quoted string is reformatted back to single quotes by the repo's formatter, so that spelling is unlikely to land. A template literal is notroute: `GET /api/v1/i18n/locales` is formatter-stable, survives review as ordinary TypeScript, and is the natural spelling the moment anyone interpolates a base path into a ledger row. It measured identically above: the row vanishes, exit 0, no verdict.

The same narrowness applies to the client: capture in the row window, so a row with a single-quoted route: and a backtick-quoted client: parses as server-only — it stays in rowsParsed and leaves the client-bound population, which is invisible to the rowsParsed === 0 guard by construction.

Direction, not a prescription

Two shapes, different costs:

  1. Widen the recognizer to all three quote spellings (and strip ${...} the way routeTailOf already does). Cheap, but silently changes the measured population, so it wants before/after numbers per docs-drift's route bridge counts identifiers found inside COMMENT text — an English sentence in a handler can mint a route anchor #9432's standard.
  2. Detect the shape it declines — count route\s*: occurrences and compare against rows actually parsed, emitting the difference as a broken-scan verdict. This keeps the recognizer as narrow as it is and makes its narrowness say so, which is the reporting posture [finding] docs-drift's route bridge can reach only 45 of the 221 client-bound ledger routes — 176 have no registrar tail at all, and the variable-path recall half of #9503 is a small slice of it #9572 and [finding] docs-drift's route-bridge exclusions are silent — only the cross-cutting CAP publishes what it withheld, the two KIND rules do not #9433 both argue for. Cheaper to review; produces a number rather than a behaviour change.

(2) looks like the right first move: it cannot change what the bridge reaches, only what it admits it could not read.

Refs: #9572 (the reach report this was found while resuming), #9433, #4690, #9432.


Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions