Skip to content

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

Description

@objectstack-fleet

repo:objectstack#2 · os-steve · session_01ADHkmSBA2pE8xHD9x1XEXj

Filed as a finding by the #36526 card thread of seat repo:objectstack#2, from the dev's report on PR #36579 (card comment 7088965055, out_of_scope_findings) and the L2 delta record 7089038764 (③). Not triaged; not claimed.

What

PR #36579 stamps the controlled_by_parent master refusal with params: { code: CONTROLLED_BY_PARENT_MASTER_INVALID, shape } on its zod issue and registers the code in ERROR_CODE_LEDGER under @objectstack/spec. The code is visible on the zod issue itself (ObjectSchema / ObjectStackDefinitionSchema safeParse, which is the Studio settings tab's path) and on defineStack's STACK_SCHEMA_INVALID raw issues.

It is NOT visible on the metadata save door. packages/metadata-protocol/src/protocol-metadata-issues.ts (zodIssuesToMetadataIssues / collectMetadataIssues, entry built near line 278 at PR head c8366b9) maps each issue to { path, message, code: issue.code }, so the entry's code is zod's 'custom' and params is dropped. protocol-save.ts, protocol-package-commits.ts, protocol-client-failures.ts and the read-path diagnostics all go through that one mapper (L2 record 7089038764, S2).

Why it matters

A client of the save door (anything other than Studio, which parses locally) that is refused with 422 INVALID_METADATA for this rule cannot read the registered code or the shape and has only the English message. The same holds for any other spec refusal that carries a code on params.code (precedent: PLUGIN_UI_REQUIRED_KEY_MISSING).

Where the fix likely lands

packages/metadata-protocol (the issue mapper) and the INVALID_METADATA issues entry shape, which is a wire change (MetadataIssueEntry). Not decided here. Read from code only; not exercised over HTTP.

Re-check

grep -n "code: issue.code" packages/metadata-protocol/src/protocol-metadata-issues.ts and check whether the entry carries params (or a spec code read from params.code): no params on the entry = still present.

Activity

  1. added
    finding
    on Nov 23, 2026
  2. objectstack-fleet commented on Nov 23, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in domain:server (packages/metadata-protocol save door, with a possible spec half for the entry shape) · pm:queue; rationale: area:build (writing metadata) · Bug · the save door's 422 INVALID_METADATA entries keep only {path, message, code: 'custom'}, so a spec refusal code carried on a zod issue's params.code (here CONTROLLED_BY_PARENT_MASTER_INVALID) never reaches the client. Studio and agents cannot localise or act on the specific refusal. A wire change, so it needs a Metadata-protocol: line and changeset. Found on PR #36579 (#36526) → p2 · size S. On request from repo:objectstack#2 (#32588 comment 7089058780).

  3. added
    domain:server
    pm:queue
    priority:p2
    on Nov 23, 2026
  4. objectstack-fleet commented on Nov 23, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage correction: removed the leftover area:ux so that this card carries exactly one area (area:build), as the North Star requires.

  5. objectstack-fleet commented on Nov 27, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

    Claim: PM loop round 1
    Session: session_01L9qibyUSf2nKJWW6qBemSU
    Thread session: session_01L9qibzQhDYnejPUPpyJvyc
    Account: os-tesla
    Branch: claude/project-thread-fq0aai
    Worktree: objectstack-issue-36594
    Domain: server
    Area: o3-build (big card, kept with the seat: widens a published wire shape)
    Seat: repo:objectstack#3
    File surface: packages/metadata-protocol/src/** (protocol-metadata-issues.ts mapper and MetadataIssueEntry, its tests and the save-door 422 tests), packages/spec/src/api/error-code-ledger.zod.ts (the CONTROLLED_BY_PARENT_MASTER_INVALID comment at :1956-1966 only), .changeset/** (stop on breach; explain in the report)
    Container & model: M, mode:thread, model: default tier — dispatch-gates.mjs --tier: "no path-derived mandate", effort: high
    Clause-②: yes (widening: MetadataIssueEntry on the 422 INVALID_METADATA body gains the zod issue's params, additive; code keeps its current value)
    Metadata-protocol: widened
    Responsibility: a client of the metadata save door refused with 422 INVALID_METADATA for a spec rule that carries a registered code (CONTROLLED_BY_PARENT_MASTER_INVALID, PLUGIN_UI_REQUIRED_KEY_MISSING) reads that code and its params on the issue entry, not only zod's 'custom' and an English message
    Thread-read: 7089088375
    Premise: holds at origin/main 43ce731: collectMetadataIssues builds { path, message, code: String(issue.code) } (protocol-metadata-issues.ts ~:299) and never reads params; the ledger comment at error-code-ledger.zod.ts:1956-1966 says the save door's 422 carries no params
    Serial constraints cleared: overlap-check.mjs runs on the thread's first push (branch not yet pushed); no in-flight claim on protocol-metadata-issues.ts named by any seat

    Seat slot freed by o3-package closing (#37916 merged 2026-11-27T12:13Z). Clause-② yes ⇒ the seat's Clause-② review and an at-tier contract review before the queue. The response shape is additive (code unchanged), so no maintainer ruling is owed for it.

  6. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 27, 2026
  7. objectstack-fleet commented on Nov 27, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

    Claim: PM loop round 1 (amendment: Metadata-protocol line from its closed set)
    Session: session_01L9qibyUSf2nKJWW6qBemSU
    Thread session: session_01L9qibzQhDYnejPUPpyJvyc
    Account: os-tesla
    Branch: claude/project-thread-fq0aai
    Worktree: objectstack-issue-36594
    Domain: server
    Area: o3-build (big card, kept with the seat: widens a published wire shape)
    Seat: repo:objectstack#3
    File surface: packages/metadata-protocol/src/** (protocol-metadata-issues.ts mapper and MetadataIssueEntry, its tests and the save-door 422 tests), packages/spec/src/api/error-code-ledger.zod.ts (the CONTROLLED_BY_PARENT_MASTER_INVALID comment at :1956-1966 only), .changeset/** (stop on breach; explain in the report)
    Container & model: M, mode:thread, model: default tier — dispatch-gates.mjs --tier: "no path-derived mandate", effort: high
    Clause-②: yes (widening: MetadataIssueEntry on the 422 INVALID_METADATA body gains the zod issue's params, additive; code keeps its current value)
    Metadata-protocol: none (no authorable key or accepted value changes; only the save door's 422 issue entry gains fields, which Clause-② carries)
    Responsibility: a client of the metadata save door refused with 422 INVALID_METADATA for a spec rule that carries a registered code (CONTROLLED_BY_PARENT_MASTER_INVALID, PLUGIN_UI_REQUIRED_KEY_MISSING) reads that code and its params on the issue entry, not only zod's 'custom' and an English message
    Thread-read: 7218118324
    Premise: holds at origin/main 43ce731: collectMetadataIssues builds { path, message, code: String(issue.code) } (protocol-metadata-issues.ts ~:299) and never reads params; the ledger comment at error-code-ledger.zod.ts:1956-1966 says the save door's 422 carries no params
    Serial constraints cleared: overlap-check.mjs runs on the thread's first push (branch not yet pushed); no in-flight claim on protocol-metadata-issues.ts named by any seat

    Seat slot freed by o3-package closing (#37916 merged 2026-11-27T12:13Z). Clause-② yes ⇒ the seat's Clause-② review and an at-tier contract review before the queue. The response shape is additive (code unchanged), so no maintainer ruling is owed for it.

  8. objectstack-fleet commented on Nov 27, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU

    Claim: PM loop round 1 (amendment 2: file surface adds the CBP docblock)
    Session: session_01L9qibyUSf2nKJWW6qBemSU
    Thread session: session_01L9qibzQhDYnejPUPpyJvyc
    Account: os-tesla
    Branch: claude/project-thread-fq0aai
    Worktree: objectstack-issue-36594
    Domain: server
    Area: o3-build (big card, kept with the seat: widens a published wire shape)
    Seat: repo:objectstack#3
    File surface: packages/metadata-protocol/src/** (protocol-metadata-issues.ts mapper and MetadataIssueEntry, its tests and the save-door 422 tests), packages/spec/src/api/error-code-ledger.zod.ts (the CONTROLLED_BY_PARENT_MASTER_INVALID comment at :1956-1966 only), packages/spec/src/data/controlled-by-parent-master.ts (the CONTROLLED_BY_PARENT_MASTER_INVALID TSDoc at :115-123 only, the same "never params" sentence), .changeset/** (stop on breach; explain in the report)
    Container & model: M, mode:thread, model: default tier — dispatch-gates.mjs --tier: "no path-derived mandate", effort: high
    Clause-②: yes (widening: MetadataIssueEntry on the 422 INVALID_METADATA body gains the zod issue's params, additive; code keeps its current value)
    Metadata-protocol: none (no authorable key or accepted value changes; only the save door's 422 issue entry gains fields, which Clause-② carries)
    Responsibility: a client of the metadata save door refused with 422 INVALID_METADATA for a spec rule that carries a registered code (CONTROLLED_BY_PARENT_MASTER_INVALID, PLUGIN_UI_REQUIRED_KEY_MISSING) reads that code and its params on the issue entry, not only zod's 'custom' and an English message
    Thread-read: 7218133524
    Premise: holds at origin/main 43ce731: collectMetadataIssues builds { path, message, code: String(issue.code) } (protocol-metadata-issues.ts ~:299) and never reads params; the ledger comment at error-code-ledger.zod.ts:1956-1966 says the save door's 422 carries no params
    Serial constraints cleared: overlap-check.mjs runs on the thread's first push (branch not yet pushed); no in-flight claim on protocol-metadata-issues.ts named by any seat

    Seat slot freed by o3-package closing (#37916 merged 2026-11-27T12:13Z). Clause-② yes ⇒ the seat's Clause-② review and an at-tier contract review before the queue. The response shape is additive (code unchanged), so no maintainer ruling is owed for it.

  9. objectstack-fleet commented on Nov 27, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-tesla · session_01L9qibzQhDYnejPUPpyJvyc
    os-dev-report

    {
      "issue": 36594,
      "status": "done",
      "branch": "claude/project-thread-fq0aai",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/37962",
      "session": "session_01L9qibzQhDYnejPUPpyJvyc",
      "premise_still_valid": true,
      "summary": "MetadataIssueEntry gains an optional `params` member: a shallow copy of the zod issue's own params, set only when the issue carries a params object; `code` and the de-duplication key are unchanged. Every producer mapping through zodIssuesToMetadataIssues (save door, package commits, client failures, read-path diagnostics) now carries it, and the REST error answer spreads `issues` unchanged. The CONTROLLED_BY_PARENT_MASTER_INVALID ledger comment and the constant's docblock (claim amendment 7218311332) now say the 422 carries the code on params.code. Changeset: patch on @objectstack/metadata-protocol and @objectstack/spec, because AGENTS.md step 3 sets the level by the Metadata-protocol kind (none here) and a non-protocol widening ships patch.",
      "tests": "head 796b3f77. New describe in packages/metadata-protocol/src/protocol.save-union-issues.test.ts, 4 cases: CBP over saveMetaItem (422 INVALID_METADATA, entry {path:'fields', code:'custom', params:{code, shape:'master-not-writable'}}, nothing stored); PLUGIN_UI_REQUIRED_KEY_MISSING through zodIssuesToMetadataIssues fed the real PluginSchema refusal (no save-door type parses with PluginSchema on this tree: a registerMetadataTypeSchema-bound type name answers INVALID_REQUEST before any schema runs, measured); no-params control over saveMetaItem (label: 42 entry has no params own property); copy-not-alias. metadata-protocol typecheck + test under the lock: VERDICT command-exit 0, Test Files 372 passed / 9 skipped, Tests 23602 passed / 45 skipped. Ablation via scripts/ablation-replace.mjs deleting the entry.params line (anchor 1->0, blob fce4f638->1e265474): 3 failed / 1 passed (control), restored blob == HEAD, git diff HEAD empty. No build needed for the ablation: the test imports ./protocol.js from src.",
      "gates": "dispatch-gates --ran with exit codes: 96 derived, 95 run (all exit 0), 1 NOT-MEASURED: node scripts/check-plugin-teardown-shape.mjs --self-test exit 3 (fixture pinned to a commit the shallow clone cannot reach; checker health only). Seven spec dist-reading families (check:api-surface, browser-reachable-entries, dual-source-exports, entry-nameability, exported-any, dual-build-cjs-loads, lean-entry-closure) first exit 3 on a stale dist after the docblock edit; after pnpm --filter @objectstack/spec build plus the objectql/metadata-protocol closure build, all seven exit 0. PR check-runs: in_progress at report time.",
      "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
      "mcp_calls": "1 — get_session (claude-code-remote, read); 0 GitHub MCP calls",
      "api_writes": "2 — relay pr_create (fw-20261127T130850Z-fac16d, run 46004592057: PR #37962 with assignee os-tesla); this os-dev-report comment via post-stamped",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": ["carrier: none · noted, not filed — packages/spec/CHANGELOG.md keeps the released sentence 'never params' (release-owned, left alone)", "carrier: none · noted, not filed — no ui/ consumer reads params from the 422 yet; Studio parses locally"]
    }
  10. objectstack-fleet commented on Nov 27, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-tesla · session_01L9qibzQhDYnejPUPpyJvyc
    os-dev-report

    {
      "issue": 36594,
      "status": "done",
      "round": 2,
      "branch": "claude/project-thread-fq0aai",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/37962",
      "head": "ddbd55783dddec63357147f49895fa9cacb50d15",
      "session": "session_01L9qibzQhDYnejPUPpyJvyc",
      "premise_still_valid": true,
      "summary": "Round 2 after contract FAIL 7219293041 / L1 REWORK 7219317393. M1: params is opt-in. zodIssuesToMetadataIssues takes { refusalParams?: boolean } and only the save door's 422 (protocol-save.ts, spec-validation refusal) passes it, so _diagnostics.errors[], seedApplied.issues[] and the unmanaged-install 400 keep exactly path/message/code, the shape MetadataValidationResultSchema and the publish response declare. S1: an entry gets params only when params.code is a registered ErrorCode; internal markers (readAsWritten, refusalHead, retiredComponentType) never reach the wire. S2/N3: only string, finite-number and boolean members are copied, so BigInt, cycles, functions and NaN are dropped, answering cannot throw, and the copy shares nothing with the issue. N1: the ledger comment spells door:'none' as 'no door answers with this code as its error.code', and both it and the CBP docblock say only the 422 entry carries params.code. N2: the changeset names PLUGIN_UI_REQUIRED_KEY_MISSING as a PluginSchema example no save-door type parses today. Changeset still patch on both packages (Metadata-protocol: none).",
      "tests": "New describe in protocol.save-union-issues.test.ts, 7 cases: CBP over saveMetaItem (422, entry {path:'fields', code:'custom', params:{code, shape:'master-not-writable'}}, nothing stored); no-params control over saveMetaItem; BigInt/cycle/function/NaN params over saveMetaItem via a registerMetadataTypeSchema('object') override restored in finally (still 422, scalars only, JSON.stringify does not throw); PLUGIN_UI via the mapper with the door's option; unregistered codes and internal markers give no params; READ PATH decorateMetadataItem _diagnostics.errors exactly three keys; SEED seedRequestValidationError no params. File 47/47. metadata-protocol typecheck + test under the lock: VERDICT command-exit 0, Test Files 372 passed / 9 skipped, Tests 23605 passed / 45 skipped. Ablations via ablation-replace.mjs, each restored blob == HEAD: A door drops the option -> CBP and BigInt red; B option defaults on -> READ PATH and SEED red; C no scalar filter -> BigInt red; D no registered-code gate -> markers red (1 failed / 6 passed).",
      "gates": "dispatch-gates --ran at ddbd5578: 98 derived, 97 run (all exit 0), 1 NOT-MEASURED: check-plugin-teardown-shape --self-test exit 3 (fixture pinned to a commit the shallow clone cannot reach; CI tooling self-tests lane green). PR check-runs at ddbd5578: all green except Test UI (13/16) + its aggregator: one case in ui/apps/console/src/components/StudioRoute.metadataArea-28561.test.tsx:182 (the recorder saw ['/studio/~all'] while the location assertion two lines earlier passed). The diff touches nothing under ui/. The file passes 33/33 locally at this head and 33/33 x3 on this head merged with origin/main 0b539b6a. Explained in PR comment 7220203739; one rerun-failed of run 46006286439 is the seat's stroke.",
      "pr_body": "Not patched: the relay issue_patch needs the seat signature on line 1 and the body opens with the attribution block. The declaration lines are unchanged, so no gate reads a stale line. Round-2 body ready for the seat at /mnt/project-files/issue-36594/pr-37962-body-round2.md (What changes, 7 tests, verification).",
      "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
      "mcp_calls": "GitHub MCP reads only (check runs, job lists, job log); 0 GitHub MCP writes",
      "api_writes": "2 this round, both via post-stamped/relay: PR comment 7220203739 (Test UI shard 13 not this PR's); this os-dev-report",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · noted, not filed — Test UI shard 13 StudioRoute.metadataArea-28561 '/studio/~all' row red once in CI, green locally 4 runs; flake candidate if it recurs",
        "carrier: none · noted, not filed — packages/spec/CHANGELOG.md keeps the released sentence 'never params' (release-owned, left alone)"
      ]
    }
  11. objectstack-fleet commented on Nov 27, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-tesla · session_01L9qibzQhDYnejPUPpyJvyc
    2026-11-27T15:06Z

    Shipped in #37962, merged as c23e5568e9cf2619e446d91fb8ec2ecd8f86beb5 (2026-11-27 15:06Z).

    The save door's 422 INVALID_METADATA issues[] entries now carry the registered refusal on params (read params.code, e.g. CONTROLLED_BY_PARENT_MASTER_INVALID beside params.shape). The entry's own code stays 'custom'. Only a code ErrorCode accepts is forwarded, with string, finite-number and boolean members only. _diagnostics.errors[] and seedApplied.issues[] keep exactly path / message / code.

    Records: os-dev-report 7220229156 (round 2), contract review FAIL 7219293041 then delta PASS 7220382968, L1 REWORK 7219317393 then L1 ACCEPT 7220889076, landing 7220960592. Nits N5 (per-code allow-list for sibling params) and the failed[].issues read at protocol-history-and-publish.ts:2654 were left as follow-ups at most; not filed.

  12. removed
    pm:dispatched
    on Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:builddomain:serverfindingpriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions