Skip to content

Commit 22dc89f

Browse files
committed
test: follow the plugin-ai retirement in the cli ratchet, markdown inputs and the types pins (WIP)
Claude-Session: https://claude.ai/code/session_01VBDBR9oS1MNUcjBVXds5D6 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 61bf86d commit 22dc89f

7 files changed

Lines changed: 45 additions & 919 deletions

‎ui/packages/cli/src/__tests__/registered-types-validate-ratchet-10859.test.ts‎

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
* (`validateAuthoredDocument`, objectui#5250), whose root is the strict twin of
1717
* `AnyComponentSchema` — a union discriminated on `type`. A registered type
1818
* with no arm in that union is refused with one `invalid_union` issue at
19-
* `['type']`, whatever else the document says: `ai-form-assist`, which
20-
* `packages/plugin-ai/README.md` teaches, was one of them. The mirror-parity
19+
* `['type']`, whatever else the document says: `ai-form-assist`, which the
20+
* since-retired `@object-ui/plugin-ai` README taught, was one of them. The mirror-parity
2121
* ratchet in `@object-ui/types` counts declaration↔mirror PAIRS and the keys
2222
* inside them; a registered type with no mirror at all is in neither, so
2323
* nothing counted this family until this file.
@@ -379,7 +379,7 @@ describe('registered component types refused at `type` — a ratchet (objectui#1
379379
// was 200 until objectui#10859 batch 8 unregistered thirty bare keys.)
380380
expect(BARE_KEYS.length).toBeGreaterThan(150);
381381
expect(BARE_KEYS).toContain('timeline');
382-
expect(BARE_KEYS).toContain('ai-form-assist');
382+
expect(BARE_KEYS).toContain('pivot');
383383
});
384384

385385
it('tells a claimed type from an unclaimed one — both instrument controls fire', () => {
@@ -392,11 +392,24 @@ describe('registered component types refused at `type` — a ratchet (objectui#1
392392
expect(refusedAtType('no-such-component-10859')).toBe(true);
393393
});
394394

395-
it('counts the three plugin-ai keys as armed (objectui#10859 batch 1)', () => {
395+
it('refuses the three plugin-ai keys BY NAME at `type` — the package retired and their arms became refusals (objectstack#25921)', () => {
396+
// objectui#10859 batch 1 armed them; the registrations left with
397+
// `@object-ui/plugin-ai`, so registration and arm leaving in one change move
398+
// neither count. Each arm stays as `retiredNodeType()`'s refusal, the
399+
// `cloud:plan-status` shape below.
396400
for (const key of ['ai-form-assist', 'ai-recommendations', 'nl-query']) {
397-
expect(BARE_KEYS, key).toContain(key);
401+
expect(BARE_KEYS, key).not.toContain(key);
402+
const result = validateAuthoredDocument({ type: key });
403+
expect(result.success, key).toBe(false);
404+
const named = (result.success ? [] : result.error.issues).filter(
405+
(issue) => issue.code === 'custom' && issue.path.length === 1 && issue.path[0] === 'type',
406+
);
407+
expect(named, key).toHaveLength(1);
408+
expect(named[0]?.message, key).toContain('@object-ui/plugin-ai');
398409
expect(refusedAtType(key), key).toBe(false);
399410
}
411+
// Control: an unknown bare literal still takes the generic path.
412+
expect(refusedAtType('ai-no-such-node-25921')).toBe(true);
400413
});
401414

402415
it('counts the three keys batch 2 armed (objectui#10859 batch 2)', () => {
@@ -712,7 +725,6 @@ describe('registered NAMESPACED component types refused at `type` — a ratchet
712725

713726
/** Rooted on this file, never on `process.cwd()`. */
714727
const HERE = dirname(fileURLToPath(import.meta.url));
715-
const PLUGIN_AI_README = join(HERE, '..', '..', '..', 'plugin-ai', 'README.md');
716728
const QUICK_START = join(HERE, '..', '..', '..', '..', 'content', 'docs', 'guide', 'quick-start.md');
717729

718730
/** See `validate-root-path-line.test.ts` — the escape byte is never spelled. */
@@ -750,26 +762,6 @@ afterEach(() => {
750762
rmSync(dir, { recursive: true, force: true });
751763
});
752764

753-
describe('objectui validate — the plugin-ai README document (objectui#10859)', () => {
754-
it('validates the "Schema-Driven Usage" `ai-form-assist` document', async () => {
755-
const readme = readFileSync(PLUGIN_AI_README, 'utf8');
756-
const section = readme.slice(readme.indexOf('## Schema-Driven Usage'));
757-
const fence = /```json\n([\s\S]*?)\n```/.exec(section);
758-
expect(fence, 'no ```json fence under "## Schema-Driven Usage"').not.toBeNull();
759-
const file = join(dir, 'ai-form-assist.json');
760-
writeFileSync(file, (fence as RegExpExecArray)[1], 'utf-8');
761-
// Lit control on the extraction: it is the taught node.
762-
expect(JSON.parse((fence as RegExpExecArray)[1]).type).toBe('ai-form-assist');
763-
764-
await validate(file);
765-
766-
const text = out.join('\n').replace(ANSI, '');
767-
expect(text).not.toContain('Schema validation failed');
768-
expect(text).toContain('Schema is valid');
769-
expect(exitCodes).toEqual([0]);
770-
});
771-
});
772-
773765
/* ── End to end: a page of public blocks through `objectui validate` ─────── */
774766

775767
describe('objectui validate — a page built from ADR-0080 public blocks (objectui#10872)', () => {

‎ui/packages/cli/src/utils/known-schema-types.ts‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ export const KNOWN_SCHEMA_TYPES: readonly string[] = [
3939
'action:icon',
4040
'action:menu',
4141
'address',
42-
'ai-form-assist',
43-
'ai-recommendations',
4442
'ai:feedback',
4543
'ai:input',
4644
'ai:suggestion',
@@ -222,7 +220,6 @@ export const KNOWN_SCHEMA_TYPES: readonly string[] = [
222220
'nav:breadcrumb',
223221
'nav:menu',
224222
'navigation-menu',
225-
'nl-query',
226223
'object-calendar',
227224
'object-chart',
228225
'object-data-table',

‎ui/packages/types/src/__tests__/ai-insights-retired-8800.test.ts‎

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -118,21 +118,23 @@ describe('objectui#8800 — `ai-insights` stays retired (type face)', () => {
118118
// declaration is caught even by a run that never type-checks.
119119
const source = readFileSync(DECLARATION_PATH, 'utf8');
120120

121-
expect(/^export interface AIInsightsSchema\b/m.test(source)).toBe(false);
122-
expect(/^\s*type: 'ai-insights';/m.test(source)).toBe(false);
123-
124-
// ⭐ LIT CONTROLS — the SAME two matchers, one sibling over, still fire. The
125-
// three AI schemas this file keeps are registered and rendered by
126-
// `@object-ui/plugin-ai`; only the fourth was retired. Without these, both
127-
// absences above would also be satisfied by a truncated read or a matcher
128-
// that can never match.
129-
expect(/^export interface AIRecommendationsSchema\b/m.test(source)).toBe(true);
130-
expect(/^\s*type: 'ai-recommendations';/m.test(source)).toBe(true);
131-
132-
// The tombstone itself must stay: it is where the ruling, the boundary
133-
// against the three live schemas, and the in-repo limit are recorded. A
134-
// retirement whose reasoning is deleted is re-litigated by the next sweep.
135-
expect(source).toContain('`AIInsightsSchema` (`type: \'ai-insights\'`) — RETIRED');
121+
const declares = (name: string) => new RegExp(`^export (?:interface|type) ${name}\\b`, 'm');
122+
const literal = /^\s*type: 'ai-insights';/m;
123+
expect(declares('AIInsightsSchema').test(source)).toBe(false);
124+
expect(literal.test(source)).toBe(false);
125+
126+
// ⭐ LIT CONTROLS — the SAME two matchers still fire. The three sibling names
127+
// stay declared in this file (as `never` tombstones since `@object-ui/plugin-ai`
128+
// retired, objectstack#25921), so the declaration matcher finds one; no
129+
// node literal is declared here any more, so the literal matcher is lit on
130+
// the line it was written to catch. Without these, both absences above would
131+
// also be satisfied by a truncated read or a matcher that can never match.
132+
expect(declares('AIRecommendationsSchema').test(source)).toBe(true);
133+
expect(literal.test(" type: 'ai-insights';")).toBe(true);
134+
135+
// The module keeps pointing at this retirement, so the next sweep finds the
136+
// ruling instead of re-litigating it.
137+
expect(source).toContain('objectui#8800');
136138
});
137139

138140
it('the published BARREL no longer re-exports the symbol', () => {
@@ -162,17 +164,13 @@ describe('objectui#8800 — nothing in this TRACKED tree carries either spelling
162164
* a tombstone comment that names the symbol on purpose; a scan reddening on
163165
* them would be asserting the retirement had not landed. That they no longer
164166
* DECLARE it is asserted above, by matchers shaped for a declaration.
165-
* - `ai-zero-read-members-retired-8178.test.ts` — objectui#8178's pin, whose
166-
* exclusion paragraph was rewritten BY THIS RULING and names the symbol to
167-
* record what it used to hold.
168167
* - this pin, which must write both spellings to probe for them.
169168
*/
170169
const EXCLUDED = [
171170
':!*CHANGELOG.md',
172171
':!.changeset/',
173172
':!packages/types/src/ai.ts',
174173
':!packages/types/src/index.ts',
175-
':!packages/types/src/__tests__/ai-zero-read-members-retired-8178.test.ts',
176174
':!packages/types/src/__tests__/ai-insights-retired-8800.test.ts',
177175
];
178176

@@ -201,7 +199,7 @@ describe('objectui#8800 — nothing in this TRACKED tree carries either spelling
201199
expect(grepTree('ai-insights')).toEqual([]);
202200
});
203201

204-
it('LIT CONTROLS — the same probe finds the three siblings that DO render', () => {
202+
it('LIT CONTROLS — the same probe finds the three siblings (tombstoned since objectstack#25921)', () => {
205203
// Without these, both zeros above would also be produced by a broken
206204
// `git grep` invocation, a wrong cwd, or an exclusion list that swallowed
207205
// the tree — and a swallowed tree renders as a successful retirement.
@@ -242,7 +240,7 @@ describe('objectui#8800 — PREMISE: the zod face never accepted the spelling',
242240
expect('AIInsightsSchema' in ZodFace).toBe(false);
243241
// ⭐ LIT CONTROLS — the same probes find a sibling the mirror DOES carry, so
244242
// the absences above are readings and not a broken path join or namespace.
245-
expect(source).toMatch(/z\.literal\('ai-recommendations'\)/);
243+
expect(source).toMatch(/retiredNodeType\('ai-recommendations'/);
246244
expect('AIRecommendationsSchema' in ZodFace).toBe(true);
247245
});
248246
});

0 commit comments

Comments
 (0)