Repository navigation
fix(metadata-protocol): a 422 INVALID_METADATA issue entry carries its zod issue's params - #37962
Conversation
…ID_METADATA issue entry Claude-Session: https://claude.ai/code/session_01L9qibzQhDYnejPUPpyJvyc Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibzQhDYnejPUPpyJvyc Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibzQhDYnejPUPpyJvyc Co-authored-by: Claude <noreply@anthropic.com>
…rams.code on the save door's 422 Claude-Session: https://claude.ai/code/session_01L9qibzQhDYnejPUPpyJvyc Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibzQhDYnejPUPpyJvyc Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 2 package(s): 4 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 3 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 178 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 d52ec0bfaf515b1eca3aacceae29612d0fa4270f && git checkout d52ec0bfaf515b1eca3aacceae29612d0fa4270f
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 80341f2cb62769869fa2468636b71dbab34df86e ddbd55783dddec63357147f49895fa9cacb50d15 && git checkout -B drift-repro 80341f2cb62769869fa2468636b71dbab34df86e && git merge --no-ff ddbd55783dddec63357147f49895fa9cacb50d15
node scripts/docs-audit/affected-docs.mjs --json 80341f2cb62769869fa2468636b71dbab34df86e
|
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 Contract-review-claim: session_01L9qibwSEecrzDjKjbk24r1 · head 796b3f7 · 2026-11-27T13:11Z L1-a (the seat's L1 thread) runs the isolated |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 Contract reviewServed-tier: Inputs read: card #36594 (body, triage 7089073342 / 7089088375, claim 7218118324 and its amendments 7218133524 / 7218311332, dev report 7219154370), PR #37962 (body, 5 files, net diff against merge base Check-runs when read: completed and green — Check Changeset, Check PR Size, Governed Surface Queue Guard, PR-body guards, Spec property liveness, Lint · PM dispatch-gates, Lint · scoped · tooling self-tests, Dogfood Regression Gate, Flag docs affected by code changes, Auto Label, Plan Test Core shards, Plan Test UI shards, filter. No run had failed. STILL PENDING (in_progress, not waited for, so they are no part of this verdict): Build Core, Build UI Deps, Lint · CI, release & engine gates, Lint · ESLint, Lint · docs & code guards, Lint · repo & tooling gates, Lint · scoped · query-options erasure, Lint · scoped · slot lookup & corpus, Live E2E UI, Test Core 1/10 through 10/10, Type Check · consumer gates, Type Check · debt ledger, Type Check · source gates, Type Check · workspace. Skipped by design: Build Docs, UI Published Artifacts, Queue verdict, Borrowed queue verdict, Dogfood Verify CLI, the sharded Dogfood matrix row, Temporal Conformance, the two opt-in harnesses, Schedule gate. ① Derived judgments
② Semver level
Clause-②: yes (widening) — correct arm; the 422 entry and the exported type only gain an optional member. One caveat tied to M1: the changeset says the spec half is docblock-only. If M1 is fixed by declaring ③ Boundary flags
④ Design judgmentM1 (must-fix) — the read path now serves a key the published spec schema for it declares closed. S1 (should-fix) — the entry forwards every S2 (should-fix) — N1 (nit) — N2 (nit) — N3 (nit) — "copied verbatim" / "a copy": the copy is one level deep; a nested value inside Checked and clean: the Implemented-by: VERDICT: FAIL |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 The filled brief the record above was rendered from (L1-a, isolated Contract review brief — PR #37962 @
|
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 L1 REWORK at M1 (must-fix), checked in the tree.
S1 (should-fix). The mapper forwards every S2 (should-fix). Nits (no effect): N1 the ledger comment's Semver. Clause-② (widening). The widening the changeset declares is right for the 422. As the head stands it also widens two read-path answers the spec declares closed (M1); the fix decides which widening ships. Next. Fix M1, S1 and S2 and announce the green head. The same reviewer runs the delta, then the L1 reads it. CI at this head was still running when the record was read. |
…gistered refusal's JSON-scalar members Claude-Session: https://claude.ai/code/session_01L9qibzQhDYnejPUPpyJvyc Co-authored-by: Claude <noreply@anthropic.com>
…; changeset follows the save-door-only contract Claude-Session: https://claude.ai/code/session_01L9qibzQhDYnejPUPpyJvyc Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#3 · os-tesla · session_01L9qibzQhDYnejPUPpyJvyc Test UI (13/16) on The failing case is Why it isn't this PR's:
The other 15 Test UI shards pass. A one-time re-run of the failed shard is the seat's call; nothing is pushed for it. Generated by Claude Code |
|
repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU Seat reading of the red
|
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 Contract-review-claim: session_01L9qibwSEecrzDjKjbk24r1 · head ddbd557 · 2026-11-27T14:04Z L1-a runs the delta of record 7219293041 on this fix head, by the same |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 Contract reviewServed-tier: Delta review of the FAIL record 7219293041 (head Check-runs when read: no run had failed. Green: Build Core, Build UI Deps, Build & E2E UI, Live E2E UI, Test Core 1/10 through 10/10 and its aggregator, Test UI 1 through 12 and 14 through 16 of 16, Type Check UI, the four Type Check lanes and TypeScript Type Check, every Lint lane and Lint & Repo Gates, Governed Surface Queue Guard, PR-body guards, Spec property liveness, Dogfood Regression Gate, Check PR Size, and one Check Changeset run. STILL PENDING, not waited for and no part of this verdict: ① Derived judgments
② Semver levelUnchanged and still correct: Clause-②: yes (widening) — correct, and now the only widening is the one declared. ③ Boundary flags
④ Design judgmentNo must-fix, no should-fix. M1: closed How each was checked in the tree:
New, nits only: N4 (nit) — the PR body still describes the first head ("Every producer that maps through N5 (nit) — the gate is on Read, not graded: three sites relay a caught error's Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 L1 ACCEPT at Contract review. Record 7219293041 on L1 delta, as the record confirms in the tree.
Clause-② (widening). The published surface grows by the optional Face. Nits (do not block).
|
|
repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU Landing · 2026-11-27T14:34Z · zone
|
repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU
Requested by Tesla · project thread
Fixes #36594
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
What changes
Revised after the contract review FAIL (record 7219293041, L1 REWORK 7219317393). Round 2 closes M1, S1, S2 and N1-N3.
packages/metadata-protocol/src/protocol-metadata-issues.ts:MetadataIssueEntrygains an optionalparams?: Record<string, string | number | boolean>.zodIssuesToMetadataIssuestakes a new option,{ refusalParams?: boolean }, threaded throughcollectMetadataIssues. Only when it is set does an entry carryparams. Three limits apply:params.codeis a stringErrorCodeaccepts. Internal markers (readAsWritten,refusalHead,retiredComponentType) never reach the wire.codeis stillString(issue.code),'custom'for a refinement, and the de-duplication key is unchanged.packages/metadata-protocol/src/protocol-save.ts: the save door's 422 (saveMetaItem, the spec-validation refusal) is the one caller that passes{ refusalParams: true }. Every other caller is unchanged, so_diagnostics.errors[](parseDiagnostics, whose cached verdictcopyDiagnosticscopies one level deep),seedApplied.issues[](seedRequestValidationError) and the unmanaged-install 400 keep exactlypath/message/code. That is the shapeMetadataValidationResultSchemaand the publish response declare (M1).packages/spec/src/api/error-code-ledger.zod.ts(theCONTROLLED_BY_PARENT_MASTER_INVALIDcomment) andpackages/spec/src/data/controlled-by-parent-master.ts(the constant's docblock): both said the save door's 422 never carriesparams. Both now say the 422'sissues[]entry carries the code onparams.code, and that the read path's_diagnostics.errors[]does not. The ledger comment now spells outdoor: 'none'as "no door answers with this code as itserror.code" (N1). Comment and TSDoc only..changeset/36594-metadata-issue-params.md:patchon both packages. AGENTS.md Post-Task Checklist step 3 sets the level by theMetadata-protocolkind, and "a non-protocol change, widening or breaking, shipspatch". This change widens the 422 wire entry (Clause-②: yes (widening)) but changes nothing a metadata author can write (Metadata-protocol: none).PLUGIN_UI_REQUIRED_KEY_MISSINGis named as aPluginSchemaexample, not a save-door one (N2).The REST error answer spreads
error.issuesunchanged (packages/rest/src/error-response.ts, theissuesmember), so the HTTP 422 body carriesparamswith no REST change.Tests
The new top-level
describeinpackages/metadata-protocol/src/protocol.save-union-issues.test.ts(the save door's issue-mapping harness: the real repository write path over a stub engine) has 7 cases:CONTROLLED_BY_PARENT_MASTER_INVALIDoversaveMetaItem: an object save with areadonlymaster answers 422INVALID_METADATAwith exactly[{ path: 'fields', code: 'custom', message, params: { code: 'CONTROLLED_BY_PARENT_MASTER_INVALID', shape: 'master-not-writable' } }], and nothing is stored.saveMetaItem: an issue zod raised without params (label: 42) gets noparamsown property.saveMetaItem: a refusal whose params also hold a BigInt, a cycle, a function and NaN still answers 422INVALID_METADATA. The entry keeps onlycode,shapeand the scalar members, andJSON.stringifyof the issues does not throw. The door is reached through aregisterMetadataTypeSchema('object', …)override, restored infinallyand checked restored.PLUGIN_UI_REQUIRED_KEY_MISSING: the realPluginSchemarefusal through the mapper with the door's option gives{ path: 'staticPath', code: 'custom', params: { code: 'PLUGIN_UI_REQUIRED_KEY_MISSING', key: 'staticPath' } }. It is not tested oversaveMetaItembecause no metadata type the save door accepts parses withPluginSchemaon this tree. Measured: registeringPluginSchemafor a new type name and saving under it answersINVALID_REQUESTbefore any schema runs.codeis not a registered error code (readAsWritten,retiredComponentType, an unregistered string, a number, an array, null) give noparams.decorateMetadataItem('object', …)on the same refused object gives_diagnostics.errorsof exactly[{ path, message, code }].seedRequestValidationErrorover an issue carrying CBP params givesissueswith noparams.Acceptance notes
ui/consumer readsparamsfrom the 422 yet. Studio parses locally and already reads the code off the zod issue. The twoui/read-path mirrors the review named (draftVerdict.ts,metadata-client.ts) describe_diagnostics, which stays three keys, so they still match.packages/spec/CHANGELOG.mdstill holds the released sentence "neverparams". It is release-owned and left alone.Verification
Two-minute check:
pnpm --filter @objectstack/metadata-protocol exec vitest run --maxWorkers=2 src/protocol.save-union-issues.test.ts -t 36594. Expect 7 passed.Read first, by risk:
packages/metadata-protocol/src/protocol-metadata-issues.ts:refusalParamsOf, the option, and wherecollectMetadataIssuesreads it.packages/metadata-protocol/src/protocol-save.ts: the one call that passes{ refusalParams: true }.describeat the foot ofprotocol.save-union-issues.test.ts.Local readings at head
ddbd5578:Package tests and typecheck
pnpm --filter @objectstack/metadata-protocol typecheck && pnpm --filter @objectstack/metadata-protocol testunder the verify lock:VERDICT command-exit 0, Test Files 372 passed, 9 skipped (381); Tests 23605 passed, 45 skipped.Ablation, four legs
Each leg used
node scripts/ablation-replace.mjsonprotocol-metadata-issues.tsorprotocol-save.ts, ran the new describe, and restored with blob == HEAD and an emptygit diff HEAD.{ refusalParams: true }. The CBP and BigInt cases go red.Derived gate families
node scripts/pm/dispatch-gates.mjs --ranon a record carrying each exit code:98 derived famil(ies) accounted for — 97 run, 1 NOT-MEASURED. The NOT-MEASURED one isnode scripts/check-plugin-teardown-shape.mjs --self-test(checker health only, exit 3: its positive control is pinned to a commit this shallow clone cannot reach; CI's "Lint · scoped · tooling self-tests" is green).CI on
ddbd5578: every check green exceptTest UI (13/16), one case inStudioRoute.metadataArea-28561.test.tsxthat passes locally at this head and on this head merged withorigin/main(3 runs, 33/33 each). See the PR comment.Changed lines: 255 (+238 / -17) across 6 files, under the 3000 threshold. Dogfood battery: not owed (no
!in the title, no narrowing arm).Generated by Claude Code