Skip to content

Commit 3d79e33

Browse files
claude[bot]os-steveclaude
authored
docs(objectql): drop the unverified "268KB" from the ./core boundary claim (#9803) (#9909)
The `@objectstack/objectql/core` entry comment sold the ADR-0076 D2 boundary with a hard byte figure ("the 268KB metadata protocol"). It is not merely stale - it never had a stated unit, and no refresh can supply one. Provenance, re-derivable with `git cat-file -s <rev>:<path>`: 268,886 B packages/objectql/src/protocol.ts @ d9fe95f 268,921 B packages/metadata-protocol/src/protocol.ts @ 13dbcf2 (#2415) 1,054,749 B packages/metadata-protocol/src/protocol.ts @ HEAD The figure was raw source bytes of ONE file - what ADR-0076's premise paragraph counted on 2026-06-28 (268,886 B = 268.9 decimal KB). It was then re-pointed at a whole package ("the 268KB metadata-management layer"), a unit it never had. There is also no single right number to write instead. Measured today: 169,718 B dist/index.js, gzipped (LESS than the quoted figure) 591,087 B dist/index.js, raw 1,054,749 B src/protocol.ts (the quoted figure's own unit) 1,513,973 B src/**/*.ts, excluding tests 3,637,237 B src/**/*.ts A 21x spread straddling "268KB" in both directions, before an embedder's own bundler and tree-shaking are considered. So the figure goes rather than getting refreshed: exclusion is the load-bearing claim and the D2 ratchet already pins it. Removed from core.ts and both embed-objectql sites; the provenance above is recorded, commit-pinned, in the ratchet test header. Adds a second assertion to that existing ratchet test so core.ts cannot quote a byte figure for the excluded weight again. It is a content assertion on one file, not a size ratchet: no threshold, and it can only fire on a KB/MB figure written into core.ts. Replayed over all 14 states of core.ts since the file was created: red at 13 (every one of them this same line), green only at this fix. docs/adr/0076-objectql-core-tiering.md keeps its three uses: governed surface, and historically accurate there - it describes protocol.ts the file. Claude-Session: https://claude.ai/code/session_01XqDQYVU5smx29ts9pAErja Co-authored-by: os-steve <steve@objectstack.ai> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
1 parent 7507620 commit 3d79e33

4 files changed

Lines changed: 70 additions & 6 deletions

File tree

‎examples/embed-objectql/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { ObjectQL } from '@objectstack/objectql/core';
1515

1616
`@objectstack/objectql/core` exposes the engine, registry, hooks, and validation
1717
only. It does **not** pull in `ObjectQLPlugin`, the kernel factory, or
18-
`@objectstack/metadata-protocol` (the 268KB metadata-management layer), so none
18+
`@objectstack/metadata-protocol` (the metadata-management layer), so none
1919
of that lands in your bundle. (The batteries-included `@objectstack/objectql`
2020
entry still re-exports everything for full hosts.)
2121

‎examples/embed-objectql/src/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//
55
// This imports from `@objectstack/objectql/core` — the LEAN entry. It pulls the
66
// data engine (query/CRUD/hooks/validation) only: NO kernel, NO ObjectQLPlugin,
7-
// and NOT `@objectstack/metadata-protocol` (the 268KB metadata-management layer).
7+
// and NOT `@objectstack/metadata-protocol` (the metadata-management layer).
88
// Ideal for a thin, latency-sensitive host (e.g. a gateway) that wants the
99
// engine and the *same* object definitions as the full platform, without the
1010
// platform itself.

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

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,47 @@
44
// (src/core.ts) and its entire local import closure must NOT depend on the kernel
55
// plugin, the kernel factory, or the metadata-management protocol — so a thin
66
// 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+
// ---------------------------------------------------------------------------
848
//
949
// If this test fails, you added a forbidden import somewhere reachable from
1050
// core.ts. Keep metadata/plugin/kernel concerns out of the core closure.
@@ -70,4 +110,27 @@ describe('ADR-0076 D2 — @objectstack/objectql/core boundary', () => {
70110
// sanity: the engine itself IS in the closure
71111
expect([...visited].some((f) => f.endsWith('/engine.ts'))).toBe(true);
72112
});
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+
});
73136
});

‎packages/objectql/src/core.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
// registry, hooks, validation, in-memory aggregation, utilities — WITHOUT the
55
// kernel plugin (`ObjectQLPlugin`), the kernel factory, or any metadata
66
// management (`@objectstack/metadata-protocol`). Embedders that want only the
7-
// engine (e.g. a thin gateway) import from `@objectstack/objectql/core` so the
8-
// 268KB metadata protocol is never pulled into their dependency graph.
7+
// engine (e.g. a thin gateway) import from `@objectstack/objectql/core` so
8+
// `@objectstack/metadata-protocol` is never pulled into their dependency graph.
99
//
1010
// A boundary ratchet (ADR-0076 D2) keeps this entry free of protocol/plugin
1111
// imports; do not add `./plugin`, `./kernel-factory`, or `@objectstack/metadata-protocol`
12-
// re-exports here.
12+
// re-exports here. That ratchet — not a byte figure — is what backs the sentence
13+
// above; see core-boundary.ratchet.test.ts for why no size is quoted (#9803).
1314

1415
// Registry
1516
export {

0 commit comments

Comments
 (0)