Skip to content

Commit 3873098

Browse files
committed
test(floors, ui): one shared floor per ui package population, catalog entry floor in one place, all at about two thirds
The ui published-package count was spelled in about eight places, each floor sitting at or just under today's measured value, so one package retirement edited a floor in every file. The floors now live in ui/scripts/__tests__/helpers/ui-package-population.mjs at about two thirds of the values measured on 6a7c0fe, read by both gate scripts' MIN_PACKAGES and by every test site; the schema-catalog entry floor lives in one helper read by all eight call sites. ui/QUICK_REFERENCE.md drops its hand-written count and its test now refuses one. Claude-Session: https://claude.ai/code/session_01ADHkmTNh6kDC6Lu2Yr7s5v Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6a7c0fe commit 3873098

16 files changed

Lines changed: 215 additions & 97 deletions

‎ui/QUICK_REFERENCE.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pnpm changeset publish # Publish to npm (CI only)
8282

8383
| Path | Purpose |
8484
| --- | --- |
85-
| `packages/*` | 35 published packages (`@object-ui/*`), plus the private `vscode-extension`, `test-support` (test-only, never released), `runner` (workspace demo app, never released) and `app-shell` (the Console's shell and views, no longer published after 18.2.0) |
85+
| `packages/*` | The published `@object-ui/*` packages, plus the private `vscode-extension`, `test-support` (test-only, never released), `runner` (workspace demo app, never released) and `app-shell` (the Console's shell and views, no longer published after 18.2.0) |
8686
| `apps/console` | Full ObjectUI console app (Vite + React) |
8787
| `apps/site` | Public docs site at <https://www.objectui.org> (fumadocs) |
8888
| `examples/*` | Runnable examples and the schema catalog — see [`examples/README.md`](./examples/README.md) |

‎ui/examples/schema-catalog/test/badge-demo-label-6829.test.tsx‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ import { render } from '@testing-library/react';
119119
import '@object-ui/components';
120120
import { SchemaRenderer, toRenderableSchema } from '@object-ui/react';
121121
import { allExamples, getExample } from '../src/index.js';
122+
import { CATALOG_ENTRY_FLOOR } from './catalog-entry-floor.js';
122123

123124
type Json = Record<string, unknown>;
124125

@@ -245,10 +246,12 @@ const containers = entries.flatMap((entry) =>
245246
describe('catalog corpus: every `badge` node draws its authored `label` (objectui#6829 arm A)', () => {
246247
it('the walk is not vacuous — a broken collector would pass every case below', () => {
247248
// Floors, not equalities: catalog growth must not fail this file, only a
248-
// walk that stopped working.
249-
expect(entries.length).toBeGreaterThanOrEqual(431);
250-
expect(badges.length).toBeGreaterThanOrEqual(40);
251-
expect(new Set(badges.map((b) => b.where.split('/')[0])).size).toBeGreaterThanOrEqual(12);
249+
// walk that stopped working. About two thirds of the counts measured on
250+
// objectstack 6a7c0fe3 (40 badges in 12 categories), so deleting an entry
251+
// does not fail it either.
252+
expect(entries.length).toBeGreaterThanOrEqual(CATALOG_ENTRY_FLOOR);
253+
expect(badges.length).toBeGreaterThanOrEqual(27);
254+
expect(new Set(badges.map((b) => b.where.split('/')[0])).size).toBeGreaterThanOrEqual(8);
252255
// …and it sees the seven nodes this card is about, by location.
253256
expect(badges.map((b) => b.where)).toEqual(expect.arrayContaining(REAUTHORED_NODES));
254257
});

‎ui/examples/schema-catalog/test/card-demo-content-6788.test.tsx‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ import '@object-ui/components';
124124
import { SchemaRenderer, toRenderableSchema } from '@object-ui/react';
125125
import { CardSchema } from '@object-ui/types/zod';
126126
import { allExamples } from '../src/index.js';
127+
import { CATALOG_ENTRY_FLOOR } from './catalog-entry-floor.js';
127128

128129
type Json = Record<string, unknown>;
129130

@@ -213,11 +214,13 @@ function unreadKeys(node: Json, allowed: readonly string[]): string[] {
213214

214215
describe('catalog corpus: every `card` node authors keys `ui:card` reads (objectui#6788)', () => {
215216
it('the walk is not vacuous — a broken collector would pass every case below', () => {
216-
// Measured on d06059f24; these are floors, not equalities, so growth of
217-
// the catalog does not fail the file — only a walk that stopped working.
218-
expect(entries.length).toBeGreaterThanOrEqual(431);
219-
expect(cards.length).toBeGreaterThanOrEqual(93);
220-
expect(new Set(cards.map((c) => c.where.split('/')[0])).size).toBeGreaterThanOrEqual(19);
217+
// Floors, not equalities, so growth of the catalog does not fail the file —
218+
// only a walk that stopped working. About two thirds of the counts measured
219+
// on objectstack 6a7c0fe3 (93 cards in 19 categories), so deleting an entry
220+
// does not fail it either.
221+
expect(entries.length).toBeGreaterThanOrEqual(CATALOG_ENTRY_FLOOR);
222+
expect(cards.length).toBeGreaterThanOrEqual(62);
223+
expect(new Set(cards.map((c) => c.where.split('/')[0])).size).toBeGreaterThanOrEqual(13);
221224
});
222225

223226
it('every authored key is DECLARED by the shipped CardSchema', () => {

‎ui/examples/schema-catalog/test/catalog-authored-key-6805-6806.test.tsx‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ import { render } from '@testing-library/react';
117117
import '@object-ui/components';
118118
import { SchemaRenderer, toRenderableSchema } from '@object-ui/react';
119119
import { allExamples } from '../src/index.js';
120+
import { CATALOG_ENTRY_FLOOR } from './catalog-entry-floor.js';
120121

121122
type Json = Record<string, unknown>;
122123

@@ -150,7 +151,8 @@ const RENDERERS = [
150151
readKeys: ['type', 'orientation', 'height', 'width', 'className', 'children'],
151152
contentKey: 'children',
152153
issue: 'objectui#6805',
153-
minNodes: 7,
154+
// About two thirds of the 7 measured on objectstack 6a7c0fe3.
155+
minNodes: 5,
154156
},
155157
{
156158
type: 'badge',
@@ -161,7 +163,8 @@ const RENDERERS = [
161163
readKeys: ['type', 'label', 'variant', 'className', 'body'],
162164
contentKey: 'label',
163165
issue: 'objectui#6806',
164-
minNodes: 40,
166+
// About two thirds of the 40 measured on objectstack 6a7c0fe3.
167+
minNodes: 27,
165168
},
166169
] as const;
167170

@@ -256,8 +259,9 @@ const nodesOf = (type: string): Located[] =>
256259
describe('catalog corpus: every node authors keys ITS renderer reads (objectui#6805 + objectui#6806)', () => {
257260
it('the walk is not vacuous — a broken collector would pass every case below', () => {
258261
// Floors, not equalities: catalog growth must not fail this file, only a
259-
// walk that stopped working.
260-
expect(entries.length).toBeGreaterThanOrEqual(431);
262+
// walk that stopped working — and at about two thirds of the measured
263+
// counts, so deleting an entry does not fail it either.
264+
expect(entries.length).toBeGreaterThanOrEqual(CATALOG_ENTRY_FLOOR);
261265
for (const renderer of RENDERERS) {
262266
expect(nodesOf(renderer.type).length).toBeGreaterThanOrEqual(renderer.minNodes);
263267
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* The ONE anti-vacuity floor for the size of the catalog (`allExamples()`), read
3+
* by every test here that guards its own sweep against an empty corpus.
4+
*
5+
* A floor, not a census: it answers "did the collector find a corpus at all?",
6+
* so catalog growth never moves it and neither does deleting an entry. It sits
7+
* at about two thirds of the 432 entries measured on objectstack `origin/main`
8+
* `6a7c0fe3` (the `vite-dts-wiring-ratchet` precedent: measured 22, floor 15).
9+
* Before it existed the same population was pinned at three different values
10+
* across eight call sites, the tightest one entry under the measured count.
11+
*
12+
* Re-measure only when the corpus has shrunk to near it, and then move it to
13+
* about two thirds of the new reading. ⛔ Never raise it to track growth.
14+
*/
15+
export const CATALOG_ENTRY_FLOOR = 288;

‎ui/examples/schema-catalog/test/catalog-gallery-render.test.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ import { SchemaRenderer, SchemaRendererContext, toRenderableSchema } from '@obje
149149
import fs from 'node:fs';
150150
import path from 'node:path';
151151
import { allExamples } from '../src/index.js';
152+
import { CATALOG_ENTRY_FLOOR } from './catalog-entry-floor.js';
152153

153154
/**
154155
* The repo root, derived from THIS FILE's own location — never from
@@ -646,7 +647,7 @@ describe('objectui#4616 — every catalog entry renders in the docs gallery', ()
646647
* size and the registration set the sweep depends on.
647648
*/
648649
it('the corpus is populated and every package the census needs is loaded', () => {
649-
expect(entries.length).toBeGreaterThanOrEqual(423);
650+
expect(entries.length).toBeGreaterThanOrEqual(CATALOG_ENTRY_FLOOR);
650651
// One type per package below, chosen as the one the census actually needed.
651652
for (const type of [
652653
'dashboard',
@@ -1345,7 +1346,9 @@ describe('objectui#6025 — the gallery DECLARES the packages its entries need',
13451346
expect(
13461347
PLUGIN_CATEGORIES.length,
13471348
'no plugin categories were derived, so this case would be vacuous',
1348-
).toBeGreaterThanOrEqual(13);
1349+
// About two thirds of the 13 measured on objectstack 6a7c0fe3: retiring a
1350+
// plugin package (and its category) must not red an anti-vacuity floor.
1351+
).toBeGreaterThanOrEqual(9);
13491352

13501353
const undeclared = PLUGIN_CATEGORIES.map((category) => `@object-ui/${category}`).filter(
13511354
(pkg) => !HOST_PACKAGES.includes(pkg),

‎ui/examples/schema-catalog/test/component-fixture-declared-keys.test.ts‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ import {
8787
} from '@object-ui/types/zod';
8888
import { enumOptions } from '@object-ui/test-support';
8989
import { allExamples, getExample } from '../src/index.js';
90+
import { CATALOG_ENTRY_FLOOR } from './catalog-entry-floor.js';
9091

9192
type Json = Record<string, unknown>;
9293

@@ -280,7 +281,7 @@ describe('catalog corpus: no fixture hangs an action object off a handler key (o
280281
expect(handlers.map((h) => h.where)).toContain(
281282
'components-feedback-toaster/with-toast-trigger.children[0].onClick',
282283
);
283-
expect(entries.length).toBeGreaterThan(400);
284+
expect(entries.length).toBeGreaterThanOrEqual(CATALOG_ENTRY_FLOOR);
284285
});
285286

286287
it('every handler value in the corpus is a string expression, never an action object', () => {
@@ -565,7 +566,7 @@ describe('catalog corpus: every menubar item uses the declared MenuItem spelling
565566
]),
566567
);
567568
expect(items).toHaveLength(13);
568-
expect(allExamples().length).toBeGreaterThan(400);
569+
expect(allExamples().length).toBeGreaterThanOrEqual(CATALOG_ENTRY_FLOOR);
569570
});
570571

571572
it('the walker descends into submenu `children` — synthetic positive control', () => {
@@ -773,7 +774,7 @@ describe('catalog corpus: no overlay-menu item authors the undeclared `value` ke
773774
// below. 25 items = menubar 13 + basic-context-menu 5 + basic-dropdown-menu
774775
// 4 + with-icons 3.
775776
expect(items).toHaveLength(25);
776-
expect(allExamples().length).toBeGreaterThan(400);
777+
expect(allExamples().length).toBeGreaterThanOrEqual(CATALOG_ENTRY_FLOOR);
777778

778779
// One representative position per container shape, including the deeper
779780
// `menus[].items[]` nesting only `menubar` has.
@@ -935,11 +936,12 @@ describe('catalog corpus: no `select` option authors the undeclared `type` key (
935936

936937
it('the sweep reaches every select option in the corpus — non-vacuity', () => {
937938
// Floors, not equalities: catalog growth must not fail this file, only a
938-
// walker that stopped working. 66 options on 19 select nodes across 7
939-
// categories at `b6e83be6a`.
940-
expect(options.length).toBeGreaterThanOrEqual(66);
941-
expect(new Set(options.map((o) => o.where.split('/')[0])).size).toBeGreaterThanOrEqual(7);
942-
expect(allExamples().length).toBeGreaterThan(400);
939+
// walker that stopped working. About two thirds of the 66 options across 7
940+
// categories measured on objectstack 6a7c0fe3, so deleting an entry does
941+
// not fail it either.
942+
expect(options.length).toBeGreaterThanOrEqual(44);
943+
expect(new Set(options.map((o) => o.where.split('/')[0])).size).toBeGreaterThanOrEqual(5);
944+
expect(allExamples().length).toBeGreaterThanOrEqual(CATALOG_ENTRY_FLOOR);
943945

944946
// One representative position per authoring shape, including the two
945947
// nesting depths a shallow walker would silently miss: a select inside a

‎ui/scripts/__tests__/check-dist-completeness.test.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { describe, expect, it } from 'vitest';
22
import { uiTurboConfigPath } from '../workspace-root.mjs';
3+
import { UI_TSC_BUILT_PACKAGE_FLOOR } from './helpers/ui-package-population.mjs';
34
import fs from 'node:fs';
45
import os from 'node:os';
56
import path from 'node:path';
@@ -269,7 +270,9 @@ describe('this repository', () => {
269270
const tscPackages = discoverTscPackages(repoRoot) as Array<{ name: string; dir: string }>;
270271

271272
it('finds the tsc-built packages', () => {
272-
expect(tscPackages.length).toBeGreaterThanOrEqual(11);
273+
// A floor against an empty walk, not a census: about two thirds of the 11
274+
// measured on objectstack 6a7c0fe3, so retiring a package leaves it green.
275+
expect(tscPackages.length).toBeGreaterThanOrEqual(UI_TSC_BUILT_PACKAGE_FLOOR);
273276
});
274277

275278
it.each(tscPackages.map((p) => [p.name, p.dir] as const))(

‎ui/scripts/__tests__/check-doc-links.test.ts‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
stripCode,
2323
} from '../check-doc-links.mjs';
2424
import { GithubSlugger as VendoredSlugger, slug as vendoredSlug } from '../github-slug.mjs';
25+
import { UI_PUBLISHED_PACKAGE_FLOOR } from './helpers/ui-package-population.mjs';
2526

2627
/**
2728
* objectui#3479 — the behaviour test for `scripts/check-doc-links.mjs`.
@@ -514,16 +515,18 @@ describe('the repo it guards', () => {
514515
expect(scanned['README.md']).toBe(1);
515516
expect(scanned['CONTRIBUTING.md']).toBe(1);
516517
expect(scanned['ROADMAP.md']).toBe(1);
517-
// Three READMEs since the two host-console examples were deleted (#25922):
518-
// the index, hello-world and schema-catalog.
519-
expect(scanned['examples']).toBeGreaterThanOrEqual(3);
518+
// A floor against an empty scan, not a census: three READMEs today (the
519+
// index, hello-world and schema-catalog, measured on objectstack 6a7c0fe3),
520+
// so deleting one example leaves it green.
521+
expect(scanned['examples']).toBeGreaterThanOrEqual(2);
520522
expect(scanned['docs']).toBeGreaterThanOrEqual(15);
521523
expect(scanned['content/docs']).toBeGreaterThanOrEqual(100);
522-
// objectui#3622. 38 of the 39 package directories carry a README today
523-
// (`sdui-parser` does not), and this row is the only one whose path needs
524-
// expanding before anything is opened — so a floor here is also the floor
525-
// under `expandWildcard()`.
526-
expect(scanned['packages/*/README.md']).toBeGreaterThanOrEqual(35);
524+
// objectui#3622. This row is the only one whose path needs expanding before
525+
// anything is opened, so a floor here is also the floor under
526+
// `expandWildcard()`. Every published package carries a README, so the
527+
// shared published-package floor bounds it (39 READMEs measured on
528+
// objectstack 6a7c0fe3); deleting a package moves no floor.
529+
expect(scanned['packages/*/README.md']).toBeGreaterThanOrEqual(UI_PUBLISHED_PACKAGE_FLOOR);
527530
// objectui#4148. Both apps carry one today; the floor is 2 rather than the
528531
// exact count because this row exists precisely so the NEXT app is scanned
529532
// without anyone editing the table.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
/**
4+
* ui-package-population -- the ONE place the size of the ui package population
5+
* is written down, as anti-vacuity floors.
6+
*
7+
* import { UI_PUBLISHED_PACKAGE_FLOOR } from './helpers/ui-package-population.mjs';
8+
* expect(published.length).toBeGreaterThanOrEqual(UI_PUBLISHED_PACKAGE_FLOOR);
9+
*
10+
* A floor here answers one question: "did the scan find a population at all,
11+
* or did a lost workspace root, a broken glob or a renamed manifest field leave
12+
* it reading nothing?" It is NOT a census. A census pinned at today's measured
13+
* value goes red on every legitimate package deletion, and one deletion then
14+
* edits a floor in every file that spelled the count (objectstack#26444 counted
15+
* five for a single retirement). So each floor sits at about two thirds of the
16+
* value measured below -- the `vite-dts-wiring-ratchet` precedent: measured 22,
17+
* floor 15 -- and is written once, here, for every reader:
18+
*
19+
* - `scripts/check-node-esm-load.mjs` and `scripts/check-published-dist-tooling.mjs`
20+
* (`MIN_PACKAGES`, the gates' own refusal to judge a collapsed scan);
21+
* - `package-files-exist`, `side-effects-declaration-consistency`,
22+
* `check-dist-completeness`, `zero-test-member-exclusion-9106`,
23+
* `check-doc-links` and `quick-reference-commands-4149` under `scripts/__tests__/`.
24+
*
25+
* It is an `.mjs` module, not a `.ts` helper like its neighbours, because the two
26+
* gate scripts above import it at run time under plain `node`.
27+
*
28+
* Re-measuring: a floor moves only when its population has shrunk to near it,
29+
* and then to about two thirds of the new measurement, with the measurement and
30+
* its commit recorded in the table below. ⛔ Never raise a floor to track growth:
31+
* growth is routine and the floor's job is only to refuse an empty scan.
32+
*
33+
* Measured on objectstack `origin/main` `6a7c0fe3` (2026-10-27, right after
34+
* `@object-ui/app-shell` became private):
35+
*
36+
* population measured floor margin
37+
* published packages (release group) 36 24 12
38+
* workspace members (packages/*, apps/*, examples/*) 43 28 15
39+
* `sideEffects: false` declarers 11 7 4
40+
* `sideEffects` array declarers 17 11 6
41+
* tsc-built packages 11 7 4
42+
*/
43+
44+
/**
45+
* Packages that publish to npm: not `private: true`, in the changesets release
46+
* group. Readers whose population is a superset of these (packages declaring
47+
* `files` or `exports`, package directories carrying a README) read this floor
48+
* too: if the published set is there, so is theirs.
49+
*/
50+
export const UI_PUBLISHED_PACKAGE_FLOOR = 24;
51+
52+
/** Every manifest under the three workspace globs, private ones included. */
53+
export const UI_WORKSPACE_MEMBER_FLOOR = 28;
54+
55+
/** Packages declaring `"sideEffects": false`. */
56+
export const UI_SIDE_EFFECTS_FALSE_FLOOR = 7;
57+
58+
/** Packages declaring `sideEffects` as an array of paths. */
59+
export const UI_SIDE_EFFECTS_ARRAY_FLOOR = 11;
60+
61+
/** Packages whose build runs `tsc` (the `check-dist-completeness` population). */
62+
export const UI_TSC_BUILT_PACKAGE_FLOOR = 7;

0 commit comments

Comments
 (0)