Skip to content

fix(types): the @object-ui/types/zod mirrors keep an unknown key instead of silently dropping it - #26019

Merged
objectstack-fleet[bot] merged 14 commits into
mainfrom
claude/project-thread-l29r5s
Oct 26, 2026
Merged

objectstack-fleet[bot] merged 14 commits into
mainfrom
claude/project-thread-l29r5s

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steedos · project thread

Part of #25923 — work item 2 (strip-mode mirrors) only. Items 1 (the flat calendar / gantt keys) and 3 (the options bag, which needs the stored-row census first) stay on the card for later dispatches, and #25923 remains open after this merges.

Clause-②: yes
Metadata-protocol: none

What changed

The @object-ui/types/zod mirrors held strip-mode objects (plain z.object()): a misspelled key parsed green and was silently dropped, so FormFieldSchema.safeParse({ name, type, labell: 'oops' }) succeeded with labell gone, while @objectstack/spec refuses it by name. Every one of them is now .passthrough() (z.looseObject), like BaseSchema already was. The strict authoring face (StrictAnyComponentSchema / deriveStrictAuthoringSchema, what objectui validate uses) is unchanged and still refuses an unknown key by name, so the two faces now disagree only on keep-or-refuse, never on silently dropping.

Re-measured with the card's probe

reading before (base 38050ced) after
*Schema exports of index.zod.ts in strip mode (the card's probe) 67 (the card said 74, the static scan 63) 1
strip-mode object nodes reachable from those exports, local to ui/packages/types 157 3
z.object( call sites in ui/packages/types/src/zod/*.zod.ts converted — 145

The one remaining strip export is HttpRequestSchema, and the three remaining reachable nodes (HttpRequestSchema, the $and/$or/$not filter group, a filter-field object) are all spec-derived clones made by stripImportedDefaults from @objectstack/spec subschemas: they are not authored in this package, HttpRequestSchema is already in the parity file's EXCLUSIONS, and the new census reads source sites, which they are not.

Landing point

As expected by the card: ui/packages/types/src/zod/*.zod.ts (16 files) and ui/packages/types/src/__tests__/zod-mirror-parity.test.ts. No producer lives outside the package.

The guard (beside assertionNoVacuousEntry)

A new describe in zod-mirror-parity.test.ts, "no object in ../zod/ strips an unknown key (objectstack#25923)":

  • an AST census of every z.object / z.looseObject / z.strictObject call in ../zod/, classifying each by its method chain (.passthrough(), .strict(), .strip(), .catchall()), fails on any site whose mode is strip;
  • a non-vacuity pin (more than 100 loose sites, one in form.zod.ts, at least one strict site);
  • a runtime pin that no registered MIRRORS value is an object with an undefined catchall.

It is runtime, not a type-level assertion… like its neighbour, and the docblock says why: zod 4 types $strip and $strict identically, so a type-level "no strip" pin cannot tell them apart (measured: it flagged exactly the five strict entries). This is the existing instrument the card named, not a new gate.

Type-surface consequence, and how the pins absorb it

zod 4 gives a passthrough object's z.input / z.infer a [k: string]: unknown index signature. A declared interface is not assignable to a type carrying one, so the parity file's narrower-direction pin read every nested object member as narrower than its declaration (22 pins went red). The fix is one test-only operator, WithoutCatchall (ui/packages/types/src/__tests__/zod-catchall-type.ts), which removes exactly that signature (an index signature of unknown on an object that also has literal keys) and is the identity everywhere else. It is applied to the narrower direction only (AcceptedOf), so the wider direction still compares the raw input. KnownDrift moves from 55 entries / 93 keys to 53 / 90: AppSchemaRendererNodeSchema and ReportSectionSchema leave the ledger, DashboardWidgetSchema and ReportComponentSchema change their keys, each with a "LEFT / JOINED under objectstack#25923" note.

Downstream: pnpm exec turbo run type-check --filter='...@object-ui/types' was 112/112 tasks green with the passthrough mirrors.

Held back: the FormField index signature in form.ts

The card also recommends dropping FormField's [key: string]: any. It was measured on this branch and reverted, because it breaks consumers outside this dispatch's file surface:

  • @object-ui/components src/renderers/form/form.tsx lines 1884, 1959, 2055, 2195, 3228: FormField is not assignable to FieldWithDeclaredDefault (index signature missing);
  • @object-ui/plugin-form src/ObjectForm.tsx:1068 writes group, which FormField does not declare; src/WizardForm.tsx:845, the same FieldWithDeclaredDefault error;
  • @object-ui/plugin-grid src/ObjectGrid.tsx lines 5963 and 6016, plus the type-check cascade of every package depending on those.

Removing a published index signature also narrows what a TypeScript caller may write on FormField, so it is a (narrowing) Clause-② change on its own. It is reported to the seat as an open question rather than folded in here; form.ts is unchanged in this PR.

File surface beyond the claim

The claim named the strip-mode zod files, form.ts, the parity test and one changeset. The diff also touches:

  • ui/packages/types/src/__tests__/zod-catchall-type.ts (new, test-only; excluded from the build) and five sibling type tests that compare z.input with a declaration and now read it through the same operator (ai-zod-arms-10859, designer-zod-arms-10859, registered-type-arms-10859-b2, sort-string-arm-retired-8221, base-schema-predicate-envelope-7530);
  • 18 ui/packages/types tests that pinned the old strip behaviour ("the unknown key is dropped") and now pin passthrough ("the key is kept and still not refused"), each with a comment citing objectstack#25923;
  • two consumer tests that used the strip as their measuring instrument ("parse and see which keys survive"), now measured with the strict twin (deriveStrictAuthoringSchema), which refuses an undeclared key by name: ui/examples/schema-catalog/test/component-fixture-declared-keys.test.ts and ui/packages/plugin-kanban/src/__tests__/columnCollapsedHonoured-9628.test.tsx;
  • scripts/sdui-manifest.record.json: the registry-source digest moves because the registry sources changed; sdui.manifest.json itself is byte-identical.

Each of these is a consequence of the mirrors no longer stripping; none changes runtime code outside ui/packages/types/src/zod/.

Verification

All on the final head 0d70f7e3 (branch merged with main at 6a6ebff9); tests and type-checks ran under scripts/pm/os-verify-lock.sh:

  • pnpm --dir ui exec vitest run --maxWorkers=2 packages/types/ plus the 120 ui/ test files that import @object-ui/types/zod or a mirror schema: 510 files, 12867 tests, all passed. Before the two instrument tests moved to the strict twin, that consumer set read 118 passed, 2 failed (5 tests). The full consumer battery is CI's.
  • pnpm --filter @object-ui/types type-check: exit 0. Downstream turbo run type-check --filter='...@object-ui/types': 112/112 tasks successful (pre-merge head); @object-ui/plugin-kanban and @object-ui/example-schema-catalog type-check clean after the test edits.
  • The derived gate union (node scripts/pm/dispatch-gates.mjs --commands, 46 commands): all exit 0, reconciled with --ran: 46 derived, 46 run, 0 NOT-MEASURED, 0 UNRUN.

Acceptance notes

  • Spec-owned strip nodes: the reachability walk also counts 18 strip-mode object nodes inside @objectstack/spec subschemas that the mirrors import by reference. They are the spec's, not this package's, and are out of scope here.
  • exportConfigs residue: WithoutCatchall does not walk into an object that has no catchall of its own (a partial record keyed by export format), because walking those was measured to hit TS2589 on the node tree. The residue is ledgered in KnownDrift on ReportComponentSchema, ReportBuilderSchema and ReportViewerSchema.
  • ObjectForm.tsx:1068 writing an undeclared group key on a FormField is only visible once the index signature goes; it belongs to the FormField follow-up above.

Serial note: #25926 waits for this PR, because both edit ui/packages/types/src/zod/base.zod.ts.


Generated by Claude Code

…oseObject at 145 sites

Claude-Session: https://claude.ai/code/session_01UDxCk99USU7v77odNZ66qE
Co-authored-by: Claude <noreply@anthropic.com>
…ll; pin no strip-mode object

Claude-Session: https://claude.ai/code/session_01UDxCk99USU7v77odNZ66qE
Co-authored-by: Claude <noreply@anthropic.com>
Two consumer tests used a strip-mode mirror's silent key drop as their
instrument ("call .parse and see what survives"). The mirrors are
passthrough since objectstack#25923, so every key survives a parse; the
tests now ask deriveStrictAuthoringSchema(...) whether a key is declared,
which refuses an undeclared key by name.

Claude-Session: https://claude.ai/code/session_01UDxCk99USU7v77odNZ66qE
Co-authored-by: Claude <noreply@anthropic.com>
The registry sources changed under objectstack#25923 (the zod mirrors are
passthrough); the generated sdui.manifest.json is byte-identical, only the
source digest in the record moves.

Claude-Session: https://claude.ai/code/session_01UDxCk99USU7v77odNZ66qE
Co-authored-by: Claude <noreply@anthropic.com>
…rip-mirrors

# Conflicts:
#	scripts/sdui-manifest.record.json
`[T] extends [{}]` tripped @typescript-eslint/no-empty-object-type in
Lint UI. `keyof unknown` is `never` while `keyof any` is not, so the
operator reads the same without it.

Claude-Session: https://claude.ai/code/session_01UDxCk99USU7v77odNZ66qE
Co-authored-by: Claude <noreply@anthropic.com>
…rip-mirrors

# Conflicts:
#	scripts/sdui-manifest.record.json
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract review

Served-tier: TIER_DEFAULT
Head-sha: dd1658543998bae532198e94748565891623f602
Local-runs: none

Face: declaration (reviewFace on the 45-file list: no published-schema path, no governed path, no narrowing declared). Reviewed in seat by the lane seat, per contract-review.md.

① Derived judgments

  • Accept set (right). 145 strip-mode z.object() sites in ui/packages/types/src/zod/*.zod.ts become z.looseObject. Strip mode already accepted an unknown key, so nothing that parsed before is refused now. What changes is the output: the unknown key is kept instead of dropped. The strict authoring face (StrictAnyComponentSchema / deriveStrictAuthoringSchema) is untouched and still refuses an unknown key by name.
  • Public type surface (right, disclosed). The z.input / z.infer types of the converted objects gain zod's [k: string]: unknown index signature. That makes a declared-interface value no longer assignable to a variable typed by one of these inferred types. The changeset names this and gives the fix. Downstream type-check over ...@object-ui/types was 112/112 green, so no in-repo consumer relies on the old shape.
  • Remaining strip nodes (right). The one strip export left, HttpRequestSchema, and the two other reachable nodes are spec-derived clones made by stripImportedDefaults, not authored here; HttpRequestSchema is already in the parity EXCLUSIONS.
  • Guard (right). The new zod-mirror-parity.test.ts block censuses every object call site by its method chain and fails on strip, with non-vacuity and runtime pins. It is runtime rather than type-level for the stated reason (zod 4 types $strip and $strict alike).
  • Test-only operator (right). WithoutCatchall removes only an unknown index signature beside literal keys and is applied on the narrower direction only, so the wider direction still compares the raw input. KnownDrift 55/93 → 53/90, each move noted.

② Semver level

@object-ui/types patch, Clause-②: yes and Metadata-protocol: none line-initial on the PR body and the changeset. No packages/spec path. Patch matches: no runtime input is refused, and the type consequence is disclosed with a fix.

③ Boundary flags

Implemented-by: claude/project-thread-l29r5s
Reviewed-by: session_01RyMY3prh9GRva1Tt37Di3i

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

席位核对

ACCEPT · domain:spec seat 2 · 2026-10-26T10:26Z · head dd1658543998bae532198e94748565891623f602

  1. Shape. Draft, base main, Part of #25923 (work item 2 only; items 1 and 3 and the FormField follow-up stay on the card). 45 files, +567/−276. check-governed-merges --pr 26019: NOT governed.
  2. Premise and stop conditions. The premise held: the mirrors had strip-mode objects that dropped a misspelled key silently. The card's probe reads 67 strip exports before and 1 after (HttpRequestSchema, a spec-derived clone already excluded). The file surface widened as measured and the claim was amended (6410175297).
  3. Gates (check-runs pinned to this head). 61 runs: 54 success, 7 skipped, 0 failed. check-expected-skips --pr 26019: OK.
  4. Contract review. PASS at TIER_DEFAULT (face declaration), comment 6413760984, reviewed in seat.
  5. Prose checked against the diff. Changeset: "Nothing new is refused" holds (strip already accepted unknown keys); "the inferred z.input / z.infer types … gain zod's [k: string]: unknown index signature" holds for every converted object; "Guard" names the new parity block, which exists and fails on a strip site.
  6. Open question. Ruled A on the card (6412606977): FormField keeps its index signature here; the narrowing waits for a follow-up, which is not dispatched while the lane's token hold lasts.
  7. Serial constraint. types,react,skills,docs: retire the node-level visibility dialects visibleOn / hiddenOn / disabledOn / visible and teach only visibleWhen #25926 starts after this PR merges (both edit base.zod.ts); it is not dispatched while the hold lasts.
  8. Landing. Ready plus auto-merge.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 26, 2026 10:27
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 26, 2026
…rip-mirrors

# Conflicts:
#	scripts/sdui-manifest.record.json
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract review

Served-tier: TIER_DEFAULT
Head-sha: d061690bfc558ae1f004166988b7adebffd21c50
Local-runs: none

Face: declaration, reviewed in seat. This head re-judges the PR after a merge-forward; the previous record is 6413760984 on dd165854. A Regen-provenance: carry does not certify this hop: scripts/sdui-manifest.record.json carries no merge=os-regen attribute, so unexplainedPathsBetween reads it as a hand edit.

① Derived judgments

The PR's own diff against main is unchanged except scripts/sdui-manifest.record.json (+1/−1: the registry-source digest, re-recorded after taking main's side; sdui.manifest.json byte-identical). Every judgment in 6413760984 stands: the 145 strip sites are loose, nothing new is refused, the inferred-type index signature is disclosed, the strict authoring face is untouched.

② Semver level

Unchanged: @object-ui/types patch, Clause-②: yes, Metadata-protocol: none.

③ Boundary flags

No new flag. Check-runs on this head: 54 success, 7 skipped, 0 failed.

Implemented-by: claude/project-thread-l29r5s
Reviewed-by: session_01RyMY3prh9GRva1Tt37Di3i

VERDICT: PASS

@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 26, 2026
…rip-mirrors

# Conflicts:
#	scripts/sdui-manifest.record.json
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract review

Served-tier: TIER_DEFAULT
Head-sha: a444f224f1b03785ce33c911a23c7a126849b85d
Local-runs: none

Face: declaration, reviewed in seat. This head re-judges the PR after a second merge-forward (origin/main at cc378e93); the previous records are 6413760984 on dd165854 and 6415326091 on d061690b. A Regen-provenance: carry does not certify this hop: scripts/sdui-manifest.record.json carries no merge=os-regen attribute, so unexplainedPathsBetween reads it as a hand edit.

① Derived judgments

The PR's own diff against main is unchanged except scripts/sdui-manifest.record.json (+1/−1: the registry-source digest, re-recorded after taking main's side; sdui.manifest.json byte-identical). Every judgment in 6413760984 stands: the 145 strip sites are loose, nothing new is refused, the inferred-type index signature is disclosed, the strict authoring face is untouched.

② Semver level

Unchanged: @object-ui/types patch, Clause-②: yes, Metadata-protocol: none.

③ Boundary flags

No new flag. Check-runs on this head: 54 success, 7 skipped, 0 failed.

Implemented-by: claude/project-thread-l29r5s
Reviewed-by: session_01RyMY3prh9GRva1Tt37Di3i

VERDICT: PASS

@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 40325012039 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Test UI (16/16) — 失败步骤: Run the ui tests (shard 16/16)

    × reads null under this test setup, which bakes no VITE_APP_VERSION 7ms
    FAIL   unit  packages/app-shell/src/__tests__/buildIdentity-12970.test.ts > resolveConsoleBuild: the console build identity (objectui#12970) > reads null under this test setup, which bakes no VITE_APP
      ↳ 失败原因: AssertionError: expected '1bbb7bf490' to be null
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

  • packages/app-shell/src/__tests__/buildIdentity-12970.test.ts — 24h 窗口内只有本 PR 撞到过,暂不汇总(再有一个不同 PR 撞到就会自动开汇总 issue)。
  • ⚠️ 24h 评论账本没读完(超过 5 页仍未读到窗口尽头),所以上面的「不同 PR 数」是下界,不是全量。

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 30 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

Merged via the queue into main with commit 1bbb7bf Oct 26, 2026
61 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-l29r5s branch October 26, 2026 13:02
os-elon-musk pushed a commit that referenced this pull request Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants