diff --git a/scripts/pm/dispatch-gates.mjs b/scripts/pm/dispatch-gates.mjs index 6343de57fbc..8e00e6752a6 100644 --- a/scripts/pm/dispatch-gates.mjs +++ b/scripts/pm/dispatch-gates.mjs @@ -6572,6 +6572,174 @@ export function firstPartyImportTargets(scriptPath, source, { root = ROOT } = {} return [...firstPartyImportBindings(scriptPath, source, { root }).keys()]; } +/** + * ── The LOAD edge, read for the import-graph key (#33848) ────────────────── + * + * `firstPartyImportBindings` answers a POPULATION question — what a gate + * inherits from a module it imports — and every one of its narrowings is + * priced for that question: static clauses only, self-test bodies masked. + * This answers a different one: *which first-party modules does running this + * file LOAD?* — the question `importGraphReach` walks to name the family that + * runs a changed `scripts/pm/**` module. A missed edge here is a gate a card + * can break without being told, so every narrowing above is turned the other + * way, toward MORE edges: + * + * - self-test bodies are NOT masked: a `--self-test` invocation runs them, and + * a self-test that loads its battery lazily loads it there. + * - comments ARE masked, and a keyword inside a string or template literal is + * not a load: a fixture spelling an import is text this file carries. + * - static `import … from`, `export … from` (a re-export loads its target) + * and the side-effect form; a dynamic `import()` whose argument is a string + * literal or `new URL('', import.meta.url)`. + * - a dynamic `import()` whose argument this scan cannot read (a variable, a + * property, a computed URL) has a target nothing here can name. It is not + * dropped: the file is marked, and EVERY code-position string literal in it + * that names a first-party module — a relative specifier, or a path spelled + * from the repo ROOT under `scripts/` — is taken as an edge. Both live + * shapes: a loader seam (`load = (specifier) => import(specifier)`) whose + * relative specifiers sit in a constant elsewhere in the file + * (`ARM_READER_SOURCE`), and a root-spelled roster loaded in process — + * `fleet-write/dispatch.mjs`'s self-test imports every sender through + * `pathToFileURL(join(REPO_ROOT, sender))`, `check-dispatch-gates.mjs` its + * engine through `import(resolve(ROOT, TOOL))`. Taking the root spelling + * also takes the fixture rows and text reads such a file spells in the same + * form (measured: five modules `check-governed-merges.mjs` names as data + * and never loads), and that is the direction this key errs in: a lead too + * many costs one gate run, a lead too few costs a red CI round. + * + * Resolution is `firstPartyImportBindings`': relative specifiers only, inside + * `scripts/`, outside `node_modules`, and only a target that exists — a bare + * specifier is an installed package, not a source a card edits. + * + * Returns `{ targets, unreadDynamic }`: `targets` sorted, `unreadDynamic` the + * count of `import()` calls whose argument was not read, so a caller can name + * the files the literal fallback widened. + */ +const LOAD_DYNAMIC_IMPORT = /(? !scan.comment[at] && !scan.literal[at]; + const here = nodePath.dirname(nodePath.join(root, scriptPath)); + const present = exists ?? ((rel) => { + const abs = nodePath.join(root, rel); + return existsSync(abs) && statSync(abs).isFile(); + }); + const targets = new Set(); + const admit = (rel) => { + if (!rel.startsWith('scripts/')) return; + if (rel.split('/').includes('node_modules')) return; + if (rel === scriptPath) return; + if (present(rel)) targets.add(rel); + }; + const resolveRelative = (specifier) => { + if (!specifier.startsWith('./') && !specifier.startsWith('../')) return; + admit(nodePath.relative(root, nodePath.resolve(here, specifier))); + }; + // The keyword's own offset, not the match's: both regexes open on the + // statement separator before it. + for (const m of body.matchAll(IMPORT_FROM_SPECIFIER)) { + if (isCode(m.index + m[0].indexOf(m[1]))) resolveRelative(m[4]); + } + for (const m of body.matchAll(SIDE_EFFECT_IMPORT)) { + if (isCode(m.index + m[0].indexOf('import'))) resolveRelative(m[2]); + } + let unreadDynamic = 0; + for (const m of body.matchAll(LOAD_DYNAMIC_IMPORT)) { + if (!isCode(m.index)) continue; + const rest = body.slice(m.index + m[0].length, m.index + m[0].length + 400); + if (/^[ \t\n]*\)/.test(rest)) continue; + const literal = LOAD_DYNAMIC_LITERAL.exec(rest); + if (literal && !(literal[1] === '`' && literal[2].includes('${'))) { + resolveRelative(literal[2]); + continue; + } + const url = LOAD_DYNAMIC_URL.exec(rest); + if (url && !(url[1] === '`' && url[2].includes('${'))) { + resolveRelative(url[2]); + continue; + } + unreadDynamic += 1; + } + if (unreadDynamic > 0) { + for (const m of body.matchAll(LOAD_MODULE_LITERAL)) { + // A literal in CODE: its opening delimiter is code and its first byte is + // literal — the scan flags a literal's content, never its delimiters. + if (!isCode(m.index) || !scan.literal[m.index + 1]) continue; + if (m[1] === '`' && m[2].includes('${')) continue; + if (m[2].startsWith('scripts/')) admit(m[2]); + else resolveRelative(m[2]); + } + } + return { targets: [...targets].sort((a, b) => (a < b ? -1 : a > b ? 1 : 0)), unreadDynamic }; +} + +/** + * Every first-party module running these files LOADS, transitively, each with + * the importer that first reached it (#33848) — the forward closure of + * `loadEdgeTargets` from a family's gate files, which read from the module's + * side is the REVERSE import graph: module M is in family F's reach exactly + * when M is reachable backwards from F's gate files. Breadth-first, so each + * module's recorded importer is on a shortest chain, and the chain a row + * prints is the shortest one a reader can walk. + * + * `edgesOf(rel)` answers one file's targets; the discovery hands in a memoised + * one so a module shared by many families is scanned once. A file it cannot + * read contributes no edge and is still in the reach — the edge INTO it is a + * fact about its importer. + */ +export function importGraphReach(files, edgesOf) { + const own = new Set(files); + const reach = new Map(); + const queue = [...files]; + const seen = new Set(files); + while (queue.length > 0) { + const from = queue.shift(); + let targets = []; + try { + targets = edgesOf(from) ?? []; + } catch { + targets = []; + } + for (const to of targets) { + if (seen.has(to)) continue; + seen.add(to); + if (!own.has(to)) reach.set(to, from); + queue.push(to); + } + } + return reach; +} + +/** + * The chain a reach row prints, gate file first: walk the recorded importers + * back from the module until one is the family's own file. + */ +export function importGraphChain(reach, module) { + const chain = [module]; + let at = module; + const guard = new Set([module]); + while (reach.has(at)) { + at = reach.get(at); + if (guard.has(at)) break; + guard.add(at); + chain.unshift(at); + } + return chain; +} + +/** + * The subtree the import-graph key answers for (#33848). The refusal in + * `coveringKey`'s docblock (#13126) stands for every other module: its price is + * the fan-in of the shared heads under `scripts/`, none of which is in here. + */ +export const IMPORT_GRAPH_KEY_ROOT = 'scripts/pm/'; + /** * The exporter half of the binding rule: is NAME declared in this module as a * VALUE — a `const` initialised to one primitive literal? @@ -7889,12 +8057,43 @@ export function coveringJobFilter(entry, inputPath) { * * What the refusal COSTS is a live missing lead, and it is named rather than * implied: `scripts/pm/bare-root-worklist.mjs --self-test` statically imports - * THIS file, and a card editing this file derives 14 families without naming + * THIS file, and a card editing this file derived 14 families without naming * it. That gate gets run by hand, but lint.yml runs it on every PR too, so the * miss costs one CI round, which is the side this file's header errs on * everywhere, and it is a far smaller cost than the card the general key * prints for the module nearly every family imports — the run's `would name F - * families` line is what prices that one. + * families` line is what prices that one. (That witness is now paid back by + * the admission below, because THIS file lives under `scripts/pm/`.) + * + * ## …and ADMITTED for `scripts/pm/**`, transitively (#33848) + * + * The refusal is priced on the shared heads, and none of them is a pm module. + * The pm tools are the other shape: they import one another in CHAINS — a + * register module read by an executor that a dispatcher loads — and each + * chain ends in a gate whose self-test fakes what it imports. Measured on PR + * #33804's first head (`check-governed-queue-guard.mjs` and + * `check-governed-merges.mjs`): the derivation named 35 gates and not + * `check:pm-fleet-write-execute`, whose script imports a changed function and + * whose self-test went red in CI on that head, behind a dev's "35 of 35 exit + * 0". So a changed path under `IMPORT_GRAPH_KEY_ROOT` is answered by the + * family of every gate whose files LOAD it, at any depth: `importGraphReach` + * walks `loadEdgeTargets` forward from each family's files, which read from + * the module's side is the reverse import graph. The key is the LAST one + * consulted, so it re-attributes nothing an earlier key answered, and it + * ignores both narrowings the population follow takes — it walks self-test + * families too, and gate files too — because it claims what RUNNING the + * family loads, never what the family watches. + * + * Its price is real and is the card's to pay: the pm tools close into one + * large cycle (the governed register, the half-state patrol, the queue guard + * and this file all load one another), so an edit to most pm modules names + * the forty-odd families that run any of them. That is the size of what such + * an edit can break, measured rather than assumed; the replay row and the + * transitive row in `--self-test` are its pins, and a row there PRINTS the + * current size (modules reached, pairs, the most-reached module) rather than + * this prose recording it. Its time price is small and measured: the load + * scan adds about one to two seconds to a cold discovery (`derivationInputs` + * carries the before/after readings). * * WHERE THAT PRICE DOES NOT HOLD (#13467). "One CI round" is the WITNESS's * price and an AVERAGE over the class, and the next reader will quote it as the @@ -8010,6 +8209,16 @@ export function coveringKey(entry, inputPath) { entry.readEdge?.get(read) === 'declared-self-test' ? 'declared self-test read' : 'program text read'; return { key: read, via: by && by !== read ? `${kind} by ${by}` : kind }; } + // The import-graph key (#33848), LAST for the reason the read key above is + // last: additive by construction, so every path an earlier key already + // answered keeps its exact key and label. The FIFTH key this docblock refuses + // is this one, and it stays refused outside `IMPORT_GRAPH_KEY_ROOT`; inside it + // it is admitted transitively, because the pm tools import one another in + // chains (a changed register read by an executor a dispatcher loads) and a + // one-level edge would miss the importer of an importer. + if (String(inputPath).startsWith(IMPORT_GRAPH_KEY_ROOT) && entry.importReach?.has(inputPath)) { + return { key: inputPath, via: `import graph ${importGraphChain(entry.importReach, inputPath).join(' -> ')}` }; + } return null; } @@ -13527,7 +13736,22 @@ function discoverFamiliesPass(tree) { } return manifestHints.get(rel); }; + // The LOAD graph the import-graph key walks (#33848), one scan per file + // however many families reach it — the discovery memo makes it one per tree. + const loadEdges = new Map(); + const loadEdgesOf = (rel) => { + if (!loadEdges.has(rel)) { + const abs = nodePath.join(ROOT, rel); + loadEdges.set(rel, existsSync(abs) ? loadEdgeTargets(rel, readFileSync(abs, 'utf8')).targets : []); + } + return loadEdges.get(rel); + }; for (const entry of byCheck.values()) { + // ⛔ NOT gated on `entry.selfTest`, and not narrowed to non-gate modules: + // this is a claim about what RUNNING the family loads, and a `--self-test` + // invocation loads its script's whole import graph as surely as the bare + // run does — the card's own specimen is a self-test family. + entry.importReach = importGraphReach(entry.files ?? [], loadEdgesOf); entry.imports = []; // The subset of `entry.imports` that CONTRIBUTES a population (#17991). // The edge list stays whole — the gate really does import every module in @@ -16361,9 +16585,14 @@ const derivationInputsMemo = new WeakMap(); * * Memoised per discovery, which is itself memoised per tree, so a derivation * that already discovered pays nothing more for it — and that is the ONLY - * price this may have. A discovery costs seconds (measured: ~14 s cold on - * this tree), so the modes that derive hand it to `baseDrift` and `--tier`, - * which reads no workflow by contract, does not: a battery of `--tier` + * price this may have. A discovery costs seconds — measured on a quiet + * container, two cold runs each: 16.6 s and 14.8 s before the import-graph + * key (#33848, base e71ecc1b), 17.2 s and 17.0 s with it (6f34ab17); a whole `--commands` + * run over one pm path, 36.0 s and 37.0 s before, 38.0 s and 35.7 s after. + * A shared box reads higher (48.7 s was measured for that run under load), so + * quote the ratio, never one absolute. Because it costs that much, the modes + * that derive hand it to `baseDrift` and `--tier`, which reads no workflow by + * contract, does not: a battery of `--tier` * children on a tree a few commits behind was measured to quadruple its wall * clock when the banner asked for a discovery the mode never needed. */ @@ -16378,6 +16607,9 @@ export function derivationInputs({ tree = repoCorpus().tree } = {}) { for (const list of [entry.files, entry.imports, entry.runs, entry.reads, entry.manifests]) { for (const rel of list ?? []) inputs.add(rel); } + // The import-graph key's reach (#33848): a module's edges decide which + // families that key names, so every file the walk opened is an input. + for (const rel of entry.importReach?.keys() ?? []) inputs.add(rel); } derivationInputsMemo.set(discovered, inputs); return inputs; diff --git a/scripts/pm/dispatch-gates.self-test.mjs b/scripts/pm/dispatch-gates.self-test.mjs index 09035aca05e..1329f116c79 100644 --- a/scripts/pm/dispatch-gates.self-test.mjs +++ b/scripts/pm/dispatch-gates.self-test.mjs @@ -300,6 +300,10 @@ import { readmeClaims, takesAReadmeClaim, verifyStandInGuarded, + IMPORT_GRAPH_KEY_ROOT, + importGraphChain, + importGraphReach, + loadEdgeTargets, } from './dispatch-gates.mjs'; import { SCANNED_ROOTS as RUNNER_ENV_ROOTS, isProductSource as runnerEnvIsProductSource } from '../check-runner-env-posture.mjs'; import { findViolations as casingFindViolations } from '../check-error-code-casing.mjs'; @@ -1394,16 +1398,18 @@ export function selfTest({ tier = 'full' } = {}) { + ' already answers, so the novel half is a measurement and not the raw count', importCoveredElsewhere > 0, ); - // The card's own witness, and the single lead this refusal is KNOWN to cost. - // Asserted in both halves: the import edge exists, and no key names it. + // The card's own witness, the single lead this refusal was KNOWN to cost — + // and now the lead the import-graph key (#33848) pays back, because the + // module it imports lives under `IMPORT_GRAPH_KEY_ROOT`. Asserted in both + // halves: the import edge exists, and the key that names it is that one. const bareRootKey = 'scripts/pm/bare-root-worklist.mjs --self-test'; const bareRootImportFamily = importClassFamilies.find(([c]) => c === bareRootKey)?.[1]; t( - 'the witness holds — bare-root-worklist --self-test imports THIS file, and no key names that' - + ' family for a card editing it', + 'the witness is paid back — bare-root-worklist --self-test imports THIS file, and the import-graph' + + ' key names that family for a card editing it', (importClassEdges.get(bareRootKey)?.has('scripts/pm/dispatch-gates.mjs') ?? false) && !!bareRootImportFamily - && coveringKey(bareRootImportFamily, 'scripts/pm/dispatch-gates.mjs') === null, + && String(coveringKey(bareRootImportFamily, 'scripts/pm/dispatch-gates.mjs')?.via ?? '').startsWith('import graph '), ); // Why it is refused, re-derived rather than recalled: the worst module would // print a list nobody reads. The bound is the header's own "22 leads is the @@ -1482,6 +1488,147 @@ export function selfTest({ tier = 'full' } = {}) { importDeferredOnHeads.length * 2 > importDeferred.length, ); + // ── The import-graph key (#33848) ────────────────────────────────────────── + // A changed `scripts/pm/**` module names the family of every gate that LOADS + // it, transitively. The refused fifth key above stands outside that subtree; + // inside it, the pm tools import one another in chains, and a one-level edge + // missed the measured case: on PR #33804's first head the derivation named 35 + // gates and not `check:pm-fleet-write-execute`, whose script imports a changed + // module and whose self-test then went red in CI. + // + // Fixture rows first: one in-memory graph, so the edge reader and the walk are + // pinned on shapes this tree may stop carrying. + const lgSources = { + 'scripts/pm/gate.mjs': [ + "import { a } from './a.mjs';", + "export { r } from './reexported.mjs';", + "import './side.mjs';", + 'const fixture = `', + "import { never } from './fixture-only.mjs';", + '`;', + "// import { prose } from './comment-only.mjs';", + "import { pkg } from 'yaml';", + 'export function selfTest() {', + " return import('./battery.mjs');", + '}', + "const lazy = () => import(new URL('./by-url.mjs', import.meta.url));", + ].join('\n'), + 'scripts/pm/a.mjs': "export { b } from './b.mjs';\nexport const a = 1;\n", + 'scripts/pm/b.mjs': "export const b = 2;\n", + 'scripts/pm/reexported.mjs': 'export const r = 3;\n', + 'scripts/pm/side.mjs': '', + 'scripts/pm/fixture-only.mjs': '', + 'scripts/pm/comment-only.mjs': '', + 'scripts/pm/battery.mjs': '', + 'scripts/pm/by-url.mjs': '', + 'scripts/pm/seam.mjs': [ + 'export const SOURCE = "./table.mjs";', + "const ROOT_SPELLED = 'scripts/pm/root-spelled.mjs';", + 'export const load = (specifier) => import(specifier);', + ].join('\n'), + 'scripts/pm/table.mjs': '', + 'scripts/pm/root-spelled.mjs': '', + 'scripts/pm/no-seam.mjs': 'export const SOURCE = "./table.mjs";\nexport const ROOT_SPELLED = \'scripts/pm/root-spelled.mjs\';\n', + }; + const lgExists = (rel) => Object.hasOwn(lgSources, rel); + const lgEdges = (rel) => loadEdgeTargets(rel, lgSources[rel] ?? '', { exists: lgExists }).targets; + const lgGate = lgEdges('scripts/pm/gate.mjs'); + t( + 'the load-edge reader takes the static import, the re-export, the side-effect form, a literal import() inside' + + ' the self-test body and a new URL(...) import()', + ['scripts/pm/a.mjs', 'scripts/pm/reexported.mjs', 'scripts/pm/side.mjs', 'scripts/pm/battery.mjs', 'scripts/pm/by-url.mjs'] + .every((m) => lgGate.includes(m)), + lgGate.join(' '), + ); + t( + '…and refuses an import spelled inside a template literal or a comment, and a bare package specifier', + !lgGate.includes('scripts/pm/fixture-only.mjs') && !lgGate.includes('scripts/pm/comment-only.mjs') + && lgGate.every((m) => m.startsWith('scripts/')), + lgGate.join(' '), + ); + const lgSeam = loadEdgeTargets('scripts/pm/seam.mjs', lgSources['scripts/pm/seam.mjs'], { exists: lgExists }); + t( + 'an import() whose argument is not a literal widens toward MORE: every module literal in the file is an edge,' + + ' relative or spelled from the repo root', + lgSeam.unreadDynamic === 1 && lgSeam.targets.join() === 'scripts/pm/root-spelled.mjs,scripts/pm/table.mjs', + `${lgSeam.unreadDynamic} unread · ${lgSeam.targets.join(' ')}`, + ); + t( + 'CONTROL: the same two literals in a file with no unread import() are not edges', + lgEdges('scripts/pm/no-seam.mjs').length === 0, + ); + const lgReach = importGraphReach(['scripts/pm/gate.mjs'], lgEdges); + const lgEntry = { check: 'check:fixture', files: ['scripts/pm/gate.mjs'], hints: [], importReach: lgReach }; + const lgTransitive = coveringKey(lgEntry, 'scripts/pm/b.mjs'); + t( + '⭐ the transitive row: a module reached only through an importer of an importer names the family, and the' + + ' row prints the chain from the gate file', + lgTransitive?.key === 'scripts/pm/b.mjs' + && lgTransitive?.via === 'import graph scripts/pm/gate.mjs -> scripts/pm/a.mjs -> scripts/pm/b.mjs' + && importGraphChain(lgReach, 'scripts/pm/b.mjs').length === 3, + lgTransitive?.via ?? 'no key', + ); + const lgOutside = { + ...lgEntry, + importReach: new Map([['scripts/shared-head.mjs', 'scripts/pm/gate.mjs']]), + }; + t( + 'the key answers only under scripts/pm/ — a shared module outside it stays under the refusal above', + IMPORT_GRAPH_KEY_ROOT === 'scripts/pm/' && coveringKey(lgOutside, 'scripts/shared-head.mjs') === null, + ); + // The live replay: PR #33804's first file list, against this tree. + const replayPaths = ['scripts/pm/check-governed-queue-guard.mjs', 'scripts/pm/check-governed-merges.mjs']; + const replayFamilies = new Map(discoverFamilies().byCheck); + const replayPlaced = (check) => { + const entry = replayFamilies.get(check); + return entry ? placeFamily(entry, replayPaths) : { verdict: 'not discovered', hits: [] }; + }; + const replayExecute = replayPlaced('check:pm-fleet-write-execute'); + t( + '⭐ the replay row: PR #33804\'s first file list derives check:pm-fleet-write-execute, through the import graph', + replayExecute.verdict === 'matched' + && replayExecute.hits.some((h) => h.via.startsWith('import graph scripts/pm/fleet-write/execute.mjs -> ')) + && runnableInvocation(replayFamilies.get('check:pm-fleet-write-execute') ?? {}) === 'pnpm check:pm-fleet-write-execute', + replayExecute.hits.map((h) => h.via).join(' · ') || replayExecute.verdict, + ); + const replayFleet = ['check:pm-fleet-write-validate', 'check:pm-fleet-write-dispatch'].map((c) => [c, replayPlaced(c)]); + t( + '…and the validator and the dispatcher, the other two fleet-write families the card names', + replayFleet.every(([, placed]) => placed.verdict === 'matched'), + replayFleet.map(([c, placed]) => `${c}: ${placed.verdict}`).join(' · '), + ); + // The root-spelled roster, live (review M1): the dispatcher's self-test loads + // every sender in process through `pathToFileURL(join(REPO_ROOT, sender))`, + // and `scripts/pm/issue-create.mjs` has no static importer under scripts/ — + // so only the root-spelled fallback reaches it, and without it a card editing + // the sender reddens check:pm-fleet-write-dispatch in CI underived. + const senderDispatch = replayFamilies.get('check:pm-fleet-write-dispatch'); + const senderPlaced = senderDispatch + ? placeFamily(senderDispatch, ['scripts/pm/issue-create.mjs']) + : { verdict: 'not discovered', hits: [] }; + t( + '⭐ a sender the dispatcher loads by a root-spelled path derives check:pm-fleet-write-dispatch, through the import graph', + senderPlaced.verdict === 'matched' && senderPlaced.hits.some((h) => h.via.startsWith('import graph ')), + senderPlaced.hits.map((h) => h.via).join(' · ') || senderPlaced.verdict, + ); + // The key's price, PRINTED rather than recorded (review nit): the pm modules + // it reaches, the (family, module) pairs, and the module that names the most + // families. Prose cannot notice the tree moving under these numbers, so the + // run says them and asserts only that the key reaches anything at all. + const priceByModule = new Map(); + for (const entry of replayFamilies.values()) { + for (const mod of entry.importReach?.keys() ?? []) { + if (mod.startsWith(IMPORT_GRAPH_KEY_ROOT)) priceByModule.set(mod, (priceByModule.get(mod) ?? 0) + 1); + } + } + const pricePairs = [...priceByModule.values()].reduce((sum, n) => sum + n, 0); + const priceWorst = [...priceByModule].sort((a, b) => b[1] - a[1] || (a[0] < b[0] ? -1 : 1))[0]; + t( + `the import-graph key's price on this tree: ${priceByModule.size} pm module(s) reached over ${pricePairs}` + + ` (family, module) pair(s); ${priceWorst?.[0]} names ${priceWorst?.[1]} famil(ies)`, + priceByModule.size > 0 && pricePairs >= priceByModule.size, + ); + // #12107, the live half — three claims about THIS tree, each one a thing the // fix buys that a fixture cannot show. const tsLiveFamilies = [...discoverFamilies().byCheck]; @@ -9170,10 +9317,16 @@ export function selfTest({ tier = 'full' } = {}) { const reattributed = []; for (const [check, entry, target] of readEdges.map(([c, r]) => [c, liveDiscovery.byCheck.get(c), r])) { const withKey = coveringKey(entry, target); + // The keys consulted BEFORE this one are the comparison, so the one + // consulted after it (the import-graph key, #33848) is stripped too: it + // fills holes this key leaves, and is not what this key could re-attribute. const saved = entry.reads; + const savedReach = entry.importReach; entry.reads = []; + entry.importReach = new Map(); const without = coveringKey(entry, target); entry.reads = saved; + entry.importReach = savedReach; // Both halves, because only the pair is the claim. Without the first, a // derivation that answers NOTHING for every read edge satisfies "nothing // was re-attributed" perfectly.