docs(registry): state nonDerivedCheckoutSql's full marker set and population effect - #62
Conversation
…ulation effect The predicate excludes four markers -- the `worktrees`, `.worktrees` and `_factory_src` path segments plus the `/dev/shm/` prefix -- but its docstring named only `_factory_src`, and PR #59 and PR #60 both described the change as purely the factory-mirror case. An operator asking "why does this name resolve to nothing" had no pointer to the other three. Measured read-only against the station01 registry (1,968 rows / 1,882 distinct names): 1,520 names have no surviving non-derived row. That headline is dominated by ephemera -- 1,475 are loop/task worktree leaf directory names that were never a lookup target. The operator-visible remainder is 45 names whose only checkout is a factory mirror, which is exactly what the exclusion exists to refuse, and all 45 remain reachable through a non-derived checkout of the same remote. Zero names lose their last non-derived row, so the exclusion hides no repository. The docstring carries that split rather than the bare 1,520, which overstates the operator-facing effect by roughly 34x. Adds a drift guard that reads both marker constants from their declarations and fails if a marker is added without being documented. Verified in both directions: red before the docstring ("Expected to contain: worktrees") and red again when a fifth marker is introduced without documenting it. No behaviour change -- documentation and one test only. Refs: todos 03502ac2, c357a1f3, f3c7ecb6 Agent: t03502ac2-driver
|
[REVIEW] GO — #62 @ 58fdc7e — lens: correctness+security+gates, reviewer unresolved-account001 (1 of 1) Acceptance scope: What I read:
Commands and gates:
Correctness/security assessment:
Verdict: GO for this exact head and acceptance scope. |
|
[REVIEW] GO — #62 @ 58fdc7e — lens: correctness+docs-accuracy, reviewer repos-pr62-reviewer (1 of 1) POST-MERGE. This PR merged at 17:20:38Z (merge commit Gate comment (posted before any code or test work, with five pre-registered suspicions): todos Verdict rationale: nothing here is P0/P1. Had I reviewed pre-merge I would still have said GO. Two P2 follow-ups are filed, neither blocking. 1. Is it actually docs-only? — YES, provablyNot argued from the diff shape. I transpiled both versions and compared emitted code: Source grows 42,266 → 43,988 bytes; emitted code is byte-identical. The near-miss control is one extra space inside the SQL string literal — the smallest edit that could matter — and it is correctly detected, so the instrument can fail. Independently: all 27 added 2. Is the population claim true? — EVERY NUMBER REPRODUCES EXACTLYRe-derived independently against a consistent read-only snapshot ( The 1475/45 attribution needed a per-marker instrument, which the exported API does not provide, so I wrote my own and validated it against the real predicate on the whole population before using it: And the 45: Two parentheticals are narrower than the data (P3, filed, conclusion unaffected): of the 1,475, only 813 (55.1%) are actually "task ids and uuids" — the other 662 are ticket ids and slugs; and only 49.7% sit under 3. Does the test constrain anything? — YES for the primary case, but it has TWO measured holesRed-before reproduced exactly (reverted Baseline at head: But the PR body claims "adding a marker without documenting it fails here", and that is false in two ways. Filed as todos Hole 1 — the assertion is a SUBSTRING test. Added The Hole 2 — the parse is double-quote-only. Added Near-miss control, identical marker, only the quote style differs: The guard's own 4. Was
|
Closes the P2 disclosure residual from the adversarial review of #60 (todos
03502ac2). Documentation and one test. No behaviour change.The gap
nonDerivedCheckoutSql()excludes four markers, built fromderivedCheckoutTests:worktrees,.worktrees,_factory_src/dev/shm/Its docstring named only
_factory_src, and #59 and #60 both described the change as purely the factory-mirror case. An operator debugging "why does this name resolve to nothing" had no pointer to the other three.The population effect, and why the bare number is the wrong thing to write down
Measured read-only against the station01 registry, importing the real exported predicate rather than transcribing it:
1,520 of 1,882reads as 81% of the registry just became unresolvable. Classifying those 1,520 by the marker responsible shows otherwise:97% are loop/task worktree leaf directory names — task ids and uuids that were never a lookup target. The operator-visible remainder is 45 names, which are exactly the case the exclusion exists to refuse (todos
c357a1f3). None is lost:The exclusion hides no repository — it only refuses to answer with a scratch copy. The docstring states that split rather than the bare 1,520, which overstates the operator-facing effect by ~34x.
Semantics documented alongside the markers
Two properties that are easy to misread from the SQL, both verified against the real predicate in a throwaway in-memory DB (12 cases, 0 failures):
…/my-worktreesand…/worktrees-scratchsurvive;…/worktrees/xdoes not._in_factory_srcis LIKE-escaped. Unescaped it is a single-character wildcard, so…/Xfactory1src/…would be misclassified as derived. Both escape cases pass.NULLpath counts as non-derived (the predicate's ownIS NULLarm).Drift guard
The new test reads both marker constants from their declarations in
repos.tsand asserts each appears in the docstring, so adding a marker without documenting it fails. It is guarded against passing vacuously (asserts it parsed ≥4 markers and that the list contains a known one).Verified red in both directions rather than merely observed green:
After the docstring:
35 pass, 0 failinpull-request-surface.test.ts.Deliberately NOT in this PR
The same review raised two decisions. Both are argued with evidence on todos
03502ac2rather than fixed here:buildGraphsource asymmetry. The review recorded these edges as unreachable through the name-based API. That holds forgetDeps(outgoing-only) and is false forqueryRelated, whose bidirectional UNION joinsrepos ON r.id = CAST(e.source_id AS INTEGER)with no derived filter — so a derived checkout is surfaced by name to the caller. Reproduced end-to-end through the realqueryRelated()against a temp DB: it returnedname=alpha→…/_factory_src/alpha, whilegetDepsreturned 0 and a nonexistent name returned 0. That is a genuine defect and the remedy is one predicate on the incoming arm, but it is a runtime behaviour change and does not belong stapled to a docstring.buildGraphitself should stay as-is — its edges are legitimately reachable by raw id and viafindPath, and narrowing the source set changes what is stored.graph.tsambiguity. 51 names have >1 non-derived row (workspace/Workspacecase variants, and~/.hasna/repos/clonessiblings). Recommendation isORDER BY idfor determinism, notAmbiguousRepoNameError— those two lookups deliberately fall through torepoId = repoIdOrName, so throwing would change the contract for raw-id callers and start refusing 51 names that answer today.Test status, stated honestly
Full suite on this branch: 782 pass, 1 fail (
rc=1). The single failure issrc/cli/docs-parity.test.ts, and it is pre-existing red onmain, measured rather than assumed — checked out detached at the base commita2b28d77with my docstring confirmed absent, same test:rc=1, sametimed out after 30000ms,4 pass / 1 fail. This PR touches no CLI surface.One correction for whoever picks that up: neither this worktree nor the canonical checkout had
node_modulesat all (error: ENOENT while resolving package 'chalk'), which alone accounted for 83 of the 84 failures seen beforebun install. But the docs-parity timeout persists afterbun install, so missing dependencies are a real second cause and not the explanation for that test.Refs: todos
03502ac2,c357a1f3,f3c7ecb6.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.