Skip to content

fix(metadata-protocol)!: drop an explained union head from a refused save's issues only when it is zod's bare "Invalid input" - #35520

Merged
objectstack-fleet[bot] merged 8 commits into
mainfrom
claude/issue-35400-drop-explained-union-wrapper
Nov 19, 2026
Merged

objectstack-fleet[bot] merged 8 commits into
mainfrom
claude/issue-35400-drop-explained-union-wrapper

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread

repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me

Fixes #35400

Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — no skill or doc teaches the order of a refused metadata save's issues, or its union entry (searched skills/ and content/docs/ for invalid_union, "Invalid input", issues[0] and "strictly additive"; the hits describe the data API's fields[] and the UI CLI's validate report, both unchanged here)

维护者速读

  1. 设计器、接口或 AI 助手保存元数据被拒时,清单里那句什么都没说的「输入无效」不再排在真正原因前面,第一条直接指出是哪个键错了;自带修法说明的条目照旧保留。
  2. 这是巡检发现的「视图或表单保存被拒时,清单第一行是一句空话」的问题,按您两次裁定的范围执行:每一层都去掉,但只去真正空的那句。
  3. 出错时,设计器约 25 个字段在保存被拒后少一行「输入无效」红字(多数在作者下次改动后恢复,表单另开一张单改),按第几条读清单的外部调用方会读到另一条;不丢数据也不影响权限,回退代码即可恢复,但发版后回退等于接口再变一次。
  4. 无。

What changes

  • The rule (collectMetadataIssues, packages/metadata-protocol/src/protocol-metadata-issues.ts): a union's own entry (the head) is dropped only when BOTH hold: the branch expansion appended at least one entry, and the head's message is exactly zod's default for a failed union. Every other head stays, ahead of what it explains: a head carrying the schema's own sentence (the template slot's sentence telling the author to write a template string, an action's confirmText sentence, a view's retirement prescription), a head nothing below explains (every branch a bare kind mismatch, zod's empty errors, the depth bound), and every container head (invalid_key, invalid_element). This narrows the round-1 WIP (b277779bd0), which dropped every explained head whatever its message.
  • One named constant for the compared text, ZOD_UNION_DEFAULT_MESSAGE (module-level export, not re-exported by protocol.ts), pinned against a real zod parse (plain z.union and the real view schema), so a zod rewording fails a test instead of silently turning the drop off.
  • Texts that became false move here: the producer's entry-rule docblock (and the WIP's "carries no prescription" line, measured false), the zodIssuesToMetadataIssues docblock, and the read-path comment in metadata-diagnostics.ts that said the union entry stays first.
  • All four callers move together (save 422 INVALID_METADATA, read _diagnostics.errors, seed-request refusal, unmanaged-import 400): they share the one producer.
  • Changeset .changeset/metadata-issues-bare-union-head.md: patch, both declaration lines, BREAKING banner, a was/now table, "read entries by path and code, not by index", one ADR-0087 marker (not-required (no-migration-prescription); the gate accepted it), what stays, the deliberate asymmetry, and the known regression below.
  • The asymmetry, recorded in union-branch-policy.cross-package-parity.test.ts: this envelope drops an explained bare head; the terminal renderer keeps it as its parent row; the data API's fields[] keeps it as invalid_shape (data API refusal: fields[] lists the union head as an "Invalid input" invalid_shape entry ahead of the entries that explain it (sibling of #35400) #35433 tracks it). §2 still compares branch selection across all three walks, with exactly those heads projected out of the two spec walks; §4 asserts the asymmetry itself and that an unexplained bare head is kept by all three.
  • Not here: no ui/ change (Studio's form rows are Studio form: a refused save marks a field row only when an issue's path equals the row's key, so nested causes (label.xx, visibleWhen.*, columns.N.*) leave the row unmarked (form side of #35400) #35499) and no change to packages/spec/src/api/zod-issues-to-fields.ts (data API refusal: fields[] lists the union head as an "Invalid input" invalid_shape entry ahead of the entries that explain it (sibling of #35400) #35433).

Known regression, until #35499 lands. Studio's metadata form draws a refusal's entry on a field row only when the entry's path equals the row's key. On about 25 top-level keys the dropped head was the only entry at that exact path, so after a refused save that row shows one red line fewer (the "Invalid input" line). On a type with a live validator the author's next edit redraws the row; on the rest (the seat's analysis counted 9 keys) it stays off until #35499. The place is still named by the entries themselves and in the Save button's tooltip.

Tests

Readings are on this branch after its one merge of origin/main 5756ae0d75; the code head was 62387026db; the final head 692d874e93 adds a merge of origin/main 94fb8db2d1 and a changeset-only commit (the Clause-② line reads no (narrowing)). The code head's last commit only adds a module-top preload import to four pin files (Verification), so the five pin files and the package typecheck were re-run on it: 122 passed, VERDICT command-exit 0.

  • Moved pins: 22 tests in the five files went red on the producer change alone and were rewritten (save-union-issues 7, cross-package parity 8, 422 face inventory 3, container descent 2, diagnostics 2). That is the same 22 the WIP rule moved: every moved pin's head was zod's bare text, so the bare-only condition moved none back.
  • New pins (one describe in protocol.save-union-issues.test.ts, the file's shared harness): the zod text pin; synthetic bare-vs-authored; a refused view save with a non-locale label map answers only the two label.not_a_locale entries, container head first; an object titleFormat and an action confirmText written as formulas keep their authored heads ahead of the .dialect cause; CONTROL label: 42 keeps its unexplained bare head. Plus §4's asymmetry pin in the parity file.
Five pin files: red on the producer alone, green after the rewrite
producer commit only (715b42d846), 5 files under the verify lock:
 Test Files  5 failed (5)
      Tests  22 failed | 93 passed (115)
os-verify-lock: VERDICT command-exit 1

after the rewrite:
 Test Files  5 passed (5)
      Tests  122 passed (122)
os-verify-lock: VERDICT command-exit 0
Whole package: test and typecheck
pnpm --filter @objectstack/metadata-protocol exec vitest run --maxWorkers=2
 Test Files  360 passed | 9 skipped (369)
      Tests  23256 passed | 45 skipped (23301)
os-verify-lock: VERDICT command-exit 0

pnpm --filter @objectstack/metadata-protocol build && … typecheck
check-dts-emitted: @objectstack/metadata-protocol - 2/2 declared declaration file(s) present.
os-verify-lock: VERDICT command-exit 0
(tsc --listFiles: 368 test files in the program, all five edited files among them)
Ablations (committed first; scripts/ablation-replace.mjs, anchor 1 to 0, restored to the HEAD blob)

The tests import the producer by relative path (./protocol.js), so src is what runs and no rebuild is involved.

A1 · keep every head (main's behaviour): `out.push(entry);`
 Tests  23 failed | 99 passed (122)   VERDICT command-exit 1
 red: 20 of the 22 rewritten pins (the other two, in the 422 face inventory, hold under
 either rule) plus the three new drop pins (bare-vs-authored, the label map, §4's asymmetry);
 green: the authored-head, unexplained-head and container controls
 ok restored: blob == HEAD (dccd42f3d3dd) and `git diff HEAD` is empty

A2 · drop every explained head (the WIP rule): `if (below.length === 0) out.push(entry);`
 Tests  3 failed | 119 passed (122)   VERDICT command-exit 1
 red: exactly the three authored-head pins (synthetic, titleFormat, confirmText)
 ok restored: blob == HEAD (dccd42f3d3dd) and `git diff HEAD` is empty

Acceptance notes

Verification

Local subset on the code head 62387026db (the final head 692d874e93 adds only a merge of main and a changeset line; CI on it: 39 success, 18 skipped, 0 failed): the derived list (node scripts/pm/dispatch-gates.mjs --commands, 66 families) all exit 0. --ran reconciliation over the recorded exits: "66 derived, 66 run, 0 NOT-MEASURED, 0 UNRUN" (a derived zero: all 66 recorded an exit code and none is 3).

  • One family was red on the head before last and is answered in the diff: check:test-source-alias judged the four edited pin files that reach the protocol's lazy lint import inside a clocked case. They now import the package's existing lint preload testkit at module top, as protocol.save-union-issues.test.ts already does; the gate then read "the source reach judged 5 test file(s) changed", OK.
  • check:dual-build-cjs-loads and check:lean-entry-closure exited 3 (prerequisite, no dist/) on the first run; on the final head, after the dogfood closure build, both exit 0.
  • node scripts/pm/overlap-check.mjs --branch=claude/issue-35400-drop-explained-union-wrapper before every push: "VERDICT clean exit 0", 0 PR heads overlapping.
  • Families CI owns (Lint & Repo Gates, TypeScript Type Check, Test Core, Build Core, the UI lanes) are read from this PR's check-runs, not re-run locally.
Dogfood battery (narrowing arm)

The full battery (pnpm --filter @objectstack/dogfood test under the verify lock, no shard, no path) ran on the final head 692d874e93: VERDICT command-exit 0; 482 test files passed, 3 skipped; 4092 tests passed, 68 skipped; no failures (os-dev-report 7013769621 on #35400; the same counts as the earlier run on 62387026db, report 7011455182).

席位核对

  • Read first: packages/metadata-protocol/src/protocol-metadata-issues.ts (the one-line rule in collectMetadataIssues, and the constant), then union-branch-policy.cross-package-parity.test.ts (withoutExplainedBareHeads and §4), then the changeset.
  • Two-minute check: pnpm --filter @objectstack/metadata-protocol exec vitest run src/protocol.save-union-issues.test.ts (after building its dependencies) shows 37 passed, including the #35400 describe.
  • Line budget: 8 files, +360 / -88 (the changeset +32; production code +72 / -30 in two files; the rest is tests).

Generated by Claude Code

…ave's issues[]

collectMetadataIssues emits an invalid_union head only when its branch
expansion appended no entry; container heads stay. Producer change only.

WIP, stopped before the pins: dropping a nested head at a one-segment path
removes the only entry Studio's SchemaForm draws on that top-level row
(exact-path issuesByPath lookup), which the ruling left to measure. The five
pin files are not yet rewritten (22 of 115 tests red at this commit).

Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
Co-Authored-By: Claude <noreply@anthropic.com>
…zod's bare default

collectMetadataIssues keeps a union head ahead of its causes unless the
expansion appended an entry AND the head's message is exactly zod's default
for a failed union (ZOD_UNION_DEFAULT_MESSAGE). A head carrying the schema's
own sentence stays, so the prescription it carries is not lost; an unexplained
head stays; container heads are unchanged. The read-path comment in
metadata-diagnostics.ts that said the union entry stays first is rewritten.

Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
Co-Authored-By: Claude <noreply@anthropic.com>
…he pins it changes

New describe in protocol.save-union-issues.test.ts: zod's own failed-union
message pinned against ZOD_UNION_DEFAULT_MESSAGE (plain zod and the real view
schema); an explained bare head dropped (synthetic, and a view with a
non-locale label map); an authored head kept ahead of its cause (object
titleFormat and action confirmText written as formulas); controls for an
unexplained head (label: 42) and a container head.

The pins that named the explained bare head move in five files. The
cross-package parity test records the asymmetry: the envelope drops an
explained bare head, the terminal renderer and the data API keep it; its
corpus compares branch selection with those heads projected out.

Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
Co-Authored-By: Claude <noreply@anthropic.com>
…the refusal envelope

Clause-② narrowing with the BREAKING banner, a was/now table, the reading
instruction (by path and code, not by index), what stays, the deliberate
asymmetry with the terminal and the data API, and the known Studio form
regression with its follow-up card.

Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
Co-Authored-By: Claude <noreply@anthropic.com>
… in the four edited pin files

check:test-source-alias judges the test files a change edits: each of these
reaches the protocol's lazy lint import inside a clocked case. The module-top
preload is the package's existing testkit, as protocol.save-union-issues.test.ts
already imports it.

Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

3 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 94fb8db2d170543fbd770f89849164d4b51e2e48 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from dab3ecb504173e45649a87bc8013a117536b8ae1 — the merge of head 692d874e9376e11616cfdfd0502865db774e9101 into base 94fb8db2d170543fbd770f89849164d4b51e2e48, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin dab3ecb504173e45649a87bc8013a117536b8ae1 && git checkout dab3ecb504173e45649a87bc8013a117536b8ae1
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 94fb8db2d170543fbd770f89849164d4b51e2e48 692d874e9376e11616cfdfd0502865db774e9101 && git checkout -B drift-repro 94fb8db2d170543fbd770f89849164d4b51e2e48 && git merge --no-ff 692d874e9376e11616cfdfd0502865db774e9101

node scripts/docs-audit/affected-docs.mjs --json 94fb8db2d170543fbd770f89849164d4b51e2e48

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me

Final green head for L1 and the contract record: 62387026db · 2026-11-19T14:09Z

Checks at this head: 37 success, 16 skipped, 0 failed. Not governed (check-governed-merges.mjs --pr 35520: 448 lines). Clause-②: yes (narrowing) · Metadata-protocol: none · ADR-0087 marker not-required (no-migration-prescription) accepted by the gate. K = 12 (< 15). A CONTRACT_REVIEW_TIER record is owed before the queue (seat 5, after L1-a).

Scope is the maintainer's scope ruling 7008570921: a union head is dropped at every depth only when entries below explain it and its message is zod's bare default (one named constant, pinned by a test); authored-sentence heads, unexplained heads and container heads stay. 22 pins moved in five files, 7 added; ablations (keep every head → 23 red; the WIP rule → exactly the 3 authored-head pins red). Full dogfood battery on this head: 482 test files passed, 3 skipped; 4092 tests passed, 68 skipped; no failures. Known regression named in the changeset: Studio's form rows, tracked by #35499. os-dev report 7011455182 on #35400.
Sent to the L1 thread; the area lands after its ACCEPT and the contract record.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4

维护者速读

  • 用户能看到什么变化:保存配置被拒时,错误列表里不再先出现一句空洞的"输入无效",第一条就是真正出错的位置和原因;自带说明的那类提示照常保留。
  • 为什么做:按你的裁决"每层都去掉,表单另立单",那句空话不指出任何字段,只会挡在真正原因前面。
  • 出错会怎样:按位置读第一条错误的程序会读到不同内容;设计器里约 25 个字段在保存被拒后暂时少一行红字,等表单那张单落地后恢复。
  • 要你做什么:无。区域合并主线后,席位做合同复审,再由区域落地。
  • 席位意见:实现与你的裁决一致;落地前须先合并主线,另请席位复核"收窄"声明的写法。

席位核对

L1-a: ACCEPT · head 62387026dbfc4810b024d27774b340599ed427a0 · Fixes #35400 (scope ruling 7008570921) · 2026-11-19T14:13Z · reviewed to pm-dispatch text at origin/main fca72dfa32

Readings: check-governed-merges --pr 35520 not governed; merge-tree against main clean; CI 37 success / 16 skipped / 0 failed. K=15: merge main and get a green re-run before queueing. A merge-only push needs no fresh L1. The dogfood battery is on this head (7011518520: 482 files / 4092 tests, 0 failures), as l1-review-checklist.md asks of a ! / (narrowing) PR. Mark the draft ready after the merge.

Code (protocol-metadata-issues.ts), read in full on the head. In collectMetadataIssues:

  • A non-expandable issue is deduped and pushed, and the function returns, as before.
  • A union collects its branches' entries into below, then pushes the head only if below is empty or its message is not ZOD_UNION_DEFAULT_MESSAGE ('Invalid input'), then pushes below. So an explained bare head is dropped at every depth, while a head carrying the schema's own sentence, or one nothing explains, is kept ahead of its causes.
  • Container heads are pushed first, unchanged.
  • The constant is exported only for its pin, not re-exported from protocol.ts.

This is exactly the ruling's first bullet. The texts the ruling named as becoming false are corrected in this PR: the collectMetadataIssues and zodIssuesToMetadataIssues docblocks, and metadata-diagnostics.ts:333-335.

Pins.

  • A real-zod PIN of the default text.
  • Bare-and-explained is dropped, while the same tree with its own sentence keeps the head.
  • A view's label: {not_a_locale} gives only the label.not_a_locale entries.
  • titleFormat and confirmText written as formulas keep their authored heads.
  • CONTROL: label: 42 keeps its bare head.
  • Parity §4 records that the terminal (formatZodError) and the data API (zodIssuesToFields) keep the head.

The 23 removed expect lines are the old head-first pins (issues[0] is invalid_union, length > 1, path lists starting with ''), each replaced by the new order. None is a weakened rejection: code and the 422 face are still asserted.

Changeset: sentences checked against the diff. The Was / Now table matches the label and view cases pinned above and the meta-envelope headline change. The "What stays" list, union heads that carry the schema's own sentence, unexplained heads and container entries, matches the three keep branches. "Unchanged, on purpose" (CLI and data API) matches parity §4. The known Studio-form regression is the ruling's own consequence line, and #35499 tracks it. The text also carries the BREAKING banner, the migration (read by path / code) and one marker, not-required (no-migration-prescription), which the gate in Check Changeset accepted on this head. Skills-docs: none is in the PR body, with its search stated.

Declaration: one point for the seat's L2. The PR and the ruling record both spell Clause-②: yes (narrowing). scripts/pm/clause2-line.mjs:113-116 reads yes (narrowing) as a diff that widens one surface and narrows another, and no (narrowing) as a pure narrowing. I find no surface this diff widens. If the seat agrees, the spelling should be no (narrowing), the #35444 precedent. Because the ruling record names the current spelling, I leave the call to the seat that recorded it rather than making it an R item. Metadata-protocol: none and patch are right either way.

Routing. L2 is owed for the narrowing declaration at CONTRACT_REVIEW_TIER by seat 5, on the merged head. ux-3 lands after it.

Nothing in this change widens a published surface, so the Clause-② line
reads no (narrowing).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 692d874e9376e11616cfdfd0502865db774e9101
Local-runs: none
Scope: packages/metadata-protocol/src/protocol-metadata-issues.ts, packages/metadata-protocol/src/metadata-diagnostics.ts, packages/metadata-protocol/src/protocol.save-union-issues.test.ts, packages/metadata-protocol/src/union-branch-policy.cross-package-parity.test.ts, packages/metadata-protocol/src/metadata-diagnostics.union-issues.test.ts, packages/metadata-protocol/src/protocol.container-issue-descent.test.ts, packages/metadata-protocol/src/protocol.invalid-metadata-422-face-inventory.test.ts + read, not reviewed: packages/metadata-protocol/src/protocol-save.ts, packages/metadata-protocol/src/protocol-client-failures.ts, packages/metadata-protocol/src/protocol-package-commits.ts, packages/metadata-protocol/src/protocol-write-face.ts, packages/metadata-protocol/src/protocol-diff-delete-load.ts, packages/metadata-protocol/src/protocol.ts, packages/metadata-protocol/package.json, packages/spec/src/kernel/metadata-plugin.zod.ts, packages/spec/src/api/zod-issues-to-fields.ts, packages/spec/src/shared/error-map.zod.ts, packages/spec/src/shared/expression.zod.ts, packages/spec/src/ui/view.zod.ts, packages/spec/src/ui/action-copy-template.ts, scripts/pm/clause2-line.mjs, scripts/pm/label-write.mjs

Judged against card #35400: the first ruling (comment 7003683081, drop the head when an entry below explains it) as refined by the scope ruling (comment 7008570921: every depth, only zod's bare Invalid input, an authored sentence stays, an unexplained head stays, container heads unchanged, a pin on zod's text, the form side to its own card #35499, the false in-repo texts moved in the same PR). Net diff read against main 94fb8db2d1, which is the head's merge-base: 8 files, +360 / -88. Check-runs on this head, all concluded: 39 success, 18 skipped by their own filter, 0 failed.

① Derived judgments

  • Accept set of every metadata type: unchanged. Right. The producer runs only after a safeParse has already failed at each of its four call sites (protocol-save.ts:1570-1572, metadata-diagnostics.ts:312-338, protocol-client-failures.ts:675-676, protocol-package-commits.ts:662-664). No schema file is in the diff; which bodies are refused, and with which status and code, does not move. Metadata-protocol: none follows.
  • Membership of a published refusal list: narrowed. Right, and declared. issues[] of 422 INVALID_METADATA, _diagnostics.errors on reads, the seed-request refusal and the unmanaged-import 400 share the one producer, so all four lose a union's own entry when it is bare and explained. Element shape { path, message, code } is untouched. An entry removed from a published response is breaking for a positional reader; the title's !, the BREAKING banner and the (narrowing) arm say so.
  • Sentences rendered from the list move with it. Right. metadataIssueHeadline (count plus the first three locators, protocol-client-failures.ts:704-709), the message-only face's first-three slice (protocol-write-face.ts:96-99) and the boot warning's first entry (protocol-diff-delete-load.ts:1348) now spend their slots on located causes. These are human-read strings on faces that carry the same findings structurally or carry none; no reader in packages/ or ui/ selects a served entry by invalid_union or by slice(1.
  • Public surface: not widened. Right. ZOD_UNION_DEFAULT_MESSAGE (protocol-metadata-issues.ts:63) is a module-level export only: protocol.ts:434-435 re-exports zodIssuesToMetadataIssues and MetadataIssueEntry and nothing else from that module, and the package's exports map addresses . alone, so the constant is not reachable from the published entry.
  • The other two walks: unchanged. Right. zodIssuesToFields still pushes every head (packages/spec/src/api/zod-issues-to-fields.ts:214) and formatZodIssue still prints it as the parent line; neither file is in the diff. The asymmetry is asserted, not normalised away (parity test §4, line 484).

② Semver level

  • '@objectstack/metadata-protocol': patch is the right level: the kind is none, the only package whose source the diff moves is that one, and a non-protocol breaking change ships patch with its banner and disposition (AGENTS.md, Post-Task Checklist 3).
  • Clause-②: no (narrowing) is the right line, line-initial on both carriers (PR body line 8, changeset body). The value answers whether the card widens an accept set or enlarges a public surface: it does neither (① above). scripts/pm/clause2-line.mjs:113-116 gives no (narrowing) as "not a widening, but breaking" and reserves yes (narrowing) for a diff that widens one surface and narrows another. The two ruling comments and both claim lines on the card spell yes (narrowing); that is the seat's transcription under "as executed", not the maintainer's quoted words, which rule scope only. The head's spelling is the truthful one and costs nothing the ruling asked for: banner, was/now table, the reading instruction, exactly one ADR-0087 marker and the dogfood arm are all present or triggered either way.
  • The changeset carries both declaration lines, the BREAKING banner, a was/now table whose first two rows match the pins in protocol.save-union-issues.test.ts (the repro fixture at line 139; the label map case), the instruction to read by path and code, one adr-0087: not-required (no-migration-prescription) marker whose reason holds (nothing authorable moves and nothing is stored: _diagnostics is recomputed per read behind an in-memory memo keyed by content), what stays, the two unchanged walks with data API refusal: fields[] lists the union head as an "Invalid input" invalid_shape entry ahead of the entries that explain it (sibling of #35400) #35433, and the known Studio regression with Studio form: a refused save marks a field row only when an issue's path equals the row's key, so nested causes (label.xx, visibleWhen.*, columns.N.*) leave the row unmarked (form side of #35400) #35499. Both Check Changeset runs and every lint lane are green on this head.

③ Boundary flags

④ Design judgment

The narrowing against the published spec on main. The spec declares the list once, as MetadataValidationResultSchema.errors: an optional array of { path, message, code? } whose path is described as the path to the invalid field (packages/spec/src/kernel/metadata-plugin.zod.ts:538-542). It declares no entry for a union as such, no order and no index. The entry this PR removes named no invalid field of its own (path '', or a slot the entries under it name more exactly) and carried zod's default text, so nothing the spec declares is taken away at the consumer; the list moves toward what the spec describes. What IS reversed is a released promise in prose (the 17.0.0 changelog's "strictly additive, issues[0] unmoved"), and that reversal is the maintainer's, twice ruled, and declared as breaking. This is not a capability narrowed at the consumer in place of an implementation gap.

The rule, read in the code (protocol-metadata-issues.ts:292-303). The expansion collects into a local below, then pushes the head unless below is non-empty and the head's message equals the constant. Checked against the ruling limb by limb:

  • every depth: the test is inside the recursive walk, no depth or path condition. Holds.
  • only the bare text: exact string equality with ZOD_UNION_DEFAULT_MESSAGE. A union declared with its own error keeps its head: the typed-slot sentences (packages/spec/src/shared/expression.zod.ts), an action's copy-slot sentence (packages/spec/src/ui/action-copy-template.ts:160) and a view union's retirement prescription (packages/spec/src/ui/view.zod.ts) are such heads. Three pins hold the split: one synthetic tree with both messages, an object titleFormat and an action confirmText. No global zod locale or error map is configured in packages/ or ui/, and the three parses read here pass no per-parse map, so the call sites see the default text the pin parses.
  • an unexplained head stays: with nothing selected below is empty (pinned by label: 42, line 511); zod's empty errors and the depth bound never enter the branch at all (:284-290), so they are untouched.
  • container heads unchanged: :306-310 pushes the head unconditionally. Pinned in two files.
  • the pin on zod's text: protocol.save-union-issues.test.ts:426, through a plain z.union and through the real view schema.
  • the texts that became false: the entry-rule docblock, the zodIssuesToMetadataIssues docblock and metadata-diagnostics.ts:333-337 now state the rule the code runs. The remaining "additive" sentences in the package are about the container descent, which is still additive.

Tried to break it.

  • Ordering and de-duplication: apart from the drop, the walk is the one on main. The leaf path, the seen key and the exemption of expanded heads are unchanged, and a kept head still precedes its causes.
  • A chain of bare heads to the depth bound collapses to the deepest one alone (pinned). No location is lost: each dropped head sat at a prefix of the kept one's path.
  • A union whose only explanation is a nested bare head at the same slot leaves exactly one such entry. Equivalent to what the outer head said.
  • A discriminator miss (errors: [], bare text) is not expandable and stays. Correct: it is the whole answer.
  • Non-union issues whose text happens to be Invalid input are never candidates; only the union branch drops.
  • §2 of the parity test now compares this envelope with the two spec walks after projecting out explained bare heads (withoutExplainedBareHeads, line 188), and compares the two spec walks with each other head for head, so branch selection is still one verdict in three places. The projection is positional (bare text, next pair at or under the slot) rather than the producer's rule; it is exact on the seven fixtures and it is test scaffolding, so it is noted and not graded.

Per file. protocol-metadata-issues.ts: implements the ruling as read above. metadata-diagnostics.ts: comment only, now true. protocol.save-union-issues.test.ts: the moved pins assert the absence of the root head and the located cause at index 0; the new block pins the constant, both sides of the bare/authored split on one tree, and three real-schema cases plus the unexplained control. union-branch-policy.cross-package-parity.test.ts: records the asymmetry and keeps the unexplained-head control across all three walks. The other three test files move only the assertions the drop moved.

Findings.

No must-fix, no should-fix.

N1 (nit) — protocol-metadata-issues.ts:301, with the docblock at :219-221. "Explained" is decided by below.length, and below only receives entries seen has not already let through. When two tied branches of an outer union each fail on the same nested bare union with the same leaf cause, the second nested head finds every one of its entries de-duplicated, reads as unexplained and is kept, after its cause: the list ends [cause at x, bare head at x]. The docblock's list of unexplained cases (bare kind mismatch, empty errors, depth bound) does not name this one, and there the head is not "the whole answer". Reasoned from the code; not measured on a real schema (read-only round), and it cannot touch a top-level head, since seen is fresh per top-level issue. It is no regression (the same input on main carried that head and one more) and it contradicts neither the ruling's wording nor the changeset's ("an entry below it explains"). A fix would decide "explained" from the selection being non-empty; that moves code, so it belongs on a follow-up card, or stands as an accepted deviation. Not to be fixed on this head.

Implemented-by: claude/issue-35400-drop-explained-union-wrapper
Reviewed-by: session_01Utp6CbUb7TcZK1XUAddUmQ (L2 subagent)

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me

Landing · head 692d874e93 · after L1-a ACCEPT 7011622590 and CONTRACT_REVIEW_TIER PASS 7012624388 · 2026-11-19T15:36Z

Probe Reading
Checks at head 692d874e93 39 success, 18 skipped, 0 failed
check-governed-merges.mjs --pr 35520 NOT governed, 448 lines
K 8 (< 15)
Dogfood battery os-dev-report 7013769621 opens with 692d874e93: 482 files passed, 3 skipped; 4092 tests passed, 68 skipped
Contract record PASS on this head, no must-fix, no should-fix; nit N1 accepted as a deviation (claim amendment 2)

Status: pr_ready + automerge_enable. On MERGED the area closes out #35400; #35433 (data API fields[]) and #35499 (Studio form rows) stay open under it.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 19, 2026 15:37
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 97f3420 Nov 19, 2026
62 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-35400-drop-explained-union-wrapper branch November 19, 2026 16:04
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/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants