Skip to content

Commit 28faa51

Browse files
committed
test(pm): a #19036 sweep pin that fails under the ablation fails by NAME, never by a TypeError
Under the landing PR's ablation (the comparison inverted in `sizeVerdict`) the oversized fixture classifies to nothing; two pins dereferenced it and aborted the whole self-test with a TypeError, hiding every other failure. Guard the null so a red case is a named one — measured: 30 named failures, no crash. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W5y9kRg1YtYaMQYExVLRc2
1 parent 3c7f5ec commit 28faa51

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

‎scripts/pm/check-governed-merges.mjs‎

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5842,11 +5842,18 @@ async function selfTest() {
58425842
govLegacy !== null && govLegacy.surfaces[0].id === 'agents-md' && govLegacy.size.measured === false && govLegacy.humanMerge === true);
58435843
const govBig = classifyCommit(commitAt('7'.repeat(40), 'docs: b (#7)'), ['AGENTS.md', 'packages/x.ts'], GOVERNED_REPOS[0], { additions: LINE + 5, deletions: 0 });
58445844
assert('a-governed-AND-oversized-landing-is-ONE-entry-carrying-both-limbs', govBig.surfaces.length === 1 && govBig.size.exceeds === true);
5845+
// ⚠️ Every pin below that reads a classified entry guards the null first: under
5846+
// the landing PR's ablation (the comparison inverted in `sizeVerdict`) the
5847+
// oversized fixture classifies to NOTHING, and a pin that dereferenced it
5848+
// would abort the whole run with a TypeError — a self-test that crashes hides
5849+
// every other failure it had already collected. A red case must be a NAMED one.
58455850
assert('⭐ classifyCommit-IS-the-landed-predicate-landsByHumanMerge-on-testVerdict-never-a-restated-comparison',
5846-
[bigPlain, govSmall, govLegacy, govBig].every((e) => landsByHumanMerge(testVerdict(e.surfaces.flatMap((s) => s.files), { size: e.size.measured ? e.size : null })) === true));
5851+
[bigPlain, govSmall, govLegacy, govBig].every((e) => e !== null && landsByHumanMerge(testVerdict(e.surfaces.flatMap((s) => s.files), { size: e.size.measured ? e.size : null })) === true));
58475852
// The report an operator reads.
5848-
const bigEntry = { ...bigPlain, attribution: { mergedBy: 'os-elon-musk', mergedAt: '2026-09-18T09:00:00Z', title: 'x', size: { additions: 238310, deletions: 119 } }, attributionChannel: 'rest' };
5849-
const bigReport = renderReport({ window: dateWindowFor('2026-09-18T00:00:00Z'), repos: allAudited, scanned: 3, entries: [bigEntry], lookups: 1 });
5853+
const bigEntry = bigPlain === null
5854+
? null
5855+
: { ...bigPlain, attribution: { mergedBy: 'os-elon-musk', mergedAt: '2026-09-18T09:00:00Z', title: 'x', size: { additions: 238310, deletions: 119 } }, attributionChannel: 'rest' };
5856+
const bigReport = bigEntry === null ? '' : renderReport({ window: dateWindowFor('2026-09-18T00:00:00Z'), repos: allAudited, scanned: 3, entries: [bigEntry], lookups: 1 });
58505857
assert('⭐ the-head-counts-the-oversized-landing-APART-from-the-governed-merges',
58515858
bigReport.includes('governed-merges sweep: 0 governed merge(s) and 1 oversized landing(s) with no governed path since'), bigReport);
58525859
assert('and-the-row-names-the-PR-the-number-the-threshold-the-limb-and-the-HUMAN-MERGE-it-was-due',
@@ -5856,10 +5863,12 @@ async function selfTest() {
58565863
bigReport);
58575864
assert('and-still-carries-the-attribution-column-the-audit-asks-of-every-row', bigReport.includes('merged_by os-elon-musk'), bigReport);
58585865
assert('and-a-GitHub-pair-EQUAL-to-the-landed-number-prints-nothing-extra', !bigReport.includes('GitHub reports'), bigReport);
5859-
const skewed = renderReport({
5860-
window: dateWindowFor('2026-09-18T00:00:00Z'), repos: allAudited, scanned: 3, lookups: 1,
5861-
entries: [{ ...bigEntry, attribution: { ...bigEntry.attribution, size: { additions: 238000, deletions: 119 } } }],
5862-
});
5866+
const skewed = bigEntry === null
5867+
? ''
5868+
: renderReport({
5869+
window: dateWindowFor('2026-09-18T00:00:00Z'), repos: allAudited, scanned: 3, lookups: 1,
5870+
entries: [{ ...bigEntry, attribution: { ...bigEntry.attribution, size: { additions: 238000, deletions: 119 } } }],
5871+
});
58635872
assert('a-GitHub-pair-that-DIFFERS-from-the-landed-number-is-printed-beside-it-and-decides-nothing', skewed.includes('GitHub reports +238000 / -119') && skewed.includes('⛔ SIZE: 238429'), skewed);
58645873
const smallReport = renderReport({ window: dateWindowFor('2026-09-18T00:00:00Z'), repos: allAudited, scanned: 3, entries: [govSmall], lookups: 0 });
58655874
assert('a-governed-row-under-the-line-keeps-its-head-byte-for-byte-and-prints-its-size-as-a-plain-reading',

0 commit comments

Comments
 (0)