Skip to content

Commit 92c6964

Browse files
hotlongclaude
andcommitted
chore(pm): record the bare-root verdict for check:dual-build-cjs-loads
DECLARED-NARROWER: the gate declares packages/**/package.json (1.0% of the tree) and packages/**/tsup.config.ts (0.3%) beside SCAN_ROOT. The wider packages/**/src/** spelling — best recall, since #12971 arrived through one source line — is measured at 62.2% of the tracked tree and REFUSED on the same trade this map records for the 39% rows, and because the gate does not read those files at all. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 9e18ed0 commit 92c6964

2 files changed

Lines changed: 41 additions & 10 deletions

File tree

‎scripts/check-dual-build-cjs-loads.mjs‎

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,26 +138,40 @@ const BASELINE_PATH = 'scripts/dual-build-cjs-loads.baseline.json';
138138
* derivation for every card in the tree, including the one shape it exists to
139139
* catch.
140140
*
141-
* Three literals, because three different edits move this gate's verdict and
142-
* no narrower set is complete:
141+
* Two literals -- the two files whose CONTENT this gate's verdict is a
142+
* function of, and which it can name at a precision worth having:
143143
*
144144
* `packages/**\/package.json` declares the `require` condition -- adding
145145
* one puts a new entry into the population.
146+
* 74 tracked files, 1.0% of the tree.
146147
* `packages/**\/tsup.config.ts` decides the emitted bytes; DROPPING
147148
* `shims: true` is how a fixed package
148149
* regresses, and it is a one-line edit that
149-
* touches no source file at all.
150-
* `packages/**\/src/**` #12843 arrived here and nowhere else: one
151-
* source line, no manifest change, no config
152-
* change. A declaration that omitted this
153-
* would be precise and USELESS -- silent for
154-
* exactly the change kind that motivated it.
150+
* touches no source file at all. 20 tracked
151+
* files, 0.3%.
152+
*
153+
* ⛔ A third literal is deliberately NOT declared, and the omission is
154+
* measured rather than an oversight. #12843 arrived through
155+
* `packages/**\/src/**` -- one source line, no manifest change, no config
156+
* change -- so that spelling has the best recall of the three. It reaches
157+
* **4482 files, 62.2% of the tracked tree** (98.8% of them really are in a
158+
* dual-built package, so the imprecision is not the problem). Declaring it
159+
* would name this gate on nearly every card in the repo, which is the trade
160+
* `scripts/pm/bare-root-worklist.mjs` records as REFUSE-WIDE for rows at 39%,
161+
* one column narrower than this one: recall bought at the cost of precision,
162+
* on the column whose whole value is precision. And this gate does not READ
163+
* those files at all -- it reads `dist/` -- so declaring them would be
164+
* declaring a population the gate does not walk, which that ledger names as
165+
* the costlier error of the two. The recall is not lost: the gate is a step in
166+
* **Build Core**, a required context that runs on every PR, so the cost of the
167+
* omission is one CI round trip, not a missed defect. The row in that ledger
168+
* carries this measurement.
155169
*
156170
* ⛔ Spelled as LITERALS, never built from `SCAN_ROOT` -- the extractor reads
157171
* source text, so a computed template would produce no hint and leave the gate
158172
* as invisible as no declaration at all. Pinned in `--self-test`.
159173
*/
160-
const ROOT_DIR_WATCH_HINTS = ['packages/**/package.json', 'packages/**/tsup.config.ts', 'packages/**/src/**'];
174+
const ROOT_DIR_WATCH_HINTS = ['packages/**/package.json', 'packages/**/tsup.config.ts'];
161175

162176
/**
163177
* ## AGREES -- the third invariant, and the one loading alone cannot give you
@@ -622,7 +636,8 @@ export async function selfTest() {
622636
// ── the declaration itself ────────────────────────────────────────────────
623637
const selfSrc = readFileSync(fileURLToPath(import.meta.url), 'utf8');
624638
t('the watch hints are spelled as literals the extractor can read', ROOT_DIR_WATCH_HINTS.every((h) => selfSrc.includes(`'${h}'`)));
625-
t('the watch hints cover the manifest, the tsup config AND the sources', ROOT_DIR_WATCH_HINTS.length === 3 && ROOT_DIR_WATCH_HINTS.every((h) => h.startsWith(`${SCAN_ROOT}/`)));
639+
t('the watch hints cover the manifest and the tsup config', ROOT_DIR_WATCH_HINTS.length === 2 && ROOT_DIR_WATCH_HINTS.every((h) => h.startsWith(`${SCAN_ROOT}/`)));
640+
t('⛔ the wide source spelling stays UNDECLARED — the measured refusal above', !ROOT_DIR_WATCH_HINTS.some((h) => h.endsWith('/src/**')));
626641
t('no hint collapses to the bare scan root', !ROOT_DIR_WATCH_HINTS.some((h) => h.replace(/\/\*+$/, '') === SCAN_ROOT));
627642

628643
// ── the exports resolver ──────────────────────────────────────────────────

‎scripts/pm/bare-root-worklist.mjs‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,22 @@ const TRIAGE = new Map([
324324
+ 'can drift from the scan is worse than none. The row stays in the sweep: the bare root is '
325325
+ 'still not covered',
326326
}],
327+
['check:dual-build-cjs-loads SCAN_ROOT packages', {
328+
verdict: 'DECLARED-NARROWER',
329+
why: 'the gate walks every publishable manifest under the root to find published `require` '
330+
+ 'conditions, then reads only the dist/ those manifests point at — so the two literals it '
331+
+ 'declares beside SCAN_ROOT under the ROOT_DIR_WATCH_HINTS idiom are the files whose '
332+
+ 'CONTENT its verdict is a function of: packages/**/package.json at 74 tracked files '
333+
+ '(1.0%) and packages/**/tsup.config.ts at 20 (0.3%), against 4903 under the bare root. '
334+
+ 'A THIRD spelling was measured and REFUSED: #12971 arrived through a single source line, '
335+
+ 'so packages/**/src/** has the best recall of the three, but it reaches 4482 files — '
336+
+ '62.2% of the tracked tree, wider than the 39% rows refused below on exactly this trade — '
337+
+ 'and the gate does not READ those files at all, which makes declaring them the costlier '
338+
+ 'error this map names. The recall is not lost: the gate is a step in Build Core, a '
339+
+ 'required context on every PR, so the omission costs one CI round trip rather than a '
340+
+ 'missed defect. The row STAYS in the sweep because the bare root is still not covered — '
341+
+ 'no arbitrary file at the top of packages/ is reached — which is what this verdict says',
342+
}],
327343
// ── Refused: the population is the whole root, and the root is saturated ──
328344
['check:authz-resolver SCAN_ROOTS packages', {
329345
verdict: 'REFUSE-WIDE',

0 commit comments

Comments
 (0)