You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
build(types): type-check this package's tests so the spec-derivation guards actually run (objectstack#4074)
`spec-derived-unions.test.ts` exists to stop a spec-derived union from being
re-forked into a hand-written copy, and its header claimed the `satisfies` checks
in it "are the real enforcement". They were not. `tsconfig.json` excludes test
files — correctly, since it is the package build with `rootDir` / `composite` /
`declaration`, so tests would emit into dist — and no other `tsc` invocation read
them.
Measured, not assumed: reverting `ActionParamFieldType` from the spec's
`FieldType` back to a hand-written subset produced ZERO type errors before this
change, and now produces TS1360 on the `satisfies` line. The sibling guards over
`ChartType`, `ReportType`, `ActionType` and `PageType` were equally inert, so the
anti-regression mechanism left by #2944/#2901 was not running in CI.
`tsconfig.test.json` follows the shape this package already uses for
`tsconfig.examples.json`: a separate, emit-free project chained from `type-check`.
Kept separate rather than deleting the exclude so the BUILD stays honest — the
reexport guard's source scan needs `types: ["node"]`, and folding that into
`tsconfig.json` would let package SOURCE reference Node APIs and still compile,
in a package that ships to browsers.
Turning it on surfaced 39 pre-existing errors in test files. Fixed:
- `p2-spec-exports.test.ts` imported eight `…Schema` names as types from
`../index`. #2561 decision (a) removed those and the sibling
`spec-ui-schema-reexports.test.ts` asserts their absence, so this file
contradicted its own guard for the whole interval — a type-only import of a
nonexistent name erases at runtime, so the suite stayed green. Its minimal
fixtures were also typed as parsed OUTPUT while being parse INPUT (these
schemas `.default()` several fields); they use `z.input<>` now, the distinction
spec draws itself with `ActionInput`. `operator: 'eq'` is a legacy alias spec
folds at parse time — valid input, absent from the canonical output union. The
value-type re-exports the file exists to pin are now asserted explicitly
instead of implicitly through fixture annotations.
- `app-creation-types.test.ts` / `system-fields.test.ts` imported the package by
its own name; turbo's `type-check` dependsOn `^build` (upstream only), so the
package's own dist does not exist when it runs. They use the relative import
every sibling test uses.
Declared as debt rather than fixed: `p1-spec-alignment.test.ts` is excluded with
a written reason. Its 14 errors are not hygiene — every one sits in a test named
"should accept <shape>" whose whole purpose is asserting the type accepts that
shape, and the type rejects it. The clearest case, sharing as
`{ visibility, enabled }`, describes a shape that IS handled by `foldSharing` in
core's `normalize-list-view.ts`, but only as untyped input
(`normalizeListViewSchema<T>(schema: T): T`), so no type names it. Each site is a
separate decision — widen the type so the claim becomes true, or drop the claim —
and several touch the public surface, so rewriting them silently here would bury
the finding.
Scope is deliberately narrow: only `packages/types` is converted. 28 other
packages still exclude their tests, and 5 (`fields`, `cli`, `data-objectstack`,
`plugin-charts`, `plugin-editor`) already include them. This establishes the
pattern rather than sweeping the repo.
Refs objectstack#4074, #3003, #2561, #2944, #2901, #2911
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014DBMo8gnFduzgpuSHd5Eje
0 commit comments