Skip to content

Commit 643031b

Browse files
committed
refactor(types)!: delete the api-types module and its eight names nothing reads
The whole ui/packages/types/src/api-types.ts module goes, with the barrel's "API and Events" block: HTTPMethod, APIRequest, APIConfig, DataFetchConfig, DataFetchableSchema, ExpressionContext, ExpressionNodeSchema and APISchema. None has a reader in the workspace or in hotcrm; the ExpressionContext hits elsewhere are core's own class. The objectui#6497 tombstone the module carried moves into the barrel where the block stood, and the 6497 pin now asserts the declaring file is gone, keeps its barrel legs with lit controls on BaseSchema / AnySchema, and reads the tombstone from the barrel. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibzeiKfRPSysJDdZzQL
1 parent 1aeeafd commit 643031b

4 files changed

Lines changed: 119 additions & 409 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
'@object-ui/types': patch
3+
---
4+
5+
refactor(types)!: delete the api-types module and its eight names nothing reads
6+
7+
Clause-②: no (narrowing)
8+
Metadata-protocol: none
9+
10+
<!-- adr-0087: not-required (runtime-export-retired @object-ui/types#HTTPMethod, @object-ui/types#APIRequest, @object-ui/types#APIConfig, @object-ui/types#DataFetchConfig, @object-ui/types#DataFetchableSchema, @object-ui/types#ExpressionContext, @object-ui/types#ExpressionNodeSchema, @object-ui/types#APISchema) the retired operands are TypeScript-only interfaces and unions for a data-fetching and expression-node dialect that no renderer, adapter or host reads; nothing in the workspace or in hotcrm imports any of them from the package entry, they have no zod twin, they are not arms of `AnySchema`, and no packages/spec schema, registered node type, conversion surface or stored shape names them, so there is nothing for `objectstack migrate meta` to rewrite -->
11+
12+
**BREAKING** for a host that imports any of these eight types from `@object-ui/types`. None had an importer anywhere in the workspace or in hotcrm, so the Console and every `@object-ui/*` package are unaffected.
13+
14+
They are **gone from the package, not only from the entry**: the whole `api-types.ts` module (the entry's "API and Events" block) is deleted. The objectui#6497 tombstone for `UIEventHandler` and `EventableSchema` it carried now stands in the entry where the block was; those two stay retired.
15+
16+
What leaves, and what to write instead:
17+
18+
- FROM `HTTPMethod`, `APIRequest`, `APIConfig`, `DataFetchConfig`, `DataFetchableSchema`, `APISchema` TO no replacement in this package. A component reads data through this package's `DataSource` interface; a host that kept its own request shape declares it locally.
19+
- FROM `ExpressionContext`, `ExpressionNodeSchema` TO no replacement in this package. Expressions are `${…}` strings evaluated by `@object-ui/core`'s `ExpressionEvaluator` against its own `ExpressionContext` class.

‎ui/packages/types/src/__tests__/eventable-schema-retired-6497.test.ts‎

Lines changed: 58 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,25 @@
2626
* external TypeScript consumer that imported either name gets a compile error
2727
* naming the symbol, and the changeset is what it reads.
2828
*
29+
* ## The declaring module is gone (#25921, batch 9)
30+
*
31+
* Both names were declared in `../api-types.ts`. That whole module was DELETED
32+
* by #25921 batch 9 (its eight surviving names had no reader either), and the
33+
* tombstone moved into the barrel where its export block stood. So the pin's
34+
* module legs now assert the FILE is gone, and every text check reads the
35+
* barrel. Its assertions about `UIEventHandler` / `EventableSchema` staying
36+
* unexported are unchanged; only the file they read moved.
37+
*
2938
* ## Three instruments, and why the obvious fourth is absent
3039
*
3140
* - `tsc` sees the `@ts-expect-error` legs. They are the only half that tells
3241
* the retirement from its absence, because a retired type is a
3342
* TypeScript-only refusal, and they mean nothing unless `type-check` runs
3443
* (vitest strips types). This package compiles every `*.test.ts` file
3544
* through `tsconfig.test.json`, which is what makes them real.
36-
* - vitest reads the declaring module and the barrel as TEXT, so a
37-
* re-introduced interface or re-export reddens even in a run that never
38-
* type-checks.
45+
* - vitest reads the barrel as TEXT (and checks the deleted declaring module
46+
* stays deleted), so a re-introduced interface or re-export reddens even in
47+
* a run that never type-checks.
3948
* - vitest scans the whole TRACKED tree for both spellings, with a lit
4049
* control on the same probe.
4150
* - ⛔ A runtime `name in module` leg is deliberately absent: both names were
@@ -44,80 +53,82 @@
4453
*/
4554

4655
import { describe, it, expect } from 'vitest';
47-
import { readFileSync } from 'node:fs';
56+
import { existsSync, readFileSync } from 'node:fs';
4857
import { execFileSync } from 'node:child_process';
4958
import { dirname, resolve } from 'node:path';
5059
import { fileURLToPath } from 'node:url';
5160

5261
/** Rooted at THIS file, never at `process.cwd()` — the two differ per invocation. */
5362
const HERE = dirname(fileURLToPath(import.meta.url));
5463
const REPO_ROOT = resolve(HERE, '../../../..');
55-
const DECLARATION_PATH = resolve(HERE, '..', 'api-types.ts');
64+
/** The declaring module of both names, DELETED whole by #25921 batch 9. */
65+
const RETIRED_DECLARATION_PATH = resolve(HERE, '..', 'api-types.ts');
5666
const BARREL_PATH = resolve(HERE, '..', 'index.ts');
5767

58-
/* ── The type face: both symbols are gone from the module AND from the barrel ── */
59-
60-
// @ts-expect-error objectui#6497 — `UIEventHandler` is RETIRED from `../api-types`. No replacement type; see the tombstone in that file.
61-
type _HandlerRetiredFromTheDeclaringModule = import('../api-types').UIEventHandler;
68+
/* ── The type face: both symbols are gone from the published barrel ── */
69+
// (The declaring-module legs went with `../api-types.ts` itself; the file's
70+
// absence is asserted at runtime below, where a missing module cannot be
71+
// mistaken for a satisfied directive.)
6272

63-
// @ts-expect-error objectui#6497 — `EventableSchema` is RETIRED from `../api-types`. No replacement type; see the tombstone in that file.
64-
type _EventableRetiredFromTheDeclaringModule = import('../api-types').EventableSchema;
65-
66-
// @ts-expect-error objectui#6497 — and `UIEventHandler` is RETIRED from the published barrel, the face an external consumer imports.
73+
// @ts-expect-error objectui#6497 — `UIEventHandler` is RETIRED from the published barrel, the face an external consumer imports.
6774
type _HandlerRetiredFromThePublishedBarrel = import('../index').UIEventHandler;
6875

69-
// @ts-expect-error objectui#6497 — and `EventableSchema` is RETIRED from the published barrel, the face an external consumer imports.
76+
// @ts-expect-error objectui#6497 — `EventableSchema` is RETIRED from the published barrel, the face an external consumer imports.
7077
type _EventableRetiredFromThePublishedBarrel = import('../index').EventableSchema;
7178

7279
/**
73-
* ⭐ THE LIT CONTROLS for the four directives above, on the same instrument.
80+
* ⭐ THE LIT CONTROLS for the two directives above, on the same instrument.
7481
*
7582
* `@ts-expect-error` fails loudly when the line below it compiles (TS2578,
7683
* "unused directive"), so the directives cannot rot into silence. What they
77-
* cannot rule out on their own is a module that stopped resolving ANYTHING — an
78-
* emptied `../api-types` or a moved barrel would satisfy all four. These resolve
79-
* siblings the ruling left alone, through the exact same import forms, with no
80-
* directive.
84+
* cannot rule out on their own is a barrel that stopped resolving ANYTHING — a
85+
* moved or emptied `../index` would satisfy both. These resolve names the
86+
* ruling left alone, through the exact same import form, with no directive.
8187
*/
82-
type _SiblingStillResolvesFromTheModule = import('../api-types').DataFetchableSchema;
83-
type _SiblingStillResolvesFromTheBarrel = import('../index').ExpressionNodeSchema;
84-
type _UnionStillResolvesFromTheBarrel = import('../index').APISchema;
88+
type _SiblingStillResolvesFromTheBarrel = import('../index').BaseSchema;
89+
type _UnionStillResolvesFromTheBarrel = import('../index').AnySchema;
8590

8691
/** Consumed so the controls are not unused type aliases. */
8792
type _ControlsAreReferenced = [
88-
_SiblingStillResolvesFromTheModule['type'],
8993
_SiblingStillResolvesFromTheBarrel['type'],
9094
_UnionStillResolvesFromTheBarrel['type'],
9195
];
9296

9397
describe('objectui#6497 — the event-handler dialect stays retired (type face)', () => {
94-
it('the DECLARING module no longer declares either interface', () => {
95-
const source = readFileSync(DECLARATION_PATH, 'utf8');
98+
it('the DECLARING module is gone, and the barrel declares neither interface', () => {
99+
// #25921 batch 9 deleted `../api-types.ts` whole. ⭐ LIT CONTROL on the
100+
// same probe: the barrel, resolved the same way, exists.
101+
expect(existsSync(RETIRED_DECLARATION_PATH)).toBe(false);
102+
expect(existsSync(BARREL_PATH)).toBe(true);
103+
104+
const source = readFileSync(BARREL_PATH, 'utf8');
96105

97-
expect(/^export interface UIEventHandler\b/m.test(source)).toBe(false);
98-
expect(/^export interface EventableSchema\b/m.test(source)).toBe(false);
106+
expect(/^export (?:interface|type) UIEventHandler\b/m.test(source)).toBe(false);
107+
expect(/^export (?:interface|type) EventableSchema\b/m.test(source)).toBe(false);
99108

100-
// ⭐ LIT CONTROL — the same matcher shape, one sibling over, still fires.
101-
// Without it both absences above would also be satisfied by a truncated
102-
// read or a matcher that can never match.
103-
expect(/^export interface DataFetchableSchema\b/m.test(source)).toBe(true);
109+
// ⭐ LIT CONTROL — the same matcher shape still fires on a declaration the
110+
// barrel does carry. Without it both absences above would also be satisfied
111+
// by a truncated read or a matcher that can never match.
112+
expect(/^export (?:interface|type) AnySchema\b/m.test(source)).toBe(true);
104113

105-
// The tombstone stays: it records the ruling, what went and the supported
106-
// form. A retirement whose reasoning is deleted is re-litigated by the next
107-
// sweep.
114+
// The tombstone stays (moved here from the deleted module): it records the
115+
// ruling, what went and the supported form. A retirement whose reasoning is
116+
// deleted is re-litigated by the next sweep.
108117
expect(source).toContain('`UIEventHandler` and `EventableSchema` — RETIRED');
109118
});
110119

111-
it('`APISchema` no longer carries an `EventableSchema` arm', () => {
112-
const source = readFileSync(DECLARATION_PATH, 'utf8');
113-
const union = /^export type APISchema =([^;]*);/m.exec(source);
120+
it('the barrel\'s schema union carries no `EventableSchema` arm', () => {
121+
// The arm once sat on `APISchema`, deleted with its module (#25921 batch 9);
122+
// `AnySchema` is the union the barrel still declares.
123+
const source = readFileSync(BARREL_PATH, 'utf8');
124+
const union = /^export type AnySchema =([^;]*);/m.exec(source);
114125

115126
// The union is still declared (a missing union would make the next two
116-
// assertions vacuous), it no longer names the retired arm, and it still
127+
// assertions vacuous), it does not name the retired arm, and it still
117128
// names a surviving arm — the lit control on the same extracted text.
118129
expect(union).not.toBeNull();
119130
expect(union![1]).not.toMatch(/\bEventableSchema\b/);
120-
expect(union![1]).toMatch(/\bDataFetchableSchema\b/);
131+
expect(union![1]).toMatch(/\bBaseSchema\b/);
121132
});
122133

123134
it('the published BARREL no longer re-exports either symbol', () => {
@@ -129,10 +140,9 @@ describe('objectui#6497 — the event-handler dialect stays retired (type face)'
129140
expect(/^\s*UIEventHandler,\s*$/m.test(barrel)).toBe(false);
130141
expect(/^\s*EventableSchema,\s*$/m.test(barrel)).toBe(false);
131142

132-
// ⭐ LIT CONTROL — the identical matcher finds siblings that ARE still
133-
// re-exported from the same block.
134-
expect(/^\s*DataFetchableSchema,\s*$/m.test(barrel)).toBe(true);
135-
expect(/^\s*APISchema,\s*$/m.test(barrel)).toBe(true);
143+
// ⭐ LIT CONTROL — the identical matcher finds a name that IS still
144+
// re-exported (the block these two sat in went whole, #25921 batch 9).
145+
expect(/^\s*BaseSchema,\s*$/m.test(barrel)).toBe(true);
136146
});
137147
});
138148

@@ -143,16 +153,16 @@ describe('objectui#6497 — nothing in this TRACKED tree carries either symbol',
143153
*
144154
* - `*CHANGELOG.md` and `.changeset/` — the published RECORD of retirements,
145155
* including this one, which must keep naming what it removed.
146-
* - `api-types.ts` and `index.ts` — the two files the retirement EDITED. Each
147-
* carries a tombstone comment naming both symbols on purpose; that they no
148-
* longer DECLARE or RE-EXPORT them is asserted above by matchers shaped for
149-
* a declaration and an export-list entry.
156+
* - `index.ts` — the barrel, which carries the tombstone comment naming both
157+
* symbols on purpose (moved there when #25921 batch 9 deleted
158+
* `api-types.ts`, the other file the retirement edited); that it does not
159+
* DECLARE or RE-EXPORT them is asserted above by matchers shaped for a
160+
* declaration and an export-list entry.
150161
* - this pin, which must write both spellings to probe for them.
151162
*/
152163
const EXCLUDED = [
153164
':!*CHANGELOG.md',
154165
':!.changeset/',
155-
':!packages/types/src/api-types.ts',
156166
':!packages/types/src/index.ts',
157167
':!packages/types/src/__tests__/eventable-schema-retired-6497.test.ts',
158168
];

0 commit comments

Comments
 (0)