Skip to content

Commit ab8a63d

Browse files
committed
wip(ui-merge): K4 — re-point package doc readers and the markdown-test-inputs ledger
Claude-Session: https://claude.ai/code/session_01L9qibyMpJZ67jrDrno4jY1 Co-authored-by: Claude <noreply@anthropic.com>
1 parent d250bee commit ab8a63d

46 files changed

Lines changed: 326 additions & 3099 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,10 @@ jobs:
468468
# - `content/docs/frontend/**`, the ObjectUI SDK pages since the
469469
# objectui.org docs folded into this site. Lint UI's doc gates
470470
# (doc-types, doc-snippets, doc-json, doc-fences, spec-symbols)
471-
# and the Test UI tests that render a guide's example read them.
471+
# and the Test UI tests that render a guide's example read them;
472+
# - `content/docs/ui/pages.mdx`, where the per-element data
473+
# binding section of the old data-source guide landed. Two Test
474+
# UI pins read its fences and its block table (objectstack#27145).
472475
ui:
473476
- 'ui/**'
474477
- 'pnpm-lock.yaml'
@@ -478,6 +481,7 @@ jobs:
478481
- '.github/prompts/**'
479482
- 'skills/objectui/**'
480483
- 'content/docs/frontend/**'
484+
- 'content/docs/ui/pages.mdx'
481485
# turbo.json's `globalDependencies`: every build task hashes
482486
# them, so they move what the ui jobs build, the SDUI manifest's
483487
# regeneration included (#26137).

‎ui/apps/console/src/__tests__/objectname-binding-required-11605.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ const BOUND = Object.keys(shipped.components)
8585

8686
/* ── What the binding supplies, read off the binding doc ───────────────────── */
8787

88-
const BINDING_DOC = 'content/docs/guide/data-source.md';
88+
const BINDING_DOC = '../content/docs/ui/pages.mdx';
8989

90-
const TABLE_HEADING = '### Which blocks consume it, and which keys each one honours';
90+
const TABLE_HEADING = '#### Which blocks consume it, and which keys each one honours';
9191

9292
/**
9393
* The doc's "which keys each one honours" table, one row per block:

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

Lines changed: 16 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,13 @@
9696
* so this file mirrors exactly what the gallery host registers, in the same
9797
* order — several packages claim the same bare keyword (`chart`, `calendar`)
9898
* and the last registration wins, so a reordered mirror would not be a mirror.
99-
* The last case in this file reads the host and fails if the two lists drift.
99+
* The last case in this file read the host and failed if the two lists drifted.
100+
*
101+
* ⛔ objectstack#27145 deleted that host with the docs site (its
102+
* `registerCatalogBlocks.ts`, `SchemaThumbnail.tsx`, `InteractiveDemo.tsx` and
103+
* `galleryDataSource.ts`), and every host-parity case went with it. Where a
104+
* docblock below still says "the parity case", it is describing history: the
105+
* registration list and the fixture in this file are now the only copies.
100106
*
101107
* ## What is asserted, per entry
102108
*
@@ -128,7 +134,9 @@
128134
import { describe, it, expect, vi, beforeEach, afterEach, afterAll } from 'vitest';
129135
import { render, waitFor, cleanup } from '@testing-library/react';
130136
import '@object-ui/components';
131-
// Mirrors apps/site/app/components/registerCatalogBlocks.ts, in its order.
137+
// Mirrors the docs-site gallery host's registration list, in its order. The host
138+
// (`registerCatalogBlocks.ts`) was deleted with the site by objectstack#27145;
139+
// `HOST_PACKAGES` below is now the only copy.
132140
import '@object-ui/plugin-dashboard';
133141
import '@object-ui/plugin-charts';
134142
import '@object-ui/plugin-calendar';
@@ -220,7 +228,11 @@ const ALL_DIAGNOSTICS = [UNKNOWN_COMPONENT, FAILED_TO_RENDER, DATASOURCE_REQUIRE
220228
*/
221229
const FORM_LOADING = 'Loading form…';
222230

223-
/** The packages the gallery host must load, in the host's own order. */
231+
/**
232+
* The packages the gallery host loaded, in the host's own order. The host left
233+
* the tree with the docs site (objectstack#27145), so its parity cases are gone
234+
* and this list is what the imports above are held to.
235+
*/
224236
const HOST_PACKAGES = [
225237
'@object-ui/plugin-dashboard',
226238
'@object-ui/plugin-charts',
@@ -411,17 +423,6 @@ const galleryDataSource = {
411423
delete: async () => true,
412424
};
413425

414-
/** The method names the host fixture must expose for the mirror to be one. */
415-
const GALLERY_DATA_SOURCE_METHODS = [
416-
'queryDataset',
417-
'getObjectSchema',
418-
'find',
419-
'findOne',
420-
'create',
421-
'update',
422-
'delete',
423-
];
424-
425426
/** The two wrapper elements this harness adds around the entry's own root. */
426427
const WRAPPER_ELEMENTS = 2;
427428

@@ -754,49 +755,6 @@ describe('objectui#4616 — every catalog entry renders in the docs gallery', ()
754755
});
755756
}, 120000);
756757

757-
/**
758-
* HOST PARITY (source-text guard, deliberately not behavioural).
759-
*
760-
* Everything above mirrors the gallery: the same registration set, in the
761-
* same order, with the same dataset-capable `dataSource`. It cannot mirror it
762-
* by construction — `apps/**` is outside every root Vitest project — so
763-
* deleting a package from the host would leave this file green while
764-
* `/docs/guide/schema-catalog` went back to painting red panels. This case
765-
* reads the host and pins what the sweep assumes about it.
766-
*/
767-
describe('the docs-site gallery host registers the same set', () => {
768-
// Rooted at this file, never at the cwd — see `REPO_ROOT` above.
769-
const siteDir = path.join(REPO_ROOT, 'apps/site/app/components');
770-
const read = (f: string) => fs.readFileSync(path.join(siteDir, f), 'utf8');
771-
772-
it('loads every package this pin loads, in this pin’s order', () => {
773-
const source = read('registerCatalogBlocks.ts');
774-
const imported = [...source.matchAll(/^import\s+'(@object-ui\/[^']+)';$/gm)].map(
775-
(m) => m[1],
776-
);
777-
expect(imported).toEqual(HOST_PACKAGES);
778-
});
779-
780-
it('is imported by the gallery thumbnail host', () => {
781-
expect(read('SchemaThumbnail.tsx')).toMatch(
782-
/^import\s+'\.\/registerCatalogBlocks';$/m,
783-
);
784-
});
785-
786-
/**
787-
* The objectui#4600 separation, restated because objectui#4616 is exactly
788-
* the change that would tempt someone to collapse it: the per-page demo
789-
* hosts opt into their plugins through `PluginLoader`, and importing this
790-
* module from them would make every docs page carrying a demo load every
791-
* graph in that list eagerly.
792-
*/
793-
it.each(['InteractiveDemo.tsx', 'LiveSplitDemo.tsx'])(
794-
'%s still does NOT import it (PluginLoader stays lazy there)',
795-
(host) => {
796-
expect(read(host)).not.toContain('registerCatalogBlocks');
797-
},
798-
);
799-
});
800758
});
801759

802760
/**
@@ -1358,39 +1316,11 @@ describe('objectui#6025 — the gallery DECLARES the packages its entries need',
13581316
'these packages register the types their own category’s entries author, and the ' +
13591317
'gallery host does not name them. Whether the types resolve anyway through some ' +
13601318
'other package’s component import is a different question and not this one — add ' +
1361-
'the side-effect import to `apps/site/app/components/registerCatalogBlocks.ts` and ' +
1362-
'mirror it in `HOST_PACKAGES`.',
1319+
'the side-effect import at the top of this file and name it in `HOST_PACKAGES`.',
13631320
).toEqual([]);
13641321
});
13651322
});
13661323

1367-
/**
1368-
* HOST PARITY for the fixture, same technique and same reason as the
1369-
* registration-set parity above: the mirror at the top of this file is what
1370-
* the assertions run against, so a host fixture that lost `find` would leave
1371-
* this file green while the docs page went back to an empty view.
1372-
*/
1373-
describe('objectui#5113 — the docs-site hosts supply the same fixture', () => {
1374-
const siteDir = path.join(REPO_ROOT, 'apps/site/app/components');
1375-
const read = (f: string) => fs.readFileSync(path.join(siteDir, f), 'utf8');
1376-
1377-
it('the host fixture exposes every method this mirror implements', () => {
1378-
const source = read('galleryDataSource.ts');
1379-
const missing = GALLERY_DATA_SOURCE_METHODS.filter(
1380-
(method) => !new RegExp(`\\basync ${method}\\s*\\(`).test(source),
1381-
);
1382-
expect(missing).toEqual([]);
1383-
});
1384-
1385-
it.each(['SchemaThumbnail.tsx', 'InteractiveDemo.tsx'])(
1386-
'%s hands it to the renderer',
1387-
(host) => {
1388-
expect(read(host)).toMatch(/^import \{ galleryDataSource \} from '\.\/galleryDataSource';$/m);
1389-
expect(read(host)).toContain('dataSource: galleryDataSource');
1390-
},
1391-
);
1392-
});
1393-
13941324
/**
13951325
* objectui#6317 — every `select` field in the fixture declares the options its
13961326
* own rows use, and this mirror declares exactly what the host declares.
@@ -1448,50 +1378,6 @@ function distinctRowValues(field: string): Set<string> {
14481378
return seen;
14491379
}
14501380

1451-
/**
1452-
* The host's `USERS_SCHEMA`, read off its source. `apps/**` is outside every
1453-
* root Vitest project, which is the same constraint that makes this file a
1454-
* mirror in the first place. Brace-matched rather than pattern-matched and then
1455-
* JSON-ified, so an extraction that stops working fails LOUDLY here rather than
1456-
* quietly comparing less than it claims to.
1457-
*/
1458-
function readHostUsersFields(source: string): Record<string, UsersFieldDecl> {
1459-
const start = source.indexOf('const USERS_SCHEMA = {');
1460-
expect(start, 'the host fixture no longer declares `const USERS_SCHEMA = {`').toBeGreaterThan(-1);
1461-
const open = source.indexOf('{', start);
1462-
let depth = 0;
1463-
let end = -1;
1464-
for (let i = open; i < source.length; i++) {
1465-
if (source[i] === '{') depth += 1;
1466-
else if (source[i] === '}') {
1467-
depth -= 1;
1468-
if (depth === 0) {
1469-
end = i;
1470-
break;
1471-
}
1472-
}
1473-
}
1474-
expect(end, 'the host `USERS_SCHEMA` literal has unbalanced braces').toBeGreaterThan(-1);
1475-
const json = source
1476-
.slice(open, end + 1)
1477-
.replace(/'/g, '"')
1478-
.replace(/([{,[]\s*)([A-Za-z_$][A-Za-z0-9_$]*)\s*:/g, '$1"$2":')
1479-
.replace(/,(\s*[}\]])/g, '$1');
1480-
let parsed: { fields?: Record<string, UsersFieldDecl> };
1481-
try {
1482-
parsed = JSON.parse(json) as { fields?: Record<string, UsersFieldDecl> };
1483-
} catch (error) {
1484-
throw new Error(
1485-
'the host `USERS_SCHEMA` is no longer a plain single-quoted literal, so this ' +
1486-
'parity case can no longer read it — a comment inside the literal, or an ' +
1487-
'apostrophe inside a string, would each do it. Fix the reader, not the pin.',
1488-
{ cause: error },
1489-
);
1490-
}
1491-
expect(parsed.fields, 'the host `USERS_SCHEMA` declares no `fields`').toBeTruthy();
1492-
return parsed.fields as Record<string, UsersFieldDecl>;
1493-
}
1494-
14951381
describe('objectui#6317 — a `select` field declares the options its rows use', () => {
14961382
const mirrorFields = USERS_SCHEMA.fields as Record<string, UsersFieldDecl>;
14971383
const selectFields = Object.entries(mirrorFields)
@@ -1523,19 +1409,6 @@ describe('objectui#6317 — a `select` field declares the options its rows use',
15231409
).toEqual([]);
15241410
});
15251411

1526-
it('the host fixture declares the SAME field surface, options included', () => {
1527-
const hostSource = fs.readFileSync(
1528-
path.join(REPO_ROOT, 'apps/site/app/components/galleryDataSource.ts'),
1529-
'utf8',
1530-
);
1531-
expect(
1532-
readHostUsersFields(hostSource),
1533-
'the host fixture and this mirror declare different `users` field surfaces. They ' +
1534-
'are ONE fixture in two files and have to move together: the host gained its ' +
1535-
'`role` / `status` options in 4b0b12630 and this mirror did not follow for 330 ' +
1536-
'commits, with every case in this file green the whole time.',
1537-
).toEqual(mirrorFields);
1538-
});
15391412
});
15401413

15411414
/**

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

Lines changed: 3 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -67,35 +67,8 @@ import '@object-ui/plugin-charts';
6767
import { registerLayout } from '@object-ui/layout';
6868
import { ComponentRegistry } from '@object-ui/core';
6969
import { SchemaRenderer, SchemaRendererContext } from '@object-ui/react';
70-
import fs from 'node:fs';
71-
import path from 'node:path';
7270
import { examplesByCategory } from '../src/index.js';
7371

74-
/**
75-
* The repo root, derived from THIS FILE's own location — never from
76-
* `process.cwd()` (objectui#7799, and the gate that closed the class,
77-
* objectui#8953).
78-
*
79-
* What stood at the read site below was `path.join(process.cwd(), …)` under the
80-
* comment "`process.cwd()` is the repo root by construction:
81-
* `scripts/vitest-invocation-guard.mjs` refuses any run whose Vitest root is
82-
* not it". THAT PREMISE IS FALSE. The guard rejects a run whose VITEST root is
83-
* not the repo root; this package's own `test` script — `vitest run --root ../..
84-
* examples/schema-catalog/` — sets that root correctly while leaving
85-
* `process.cwd()` in the package directory. The guard passes and the cwd is the
86-
* package, so `expect(fs.existsSync(siteDir)).toBe(true)` was asserting against
87-
* a path that does not exist under that invocation.
88-
*
89-
* Spelled in string operations, copying the landed precedent of objectui#7791
90-
* (PR #7796) and objectui#7799 (PR #7806): only BARE `import.meta.url` is read
91-
* here and taken apart by hand.
92-
*/
93-
const SELF_DEPTH_BELOW_REPO_ROOT = 4; // examples / schema-catalog / test / this file
94-
const REPO_ROOT = decodeURIComponent(new URL(import.meta.url).pathname)
95-
.split('/')
96-
.slice(0, -SELF_DEPTH_BELOW_REPO_ROOT)
97-
.join('/');
98-
9972
registerLayout();
10073

10174
/** `DashboardRenderer`'s retired inline-analytics placeholder (framework#3320). */
@@ -217,35 +190,7 @@ describe('plugin-dashboard catalog entries render in the docs gallery (objectui#
217190
});
218191
});
219192

220-
/**
221-
* GALLERY PARITY (source-text guard, deliberately not behavioural).
222-
*
223-
* The cases above mirror the gallery: the same registry and the same
224-
* dataset-capable `dataSource`. They cannot mirror it by construction —
225-
* `apps/**` is excluded from every root Vitest project — so removing the
226-
* gallery's own wiring would leave them green while `/docs/guide/schema-
227-
* catalog` went back to "Unknown component type" (before objectui#4600 that
228-
* was its real state: `SchemaThumbnail` loaded no dashboard package) or to
229-
* the dataset error. This case reads the two host files and pins the three
230-
* things this pin assumes about them.
231-
*/
232-
it('the docs-site gallery host still registers the dashboard packages and passes the dataset stub', () => {
233-
// Rooted at this file, never at the cwd — see `REPO_ROOT` above.
234-
const siteDir = path.join(REPO_ROOT, 'apps/site/app/components');
235-
expect(fs.existsSync(siteDir)).toBe(true);
236-
const registrations = fs.readFileSync(path.join(siteDir, 'registerCatalogBlocks.ts'), 'utf8');
237-
expect(registrations).toContain('@object-ui/plugin-dashboard');
238-
expect(registrations).toContain('@object-ui/plugin-charts');
239-
240-
const dataSourceModule = fs.readFileSync(path.join(siteDir, 'galleryDataSource.ts'), 'utf8');
241-
expect(dataSourceModule).toContain('queryDataset');
242-
243-
// The stub must reach the renderer as a PROP: `SchemaRendererContext`
244-
// alone does not reach `DashboardRenderer`, which takes `dataSource` as a
245-
// React prop (measured on objectui#4600 — a context-only stub still
246-
// rendered the dataset error).
247-
const thumbnail = fs.readFileSync(path.join(siteDir, 'SchemaThumbnail.tsx'), 'utf8');
248-
expect(thumbnail).toContain('galleryDataSource');
249-
expect(thumbnail).toMatch(/<SchemaRenderer[^>]*dataSource=\{/);
250-
});
193+
// ⛔ The GALLERY PARITY case that read the docs-site host files
194+
// (`registerCatalogBlocks.ts`, `galleryDataSource.ts`, `SchemaThumbnail.tsx`)
195+
// was deleted with the site by objectstack#27145; nothing is left to read.
251196
});

0 commit comments

Comments
 (0)