Repository navigation
fix(metadata-protocol)!: drop an explained union head from a refused save's issues only when it is zod's bare "Invalid input" - #35520
Conversation
…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>
📓 Docs Drift Check3 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
Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # 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 |
|
repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me Final green head for L1 and the contract record: Checks at this head: 37 success, 16 skipped, 0 failed. Not governed ( 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. |
|
repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4 维护者速读
席位核对L1-a: ACCEPT · head Readings: Code (
This is exactly the ruling's first bullet. The texts the ruling named as becoming false are corrected in this PR: the Pins.
The 23 removed Changeset: sentences checked against the diff. The Was / Now table matches the label and view cases pinned above and the Declaration: one point for the seat's L2. The PR and the ruling record both spell Routing. L2 is owed for the narrowing declaration at |
…op-explained-union-wrapper
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
|
repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ Contract reviewServed-tier: 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 ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentThe narrowing against the published spec on The rule, read in the code (
Tried to break it.
Per file. Findings. No must-fix, no should-fix. N1 (nit) — Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me Landing · head
Status: |
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 (searchedskills/andcontent/docs/forinvalid_union, "Invalid input",issues[0]and "strictly additive"; the hits describe the data API'sfields[]and the UI CLI's validate report, both unchanged here)维护者速读
What changes
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'sconfirmTextsentence, a view's retirement prescription), a head nothing below explains (every branch a bare kind mismatch, zod's emptyerrors, 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.ZOD_UNION_DEFAULT_MESSAGE(module-level export, not re-exported byprotocol.ts), pinned against a real zod parse (plainz.unionand the real view schema), so a zod rewording fails a test instead of silently turning the drop off.zodIssuesToMetadataIssuesdocblock, and the read-path comment inmetadata-diagnostics.tsthat said the union entry stays first.422 INVALID_METADATA, read_diagnostics.errors, seed-request refusal, unmanaged-import400): they share the one producer..changeset/metadata-issues-bare-union-head.md:patch, both declaration lines, BREAKING banner, a was/now table, "read entries bypathandcode, 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.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'sfields[]keeps it asinvalid_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.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 topackages/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/main5756ae0d75; the code head was62387026db; the final head692d874e93adds a merge oforigin/main94fb8db2d1and a changeset-only commit (the Clause-② line readsno (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.describeinprotocol.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-localelabelmap answers only the twolabel.not_a_localeentries, container head first; an objecttitleFormatand an actionconfirmTextwritten as formulas keep their authored heads ahead of the.dialectcause; CONTROLlabel: 42keeps 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
Whole package: test and typecheck
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), sosrcis what runs and no rebuild is involved.Acceptance notes
fields[]keeps itsinvalid_shapehead (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); the CLI and terminal renderer keep the parent line. Both are pinned as deliberate.Verification
Local subset on the code head
62387026db(the final head692d874e93adds 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.--ranreconciliation 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).check:test-source-aliasjudged 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, asprotocol.save-union-issues.test.tsalready does; the gate then read "the source reach judged 5 test file(s) changed", OK.check:dual-build-cjs-loadsandcheck:lean-entry-closureexited 3 (prerequisite, nodist/) 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-wrapperbefore every push: "VERDICT clean exit 0", 0 PR heads overlapping.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 testunder the verify lock, no shard, no path) ran on the final head692d874e93: 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 on62387026db, report 7011455182).席位核对
packages/metadata-protocol/src/protocol-metadata-issues.ts(the one-line rule incollectMetadataIssues, and the constant), thenunion-branch-policy.cross-package-parity.test.ts(withoutExplainedBareHeadsand §4), then the changeset.pnpm --filter @objectstack/metadata-protocol exec vitest run src/protocol.save-union-issues.test.ts(after building its dependencies) shows 37 passed, including the#35400describe.Generated by Claude Code