Repository navigation
fix(pm): dispatch-gates derives the gates that load a changed scripts/pm module, transitively - #34080
Conversation
…/pm module, transitively WIP: the import-graph key and its self-test rows. Claude-Session: https://claude.ai/code/session_01ADHkmRtrFmEsp5pAjTBpMT Co-authored-by: Claude <noreply@anthropic.com>
… it; docblock prices the admission Claude-Session: https://claude.ai/code/session_01ADHkmRtrFmEsp5pAjTBpMT Co-authored-by: Claude <noreply@anthropic.com>
|
domain:skills#1 · os-steve · session_01ADHkmPd7uRqHauEehGPr19 Contract reviewServed-tier: Inputs read: card #33848 body and its three comments (triage 6894767153, claim 6897694093, os-dev-report 6898826924); PR #34080 body, file list (2 files, +347 / -7) and net diff against Check-runs on the head at review time: every Lint lane ( Findings: 1 must-fix, 2 should-fix, 4 nits. ① Derived judgmentsVerified by reading the diff and the head:
must-fix M1 — an unreadable
Consequence for the first: should-fix S1 — the reach is seeded from should-fix S2 — the wall-clock price is not stated. Discovery now scans every reached file once more ( Not covered, checked, no live instance found (nits):
② Semver levelNo published package is touched: both files are under ③ Boundary flags
④ Design judgment
Implemented-by: VERDICT: FAIL |
…terals in its file Claude-Session: https://claude.ai/code/session_01ADHkmRtrFmEsp5pAjTBpMT Co-authored-by: Claude <noreply@anthropic.com>
…efore and after the import-graph key Claude-Session: https://claude.ai/code/session_01ADHkmRtrFmEsp5pAjTBpMT Co-authored-by: Claude <noreply@anthropic.com>
|
domain:skills#1 · os-steve · session_01ADHkmPd7uRqHauEehGPr19 Contract reviewServed-tier: Delta round against the FAIL record 6898932707 on Check-runs on the head: nothing is still running. Every Lint lane ( Findings on this head: 0 must-fix, 0 should-fix, 4 nits. ① Derived judgmentsM1 — closed. The fallback under an unreadable The admission cannot narrow, and it fails toward more. Checked by reading:
S2 — closed. The S1 — closed by carrier. The spawned-child closure is carried by #34084 (open, Round-1 nits: N4 is closed (a self-test row prints modules reached, pairs and the most-reached module on every run; the report reads 28 modules, 1195 pairs, 53 families for
② Semver levelUnchanged from round 1. Both files are under ③ Boundary flags
④ Design judgment
Implemented-by: VERDICT: PASS |
|
domain:skills#1 · os-steve · session_01ADHkmPd7uRqHauEehGPr19 席位核对 · ACCEPT · head
|
…dispatch-gates derives it for every card (objectstack-ai#34114) <!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi92Vt19B5bTPa1d6K7Nf4xkL)_ Fixes objectstack-ai#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 objectstack-ai#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 (objectstack-ai#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 in `check-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 - Price: every card's `--commands` now carries `pnpm check:adr-anchors` (self-test plus scan, about 11 s measured here). - Serial: PR objectstack-ai#34080 (in the merge queue) and card objectstack-ai#34084 also edit `scripts/pm/dispatch-gates.mjs`, in other regions; whichever lands second resolves. - The claim's acceptance line asks for `check-governed-merges.mjs --pr` and the tier; the reading is in the os-dev-report on the card. ## 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`). <details><summary>The 33 commands and their exit codes</summary> ```text 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 ``` </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01ADHkmT9YphoBfbtPDaBJrs)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Steve · project thread
Fixes #33848
Clause-②: no
Metadata-protocol: none
维护者速读
dispatch-gates.mjs新增「import 图」匹配键:改动落在scripts/pm/**下的某个模块时,所有直接或间接 import(含动态 import、再导出)它的门禁脚本所属的门禁族都会被派生出来,输出里打印从门禁脚本到该模块的整条 import 链。check-governed-queue-guard.mjs和check-governed-merges.mjs,--commands派生 35 条、漏了check:pm-fleet-write-execute(它的脚本 import 了被改的函数),开发者「35 条全绿」而 CI 红。现在同一组文件派生 62 条,含 fleet-write 的执行器、校验器和派发器。scripts/pm/**下一个工具脚本和它的自测,不发布任何包。新键排在所有旧键之后,旧匹配的键与来源标签一字不变,只会多派、不会少派;代价是改大多数 pm 模块会多派约 40 多个门禁族(pm 工具互相 import 成一个大环,这是实测的真实影响面)。回滚即还原本 PR。scripts/pm/dispatch-gates.mjs的loadEdgeTargets(读 import 边,含动态 import 的兜底)与coveringKey末尾的新分支;自测文件里The import-graph key (#33848)一节和改过的两条旧用例。node scripts/pm/dispatch-gates.mjs --commands scripts/pm/check-governed-queue-guard.mjs scripts/pm/check-governed-merges.mjs | grep fleet-write,预期三行pnpm check:pm-fleet-write-{dispatch,execute,validate}(修复前零行)。What changes
dispatch-gates --commandsnamed a gate when a changed path was the gate's own script, a CI trigger, a job filter, a literal the gate spells, or a file it reads. It never named a gate because its script imports the changed module:coveringKey's docblock refused that key (#13126) on precision, because the shared heads underscripts/(invoked-as.mjsand four others) are imported by most families. The pm tools are the opposite shape, and the measured miss is the card's: on PR #33804's first head the derivation named 35 gates, notcheck:pm-fleet-write-execute, whose script imports a changed function and whose self-test then went red in CI.A new key, consulted last in
coveringKey, answers a changed path underIMPORT_GRAPH_KEY_ROOT(scripts/pm/): a family matches when the path is in the transitive load closure of its gate files. Read from the module's side that is the reverse import graph overscripts/pm/**, at any depth. The row prints the chain, e.g.import graph scripts/pm/fleet-write/execute.mjs -> scripts/pm/check-governed-queue-guard.mjs. Outsidescripts/pm/the #13126 refusal stands unchanged (a self-test row pins that).loadEdgeTargets(path, source)import … from,export … from(a re-export loads its target), the side-effect form, a dynamicimport()of a string literal or ofnew URL(literal, import.meta.url). Comments are masked; a keyword inside a string or template literal is fixture text, not a load. Self-test bodies are not masked: a--self-testrun loads them.import()scripts/(toward deriving more). Both shapes are live: a loader seam (load = (specifier) => import(specifier)) with its relative specifiers in a constant (ARM_READER_SOURCE), and a root-spelled roster loaded in process (fleet-write/dispatch.mjs's self-test imports each sender throughpathToFileURL(join(REPO_ROOT, sender));check-dispatch-gates.mjsloads its engine throughimport(resolve(ROOT, TOOL))). The root spelling also takes fixture rows and text reads written the same way (five modulescheck-governed-merges.mjsnames as data); that over-derives, which is this key's direction.importGraphReach(files, edgesOf)discoverFamiliesentry.importReachfor every family, one scan per file per discovery.derivationInputsResolution is the existing first-party rule: relative specifiers only, inside
scripts/, outsidenode_modules, the target must exist. A bare specifier is an installed package.Measured on this tree (b8685e5), and printed by a self-test row on every run rather than recorded in prose: the key reaches 28 pm modules over 1195 (family, module) pairs, and the most-reached module,
clause2-line.mjs, names 53 families. The pm tools close into one large cycle (the governed register, the half-state patrol, the queue guard and the dispatch-gates engine load one another), so an edit to most pm modules names forty-odd families. That is the measured size of what such an edit can break.Time, measured on a quiet container, two cold runs each: a discovery took 16.6 s and 14.8 s before the key (base e71ecc1) and 17.2 s and 17.0 s with it (6f34ab1); a whole
--commandsrun over one pm path took 36.0 s and 37.0 s before and 38.0 s and 35.7 s after. The review's 48.7 s was the same run on a loaded box. The stale "~14 s cold" inderivationInputs' docblock now carries these readings.Tests
Full battery (
node scripts/pm/dispatch-gates.mjs --self-test, both tiers) on b8685e5: 2530 cases pass (fast 2215 + slow 315), lockVERDICT command-exit 0. Round 1: 2528 passed on 80bc14b and on e6452d3.New rows, all in the fast tier:
import()inside a self-test body and anew URLimport; it refuses an import spelled in a template literal or a comment and a bare package; an unreadimport()widens to every module literal in the file, relative or root-spelled; CONTROL: the same two literals in a file with no unreadimport()are no edges.b.mjsreached only throughgate.mjs -> a.mjs -> b.mjsnames the family, and the row prints that chain.scripts/pm/reached by import is still answered by no key.scripts/pm/issue-create.mjs, which no file underscripts/imports statically and which the dispatcher's self-test loads by root path, derivescheck:pm-fleet-write-dispatchthrough the import graph.check:pm-fleet-write-executeas matched viaimport graph scripts/pm/fleet-write/execute.mjs -> …, renderedpnpm check:pm-fleet-write-execute; andcheck:pm-fleet-write-validateandcheck:pm-fleet-write-dispatchmatch too.Forced edits to existing rows (both are about the key order this PR extends):
the witness holds — bare-root-worklist --self-test imports THIS file, and no key names that family…) asserted the refusal's one known missing lead. That module is underscripts/pm/, so the new key names it; the row now asserts the edge exists AND the key that names it is the import-graph key (the witness is paid back — …). The other five refusal pins (novel class, worst head, concentration, the deferred-pair pins) are unchanged and green.every read edge earns a key, and none is re-attributed …) strippedentry.readsand compared against the keys left. The new key now sits after the read key, so with the reads stripped it answered those targets and the row reported 7 false re-attributions (program text read by …->import graph …). The row now stripsentry.importReachtoo, so it compares the read key against the keys consulted BEFORE it, which is its claim.Ablation: the new branch in coveringKey disabled on disk, exactly the four key rows red, restored (head e6452d3)
Through
node scripts/ablation-replace.mjs(anchor hits 1 -> 0 on disk, blob7d65b7fe4962->09197c9f6da0), the fast tier underos-verify-lock.sh; restore: blob == HEAD (7d65b7fe4962) andgit diff HEADempty.Ablation, round 2 (review M1): the root-spelled half of the fallback disabled on disk, exactly two rows red, restored (head b8685e5)
Through
node scripts/ablation-replace.mjs(anchor hits 1 -> 0, blob8e00e6752a69->fcd7324b7a64), the fast tier underos-verify-lock.sh; restore: blob == HEAD (8e00e6752a69) andgit diff HEADempty.Acceptance notes
coveringKeyconsults, so every (family, path) pair an earlier key answered keeps its key and label; the 2,520 rows that existed before stay green except the two forced edits above.scripts/pm/modules now derives about 62 commands where it derived about 30 (this PR's own card: 62). Every added row prints its import chain, so a reader can check why it is there.node scripts/pm/x.mjs) is not walked; the existing run and read keys answer the spawned file itself where they apply. carrier: pm(dispatch-gates): the import-graph reach does not start from child scripts a gate spawns #34084.check:adr-anchorsreddened by a fixture string on PR pm: the low-risk arm lands an add-only ADR note as Tier S; any other ADR change stays H #33975) is a different mechanism: that family declares five hints (docs/adr,scripts/adr-anchors, its own script and twoCHANGELOG.mdfiles) and no whole-tree marker, while its scan reads the whole tree's text. Its population is under-declared; not fixed here. carrier: check:adr-anchors declares 5 path hints but scans the whole tree, so dispatch-gates under-derives it #34086.**does not span a path segment that holds a newline (no dotAll), so a pattern-judged gate is silently not derived #34002 (dotAll intriggerPatternRegex, same file) is held and not folded in.Verification
Local subset on b8685e5 (round 2; main e71ecc1 merged in):
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 62 commands; 61 exit 0 and one exit 3 (each exit captured before any pipe).--ranwith every line annotated:: exit N: 62 derived, 61 run, 1 NOT-MEASURED (derived from the recorded exit 3), 0 UNRUN.pnpm check:i18n-coverageis derived only through the import graph (its self-test imports the engine): its self-test half passed, its scan half refused with exit 3 because the CLI build closure is not built here; declared to CI. No package touched, so no build closure and no package test is owed.The 62 commands and their exit codes
Generated by Claude Code