From f9812ff974e983a6f75bbacdf55a62472bfb5d2b Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 12 Nov 2026 04:26:18 +0000 Subject: [PATCH] ci(prism-code): sum the package cap from one allowance file per change PACKAGE_LIMIT was one comment line that every change growing the package edited, so parallel v0.5 PRs would all conflict on it. The cap is now the sum of scripts/package-allowances/*.json, each holding a kib and a reason. The 19 allowances on the old line move over unchanged (1584 KiB in total, the same 1622016 bytes), and the package test reads the limit instead of repeating the number. Part of #441 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013Asa3QVSkS6PGopegNeztG --- sdk/npm/prism-code/scripts/check-package.mjs | 16 ++++++++++++++-- .../attest-unsigned-statement.json | 4 ++++ .../scripts/package-allowances/base.json | 4 ++++ .../package-allowances/build-remote-github.json | 4 ++++ .../package-allowances/closure-v2-studio.json | 4 ++++ .../package-allowances/first-run-fixes.json | 4 ++++ .../first-run-without-docker.json | 4 ++++ .../package-allowances/gap-telemetry.json | 4 ++++ .../package-allowances/generate-python.json | 4 ++++ .../package-allowances/generate-rust.json | 4 ++++ .../scripts/package-allowances/hosted-tiers.json | 4 ++++ .../package-allowances/journey-hosted-proof.json | 4 ++++ .../load-refuses-altered-holo.json | 4 ++++ .../scripts/package-allowances/mcp-journey.json | 4 ++++ .../scripts/package-allowances/nine-modules.json | 4 ++++ .../package-allowances/setup-machine-tiers.json | 4 ++++ .../package-allowances/setup-open-skill.json | 4 ++++ .../package-allowances/spec-from-sentence.json | 4 ++++ .../package-allowances/template-instances.json | 4 ++++ .../verifier-wire-refusals.json | 4 ++++ sdk/npm/prism-code/test/package.test.mjs | 4 ++-- 21 files changed, 92 insertions(+), 4 deletions(-) create mode 100644 sdk/npm/prism-code/scripts/package-allowances/attest-unsigned-statement.json create mode 100644 sdk/npm/prism-code/scripts/package-allowances/base.json create mode 100644 sdk/npm/prism-code/scripts/package-allowances/build-remote-github.json create mode 100644 sdk/npm/prism-code/scripts/package-allowances/closure-v2-studio.json create mode 100644 sdk/npm/prism-code/scripts/package-allowances/first-run-fixes.json create mode 100644 sdk/npm/prism-code/scripts/package-allowances/first-run-without-docker.json create mode 100644 sdk/npm/prism-code/scripts/package-allowances/gap-telemetry.json create mode 100644 sdk/npm/prism-code/scripts/package-allowances/generate-python.json create mode 100644 sdk/npm/prism-code/scripts/package-allowances/generate-rust.json create mode 100644 sdk/npm/prism-code/scripts/package-allowances/hosted-tiers.json create mode 100644 sdk/npm/prism-code/scripts/package-allowances/journey-hosted-proof.json create mode 100644 sdk/npm/prism-code/scripts/package-allowances/load-refuses-altered-holo.json create mode 100644 sdk/npm/prism-code/scripts/package-allowances/mcp-journey.json create mode 100644 sdk/npm/prism-code/scripts/package-allowances/nine-modules.json create mode 100644 sdk/npm/prism-code/scripts/package-allowances/setup-machine-tiers.json create mode 100644 sdk/npm/prism-code/scripts/package-allowances/setup-open-skill.json create mode 100644 sdk/npm/prism-code/scripts/package-allowances/spec-from-sentence.json create mode 100644 sdk/npm/prism-code/scripts/package-allowances/template-instances.json create mode 100644 sdk/npm/prism-code/scripts/package-allowances/verifier-wire-refusals.json diff --git a/sdk/npm/prism-code/scripts/check-package.mjs b/sdk/npm/prism-code/scripts/check-package.mjs index 7cf6a20ed..67bdd7edf 100644 --- a/sdk/npm/prism-code/scripts/check-package.mjs +++ b/sdk/npm/prism-code/scripts/check-package.mjs @@ -1,10 +1,22 @@ // Validate npm's pack manifest against the reviewed distribution inventory. // Run after npm pack --dry-run --json > pack.json, as npm-prism-code.yml does. import assert from 'node:assert/strict'; -import { readFileSync } from 'node:fs'; +import { readdirSync, readFileSync } from 'node:fs'; import { pathToFileURL } from 'node:url'; -export const PACKAGE_LIMIT = 1622016; // 1584 KiB: 1088 KiB plus 72 KiB for setup, open and the bundled prism skill (about 63 KiB), plus 48 KiB for the machine half of setup, the build tiers, axioms and init's next steps (about 44 KiB), plus 112 KiB for prism-code mcp, the guided journey (about 110 KiB), plus 4 KiB for closure v2 provenance verification and the Hologram studio stylesheet (about 2.7 KiB), plus 24 KiB for the hosted tiers: hosted.mjs, the routing of build --check and verify --lean, and their docs (about 24.6 KiB), plus 4 KiB for the journey's hosted proof (about 6.7 KiB, with the 0.9 KiB left before it), plus 40 KiB for build --remote github: the GitHub client, the artifact reader and the checks of what comes back, with its docs and skill section (about 37.8 KiB), plus 4 KiB for the first-run fixes: the lockfile found above app/, per-verb --help, located hosted diagnostics and their docs (about 5.0 KiB, with the 2.2 KiB left before them), plus 20 KiB for the first run without Docker: setup's next steps and --local, the journey choosing GitHub Actions, the approved repository and the pinned template files (about 16.5 KiB), plus 28 KiB for template instances: the files that make a journey app an instance of UOR-Foundation/template, the canonical LexLean layout, the repository made from the template and the live check (about 24 KiB), plus 12 KiB for specs drafted from one sentence: the input schema of prism_spec, reasons, meanings and limits, and SPEC.md in the OpenSpec format (about 14 KiB, with the 4 KiB left before it), plus 20 KiB for gap telemetry: gaps.mjs, the rule each refusal names, the round-trip check, delivery in a hosted call's _meta, and their docs (about 16.5 KiB), plus 4 KiB for the verifier refusing what the Wire codec refuses (about 2.4 KiB), plus 4 KiB for refusing an altered holo in load (#583, about 2 KiB), plus 56 KiB for the nine modules on one client: prism.images (#442, about 26 KiB), prism.system with its event bus (#446, about 12 KiB), and the client of #441 with containers.list and prune (about 12 KiB), plus 20 KiB for generate --lang rust: the Rust writer (about 19.2 KiB), plus 20 KiB for generate --lang python: the Python writer and its docs (about 18.5 KiB), plus 4 KiB for attest --unsigned and --statement, which sign what prismpm wrote (about 4 KiB). This is the one place the cap is written. +// The cap is the sum of the reviewed allowances in scripts/package-allowances/, one file per +// change that grew the package: { "kib": n, "reason": "what the bytes are for (about x KiB)" }. +// A change that needs room adds its own file, so parallel changes never edit the same line. +const ALLOWANCES = new URL('./package-allowances/', import.meta.url); +export const PACKAGE_ALLOWANCES = readdirSync(ALLOWANCES).filter((name) => name.endsWith('.json')).sort() + .map((name) => { + const allowance = JSON.parse(readFileSync(new URL(name, ALLOWANCES), 'utf8')); + assert.deepEqual(Object.keys(allowance).sort(), ['kib', 'reason'], `${name} holds exactly kib and reason`); + assert.ok(Number.isInteger(allowance.kib) && allowance.kib > 0, `${name} grants a whole, positive number of KiB`); + assert.ok(typeof allowance.reason === 'string' && allowance.reason.trim() !== '', `${name} says what the bytes are for`); + return { name, ...allowance }; + }); +export const PACKAGE_LIMIT = PACKAGE_ALLOWANCES.reduce((sum, { kib }) => sum + kib, 0) * 1024; export const PACKAGE_FILES = JSON.parse(readFileSync(new URL('../test/fixtures/package-files.json', import.meta.url), 'utf8')); export function checkPackage(pack) { diff --git a/sdk/npm/prism-code/scripts/package-allowances/attest-unsigned-statement.json b/sdk/npm/prism-code/scripts/package-allowances/attest-unsigned-statement.json new file mode 100644 index 000000000..2ec9dd711 --- /dev/null +++ b/sdk/npm/prism-code/scripts/package-allowances/attest-unsigned-statement.json @@ -0,0 +1,4 @@ +{ + "kib": 4, + "reason": "Attest --unsigned and --statement, which sign what prismpm wrote (about 4 KiB)." +} diff --git a/sdk/npm/prism-code/scripts/package-allowances/base.json b/sdk/npm/prism-code/scripts/package-allowances/base.json new file mode 100644 index 000000000..257eee47f --- /dev/null +++ b/sdk/npm/prism-code/scripts/package-allowances/base.json @@ -0,0 +1,4 @@ +{ + "kib": 1088, + "reason": "The package before allowances were recorded one by one." +} diff --git a/sdk/npm/prism-code/scripts/package-allowances/build-remote-github.json b/sdk/npm/prism-code/scripts/package-allowances/build-remote-github.json new file mode 100644 index 000000000..926d0a3d5 --- /dev/null +++ b/sdk/npm/prism-code/scripts/package-allowances/build-remote-github.json @@ -0,0 +1,4 @@ +{ + "kib": 40, + "reason": "Build --remote github: the GitHub client, the artifact reader and the checks of what comes back, with its docs and skill section (about 37.8 KiB)." +} diff --git a/sdk/npm/prism-code/scripts/package-allowances/closure-v2-studio.json b/sdk/npm/prism-code/scripts/package-allowances/closure-v2-studio.json new file mode 100644 index 000000000..98b4492b7 --- /dev/null +++ b/sdk/npm/prism-code/scripts/package-allowances/closure-v2-studio.json @@ -0,0 +1,4 @@ +{ + "kib": 4, + "reason": "Closure v2 provenance verification and the Hologram studio stylesheet (about 2.7 KiB)." +} diff --git a/sdk/npm/prism-code/scripts/package-allowances/first-run-fixes.json b/sdk/npm/prism-code/scripts/package-allowances/first-run-fixes.json new file mode 100644 index 000000000..af1c34c50 --- /dev/null +++ b/sdk/npm/prism-code/scripts/package-allowances/first-run-fixes.json @@ -0,0 +1,4 @@ +{ + "kib": 4, + "reason": "The first-run fixes: the lockfile found above app/, per-verb --help, located hosted diagnostics and their docs (about 5.0 KiB, with the 2.2 KiB left before them)." +} diff --git a/sdk/npm/prism-code/scripts/package-allowances/first-run-without-docker.json b/sdk/npm/prism-code/scripts/package-allowances/first-run-without-docker.json new file mode 100644 index 000000000..6a4ed92a1 --- /dev/null +++ b/sdk/npm/prism-code/scripts/package-allowances/first-run-without-docker.json @@ -0,0 +1,4 @@ +{ + "kib": 20, + "reason": "The first run without Docker: setup's next steps and --local, the journey choosing GitHub Actions, the approved repository and the pinned template files (about 16.5 KiB)." +} diff --git a/sdk/npm/prism-code/scripts/package-allowances/gap-telemetry.json b/sdk/npm/prism-code/scripts/package-allowances/gap-telemetry.json new file mode 100644 index 000000000..83c3cbe0f --- /dev/null +++ b/sdk/npm/prism-code/scripts/package-allowances/gap-telemetry.json @@ -0,0 +1,4 @@ +{ + "kib": 20, + "reason": "Gap telemetry: gaps.mjs, the rule each refusal names, the round-trip check, delivery in a hosted call's _meta, and their docs (about 16.5 KiB)." +} diff --git a/sdk/npm/prism-code/scripts/package-allowances/generate-python.json b/sdk/npm/prism-code/scripts/package-allowances/generate-python.json new file mode 100644 index 000000000..07133acaa --- /dev/null +++ b/sdk/npm/prism-code/scripts/package-allowances/generate-python.json @@ -0,0 +1,4 @@ +{ + "kib": 20, + "reason": "Generate --lang python: the Python writer and its docs (about 18.5 KiB)." +} diff --git a/sdk/npm/prism-code/scripts/package-allowances/generate-rust.json b/sdk/npm/prism-code/scripts/package-allowances/generate-rust.json new file mode 100644 index 000000000..7374068c3 --- /dev/null +++ b/sdk/npm/prism-code/scripts/package-allowances/generate-rust.json @@ -0,0 +1,4 @@ +{ + "kib": 20, + "reason": "Generate --lang rust: the Rust writer (about 19.2 KiB)." +} diff --git a/sdk/npm/prism-code/scripts/package-allowances/hosted-tiers.json b/sdk/npm/prism-code/scripts/package-allowances/hosted-tiers.json new file mode 100644 index 000000000..4509a7d06 --- /dev/null +++ b/sdk/npm/prism-code/scripts/package-allowances/hosted-tiers.json @@ -0,0 +1,4 @@ +{ + "kib": 24, + "reason": "The hosted tiers: hosted.mjs, the routing of build --check and verify --lean, and their docs (about 24.6 KiB)." +} diff --git a/sdk/npm/prism-code/scripts/package-allowances/journey-hosted-proof.json b/sdk/npm/prism-code/scripts/package-allowances/journey-hosted-proof.json new file mode 100644 index 000000000..8ec761dfd --- /dev/null +++ b/sdk/npm/prism-code/scripts/package-allowances/journey-hosted-proof.json @@ -0,0 +1,4 @@ +{ + "kib": 4, + "reason": "The journey's hosted proof (about 6.7 KiB, with the 0.9 KiB left before it)." +} diff --git a/sdk/npm/prism-code/scripts/package-allowances/load-refuses-altered-holo.json b/sdk/npm/prism-code/scripts/package-allowances/load-refuses-altered-holo.json new file mode 100644 index 000000000..bc935a15d --- /dev/null +++ b/sdk/npm/prism-code/scripts/package-allowances/load-refuses-altered-holo.json @@ -0,0 +1,4 @@ +{ + "kib": 4, + "reason": "Refusing an altered holo in load (#583, about 2 KiB)." +} diff --git a/sdk/npm/prism-code/scripts/package-allowances/mcp-journey.json b/sdk/npm/prism-code/scripts/package-allowances/mcp-journey.json new file mode 100644 index 000000000..5f82a209a --- /dev/null +++ b/sdk/npm/prism-code/scripts/package-allowances/mcp-journey.json @@ -0,0 +1,4 @@ +{ + "kib": 112, + "reason": "Prism-code mcp, the guided journey (about 110 KiB)." +} diff --git a/sdk/npm/prism-code/scripts/package-allowances/nine-modules.json b/sdk/npm/prism-code/scripts/package-allowances/nine-modules.json new file mode 100644 index 000000000..9f9d55512 --- /dev/null +++ b/sdk/npm/prism-code/scripts/package-allowances/nine-modules.json @@ -0,0 +1,4 @@ +{ + "kib": 56, + "reason": "The nine modules on one client: prism.images (#442, about 26 KiB), prism.system with its event bus (#446, about 12 KiB), and the client of #441 with containers.list and prune (about 12 KiB)." +} diff --git a/sdk/npm/prism-code/scripts/package-allowances/setup-machine-tiers.json b/sdk/npm/prism-code/scripts/package-allowances/setup-machine-tiers.json new file mode 100644 index 000000000..45cc28375 --- /dev/null +++ b/sdk/npm/prism-code/scripts/package-allowances/setup-machine-tiers.json @@ -0,0 +1,4 @@ +{ + "kib": 48, + "reason": "The machine half of setup, the build tiers, axioms and init's next steps (about 44 KiB)." +} diff --git a/sdk/npm/prism-code/scripts/package-allowances/setup-open-skill.json b/sdk/npm/prism-code/scripts/package-allowances/setup-open-skill.json new file mode 100644 index 000000000..8f5969e50 --- /dev/null +++ b/sdk/npm/prism-code/scripts/package-allowances/setup-open-skill.json @@ -0,0 +1,4 @@ +{ + "kib": 72, + "reason": "Setup, open and the bundled prism skill (about 63 KiB)." +} diff --git a/sdk/npm/prism-code/scripts/package-allowances/spec-from-sentence.json b/sdk/npm/prism-code/scripts/package-allowances/spec-from-sentence.json new file mode 100644 index 000000000..b07f033b3 --- /dev/null +++ b/sdk/npm/prism-code/scripts/package-allowances/spec-from-sentence.json @@ -0,0 +1,4 @@ +{ + "kib": 12, + "reason": "Specs drafted from one sentence: the input schema of prism_spec, reasons, meanings and limits, and SPEC.md in the OpenSpec format (about 14 KiB, with the 4 KiB left before it)." +} diff --git a/sdk/npm/prism-code/scripts/package-allowances/template-instances.json b/sdk/npm/prism-code/scripts/package-allowances/template-instances.json new file mode 100644 index 000000000..89e9dfce8 --- /dev/null +++ b/sdk/npm/prism-code/scripts/package-allowances/template-instances.json @@ -0,0 +1,4 @@ +{ + "kib": 28, + "reason": "Template instances: the files that make a journey app an instance of UOR-Foundation/template, the canonical LexLean layout, the repository made from the template and the live check (about 24 KiB)." +} diff --git a/sdk/npm/prism-code/scripts/package-allowances/verifier-wire-refusals.json b/sdk/npm/prism-code/scripts/package-allowances/verifier-wire-refusals.json new file mode 100644 index 000000000..7eb89dfa6 --- /dev/null +++ b/sdk/npm/prism-code/scripts/package-allowances/verifier-wire-refusals.json @@ -0,0 +1,4 @@ +{ + "kib": 4, + "reason": "The verifier refusing what the Wire codec refuses (about 2.4 KiB)." +} diff --git a/sdk/npm/prism-code/test/package.test.mjs b/sdk/npm/prism-code/test/package.test.mjs index 1f5f28bd6..e3911b3ef 100644 --- a/sdk/npm/prism-code/test/package.test.mjs +++ b/sdk/npm/prism-code/test/package.test.mjs @@ -15,7 +15,7 @@ assert.equal(result.status, 0, result.stderr); const [pack] = JSON.parse(result.stdout); const { files } = pack; -test('all required distributed files fit the 1584 KiB package budget', () => { +test('all required distributed files fit the package budget, the sum of the reviewed allowances', () => { checkPackage(pack); }); @@ -25,7 +25,7 @@ test('one byte over budget is refused, and the exact boundary is accepted', () = files: files.map((file, i) => i === 0 ? { ...file, size: file.size + unpackedSize - pack.unpackedSize } : file), }); checkPackage(atSize(PACKAGE_LIMIT)); - assert.throws(() => checkPackage(atSize(PACKAGE_LIMIT + 1)), /cap is 1622016/); + assert.throws(() => checkPackage(atSize(PACKAGE_LIMIT + 1)), new RegExp(`cap is ${PACKAGE_LIMIT}$`)); }); test('a smaller package cannot pass by omitting a required file or changing its inventory', () => {