|
4 | 4 | // (src/core.ts) and its entire local import closure must NOT depend on the kernel |
5 | 5 | // plugin, the kernel factory, or the metadata-management protocol — so a thin |
6 | 6 | // embedder importing `@objectstack/objectql/core` never pulls |
7 | | -// `@objectstack/metadata-protocol` (or its 268KB) into its graph. |
| 7 | +// `@objectstack/metadata-protocol` into its graph. |
| 8 | +// |
| 9 | +// --------------------------------------------------------------------------- |
| 10 | +// Why no byte figure is quoted for what is excluded (#9803) |
| 11 | +// |
| 12 | +// The entry comment used to sell this boundary with a hard number. That number |
| 13 | +// was real once, but it never measured the thing the sentence claimed. Full |
| 14 | +// provenance, each line re-derivable with `git cat-file -s <rev>:<path>` |
| 15 | +// (measured 2026-08-19; the extraction predates the default shallow clone, so |
| 16 | +// `git fetch --deepen=1200` first): |
| 17 | +// |
| 18 | +// 268,886 B packages/objectql/src/protocol.ts @ d9fe95fcf |
| 19 | +// the pre-extraction SOURCE FILE — what ADR-0076's premise |
| 20 | +// paragraph counted. 268,886 B = 268.9 decimal KB, hence "268KB". |
| 21 | +// 268,921 B packages/metadata-protocol/src/protocol.ts @ 13dbcf2d0 |
| 22 | +// the same file as it landed in the new package, 2026-06-28, |
| 23 | +// "extract metadata-protocol + add lean ./core entry (ADR-0076 |
| 24 | +// Step 1)" (#2415). |
| 25 | +// 1,054,749 B packages/metadata-protocol/src/protocol.ts @ HEAD |
| 26 | +// 3.9x the quoted figure — and that is ONE file of a package |
| 27 | +// whose src tree totals ~3.6 MB (`find … -type f | xargs wc -c`). |
| 28 | +// |
| 29 | +// So the figure was raw source bytes of a single file, and was then re-pointed |
| 30 | +// at a whole package ("the 268KB metadata-management layer") — a unit it never |
| 31 | +// had. Re-measuring cannot repair that, because there is no one number to |
| 32 | +// re-measure. "The size of @objectstack/metadata-protocol" on 2026-08-19, after |
| 33 | +// `pnpm --filter @objectstack/metadata-protocol build`, via `wc -c` and |
| 34 | +// `gzip -9 -c | wc -c`: |
| 35 | +// |
| 36 | +// 169,718 B dist/index.js, gzipped (LESS than the quoted figure) |
| 37 | +// 591,087 B dist/index.js, raw |
| 38 | +// 1,054,749 B src/protocol.ts (the quoted figure's own unit) |
| 39 | +// 1,513,973 B src/**/*.ts, excluding tests |
| 40 | +// 3,637,237 B src/**/*.ts |
| 41 | +// |
| 42 | +// A 21x spread that straddles "268KB" in BOTH directions, before an embedder's |
| 43 | +// own bundler and tree-shaking are even considered. The defect is therefore not |
| 44 | +// staleness — it is that the figure never had a stated unit, and no refresh can |
| 45 | +// supply one. The claim worth making is EXCLUSION, and the test below is what |
| 46 | +// pins it. The second test keeps a figure from growing back into core.ts. |
| 47 | +// --------------------------------------------------------------------------- |
8 | 48 | // |
9 | 49 | // If this test fails, you added a forbidden import somewhere reachable from |
10 | 50 | // core.ts. Keep metadata/plugin/kernel concerns out of the core closure. |
@@ -70,4 +110,27 @@ describe('ADR-0076 D2 — @objectstack/objectql/core boundary', () => { |
70 | 110 | // sanity: the engine itself IS in the closure |
71 | 111 | expect([...visited].some((f) => f.endsWith('/engine.ts'))).toBe(true); |
72 | 112 | }); |
| 113 | + |
| 114 | + // #9803. The exclusion claim is pinned by the test above. A byte figure for |
| 115 | + // the excluded weight is pinned by nothing, so core.ts must not state one — |
| 116 | + // that is how "268KB" sat there unverified from 2026-06-28 until #9803. |
| 117 | + // Scope is deliberately this package's entry only: the historical figures in |
| 118 | + // this file's own header are provenance (dated, commit-pinned), not a claim, |
| 119 | + // and are meant to stay. |
| 120 | + it('core.ts quotes no unverifiable byte figure for the excluded weight', () => { |
| 121 | + const src = readFileSync(resolve(SRC, 'core.ts'), 'utf8'); |
| 122 | + const offenders = src |
| 123 | + .split('\n') |
| 124 | + .filter((line) => /^\s*(?:\/\/|\/\*|\*)/.test(line)) |
| 125 | + .filter((line) => /metadata[- ](?:protocol|management)/i.test(line)) |
| 126 | + .filter((line) => /\b\d[\d.,]*\s*(?:[KMG]i?B|kB)\b/.test(line)) |
| 127 | + .map((line) => line.trim()); |
| 128 | + |
| 129 | + expect( |
| 130 | + offenders, |
| 131 | + `core.ts states a byte figure for the excluded metadata protocol:\n${offenders.join( |
| 132 | + '\n', |
| 133 | + )}\nNothing re-measures such a number. State the exclusion, not a size — see this file's header.`, |
| 134 | + ).toEqual([]); |
| 135 | + }); |
73 | 136 | }); |
0 commit comments