Skip to content

fix(pm): check:adr-anchors declares its whole-tree citation scan, so dispatch-gates derives it for every card - #34114

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-g15lbf
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-g15lbf

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #34086

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:门禁 check:adr-anchors 在源码里声明「我读整棵树」(dispatch-gates 现有的 whole-tree-population 标记),派发工具 dispatch-gates 同步认得 git grep 这种全树读法;从此每张卡的 --commands 都会派出这个门禁。
  • 为什么改:这个门禁用 git grep 扫全仓所有文本文件里的 ADR-NNNN 引用,却只声明了 4 个路径;改它们之外的文件时派发清单不点它,开发者本地全绿、CI 才红(PR pm: the low-risk arm lands an add-only ADR note as Tier S; any other ADR change stays H #33975 就是一个 scripts/pm/ 脚本里的测试字符串触发的)。
  • 风险与回滚:只改三个工具脚本,不发布任何包。每张卡多派一条命令,实测约 11 秒。dispatch-gates 只在识别清单末尾追加一条,原有三条及其下标不动。回滚即还原本 PR。
  • 先看:scripts/check-adr-anchors.mjs 的 collectCitations 上方新标记行与自测 live-scan-population-is-declared;scripts/pm/dispatch-gates.mjs 的 REPO_ROOT_WALK_SPELLINGS 第四条。
  • 两分钟验证:node scripts/pm/dispatch-gates.mjs --commands scripts/pm/check-governed-merges.mjs | grep adr-anchors,预期一行 pnpm check:adr-anchors(修复前零行)。
  • 需要你做的:无,席位落地(非受管面)。

What changes

check:adr-anchors' third check (#6634) collects citations with git grep --untracked -IonE … and no pathspec, so it reads every tracked and every untracked-not-ignored text file. Its source spelled only four path literals (docs/adr, its own script and the two release-owned CHANGELOG.md files on its excuse list), so dispatch-gates placed the family by those alone and scored it silent for any other file. Measured on main f81e4b6: 10,237 tracked files cite an ADR, 10,078 of them outside those literals; --commands scripts/pm/check-governed-merges.mjs derived 33 commands and not this one.

Route: declare, don't narrow. The whole-tree read is the point of the check (a citation nobody resolves rots wherever it is written), so the scan stays as it is. wide-population was also rejected: it keeps a family out of --commands, which is the opposite of the acceptance and of "a miss fails toward deriving more". The existing whole-tree-population marker (the channel check:nul-bytes and seven other families use) is the fit. No new declaration grammar.

File Change
scripts/check-adr-anchors.mjs The // dispatch-gates: whole-tree-population -- … line above collectCitations, with a note on why the scan is not narrowed. A live self-test case, live-scan-population-is-declared, holds the marker to the scan in both directions: a scan reading more than one top-level root needs the marker, and a marker over a one-root scan is red too. The live battery's floor moves 21 → 22 for that case.
scripts/pm/dispatch-gates.mjs REPO_ROOT_WALK_SPELLINGS gains limb D, a \git grep` search of the tracked corpus, appended after limbs 0–2 (unchanged). Without it the marker was REFUSED ("its own source carries no recognised repo-root walk … EXTEND REPO_ROOT_WALK_SPELLINGS"). The regex is held to the execFile shape ('git'then an argv array holding'grep'), so the system spawnSync('grep', …)over one named file incheck-skill-compatibility-version.mjs` does not match. Out of the card's file surface: declared to the seat before the edit and approved, with the claim's surface amended.
scripts/pm/dispatch-gates.self-test.mjs Two fixture cases beside limbs A–C: limb D reads the execFile git grep; the system grep is not a walk.

Tests

  • node scripts/check-adr-anchors.mjs --self-test: 134 assertions pass, floor included.
  • pnpm check:pm-dispatch-gates (fast tier): 2207 cases pass, 335 s.
  • Acceptance, before and after: on f81e4b6 node scripts/pm/dispatch-gates.mjs --commands scripts/pm/check-governed-merges.mjs printed 33 lines, 0 naming check:adr-anchors; on a6876cc it prints 34, including pnpm check:adr-anchors, placed under "Always runs (declared population)" with the marker's reason. The always-runs block grows 8 → 9 families.
  • No forced edits to existing test rows.

Acceptance notes

Verification

Local gates on a6876cc (main f81e4b6 is the base): node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 33 commands; all 33 exit 0. --ran: 33 derived, 33 run, 0 NOT-MEASURED, 0 UNRUN. No package touched, so no build closure and no package test is owed; no changeset (skip-changeset).

The 33 commands and their exit codes
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-declaration-mirrors.mjs :: exit 0
node scripts/check-declaration-mirrors.mjs --self-test :: exit 0
node scripts/check-self-test-wired.mjs :: exit 0
node scripts/check-self-test-wired.mjs --self-test :: exit 0
node scripts/check-self-test-workflow-commands.mjs :: exit 0
node scripts/check-self-test-workflow-commands.mjs --self-test :: exit 0
node scripts/check-whole-set-label-write.mjs :: exit 0
node scripts/check-whole-set-label-write.mjs --self-test :: exit 0
node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0
node scripts/pm/bare-root-worklist.mjs --self-test :: exit 0
pnpm check:adr-anchors :: exit 0
pnpm check:agent-test-spelling :: exit 0
pnpm check:bash32-floor :: exit 0
pnpm check:ci-filter-parity :: exit 0
pnpm check:cli-command-ids :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:declared-population-live :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:entry-guard :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:parse-guard :: exit 0
pnpm check:pm-dispatch-gates :: exit 0
pnpm check:pm-governed-merges :: exit 0
pnpm check:pnpm-filter-targets :: exit 0
pnpm check:pnpm-flag-spellings :: exit 0
pnpm check:ratchet-remedy-authority :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:scripts-symbol-anchors :: exit 0
pnpm check:watch-hint-literal :: exit 0

Generated by Claude Code

…ispatch-gates

collectCitations runs `git grep --untracked` with no pathspec, so the gate
reads every text file, but it declared only its path literals and
dispatch-gates --commands called it silent for any card editing a file
outside them. The gate now carries the whole-tree-population marker, and a
live self-test case holds the marker to the scan in both directions.

Claude-Session: https://claude.ai/code/session_01ADHkmT9YphoBfbtPDaBJrs
Co-authored-by: Claude <noreply@anthropic.com>
…s a repo-root walk

A whole-tree-population declaration is refused unless the gate's source
spells a recognised repo-root walk, and `git grep` (which searches the
tracked corpus by default) was not one of the spellings, so
check:adr-anchors could not declare the scan it really performs. Limb D is
appended to REPO_ROOT_WALK_SPELLINGS, held to the execFile shape so the
system grep over one named file does not match; limbs 0-2 are unchanged.

Claude-Session: https://claude.ai/code/session_01ADHkmT9YphoBfbtPDaBJrs
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet objectstack-fleet Bot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Nov 15, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:skills#1 · os-steve · session_01ADHkmPd7uRqHauEehGPr19

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: a6876cc8848156e3fcaae109b90417402ef8d6d2
Local-runs: none
Scope: scripts/check-adr-anchors.mjs, scripts/pm/dispatch-gates.mjs, scripts/pm/dispatch-gates.self-test.mjs + none

No path of the diff is a governed-register or published-schema hit (all three sit under scripts/; the register rows are docs/adr/, .claude/, skills/, the root instruction files, .github/workflows/ and their ui/ twins). Scope is widened to the whole diff. Read: card #34086 with its triage, claim 6899732043, amendment 6899828745 and os-dev-report 6900376734; the PR body, file list and net diff against merge base f81e4b6c; the head's check-runs; PR #34080's hunk ranges. Nothing was built, run or re-run. The acceptance numbers (33 → 34 lines, 8 → 9 always-runs families, about 11 s) are the dev's measurements, checked here by reading and against CI, not reproduced.

Check-runs on the head: all completed, none still running. 26 success, the rest skipped (opt-in and UI lanes), 0 failed. Lint · PM dispatch-gates, Lint · scoped · tooling self-tests, Lint · repo & tooling gates, Check Changeset and Governed Surface Queue Guard are among the green ones.

① Derived judgments

  • Marker grammar: holds. scripts/check-adr-anchors.mjs:1188 is one whole-line // dispatch-gates: whole-tree-population -- REASON comment, the same form as the 7 existing carrier sources (check-nul-bytes, check-closing-keyword-parity, check-comment-mask-corpus, check-driver-memory-census, check-gitlink-declared, check-refd-timer-probe, check-watch-hint-literal). The diff changes no marker parser. Carrier SOURCE FILES go 7 → 8 by reading; the PR's 8 → 9 counts always-runs FAMILY rows, which is a measurement not reproduced here (one source can back more than one family row). The two counts agree on the delta of one.
  • Scan is whole-tree: holds. collectCitations is execFileSync('git', ['grep', '--untracked', '-IonE', pattern], { cwd: ROOT }) with no pathspec. The marker's reason describes it accurately.
  • live-scan-population-is-declared binds both ways, by reading: remove the marker line and declared is false while the live scan reads many top-level roots, so the case is red; narrow the scan to one root under a surviving marker and declared is true against a one-root scan, so it is red. Line 1188 is the only line in the file the case's regex can match (the regex literal itself at line 2147 is indented and does not start a line with //). See nit N1 for the limit of the second direction.
  • Floor 21 → 22: justified. The battery is the structural cases plus one per KNOWN_NUMBER_COLLISIONS row (3 today); the floor pins structural + 1. One structural case is added, so structural goes 20 → 21 and the floor 21 → 22. The comment's "a floor at 24 would redden a removal" is 21 + 3 and is consistent.
  • Limb D is append-only: holds. +12 / −0 in dispatch-gates.mjs, one object appended after index 2; indexes 0–2 are byte-identical. repoRootWalkSpelling returns the FIRST match, so a source that already matched A, B or C keeps its label.
  • Limb D shape: holds. /['"]git['"]\s*,\s*\[[^\]]*?['"]grep['"]/ needs a quoted git followed by an array literal holding a quoted grep before the first ]. It is command-agnostic, so spawnSync('git', ['grep' and execFileSync('git', ['-C', root, 'grep' both match; the bare spawnSync('grep', [...]) in check-skill-compatibility-version.mjs does not; '--grep' does not.
  • What limb D reaches beyond the declarer. entry.rootWalk is set for EVERY family, declared or not, and feeds the unnamedRootWalk census, which reds on an undeclared, unplaced root walker absent from ROOT_WALK_RESIDUE_LEDGER. So limb D widens that census as well as the marker's liveness check, and that direction is derive-MORE. Lint · PM dispatch-gates is green with no ledger row added, so no other discovered gate family became a new unlisted walker.
  • Acceptance: holds by reading. A declared family whose own source carries a recognised walk is placed always-runs by placeFamily, and its command is inside the runnable union --commands prints, for any path list including scripts/pm/check-governed-merges.mjs. The live self-test case "every live whole-tree declaration is BACKED by a repo-root walk" is green in CI with check:adr-anchors among the declarers, so the marker is not refused.
  • NOT governed: holds. 0 of 3 paths under a register row; size +59 / −4.

② Semver level

None. Three unpublished tool scripts under scripts/; no package, no published schema, no exported API. skip-changeset is right and Check Changeset is green. Clause-②: no is right: nothing is narrowed for a consumer. Metadata-protocol: none is right.

③ Boundary flags

④ Design judgment

No must-fix.

should-fix (non-blocking, follow-up)

  • S1 — limb D admits a pathspec-narrowed git grep, and the amendment's census sentence is narrower than it reads. Amendment 6899828745 says "on the tree it matches scripts/check-adr-anchors.mjs only". Read across the head's whole tree, the regex also matches 10 non-fixture files, every one a git grep WITH a pathspec, so none is a whole-tree walk: ui/scripts/measure-strict-authoring-face.mjs:876, packages/core/src/security/granted-permissions-not-enforced.pin.test.ts:100, ui/scripts/__tests__/check-vi-mock-inherit.test.ts:1321, ui/packages/plugin-detail/src/__tests__/relatedListParentScopeResidue-8937.test.ts:238, and six files under ui/packages/types/src/__tests__/. The sentence is true of gate sources under scripts/. No harm today: none of them carries the marker, the green census shows none became an unlisted walker, and a false whole-tree claim derives MORE for that family and removes nothing from any other family's columns (placeFamily leaves non-declaring families untouched). It is also the looseness limb A already has ('ls-files', 'packages' passes it), and the limb's own comment states "necessary, not sufficient". But "judged by a reader" is the only guard, and the pathspec form is the majority spelling in this tree. Suggested: refuse an argv holding a '--' element after 'grep', or pin one fixture case stating that a pathspec'd git grep passes and why.

nit

  • N1 — the self-test's second direction is "more than one top-level root", not "no pathspec". A scan narrowed to two or more roots under a surviving marker stays green. The error is toward derive-MORE, so it is safe, but the comment "holds the marker to the scan in both directions" claims more than the predicate does.
  • N2 — fixture coverage of limb D. One positive (execFileSync) and one negative (system grep), as the amendment promised. No case pins spawnSync('git', ['grep', which matches, and none pins the misses: a git([...]) helper (packages/core/src/security/*.pin.test.ts), an argv built in a variable, a nested ] before 'grep', or a shell-form git grep (scripts/ci/select-gate-families.sh). Every miss fails loud for a declarer (refusal), which is the documented direction; for a non-declarer it leaves the unnamed-walker census exactly where it was before this PR.
  • N3 — the self-test's marker regex accepts only the column-0 // form, while the grammar also takes docblock and block-comment forms. Moving the marker into a docblock would redden the case while dispatch-gates still reads it. Loud, never silent.
  • N4 — hint count. The card and triage say 5 path hints; the PR and report say 4 path literals. Not reconciled anywhere. It has no effect on the fix.

Implemented-by: claude/project-thread-g15lbf
Reviewed-by: session_01ADHkmPd7uRqHauEehGPr19

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:skills#1 · os-steve · session_01ADHkmPd7uRqHauEehGPr19

席位核对 · ACCEPT · head a6876cc8848156e3fcaae109b90417402ef8d6d2 · 2026-11-15T20:02Z

  • 形态: 3 files (+59/−4): scripts/check-adr-anchors.mjs (the whole-tree-population marker + self-test live-scan-population-is-declared), scripts/pm/dispatch-gates.mjs and its self-test (REPO_ROOT_WALK_SPELLINGS limb D, append-only, per surface amendment on this card). check-governed-merges --pr 34114: NOT governed.
  • 前提实测: on main f81e4b6c, --commands scripts/pm/check-governed-merges.mjs derived 33 commands with no check:adr-anchors, though the gate scans every tracked and untracked text file; on this head it derives 34, with check:adr-anchors among the always-runs families.
  • 复核: PASS 6900450018 on this head, Served-tier: CONTRACT_REVIEW_TIER, 0 must-fix. The marker uses the existing grammar, with no parser change; the self-test goes red if either the marker or the whole-tree scan goes; limb D is append-only with indexes 0–2 byte-identical; no hunk overlaps PR fix(pm): dispatch-gates derives the gates that load a changed scripts/pm module, transitively #34080's.
  • 门禁 check-runs: 49 on this head, all completed, 26 success, 23 skipped, none red.
  • 接受的偏差: the surface widening to dispatch-gates.mjs was approved before the edit (amendment on this card). Nits N1–N4 carried (the self-test binds "more than one root" rather than "no pathspec"; no fixture for the spawnSync form; a column-0-only marker regex in the self-test; the 4 vs 5 hint count).
  • 范围外去向: S1 (limb D admits a pathspec-narrowed git grep; it fails toward deriving more) → added to pm(dispatch-gates): the import-graph reach does not start from child scripts a gate spawns #34084, which owns dispatch-gates.mjs next.
  • 落地: K = 3 (PRBASE f81e4b6c). Not governed → ready + auto-merge by this seat.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 15, 2026 20:03
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit d2b6232 Nov 15, 2026
50 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-g15lbf branch November 15, 2026 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s skip-changeset PR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

check:adr-anchors declares 5 path hints but scans the whole tree, so dispatch-gates under-derives it

2 participants