Uh oh!
There was an error while loading. Please reload this page.
build(types): type-check this package's tests, so the spec-derivation guards actually run (objectstack#4074) - #3009
Merged
Merged
Conversation
…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
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
os-zhuang
marked this pull request as ready for review
July 30, 2026 10:18
Uh oh!
There was an error while loading. Please reload this page.
os-zhuang added a commit
that referenced
this pull request
Jul 30, 2026
… the spec's declaration forms, ListViewSchema stops promising phantom defaults (objectstack#4074) (#3020) Three public types said something different from what the platform accepts, found by making packages/types' tests compile (#3009) and resolving the declared p1-spec-alignment.test.ts debt site-by-site. ActionParam is now the AUTHORING shape, aligned with the spec's input: name/label/type optional, field/objectOverride added. The spec's primary declaration form — a bare field reference inheriting label/type/validation/ options from an object field — was unrepresentable while all three were required. The RESOLVED shape the dialog consumes (after app-shell's resolveActionParams() inlines the reference) remains core's ActionParamDef, all three required: authoring and resolved are different types on purpose. label is the spec's I18nLabel by import — which the new compile-time guard promptly revealed to be aliased to plain string in the current spec, so no behavioural widening today; importing the alias means objectui tracks any future widening automatically. ListViewInferred is z.input, not z.infer. The spec sub-schemas flowing into the list-view surface (userActions, tabs→ViewTab, sharing) carry .default()s, so the inferred output type made userActions.refresh or a tab's pinned/visible REQUIRED — but nothing on the render path runs .parse(): normalizeListViewSchema deliberately applies no defaults ("an absent flag stays absent", its own suite). The output type rejected valid authored metadata while promising renderers defaults that never arrive; input matches both author and runtime. FormField.dependsOn is DependsOnInput. The runtime reader (resolveCascadingOptions) has always accepted a bare name, a list of names, or {field, param} entries; the public property said string, so array-authored metadata type-errored while working and the form renderer read the key through (f as any).dependsOn to get past its own type. The shape now lives in @object-ui/types next to FormField; core imports and re-exports it; the two as-any reads in components are typed. The p1-spec-alignment.test.ts exclusion is gone — its 14 errors resolved: the "sharing in ObjectUI format" and legacy-ARIA fixtures are re-seated as normalizer-input dialects (folded by normalizeListViewSchema; asserted branch-by-branch in core's normalize-list-view.test.ts, the seam where the fold runs), and the one fixture no surface ever admitted (an ObjectQL triplet as a spec ViewTab.filter) is corrected to the rule-object form. Every test file in @object-ui/types is compiled, no exclusions. Discrimination-checked: reverting ListViewInferred to z.infer, dependsOn to string, or ActionParam.name to required each fails compile in the now-compiled tests (TS2739 / TS2322 / TS2741); restored, all projects clean. Claude-Session: https://claude.ai/code/session_014DBMo8gnFduzgpuSHd5Eje Co-authored-by: Claude <noreply@anthropic.com>
3 tasks
os-zhuang added a commit
that referenced
this pull request
Jul 31, 2026
…engine stops disagreeing with the server (#3103) (#3107) Five rule types in `data-protocol.ts` were hand-written interfaces labelled `(ObjectStack Spec v2.0.1)` while the installed spec was 17.0.0-rc.0. Nothing bound them to the spec, so fifteen majors of drift accumulated with `tsc` silent and the comment still vouching for it — the planted-premise failure class objectstack#4115 was filed for. They are now `z.input` derivations of the spec's schemas. `z.input`, not `z.infer`: objectui consumes AUTHORED metadata off `/meta`, before the spec's defaults and ExpressionInput canonicalization run, so `condition` really is `string | {dialect, source}` and `active`/`events`/`priority` really can be absent. What the copies had drifted into, and what each cost the user — the engine is a client PRE-CHECK of rules `objectql/src/validation/rule-validator.ts` enforces, so every one of these is a disagreement with the authority: - Predicate POLARITY was inverted. The server violates a rule when the predicate is TRUE; the engine violated it when FALSE. Every spec-authored `script`/`cross_field` rule got the opposite verdict. - `conditional` read `condition` + `rules[]` where the spec says `when` + `then`/`otherwise` → silent no-op, and `otherwise` never ran at all. - `format` read `pattern` where the spec says `regex` → `undefined.test()` threw into a catch that reported a VIOLATION, blocking writes the server accepts. - Envelope-valued conditions hit `expression.trim()`, threw, and read as "passes" → silent no-op. - An absent `active` disabled the rule; an absent `events` threw. Both arrive absent because the spec defaults them at parse time. - `initialStates` (objectstack#3165) and `priority` were missing entirely; `events: 'delete'` was still advertised after objectstack#3184 retired it. `unique`/`async`/`range` have no spec counterpart — the spec removed the first two deliberately (uniqueness → a unique index, since SELECT-then-INSERT is racy; async → the form layer) — and are now @deprecated, with a test proving the spec's union rejects them, so the comment is load-bearing rather than decorative. Gates, each mutation-tested: the compile-time pins in `validation-rule-spec-parity.test.ts` (live because tsconfig.test.json compiles it, #3009) go TS1360 when a derivation is reverted, and the engine suite goes red for polarity, envelope coercion, `otherwise`, `initialStates` and the spec defaults. `ConditionalValidation.then/otherwise` carry one pinned divergence — the spec's published types erase them to `unknown` (objectstack#4171) — with an inverted pin that fails the day upstream fixes it. Canonicity now rides on the import and the gate, not the comment: `grep "Spec v2.0.1" packages/types/src/data-protocol.ts` is empty, and objectstack#4115's ledger drops 120 -> 115. Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
akarma-synetal pushed a commit
to akarma-synetal/objectui
that referenced
this pull request
Aug 3, 2026
…assertions (objectstack-ai#3181) (objectstack-ai#3187) The file's `type _X = Assert<Equal<A, B>>` lines were never read by any compiler. `packages/app-shell/tsconfig.json` is the BUILD config and excludes `**/*.test.ts`; CI's only type gate drives that config (`pnpm type-check` -> turbo -> per-package `tsc --noEmit`), eslint is not type-aware, and vitest erases types before it runs. A provably-false `Assert<Equal<1, 2>>` appended to the file passed `pnpm type-check` at exit 0 — the same "declared != enforced" landmine the file's own header cites objectstack-ai#3009 for. Adds `packages/app-shell/tsconfig.typetests.json`: an emit-free project with an EXPLICIT include list (not a glob), chained from the package's `type-check` script so it runs in the existing CI `Type Check` job. The list is explicit because app-shell's wider test tree still has a pre-existing error backlog, already declared as TEST_DEBT — a glob would sweep that in and the project would get deleted rather than fixed. That backlog stays tracked in objectstack-ai#3181. `scripts/check-type-check-coverage.mjs` grows the matching ratchet: a `tsconfig.typetests.json` that `type-check` does not chain, that emits, or that includes no test file is now a hard failure, so this gate cannot go quiet the same way the assertions did. Claude-Session: https://claude.ai/code/session_012C2cd7tL8QDoZ2QKN3djJ5 Co-authored-by: Claude <noreply@anthropic.com>
This was referenced Aug 8, 2026
Merged
akarma-synetal pushed a commit
to akarma-synetal/objectui
that referenced
this pull request
Aug 10, 2026
…dy forwards (objectstack-ai#3309) (objectstack-ai#3772) `BulkActionParam.options` 的 entry 之前是封闭的 `{ label, value }`,而这条路径上 其余三层都不同意它: - 运行期 `bulkParamToField` 把每个 entry 整体 spread 进交给 widget 的 field metadata(`{ ...o, value: String(o.value) }`),额外键全部存活; - 目的地 `SelectOptionMetadata` 声明了 `color` / `icon` / `disabled` / `visibleWhen`,`@object-ui/fields` 确实在读(`option?.color` 两处); - `@objectstack/spec` 的 `BulkActionParamSchema` 已把同一个 entry 转成 `.passthrough()`(objectstack#4001,维护者裁决 A),服务端照收; - 它自己的父级 `BulkActionParam` 一直有 `[key: string]: unknown` 兜底注释。 于是作者写 `options: [{ label, value, color: '#8B5CF6' }]` 会拿到一个 excess-property 编译错误,而渲染器其实会 honour 它 —— 类型是唯一在拒绝一份能 正常工作的配置的那一层。今天不是运行期 bug,但这是 machine-readable surface 说谎的形状,对绝对信任类型的(AI)作者杀伤最大。 按 objectstack-ai#3559(PR objectstack-ai#3764)先落地的那一半已经定下的惯用形处理:给 entry 补 `[key: string]: unknown`,注释沿用父级 catch-all 的写法。⛔ 不动 `SelectOptionMetadata`,不把 `objectql.ts` 绑到 `field-types.ts`。**没有**改成 引用 core 的 `ActionParamOption`:`@object-ui/types` 是协议层、不吃 workspace 依赖(AGENTS.md §3 拓扑),因此是结构等价的 inline entry 加一条交叉引用注释。 `label` / `value` 保持必填且类型不变 —— open 不等于 optional;兜底也不是新增 选项键的邀请函,authoring gate 仍是 spec 的严格 `SelectOptionSchema`。 新增 `packages/types/src/__tests__/bulk-action-param-options.test.ts` 钉住四件事: 带 `color`/`visibleWhen` 的 entry 通过编译;`label`/`value` 仍必填(两条必须命中 的 `@ts-expect-error`);entry 经渲染器自己的投影后仍落进 `SelectOptionMetadata` (无需 cast);spec 侧 `.passthrough()` 这个前置事实被断言而非假定。这些钉子是 真会跑的 —— `packages/types/tsconfig.test.json` 编译本包每个测试文件(objectstack-ai#3009)。 Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt Co-authored-by: Claude <noreply@anthropic.com>
akarma-synetal pushed a commit
to akarma-synetal/objectui
that referenced
this pull request
Aug 10, 2026
…objectstack-ai#3997) (objectstack-ai#4012) 第四个字段原子,与 PR objectstack-ai#3996 修掉的 `_shared.tsx` 三个原子形状完全相同 —— `Label` 是控件的兄弟节点,没有 `htmlFor`,trigger 没有 `id` 也没有 `aria-label`。 它在自己的模块里,所以那三个修好之后它仍旧带着缺陷。标签与 `button[role=combobox]` 之间只有视觉邻接:焦点落上去读到匿名 combobox,可见标签是 一段无归属文本,`getByLabelText` 到不了它,点标签什么都不会发生。非测试调用点 18 处 (对象字段 / 数据集 / 仪表盘部件 / 应用导航 / 视图变体检查器),打开任一面板即渲染。 带 label 分支照 objectstack-ai#3994 的定型机制闭合:`React.useId()` 在原子内部生成 id,`Label` 补 `htmlFor`,id 落到 `PopoverTrigger asChild` 渲染出的那个 `Button`。⛔ 不落 `Popover` —— Radix `Popover.Root` 是纯 context provider,不渲染 DOM,给它的 id 会被静默丢弃、 `for` 随之悬空(objectstack-ai#3976 / objectstack-ai#3994 已为此付过两次学费)。 ## 无 label 分支:命名改成类型级要求,而不是消费端兜底 `label` 原本可选,无 label 分支是同缺陷更重一档 —— combobox 完全无名,而 18 处调用点 里有 5 处正是这么写的。没有采用宽松兜底(用 placeholder 合成名字会把「Select…」念成 字段名);改为「三条通道恰选其一」,零条和两条都不可编译: - `label` —— 原子渲染可见标签并自持关联。已传 label 的 13 处不变。 - `ariaLabel` —— 重复行里本就没有可见标签、加一个会破坏栅格:应用导航 URL 过滤条件的 `field = value` 行、数据集的 join 列表、依赖查找的「添加字段」选择器。 - `id` —— 外部 `Label htmlFor` 已经持有命名。`DashboardWidgetInspector` 的 `Field` 包装器渲染 `Label htmlFor={id}` 并把同一个 id 交给被包控件,其余字段都履行了这个约定 (`Input id`、`SelectTrigger id`),只有 dataset combo 落不下去,因为原子不收 id —— 那个 `for` 指向一个没有任何元素持有的 id,是悬空 IDREF,比无标签更糟,因为工具会报告 一个解析不到的关联。 两条通道同时给出是 objectstack-ai#3961/objectstack-ai#3978 要避免的重复播报,故也一并禁掉。两种错误都没有组件能 自行发现并报告的运行期症状 —— 无名 combobox 渲染、布局、提交值全都正常,只对看不见它 的用户是错的 —— 所以检查只能发生在编写期,否则就不存在。 ## 钉子与反向验证 - `_shared.labels.test.tsx`:第四原子直接加入既有的 `describe.each`(它已把「for 有 宿主 / 命中可聚焦控件 / 可访问名 / 单一命名通道 / 多实例不撞车」写成与组件无关的形 状),另加 trigger 落点、自定义值、`ariaLabel` 分支、外部 `id` 分支四组。 - `DashboardWidgetInspector.test.tsx`:真实调用点上钉 Dataset 标签解析到 combo trigger。 刻意只锁这一对,不做整面板「无悬空 for」扫描 —— `widget-color` 的 `ColorVariantPicker` 同样不收 id,那是另一个组件、本单范围外,已单独立单 objectstack-ai#4010。 - `InspectorComboField.naming.types.test.tsx`(新增,列入 `tsconfig.typetests.json`): 类型级断言。第一稿把 `@ts-expect-error` 写在 `_shared.labels.test.tsx` 里,变异实测 显示那是**假绿** —— 把命名改回可选,`tsc --noEmit` 完全通过,因为包的构建 tsconfig 排除 `**/*.test.tsx`、vitest 又擦除类型,没有任何编译器读它。这正是 objectstack-ai#3009 的失效模式, 故移入被 typetests 项目编译的独立文件;同一变异现在报 6 条错(4 条 assignability 断言 + 2 条 unused `@ts-expect-error`)。 反向验证三向(先预判后跑,变异未提交):撤 `htmlFor` → combo 8 行翻红,其中「mints exactly one owner for the id」按预判保持绿(id 还在,只是没人指向它);id 改落 `Popover` Root → 11 行翻红(多出 owner 计数、外部 id 分支、真实调用点钉);命名改回可选 → 运行期 全绿、信号只在 typetests。 Fixesobjectstack-ai#3997 Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt Co-authored-by: Claude <noreply@anthropic.com>
This was referenced Aug 10, 2026
This was referenced Aug 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #3003. While correcting a comment there I measured something worth its own change:
spec-derived-unions.test.ts— the file that exists to stop a spec-derived union from being re-forked into a hand-written copy — was not being compiled by anything.Measured, not assumed
Its header claimed the
satisfieschecks in it "are the real enforcement". RevertingActionParamFieldTypefrom the spec'sFieldTypeback to a hand-written subset:tscoutputTS1360on thesatisfieslinetsconfig.jsonexcludes test files — correctly, since it is the package build (rootDir/composite/declaration), so tests would emit intodist— and no othertscinvocation read them. There is no vitesttypecheckproject either.The sibling guards over
ChartType,ReportType,ActionTypeandPageTypewere inert for the same reason, so the anti-regression mechanism left behind by #2944 / #2901 was not running in CI. Those forks were each already drifted once when they were found; nothing would have caught a second drift.The fix
packages/types/tsconfig.test.json, chained from the package'stype-checkscript — the shape this package already uses fortsconfig.examples.json: a separate, emit-free project.Kept separate rather than deleting the exclude, for a reason that matters: the reexport guard scans sibling sources off disk, so it needs
types: ["node"]. Folding that intotsconfig.jsonwould let package source reference Node APIs and still compile, in a package that ships to browsers.The 39 pre-existing errors it surfaced
p2-spec-exports.test.ts— 22. It imported eight…Schemanames as types from../index. #2561 decision (a) removed exactly those, and the siblingspec-ui-schema-reexports.test.tsasserts 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 fixtures were also typed as parsed output while being parse input — these schemas
.default()several fields, so{ enabled: true }is valid input but the output type requires them. They now usez.input<>, the distinction spec draws itself withActionInput. Same story foroperator: 'eq': a legacy alias spec folds at parse time, valid as input and absent from the canonical output union. The value-type re-exports this file exists to pin are now asserted explicitly, instead of incidentally through fixture annotations.app-creation-types.test.ts/system-fields.test.ts— 3. They imported the package by its own name.turbo'stype-checktask isdependsOn: ["^build"](upstream only), so the package's owndistdoes not exist when it runs. They now use the relative import all 13 sibling tests use.p1-spec-alignment.test.ts— 14, declared as debt rather than fixed. Excluded intsconfig.test.jsonwith a written reason, because these are not hygiene. Every one sits in a test namedshould accept <shape>whose entire purpose is asserting the type accepts that shape — and the type rejects it:ListViewSchema.sharingis{ type, lockedBy }. The legacy shape is real and is handled —foldSharingin core'snormalize-list-view.tsfoldsvisibility/enabledinto the spec'sViewSharing.type— but only as untyped input (normalizeListViewSchema<T>(schema: T): T), so no type names it. That is the same "implementation wider than the type" shape asexecute(objectstack#3856),navigation(#2944) and the param aliases (#3003).Each of the 8 sites is a separate decision — widen the type so the claim becomes true, or drop the claim — and several touch the public surface. Rewriting them silently while landing the plumbing would bury the finding, so they are tracked on objectstack#4074.
Scope
Deliberately narrow: only
packages/types, where the spec-derivation guards live. 28 other packages still exclude their tests; 5 (fields,cli,data-objectstack,plugin-charts,plugin-editor) already include them, so this establishes a pattern that is already load-bearing elsewhere rather than sweeping the repo.This also corrects an overstatement in #3003, which said every package tsconfig excludes tests. It is 33 of 41.
Verification
TS1360. Zero errors before.pnpm type-check— 76/76 tasks.pnpm vitest run— 717 files / 8380 tests passed, 1 file / 24 skipped.packages/types: all three tsconfig projects clean; 16 files / 246 tests.eslint packages/types/src— 0 errors (249 pre-existinganywarnings, none from this diff).node scripts/check-changeset-fixed.mjs— clean.Changeset is
patch: no public API changes, only build config and tests.Refs objectstack#4074, #3003, #2561, #2944, #2901, #2911
Generated by Claude Code