Skip to content

fix(metadata-protocol): a 422 INVALID_METADATA issue entry carries its zod issue's params - #37962

Merged
objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/project-thread-fq0aai
Nov 27, 2026
Merged

objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/project-thread-fq0aai

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

Requested by Tesla · project thread

Fixes #36594

Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:保存元数据被拒时,返回的每条问题除了原有的路径、说明和通用代码外,还会带上规则自己的具体原因码(例如主从对象的主字段不可写),调用方不必再靠英文句子猜是哪条规则。
  • 为什么做:属于“搭建应用”专题,替通过接口保存元数据的客户端和智能体解决“只看到 custom、看不到具体原因码”的问题。
  • 出错会怎样:只是在拒绝回复里多加一个字段,原有字段一个不动;若有问题,最坏是多出的字段内容不对,可直接撤回本次改动。
  • 要你做什么:无。

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: MetadataIssueEntry gains an optional params?: Record<string, string | number | boolean>. zodIssuesToMetadataIssues takes a new option, { refusalParams?: boolean }, threaded through collectMetadataIssues. Only when it is set does an entry carry params. Three limits apply:
    • Registered codes only: an issue gets the member only when its params.code is a string ErrorCode accepts. Internal markers (readAsWritten, refusalHead, retiredComponentType) never reach the wire.
    • JSON scalars only: only string, finite-number and boolean members are copied. A BigInt, a cycle, a function or NaN is left out, so answering cannot throw, and the copy shares nothing with the issue (S1, S2, N3).
    • Entry shape unchanged otherwise: code is still String(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 verdict copyDiagnostics copies one level deep), seedApplied.issues[] (seedRequestValidationError) and the unmanaged-install 400 keep exactly path / message / code. That is the shape MetadataValidationResultSchema and the publish response declare (M1).
  • packages/spec/src/api/error-code-ledger.zod.ts (the CONTROLLED_BY_PARENT_MASTER_INVALID comment) and packages/spec/src/data/controlled-by-parent-master.ts (the constant's docblock): both said the save door's 422 never carries params. Both now say the 422's issues[] entry carries the code on params.code, and that the read path's _diagnostics.errors[] does not. The ledger comment now spells out door: 'none' as "no door answers with this code as its error.code" (N1). Comment and TSDoc only.
  • .changeset/36594-metadata-issue-params.md: patch on both packages. AGENTS.md Post-Task Checklist step 3 sets the level by the Metadata-protocol kind, and "a non-protocol change, widening or breaking, ships patch". 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_MISSING is named as a PluginSchema example, not a save-door one (N2).

The REST error answer spreads error.issues unchanged (packages/rest/src/error-response.ts, the issues member), so the HTTP 422 body carries params with no REST change.

Tests

The new top-level describe in packages/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_INVALID over saveMetaItem: an object save with a readonly master answers 422 INVALID_METADATA with exactly [{ path: 'fields', code: 'custom', message, params: { code: 'CONTROLLED_BY_PARENT_MASTER_INVALID', shape: 'master-not-writable' } }], and nothing is stored.
  • Control over saveMetaItem: an issue zod raised without params (label: 42) gets no params own property.
  • Over saveMetaItem: a refusal whose params also hold a BigInt, a cycle, a function and NaN still answers 422 INVALID_METADATA. The entry keeps only code, shape and the scalar members, and JSON.stringify of the issues does not throw. The door is reached through a registerMetadataTypeSchema('object', …) override, restored in finally and checked restored.
  • PLUGIN_UI_REQUIRED_KEY_MISSING: the real PluginSchema refusal 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 over saveMetaItem because no metadata type the save door accepts parses with PluginSchema on this tree. Measured: registering PluginSchema for a new type name and saving under it answers INVALID_REQUEST before any schema runs.
  • Params whose code is not a registered error code (readAsWritten, retiredComponentType, an unregistered string, a number, an array, null) give no params.
  • READ PATH: decorateMetadataItem('object', …) on the same refused object gives _diagnostics.errors of exactly [{ path, message, code }].
  • SEED: seedRequestValidationError over an issue carrying CBP params gives issues with no params.

Acceptance notes

  • No ui/ consumer reads params from the 422 yet. Studio parses locally and already reads the code off the zod issue. The two ui/ read-path mirrors the review named (draftVerdict.ts, metadata-client.ts) describe _diagnostics, which stays three keys, so they still match.
  • packages/spec/CHANGELOG.md still holds the released sentence "never params". 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:

  1. packages/metadata-protocol/src/protocol-metadata-issues.ts: refusalParamsOf, the option, and where collectMetadataIssues reads it.
  2. packages/metadata-protocol/src/protocol-save.ts: the one call that passes { refusalParams: true }.
  3. The new describe at the foot of protocol.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 test under 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.mjs on protocol-metadata-issues.ts or protocol-save.ts, ran the new describe, and restored with blob == HEAD and an empty git diff HEAD.

  • A: the save door drops { refusalParams: true }. The CBP and BigInt cases go red.
  • B: the option defaults on. The READ PATH and SEED cases go red.
  • C: the scalar filter is removed. The BigInt case goes red.
  • D: the registered-code gate is removed (anchor 1 -> 0, blob 49c9d698 -> 300da885). The markers case goes red: 1 failed, 6 passed.
Derived gate families

node scripts/pm/dispatch-gates.mjs --ran on a record carrying each exit code: 98 derived famil(ies) accounted for — 97 run, 1 NOT-MEASURED. The NOT-MEASURED one is node 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 except Test UI (13/16), one case in StudioRoute.metadataArea-28561.test.tsx that passes locally at this head and on this head merged with origin/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

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation protocol:data tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 27, 2026
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/metadata-protocol, @objectstack/spec, touching 9 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/spec/src/data/controlled-by-parent-master.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

4 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/api/client-sdk.mdx (via ERROR_CODE_LEDGER (symbol, a top-level const object))
  • content/docs/api/error-catalog.mdx (via ERROR_CODE_LEDGER (symbol, a top-level const object))
  • content/docs/api/error-handling-server.mdx (via ERROR_CODE_LEDGER (symbol, a top-level const object))
  • content/docs/kernel/contracts/data-engine.mdx (via ERROR_CODE_LEDGER (symbol, a top-level const object))

⛔ 3 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-0.mdx (via ERROR_CODE_LEDGER (symbol, a top-level const object))
  • content/docs/releases/v17/17-1.mdx (via ERROR_CODE_LEDGER (symbol, a top-level const object))
  • content/docs/releases/v17/17-4.mdx (via ERROR_CODE_LEDGER (symbol, a top-level const object))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/spec/src/data/controlled-by-parent-master.ts) — pages documenting those are invisible to this run
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 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; 124 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 — 178 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 80341f2cb62769869fa2468636b71dbab34df86e → packageMentionDocs.

Which tree this was computed on

This run read content/docs from d52ec0bfaf515b1eca3aacceae29612d0fa4270f — the merge of head ddbd55783dddec63357147f49895fa9cacb50d15 into base 80341f2cb62769869fa2468636b71dbab34df86e, 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 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

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

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 80341f2cb62769869fa2468636b71dbab34df86e → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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 CONTRACT_REVIEW_TIER review on this head (schema face: packages/spec/src/api/error-code-ledger.zod.ts, packages/spec/src/data/controlled-by-parent-master.ts, plus protocol-metadata-issues.ts, which implements the params widening), with its L1 and the Clause-② review beside it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 796b3f7746efb15945cf7b424e2d1991310856d5
Local-runs: none
Scope: packages/spec/src/api/error-code-ledger.zod.ts, packages/spec/src/data/controlled-by-parent-master.ts + packages/metadata-protocol/src/protocol-metadata-issues.ts

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 43ce73118d1999826e5f2229a1af4bd0f120ccc2; compare API: ahead 5, behind 10), and the check-runs on the head. Code outside the diff was read at the head, never reviewed.

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

  • Accept set: unchanged. No schema, refinement or accepted value moves; Metadata-protocol: none is right.
  • MetadataIssueEntry (exported type, @objectstack/metadata-protocol) gains optional params. Additive at the type level: every hand-built entry in protocol-save-door-refusals.ts, protocol-publish-backfill*.ts, protocol-extension-*.ts and protocol-write-face.ts still type-checks without it. Right.
  • 422 INVALID_METADATA issues[] (save door, protocol-save.ts:1668; REST spreads error.issues unchanged, packages/rest/src/error-response.ts:640): entries of custom issues gain params; code, path, message, order and the de-duplication key are unchanged. Right, and it is what the card asks for.
  • The PR lists the other producers but does not derive what they publish. zodIssuesToMetadataIssues also feeds (a) parseDiagnostics (metadata-diagnostics.ts:371), so _diagnostics.errors[] on every item read, the layered read and GET /meta/diagnostics; (b) seedRequestValidationError, surfaced as seedApplied.issues[]; (c) the unmanaged-install 400. (a) and (b) have a published schema that declares the entry closed. Wrong as shipped: see M1.
  • What actually rides params on this tree is five shapes, not the two the PR names: code + shape (CBP, object.zod.ts:3745, stack.zod.ts:626), code + key (plugin.zod.ts:240), readAsWritten: true (io-node-config.zod.ts:895, :1023, :1038), refusalHead (filter-save-door-refusals.ts:447), retiredComponentType (page.zod.ts:567). No package outside spec stamps params on a zod issue. See S1.

② Semver level

patch on @objectstack/metadata-protocol and @objectstack/spec is the level this repo's rule gives. The deciding rule is AGENTS.md, Post-Task Checklist step 3: "The level follows the kind alone: a kind takes at least minor on a package the diff moves, none takes patch; a non-protocol change, widening or breaking, ships patch". The kind is none (nothing a metadata author can write changes), so widening an exported type and a wire entry is a patch here, not a minor; ordinary semver intuition does not decide it. Check Changeset is green on the head. Both declaration lines are present and line-initial in the PR body and the changeset body.

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 params on the spec schema, the spec bullet must say so; the level stays patch under the same rule.

③ Boundary flags

  • open_questions: empty. Nothing to answer.
  • Dev flag, PLUGIN_UI_REQUIRED_KEY_MISSING is pinned through the mapper only, because no save-door type parses with PluginSchema: accepted. The card's Responsibility names that code at the save door, and that half is unreachable on this tree; the dev measured and disclosed it. See nit N2 for the docblock wording.
  • Dev flag, packages/spec/CHANGELOG.md keeps "never params": accepted. It is release-owned (AGENTS.md documentation guardrails) and was true when released; no erratum is owed.
  • Dev flag, no ui/ consumer reads params: accepted as a statement about readers, but the two ui/ mirrors of the read-path entry (ui/packages/app-shell/src/views/metadata-admin/draftVerdict.ts:25, ui/packages/data-objectstack/src/metadata-client.ts:787) now describe less than the server serves. Part of M1.
  • Dev flag, check-plugin-teardown-shape --self-test NOT-MEASURED locally: Lint · scoped · tooling self-tests is green on the head.
  • SQL push-down: the diff adds no query, id materialisation or in-app join. Nothing to find.

④ Design judgment

M1 (must-fix) — the read path now serves a key the published spec schema for it declares closed. MetadataValidationResultSchema.errors[] (packages/spec/src/kernel/metadata-plugin.zod.ts:549-553) is { path, message, code? }. It is the declared shape of _diagnostics on the item read and the layered read (protocol.zod.ts:1025) and of GetMetaDiagnosticsResponseSchema.entries[].diagnostics (protocol.zod.ts:3054, the responseSchema of the route in packages/rest/src/rest-route-ledger.ts:223), and protocol.zod.ts:3045 calls it "the same type the save path's 422 and the read decorators speak". parseDiagnostics returns the mapper's entries untouched, so from this head a stored object refused for its controlled_by_parent master (or a page with a retired component type, a flow http/notify literal refusal, a filter comparand refusal) is read back with errors[i].params. The published JSON Schema is generated in output mode, where a strip object is emitted with additionalProperties: false (packages/spec/scripts/build-schemas.ts:1715-1717), so a client validating the response against the published kernel/MetadataValidationResult schema rejects that read; a client parsing with the zod schema silently loses the member; the generated reference (content/docs/references/kernel/metadata-plugin.mdx:395-404) lists three keys. The same holds for PublishPackageDraftsResponseSchema's seedApplied.issues[] (protocol.zod.ts:2332), whose producer is the same mapper. Before this head every errors[] producer in metadata-diagnostics.ts emitted exactly the three declared keys, so this is a new disagreement, not an existing one. The card's Responsibility is the save door's 422 only. Fix one of two ways: keep params off the read path and the seed answer (map it at the 422 producers, or strip it in parseDiagnostics and seedRequestValidationError), or declare params on the spec schemas and carry the generated reference, baselines, the two ui/ mirrors and the spec changeset bullet with it.

S1 (should-fix) — the entry forwards every params key of every refinement, unfiltered, and the contract does not say so. issueParamsOf is a one-level spread typed Record of unknown. On this tree all five shapes are JSON scalars and none says more than its message (a closed-set code, shape or key; a head of at most 160 characters built from the author's own field name; a retired type name from a closed map), so nothing leaks today. Two gaps remain. (a) readAsWritten is an internal marker between the flow contract and the build doors' value arm (flow-template-token.ts:49); it becomes wire that a client can pin, and neither the docblock nor the changeset names it or refusalHead / retiredComponentType. (b) Nothing bounds the values: a metadata type schema registered by a plugin can stamp a BigInt or a cyclic object, JSON.stringify then throws while answering, and a 422 becomes a 500 (on the read path, if M1 is fixed by declaring rather than removing, an item read fails the same way); a function value is dropped silently. Either state the forwarded vocabulary as the contract and keep only JSON-safe values (pinned by a test), or forward an allow-list.

S2 (should-fix) — copyDiagnostics (metadata-diagnostics.ts:177-181) copies each entry one level deep on the stated ground that the lists are "flat lists of flat entries, so copying each entry copies it all", which is what backs "a caller that edits the verdict it was handed edits nobody else's" (:90-92). An entry with params is no longer flat: the cached verdict and every caller's copy share one params object. Closed by the first M1 option; under the second, copy params there too.

N1 (nit) — error-code-ledger.zod.ts:1956: the comment still opens "door: 'none' on the PLUGIN_UI_REQUIRED_KEY_MISSING reading below", and that reading (:1972-1980) says "none reaches a wire on this tree, so registering them changes no HTTP body". The new sentence two lines later puts this code on an HTTP 422 body. Both are true only if door is read as "no door answers with it as error.code"; say that in the comment. The rest of the comment agrees with the code: params.code beside params.shape (ControlledByParentMasterIssueParams), no status, not in the message, entry code stays 'custom'.

N2 (nit) — MetadataIssueEntry.params docblock and the changeset present PLUGIN_UI_REQUIRED_KEY_MISSING with its key beside the CBP code as what a client of the save door's 422 reads. On this tree no save-door type parses with PluginSchema, as the PR's own test comment says. Name it as a mapper example, not a save-door one.

N3 (nit) — "copied verbatim" / "a copy": the copy is one level deep; a nested value inside params is still the issue's own object. No in-tree params nests.

Checked and clean: the CONTROLLED_BY_PARENT_MASTER_INVALID docblock in controlled-by-parent-master.ts agrees with the code sentence by sentence (both raise sites stamp code + shape; the save door parses ObjectSchema and maps through zodIssuesToMetadataIssues at protocol-save.ts:1668; defineStack issues are raw). issueParamsOf refuses null, arrays and non-objects, so an absent params yields no own property. zod sets params on custom issues only, so union heads and container wrappers gain nothing. Leaving params out of the de-duplication key is sound: two entries equal on path, code and message are one finding.

Implemented-by: claude/project-thread-fq0aai
Reviewed-by: session_01L9qibwSEecrzDjKjbk24r1

VERDICT: FAIL

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1

The filled brief the record above was rendered from (L1-a, isolated CONTRACT_REVIEW_TIER subagent):

Contract review brief — PR #37962 @ 796b3f7746efb15945cf7b424e2d1991310856d5 (card #36594)

You review at CONTRACT_REVIEW_TIER. Render ONE ## Contract review record on this head — its shape is
node scripts/pm/record-recognisers.mjs --template --paths packages/spec/src/api/error-code-ledger.zod.ts packages/spec/src/data/controlled-by-parent-master.ts — with a PASS or FAIL verdict, and post it as ONE comment
on the PR or its card.

Inputs — these and nothing else:
· card #36594: its body and EVERY comment (rulings and earlier records included)
· PR #37962: its body, its file list, and the net diff against main at 43ce73118d1999826e5f2229a1af4bd0f120ccc2 (the merge base)
· the check-runs on 796b3f7746efb15945cf7b424e2d1991310856d5: their conclusions ARE the gate verdicts
⛔ Not the dispatch order, ⛔ not the dispatching seat's own conclusions — this brief is adversarial by design.

Scope — the paths reviewFace returns as hits on this PR's file list: packages/spec/src/api/error-code-ledger.zod.ts, packages/spec/src/data/controlled-by-parent-master.ts;
plus every file IN THIS DIFF that directly implements or enforces them — the gate that enforces a rule, the code
a jsdoc or schema line describes, the validator a skill teaches — reviewed for agreement with the contract.
Widen it freely, ⛔ never below hits; the record's Scope: line names the implementing files apart from hits.
The rest of the diff (tests, unrelated modules, lockfiles, generated output, changesets) is the lane seat's
ACCEPT at TIER_DEFAULT, exactly as a standalone PR of those files.
④ judges the hits files and those implementing files ONLY:
lockfiles, generated output, changesets and prose elsewhere in the PR are not reviewed;
code outside the diff is READ to judge them, never reviewed.

⛔ READ-ONLY. No worktree, no checkout, no build, no test run, no gate re-run, no ablation: the check-runs
on the head already answered every derived gate family, and a local run costs more than it returns.
If ONE probe is unavoidable, the record's Local-runs: line says probe — REASON; otherwise none.
Scratch space is /tmp/claude-0/-home-user/166e2125-4268-552f-a555-2b7c43a99f0f/scratchpad/pr-37962/ alone; nothing there you did not write this round is read.

Judge, in the record's own sections:
① Derived judgments — every accept-set and public-surface change the diff implies, each named right or wrong.
② Semver level — the changeset (or skip-changeset) matches what the diff publishes, and the Clause-②: line.
③ Boundary flags — every dev flag and every open_questions entry answered, or escalated.
On every face, SQL push-down: a new id materialisation or in-app join where SQL could push down is a
finding unless a reason is given (AGENTS.md, Prime Directive 5: SQL first).
④ Design judgment — for EVERY hits file: does the change hold against the code it cites and the
scenario it is accepted against? A skill file against the card's eval prompt and the spec it teaches
on main; a schema file against the ruling or ADR it implements and its first consumer; an ADR
against its first consumer and its execution plan. For EVERY implementing file in the diff: does the
code agree with the contract, sentence by sentence? Read the cited code in the live tree, and try to
break the design.
Grade each finding must-fix, should-fix or nit — a nit has no effect on correctness or the contract.
A must-fix is a FAIL; a must-fix or should-fix earns a delta review of its fix; nits alone end the round.
Spell a must-fix or should-fix with its id and grade, S1 (should-fix) — …, and a clean round as
No must-fix, no should-fix.: the queue guard reads a graded finding as OPEN on this head and
refuses the record; the delta record names those it closes by id alone, S1: closed.
A nit is fixed only on the prose faces, or left as an accepted deviation or a follow-up card: a fix
anywhere else moves the head, and this record no longer covers it.
⛔ Judge the tree, never the PR body's account of it.
Sign Implemented-by: with the dev's branch and Reviewed-by: with your session id — the value is the FIRST
thing after each colon.
----- to here -----

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1
2026-11-27T13:18Z

L1 REWORK at 796b3f7746efb15945cf7b424e2d1991310856d5 (L1-a for the seat), on the at-tier contract record 7219293041 (claim 7219179957, brief 7219301790): FAIL, one must-fix and two should-fix.

M1 (must-fix), checked in the tree. zodIssuesToMetadataIssues is not only the save door's mapper. parseDiagnostics (metadata-diagnostics.ts:371) and the client-failure path (protocol-client-failures.ts:676) call it too. So params now also rides on _diagnostics.errors[] (item reads, the layered read, GET /meta/diagnostics) and on seedApplied.issues[]. The spec declares those entries closed: MetadataValidationResultSchema.errors[] (kernel/metadata-plugin.zod.ts:549-553) is { path, message, code? }, and the published JSON Schema is emitted with additionalProperties: false. A client validating a read against it would now refuse it. The card asks for the 422 only. Two ways out:

  • Keep params on the save door's 422 alone (the mapper takes an option, or the door adds it), and leave the read path and the seed answer as they were. This also closes S2.
  • Or declare params on the spec schemas, and carry the generated reference, baselines, both ui/ mirrors (draftVerdict.ts:25, metadata-client.ts:787) and the spec changeset bullet with it.
    The first matches the card's scope.

S1 (should-fix). The mapper forwards every params key unfiltered, which is five shapes on this tree, not the two the PR names (readAsWritten, refusalHead and retiredComponentType too). Nothing bounds the values either: a plugin schema stamping a BigInt or a cycle turns the 422 into a 500 at JSON.stringify. Either copy only JSON-safe scalars (or a named allow-list such as code plus the fix fields), or state in the MetadataIssueEntry.params contract that every key is forwarded and which values survive.

S2 (should-fix). copyDiagnostics (metadata-diagnostics.ts:177-181) copies one level on the ground that entries are flat. With params the cached verdict and every caller's copy share one object. The first M1 option removes this.

Nits (no effect): N1 the ledger comment's door: 'none' reading at error-code-ledger.zod.ts:1956 now needs "as error.code" to stay true; N2 PLUGIN_UI_REQUIRED_KEY_MISSING is offered as a save-door example although no save-door type parses with PluginSchema on this tree; N3 "copied verbatim" is a one-level copy.

Semver. patch on both packages is right: AGENTS.md's Post-Task Checklist step 3 sets the level by the Metadata-protocol kind alone, and none takes patch, widening included. If M1 goes the declare-it route, the spec bullet must change but the level does not.

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>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibzQhDYnejPUPpyJvyc

Test UI (13/16) on ddbd5578: one red case, not this PR's.

The failing case is ui/apps/console/src/components/StudioRoute.metadataArea-28561.test.tsx:182, the /studio/~all row of the "lands on Setup's environment directory" table: expected [ '/studio/~all' ] to deeply equal [ '/studio/~all', '/apps/setup/component/security/access-directory' ]. The location assertion two lines earlier passed, so the page did land on the directory; only the test's own location recorder missed the second entry.

Why it isn't this PR's:

  • This PR changes packages/metadata-protocol (the 422 issue mapping), two comment blocks in packages/spec and a changeset. It touches nothing under ui/ and nothing on the routing path the test drives.
  • The same file passes locally at this head: 33 of 33.
  • It also passes on this head merged with current origin/main (0b539b6a), three runs in a row: 33 of 33 each time.

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

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

Seat reading of the red Test UI (13/16) on run 46006286439 (head ddbd5578): a flake, so it gets one re-run of the failed jobs.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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 CONTRACT_REVIEW_TIER reviewer (M1, S1, S2 and the nits), with the L1 beside it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: ddbd55783dddec63357147f49895fa9cacb50d15
Local-runs: none
Scope: packages/spec/src/api/error-code-ledger.zod.ts, packages/spec/src/data/controlled-by-parent-master.ts + packages/metadata-protocol/src/protocol-metadata-issues.ts, packages/metadata-protocol/src/protocol-save.ts

Delta review of the FAIL record 7219293041 (head 796b3f77), after L1 REWORK 7219317393 and the dev's round-2 report 7220229156 on card #36594. Read: the diff 796b3f77..ddbd5578 (compare API: ahead 2, behind 0, commits 53c0af57 and ddbd5578, no rebase; six files), the tree at the new head where the earlier findings point, and the check-runs on the new 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: Test UI (13/16), in_progress (the re-run for the out-of-diff case in StudioRoute.metadataArea-28561; this diff touches nothing under ui/), and a second Check Changeset run, in_progress beside the completed green one.

① Derived judgments

  • params now appears on one answer only: the save door's 422 INVALID_METADATA issues[]. zodIssuesToMetadataIssues has four call sites at this head and exactly one passes the option, protocol-save.ts:1671. The other three take the default and get the old three-key entries: parseDiagnostics (metadata-diagnostics.ts:371), seedRequestValidationError (protocol-client-failures.ts:676), the unmanaged-install request refusal (protocol-package-commits.ts:709). The option is read as options.refusalParams === true, so an absent or non-boolean value is off. Right.
  • New public surface on @objectstack/metadata-protocol: a second, optional parameter on zodIssuesToMetadataIssues and the ZodIssuesToMetadataIssuesOptions type; MetadataIssueEntry.params narrows from a record of unknown to a record of string, number or boolean against the unreleased first head, so nothing released narrows. Additive. Right.
  • Accept set unchanged; no spec schema moves. Metadata-protocol: none still right.

② Semver level

Unchanged and still correct: patch on both packages, by AGENTS.md Post-Task Checklist step 3 ("The level follows the kind alone … none takes patch; a non-protocol change, widening or breaking, ships patch"). The changeset now says what the code does: the member is on the save door's 422 only, present only for a registered code, holding only string, finite-number and boolean members; the option exists and only the save door sets it; _diagnostics.errors[] and seedApplied.issues[] keep three keys. The spec bullet (docblock and ledger note) is still accurate, since no spec schema changed.

Clause-②: yes (widening) — correct, and now the only widening is the one declared.

③ Boundary flags

  • open_questions: empty.
  • Dev flag, Test UI (13/16) red once on an out-of-diff case: not judged here; its re-run was in_progress when read (above). The queue waits on it, not this record.
  • Dev flag, PR body not patched for round 2: see N4.
  • Dev flag, packages/spec/CHANGELOG.md keeps the released sentence: accepted as before.
  • SQL push-down: no query in the delta.

④ Design judgment

No must-fix, no should-fix.

M1: closed
S1: closed
S2: closed
N1: closed
N2: closed
N3: closed

How each was checked in the tree:

  • M1 — opt-in via refusalParams, threaded through every recursion of collectMetadataIssues (union branch and container descent), set by the save door alone. The READ PATH pin runs the real decorateMetadataItem on the same refused object and expects exactly three keys; the SEED pin does the same for seedRequestValidationError. MetadataValidationResultSchema and the publish response's seedApplied.issues[] therefore agree with what is served again.
  • S1 — "registered" is checked against the real registry: ErrorCode from @objectstack/spec/api is z.enum over StandardErrorCode.options plus REGISTERED_ERROR_CODES, which is derived from ERROR_CODE_LEDGER (error-code-ledger.zod.ts:2119). A non-string code, an unregistered string, an array or null yields no member, so readAsWritten, refusalHead and retiredComponentType stay off the wire; pinned. The value filter keeps a string, a boolean, and a number only when Number.isFinite holds. A BigInt (its own typeof), NaN, both infinities, a function, a symbol, an object, an array and null are left out, and the docblock says so ("a string, a finite number, a boolean. Any other value is left out"). The door-level pin stamps a BigInt, a cycle, a function and NaN and still answers 422 with a body JSON.stringify writes.
  • S2 — the read path carries no params, so copyDiagnostics' flat-entry ground holds as written.
  • N1 — the ledger comment now reads the door: 'none' clause as "no door answers with this code as its error.code" and says the code sits inside the 422 body on an issues[] entry while the body's code is INVALID_METADATA; it adds that _diagnostics.errors[] does not carry it. All true of the code.
  • N2 — the MetadataIssueEntry.params docblock names only the CBP code; the changeset names PLUGIN_UI_REQUIRED_KEY_MISSING as a PluginSchema example "which no save-door type parses today".
  • N3 — only scalars are copied, so "the copy shares nothing with the issue" is exact.
  • controlled-by-parent-master.ts docblock: "carry the registered refusal on params … read the code there from params.code. Where it is not: the read path's _diagnostics.errors[], whose entries are exactly path, message and code." Agrees with the code.

New, nits only:

N4 (nit) — the PR body still describes the first head ("Every producer that maps through zodIssuesToMetadataIssues now carries params", four tests). The tree and the changeset are right; the body is the seat's to replace before the queue, from the round-2 text the dev prepared.

N5 (nit) — the gate is on params.code alone: once the code is registered, every scalar sibling is forwarded, named or not. That is what the docblock states ("its siblings say which fix applies"), and no in-tree issue pairs a registered code with an internal marker. A future rule that does would publish the marker; an allow-list per code would be the stricter form. Follow-up at most.

Read, not graded: three sites relay a caught error's issues into another answer (protocol-history-and-publish.ts:2654, protocol-publish-batch.ts:193, protocol-unmanaged-import.ts:139). The second receives only the seed refusal, which carries no params. The third re-throws an error envelope with no declared entry schema. For the first (failed[].issues, declared as RuntimeAuthoringIssueSchema), I did not trace whether the save door's spec refusal can be the batch's causal error; if it can, its three-key entry already differed from that schema's required keys before this PR, so params adds no new class of disagreement.

Implemented-by: claude/project-thread-fq0aai
Reviewed-by: session_01L9qibwSEecrzDjKjbk24r1

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1
2026-11-27T14:30Z

L1 ACCEPT at ddbd55783dddec63357147f49895fa9cacb50d15 (L1-a for the seat), with the seat's Clause-② review (TIER_DEFAULT, in-thread), answering L1 REWORK 7219317393.

Contract review. Record 7219293041 on 796b3f77 (FAIL) and the same reviewer's delta 7220382968 on this head (claim 7220326102): PASS. M1, S1, S2, N1, N2 and N3 are closed, with two new nits. verify-review-tier PASS on the reviewer's transcript.

L1 delta, as the record confirms in the tree.

  • M1: params is opt-in (refusalParams). Only the save door's 422 (protocol-save.ts) passes it. parseDiagnostics, the client-failure and seed path, and the package commit path keep exactly path / message / code, the shape MetadataValidationResultSchema declares. S2 goes with it, since the cached diagnostics carry no params.
  • S1: an entry carries params only when params.code is a registered ErrorCode (the z.enum over the standard codes plus REGISTERED_ERROR_CODES, derived from ERROR_CODE_LEDGER). So readAsWritten, refusalHead and retiredComponentType stay off the wire.
  • Scalar filter: strings, booleans, and finite numbers only. BigInt, NaN, the infinities, functions, objects, arrays and null are dropped, and the docblock says so.
  • The changeset, the ledger note (door: 'none' read as "no door answers with this code as its error.code") and the CONTROLLED_BY_PARENT_MASTER_INVALID docblock say what the code does.

Clause-② (widening). The published surface grows by the optional params?: Record<string, string | number | boolean> on MetadataIssueEntry and the refusalParams option. On the wire, only the 422 INVALID_METADATA entries gain a member, and only for a registered refusal. No read-path answer changes shape. patch on both packages is right (AGENTS.md Post-Task Checklist step 3: Metadata-protocol: none takes patch, widening included).

Face. Fixes #36594; the body carries the round-2 text, so the record's N4 is answered. CI at this head: 60 success · 13 expected skip · 0 failed · 0 pending (the Test UI (13/16) re-run for the out-of-diff StudioRoute.metadataArea-28561 case passed).

Nits (do not block).

  • N5: the gate is on params.code alone, so a registered code forwards every scalar sibling. The docblock says so; a per-code allow-list would be stricter. Follow-up at most.
  • Read, not graded: protocol-history-and-publish.ts:2654 relays a caught error's issues into failed[].issues (RuntimeAuthoringIssueSchema). If the save door's refusal can be that cause, its entries already mismatched before this PR.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

Landing · 2026-11-27T14:34Z · zone o3-build (seat card thread)
Head-sha: ddbd55783dddec63357147f49895fa9cacb50d15

  • L1 ACCEPT at this head: 7220889076 (L1-a), on delta record 7220382968, which closes M1, S1 and S2 from REWORK 7219317393. params is opt-in through refusalParams, so only the save door's 422 carries it. An entry carries params only with a registered ErrorCode, and only scalar members are copied. Claim 7218118324, amended 7218133524 and 7218311332.
  • check-governed-merges.mjs --pr 37962: NOT governed, +238 / −17.
  • Checks at this head: 60 success, 13 expected skip, 0 failed, 0 pending; mergeable_state clean. The Test UI (13/16) red on StudioRoute.metadataArea-28561 passed on its one re-run (seat reading 7220250781).
  • landing-k.mjs: K = 14, under 15; no new locale pack under a label PR.
  • Action: ready for review and auto-merge (queue).

Merged via the queue into main with commit c23e556 Nov 27, 2026
117 of 119 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-fq0aai branch November 27, 2026 15:06
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 protocol:data 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

Development

Successfully merging this pull request may close these issues.

Metadata save door drops a zod issue's params: 422 INVALID_METADATA issues carry code 'custom', not the registered refusal code

2 participants