Skip to content

Commit 30cae64

Browse files
committed
fix(scripts): pin the battery registry's own size, not just each battery's count
Deleting an entry from SELF_TEST_BATTERIES silences that battery's floor exactly as effectively as zeroing its count, so the registry size is pinned too — the same shrink-only shape, with the same MAINTAINER-ONLY refusal beside it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pk26oZ12t5N1hwGW1m1MgC
1 parent 68d0e4b commit 30cae64

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

scripts/check-doc-authoring.mjs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,6 +1507,12 @@ const SELF_TEST_BATTERIES = Object.freeze({
15071507
'cross-package ledger arithmetic': 7,
15081508
});
15091509

1510+
// The registry is shrink-only in the same sense its counts are: DELETING an
1511+
// entry silences that battery's floor exactly as effectively as zeroing it, so
1512+
// the registry's own size is pinned too. Adding a battery raises this number;
1513+
// removing one is the same ⛔ MAINTAINER-ONLY edit as lowering a count.
1514+
const SELF_TEST_BATTERY_FLOOR = 16;
1515+
15101516
// The key an assertion is filed under when no battery is open. It is not a
15111517
// declared battery, so it reds by the same set difference rather than silently
15121518
// inflating whichever battery happened to run last.
@@ -1892,6 +1898,13 @@ function selfTest() {
18921898
const declaredBatteries = Object.keys(SELF_TEST_BATTERIES);
18931899
const totalCases = [...seen.values()].reduce((a, b) => a + b, 0);
18941900
let floorBreached = false;
1901+
if (declaredBatteries.length < SELF_TEST_BATTERY_FLOOR) {
1902+
floorBreached = true;
1903+
failures.push(
1904+
` ✗ SELF_TEST_BATTERIES declares ${declaredBatteries.length} batteries, below the pinned `
1905+
+ `${SELF_TEST_BATTERY_FLOOR} — a battery deleted from the registry takes its own floor with it.`,
1906+
);
1907+
}
18951908
for (const [name, count] of seen) {
18961909
if (declaredBatteries.includes(name)) continue;
18971910
floorBreached = true;

0 commit comments

Comments
 (0)