Skip to content

Commit bbf7614

Browse files
os-muskclaude
andauthored
test(objectql): measure the lean entry's loaded-module closure as a package set (#16939)
The ADR-0076 D2 boundary is guarded today by a source scan over two hard-coded names in packages/objectql/src/core-boundary.ratchet.test.ts. That shape is neither transitive nor able to see a heavyweight arriving through any other specifier, which is how #14680 arrived — three packages deep, invisible to every gate for the whole time it was live. scripts/check-lean-entry-closure.mjs loads the BUILT lean entry in a fresh child per published condition, collects the evaluated module set through module.registerHooks unioned with require.cache, attributes each module to its owning package, and asserts: DENIED no module belongs to a package ADR-0076 D2 excludes ADMITTED the measured package set equals ADMITTED_PACKAGES exactly — so an arrival nobody predicted fails BY NAME, which is the one thing a forbidden list cannot do AGREE the two published conditions carry the same package set No size figure anywhere: the #9803 discipline the neighbouring file established is inherited, and re-measured on this subject — the package set is identical across the import and require conditions while the module count and byte total are not. With no dist/ it exits 3 PREREQUISITE NOT MET, never a skip and never a pass; it runs in ci.yml's build-core, which builds first. Claude-Session: https://claude.ai/code/session_01ADLdAs2pVcH17h9tZKWMBg Co-authored-by: Claude <noreply@anthropic.com>
1 parent ee4a59b commit bbf7614

5 files changed

Lines changed: 877 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,6 +1719,21 @@ jobs:
17191719
- name: No published source map embeds source text
17201720
run: pnpm check:sourcemap-no-sources-content
17211721

1722+
# #15347. The ADR-0076 D2 boundary ratchet beside `core.ts` scans SOURCE
1723+
# TEXT for two hard-coded names, so it is neither transitive nor able to
1724+
# see a heavyweight arriving through any other specifier — which is
1725+
# exactly how #14680 arrived, three packages deep, invisible to every
1726+
# gate for the whole time it was live. This one loads the built lean
1727+
# entry in a fresh child per published condition and asserts the PACKAGE
1728+
# SET it evaluates: an exclusion claim, decidable and unit-carrying, with
1729+
# no size figure anywhere (#9803). Lives here for the same reason the two
1730+
# steps above do — it reads a real `dist/`, and with none it exits 3
1731+
# (PREREQUISITE NOT MET), never a silent green. Its header is the
1732+
# authority on detail, including why it is not a case in the vitest file
1733+
# it guards beside.
1734+
- name: The lean engine entry loads no forbidden or unlisted package
1735+
run: pnpm check:lean-entry-closure
1736+
17221737
- name: Analyze bundle size
17231738
run: pnpm --filter @objectstack/spec analyze
17241739

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@
156156
"check:published-readme-exports": "node scripts/check-published-readme-exports.mjs --self-test && node scripts/check-published-readme-exports.mjs",
157157
"check:published-readme-links": "node scripts/check-published-readme-links.mjs --self-test && node scripts/check-published-readme-links.mjs",
158158
"check:dual-build-cjs-loads": "node scripts/check-dual-build-cjs-loads.mjs --self-test && node scripts/check-dual-build-cjs-loads.mjs",
159+
"check:lean-entry-closure": "node scripts/check-lean-entry-closure.mjs --self-test && node scripts/check-lean-entry-closure.mjs",
159160
"check:dts-closure": "node scripts/check-dts-closure.mjs --self-test && node scripts/check-dts-closure.mjs",
160161
"check:sourcemap-no-sources-content": "node scripts/check-sourcemap-no-sources-content.mjs --self-test && node scripts/check-sourcemap-no-sources-content.mjs",
161162
"check:type-check-coverage": "node scripts/check-type-check-coverage.mjs --self-test && node scripts/check-type-check-coverage.mjs",

packages/objectql/src/core-boundary.ratchet.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,25 @@
4646
// pins it. The second test keeps a figure from growing back into core.ts.
4747
// ---------------------------------------------------------------------------
4848
//
49+
// What this file does NOT see, and what does (#15347)
50+
//
51+
// This is a SOURCE SCAN over two hard-coded names. Both limits are by
52+
// construction, and #14680 is what they cost: a heavyweight arriving through
53+
// any other specifier is outside FORBIDDEN_PACKAGES, and a scan of this
54+
// package's own sources cannot follow one that arrives three packages deep —
55+
// which is how that one arrived, invisible to every gate for the whole time it
56+
// was live.
57+
//
58+
// The transitive half now lives in `scripts/check-lean-entry-closure.mjs`. It
59+
// loads the BUILT lean entry in a fresh child per published condition and
60+
// asserts the package set the entry actually evaluates — an exclusion claim, in
61+
// the same discipline as this file's: a set of package names, never a size.
62+
//
63+
// ⛔ It does not replace this test and this test is not folded into it. That one
64+
// needs a built `dist/` and runs in ci.yml's `build-core`; this one deliberately
65+
// needs NOTHING — no build, no install, no child process — so it still answers
66+
// on a tree where the other cannot run at all. Two instruments, one boundary.
67+
//
4968
// If this test fails, you added a forbidden import somewhere reachable from
5069
// core.ts. Keep metadata/plugin/kernel concerns out of the core closure.
5170

0 commit comments

Comments
 (0)