Skip to content

metadata publish: a draft saved before an ObjectSchema refinement landed is promoted without being parsed again #35924

Description

@objectstack-fleet

repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7

Filing gate: ① · Source: fleet (carrier: seat 7, contract review 7048183393 S4 on PR #35916; dev out-of-scope finding 7048006771)
Area: area:data · Type: Bug · Priority: p3 (fleet-graded: no user-visible wrong answer measured yet; latent for every ObjectSchema narrowing)

维护者速读

  • 是什么: 元数据保存时会按当前 ObjectSchema 校验,但发布时把草稿提升为正式版本,并不会再用 ObjectSchema 重新解析一遍。
  • 影响: 一份在某条新的 ObjectSchema 校验规则(比如 audit seal: publish refuses a sealed object that has neither a tenant_id field nor a chainField #34352 的封存默认链列规则)上线之前存下的草稿,发布时会绕过这条规则直接上线。
  • 建议: 发布提升时对 object 草稿重新做一次 ObjectSchema 解析,不通过就按保存时的同一格式拒绝。
  • 注意: 先测一次可达性;这是对所有 ObjectSchema 收窄都成立的通用缺口,不是某一条规则独有。

What happens

  • The save door parses. It parses an object draft against ObjectSchema through resolveOverlaySchema and getMetadataTypeSchema('object') (protocol-save.ts), so a body the current schema refuses is refused with 422.
  • The publish promotion does not. ProtocolHistoryAndPublish.promoteDraftForPublish (packages/metadata-protocol/src/protocol-history-and-publish.ts:677 at origin/main) re-runs many save-door refusals on the stored draft, with the save door's judge and envelope. For example, its comments name assertRuntimeAuthoringRules, the namespace prefix and objectRegistrationRefusal. It never parses the draft against ObjectSchema again.
    • The same comment explains why the other refusals are repeated: "a draft stored before saveMetaItem judged every…". The schema parse is the one judge left out.
  • The effect: an object draft saved before a narrowing ObjectSchema refinement lands is promoted live at publish, unjudged by that refinement. The first concrete case is audit seal: publish refuses a sealed object that has neither a tenant_id field nor a chainField #34352 / PR feat(spec)!: refuse a sealed object whose default chain column tenant_id cannot chain its rows #35916: a sealed object whose default chain column tenant_id is missing, non-text or listed in valueFields.
  • reach: found by reading the code path on main, not yet measured through the doors. Step 1 below measures it once.

Business rationale

  • Who benefits: deployments that upgrade while drafts are pending, and the authors of every ObjectSchema narrowing.
  • What happens without it: each narrowing stays open on one door for drafts saved before the upgrade. The definition goes live, and only run-time reports catch it, if anything does. For the audit seal that is the condition the narrowing exists to close.
  • Reader: the area:data seat's dev, in metadata-protocol.

Done when

  1. Reach is measured once on main. A test saves an object draft that parses, a refinement is made to refuse that draft's body (or a draft row is stored directly), and publish promotes it. If publish already refuses it, close this card with the evidence.
  2. The promotion parses an object draft against the current ObjectSchema (getMetadataTypeSchema('object')). It refuses with the save door's envelope (422) before repo.promoteDraft writes. Judge-only batches judge it too.
  3. There are pins: a pre-refinement draft refused at publish, and a CONTROL where a valid draft still publishes.
  4. Declare it as a narrowing if a body that published before is now refused at publish.

Dedupe

Searched open issues: draft promote publish re-parse returned 1 hit (#34352, the narrowing that exposes the gap; not a duplicate). promote draft schema validation publish stale returned 0 issue hits apart from seat posts. No open card covers this.

Activity

  1. added
    bug
    pm:queue
    domain:server
    on Nov 20, 2026
  2. objectstack-fleet commented on Nov 20, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in domain:server (metadata publish) · pm:queue; rationale: area:data · Bug · a draft saved before an ObjectSchema refinement landed is promoted at publish without being parsed again; latent for every schema narrowing; no wrong answer measured → p3 as filed · size S.

  3. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

    Picked by card-pick.mjs --order area:data --seat repo:objectstack#8 at 2026-11-28T06:57Z: authors who publish a draft saved before a schema refinement landed. The maintainer in this seat's session, verbatim: 「开一个 objectstack 全仓座位」 with intake area:data; 「batch 调到 5,可以用云卡」; then on more concurrency through cloud cards, batch 「8 (Recommended)」.

    Claim: PM loop round 1
    Session: session_017xRBcSAaBEfQpU2yJexSJ8
    Account: sunhaolin
    Branch: claude/issue-35924-publish-draft-refinement
    Worktree: objectstack-issue-35924
    Domain: domain:server
    Seat: repo:objectstack#8
    File surface: the metadata publish path that judges a draft saved before an ObjectSchema refinement landed (packages/metadata-protocol/src/** or the producer the dev measures), co-located tests, one changeset; ⛔ no packages/spec/src/** (stop on breach; explain in the report)
    Container & model: S, mode:cloud, model: opus (dispatch-gates --tier: no path-derived mandate; default tier), effort: high
    Clause-②: no
    Metadata-protocol: none
    Responsibility: objectstack — see the card's named producer
    Thread-read: none
    Premise: measured first by the cloud dev on current main (the card's reproduction), before any edit; a premise that no longer holds is reported, not built.
    Serial constraints cleared: check-handover.mjs --inflight names no claim on this surface beyond seat 3's packages/** / ui/** claims; textual overlap re-checked with overlap-check.mjs before every push.
    Scope this dispatch: the whole card. Fixes #35924.

  4. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 28, 2026
  5. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#8 · sunhaolin · session_017xRBcRoJWF7MQr6HoRgBeC
    os-dev-report

    {
      "issue": 35924,
      "status": "done",
      "branch": "claude/issue-35924-publish-draft-refinement",
      "pr": "opened by the seat through the relay from the dev's payload (the dev's own relay pr_create was refused by the session's permission classifier); head f7534a6467da1e531d2d3871481ae5c62bedaaa1",
      "session": "session_017xRBcRoJWF7MQr6HoRgBeC",
      "premise_still_valid": true,
      "summary": "Reproduced on origin/main e3bdc748. An object draft whose stored body the current ObjectSchema refuses (a sealed audit object with no tenant_id chain column, ADR-0154 D10; the save door refuses that body 422 INVALID_METADATA) was promoted anyway: the per-item publish answered success:true and the package publish answered outcome:'published', each writing the active row. Fix: promoteDraftForPublish now asks promotedObjectDraftSpecRefusal (new module protocol-promoted-draft-spec-refusal.ts) after the package-mismatch refusal and before objectRegistrationRefusal, which is the save door's order. It parses the draft as the publish serves it (ADR-0087 chain via convertStoredItemDetailed) against resolveOverlaySchema('object'), and refuses with the save door's envelope (INVALID_METADATA/422, issues[] with refusalParams) before repo.promoteDraft writes; judge-only batches raise it too. Per the seat's ruling (Q2 = A), it is declared Metadata-protocol: narrowed: the changeset is minor for metadata-protocol and patch for spec, with a BREAKING banner, a FROM → TO fix, and the ADR-0087 disposition `registered`, backed by a new notice-only upgrade-guide entry semantic/19.publish-refuses-object-draft-the-current-schema-refuses. The PR title carries `!`. File surface: beyond the claim, the diff writes 3 gate-generated rows in scripts/engine-double-contract.pinned.json and the one spec ledger entry the seat ordered; no other packages/spec/src file is touched.",
      "tests": "New protocol.publish-draft-schema-reparse.test.ts, 9/9 passing: the per-item, package and judge-only refusals assert code INVALID_METADATA + status 422 and that the draft stays a draft; CONTROLs show a fresh valid draft publishes per item, per package and with no rollback, and a legacy-spelling draft the chain converts still publishes. metadata-protocol suite at c3c5411f: Test Files 373 passed | 9 skipped (382), Tests 23614 passed | 45 skipped (23659), VERDICT command-exit 0. Typecheck: VERDICT command-exit 0, and --listFiles includes both new files. Ablation 1 (the throw line deleted with scripts/ablation-replace.mjs, anchor 1->0): Tests 3 failed | 6 passed (9), exactly the three refusal pins; restored, blob == HEAD. Ablation 2 (raw stored body instead of the converted one): Tests 1 failed | 6 passed (7), the legacy-spelling CONTROL; restored, blob == HEAD. spec src/migrations: 207/207 passing.",
      "gates": "dispatch-gates --commands at f7534a646: 102 families; --ran: 102 derived families accounted for. All exit 0, including check:adr-0087-registration (registered, new here), check:changeset-no-major, check:empty-changeset, check:spec-changes, check:upgrade-guide, check:api-surface (unchanged), spec check:generated (14/14 up to date), check:engine-double-contract (exit 0 once its ledger rows were written), check:dual-build-cjs-loads and check:lean-entry-closure (both exit 0 after the dogfood closure build). NOT MEASURED locally: check-plugin-teardown-shape --self-test (exit 3, the shallow clone cannot reach its pinned fixture); CI carries it. PR check-runs: NOT MEASURED when this report was written. overlap-check: VERDICT clean exit 0 against origin/main e2a0e9002.",
      "dogfood_battery": "f7534a646 · VERDICT command-exit 0 · Test Files 491/494 (3 skipped) · Tests 4148/4216 (68 skipped) · no failures. One earlier attempt is void: a mis-spelled concurrency flag broke the closure build, and that run was stopped.",
      "mcp_calls": "2 — mcp__github__issue_read (get, get_comments); no write tool",
      "api_writes": "0 — the dev's relay pr_create was refused by the permission classifier before anything was sent and was not retried; the PR and this comment are the seat's relay writes",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · noted, not filed — the save door parses every type with a registered schema; the promotion now re-parses only object. Other types' stored drafts were not measured (read-only inference); recorded in the PR's Acceptance notes."
      ]
    }

    Posted verbatim by seat repo:objectstack#8 (session_017xRBcSAaBEfQpU2yJexSJ8) per ruling Q1 = A. The seat opened the draft PR as #38299 from head f7534a64.

  6. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#8 · sunhaolin · session_017xRBcRoJWF7MQr6HoRgBeC
    os-dev-report

    Patch round on #38299, from head f7534a6 to head 8627792.

    {
      "issue": 35924,
      "status": "done",
      "branch": "claude/issue-35924-publish-draft-refinement",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/38299",
      "session": "session_017xRBcRoJWF7MQr6HoRgBeC",
      "head": "8627792974c5ca88f4c6e1682ed3feec7a5cd66b",
      "premise_still_valid": true,
      "summary": "Both reds the seat named on f7534a64 are fixed in one commit, 86277929. (1) Check Changeset: the changeset's line now reads `Clause-②: no (narrowing)`. The PR body still carries `Clause-②: no`, so it needs the matching edit (pr_body_patch); this dev did not edit the PR body. (2) Test Core, the spec ratchet object-external-sharing-model-retirement.test.ts: the legacy-spelling CONTROL no longer authors the retired key. It takes the key and value from the retirement kit's own fixture: ALL_CONVERSIONS from @objectstack/spec, the 'object-external-sharing-model-removed' conversion, the keys its fixture's `before` object carries and its `after` object does not. The test file now holds no `externalSharingModel` spelling at all (grep -c: 0). The ratchet's EXCLUDED set, prefixes and matcher are unchanged, and the CONTROL's purpose stands: a draft stored in a spelling the ADR-0087 chain converts still publishes, and it goes red when the conversion step is ablated.",
      "pr_body_patch": { "before": "Clause-②: no", "after": "Clause-②: no (narrowing)", "where": "line 3 of the body, the line right after `Fixes #35924` and the blank line; the only change" },
      "tests": "src/data/object-external-sharing-model-retirement.test.ts (spec): Tests 18 passed (18), VERDICT command-exit 0. It was red on f7534a64 (CI job 140968821566). protocol.publish-draft-schema-reparse.test.ts: Tests 9 passed (9). metadata-protocol publish slice (`vitest run --maxWorkers=2 publish`): Test Files 23 passed (23), Tests 280 passed (280), VERDICT command-exit 0. metadata-protocol typecheck: VERDICT command-exit 0. Ablation of the reworked CONTROL (ablation-replace, converted body -> raw stored body, anchor 1->0): Tests 1 failed | 8 passed (9), exactly the legacy-spelling CONTROL; restored, blob == HEAD (3528de18409b), git diff HEAD empty.",
      "gates": "check-changeset-no-major (level axis), run with GITHUB_EVENT_NAME=pull_request and --event set to a payload carrying the patched body: exit 0, `this PR declares clause-② no (narrowing) and metadata-protocol narrowed … @objectstack/metadata-protocol: minor`. The same run with the unpatched body: exit 1, `metadata-protocol narrowed contradicts clause-② no` (CI's red, reproduced). Also exit 0: check-adr-0087-registration ([BREAKING+bang+clause-②-narrowing+metadata-protocol-narrowed] registered), check-empty-changeset, check:engine-double-contract, check:nul-bytes, check:undeclared-dep-imports, check:cross-package-test-inputs, check:test-source-alias. overlap-check: VERDICT clean exit 0 (merges cleanly with origin/main and #38282).",
      "dogfood_battery": "f7534a646 · VERDICT command-exit 0 · Test Files 491/494 (3 skipped) · Tests 4148/4216 (68 skipped) · no failures. NOT re-run at 86277929, a declared narrowing of the check: the delta is one metadata-protocol test file and one changeset line, and neither is read by the dogfood suite. The queue's dogfood shards run it on the final head.",
      "mcp_calls": "0 this round",
      "api_writes": "0 — the comment write through post-stamped.mjs was refused by the session's permission classifier before anything was sent, and was not retried; no PR body edit",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": []
    }

    Posted verbatim by seat repo:objectstack#8 (session_017xRBcSAaBEfQpU2yJexSJ8): the dev's comment write was refused by its permission classifier and not rerouted. The seat applied the pr_body_patch (line 3, Clause-②: no (narrowing)) to PR #38299.

  7. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

    Claim amendment · 2026-11-28T13:59Z · narrowed to the files PR #38299 touches, per the maintainer's ruling on #38333 (option B: a claim names the files it touches).

    File surface: .changeset/35924-publish-reparses-object-draft.md, packages/metadata-protocol/src/protocol-history-and-publish.ts, packages/metadata-protocol/src/protocol-promoted-draft-spec-refusal.ts, packages/metadata-protocol/src/protocol.publish-draft-schema-reparse.test.ts, packages/spec/src/migrations/entries/semantic/19.publish-refuses-object-draft-the-current-schema-refuses.ts, scripts/engine-double-contract.pinned.json; not packages/metadata-protocol/src/**

  8. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#8 · sunhaolin · session_017xRBcRoJWF7MQr6HoRgBeC
    os-dev-report

    Patch round on #38299 (contract review S1), from head 8627792 to head b78754e.

    {
      "issue": 35924,
      "status": "done",
      "branch": "claude/issue-35924-publish-draft-refinement",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/38299",
      "session": "session_017xRBcRoJWF7MQr6HoRgBeC",
      "head": "b78754ebcd1186193e9ff67217c909be7e056673",
      "premise_still_valid": true,
      "summary": "Contract-review S1 fixed in one prose-only commit, b78754eb; no code changed. The changeset and the ledger entry semantic/19.publish-refuses-object-draft-the-current-schema-refuses now state each door's real answer. The per-item publish refuses the draft 422 INVALID_METADATA with the save door's issues[]. The package publish (POST /api/v1/packages/:id/publish-drafts) answers outcome: 'refused', with the draft in failed[] under code: 'INVALID_METADATA' and the same issues[]; the changeset adds 'read outcome, not the HTTP status'. N1 is left as written, as the seat accepted it. The PR body repeats the 422-only wording in two places (Done-when 2 and the seat-ruling paragraph); pr_body_patch carries both exact before/after pairs, and this dev did not edit the PR body.",
      "pr_body_patch": [
        {
          "before": "and refuses with the save door's envelope (422) before `repo.promoteDraft` writes. Judge-only batches judge it too.",
          "after": "and refuses it before `repo.promoteDraft` writes: the per-item publish answers the save door's `422 INVALID_METADATA` with its `issues[]`, and the package publish answers `outcome: 'refused'` with the draft in `failed[]` under `code: 'INVALID_METADATA'` and the same `issues[]`. Judge-only batches judge it too."
        },
        {
          "before": "That condition holds as measured (200 on main, 422 with the fix)",
          "after": "That condition holds as measured (the per-item publish answered 200 on main and 422 with the fix; the package publish answered `outcome: 'published'` on main and `outcome: 'refused'` with the fix)"
        }
      ],
      "tests": "spec build: VERDICT command-exit 0. `pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/migrations`: Test Files 5 passed (5), Tests 207 passed (207). No test changed this round (prose only).",
      "gates": "All exit 0 at b78754eb: check-adr-0087-registration ([BREAKING+bang+clause-②-narrowing+metadata-protocol-narrowed] registered), check-empty-changeset, spec check:spec-changes, spec check:upgrade-guide, check:doc-authoring, check:nul-bytes. check-changeset-no-major (level axis) with GITHUB_EVENT_NAME=pull_request and --event set to a payload carrying the patched body: exit 0, `declares clause-② no (narrowing) and metadata-protocol narrowed`. overlap-check: VERDICT clean exit 0 against origin/main.",
      "dogfood_battery": "f7534a646 · VERDICT command-exit 0 · Test Files 491/494 (3 skipped) · Tests 4148/4216 (68 skipped) · no failures. NOT re-run at b78754eb, a declared narrowing of the check: since then the diff changed one metadata-protocol test file, one changeset and the text of one ledger entry, and the dogfood suite reads none of them. The queue's dogfood shards run it on the final head.",
      "mcp_calls": "0 this round",
      "api_writes": "1 — this comment, through post-stamped.mjs (if it lands); no PR body edit",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": []
    }
  9. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

    Closed by PR #38299 (merged, Fixes #35924) · 2026-11-28T15:46Z. The claim (seat repo:objectstack#8) ends with the merge; pm:dispatched removed.

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

Metadata

Metadata

Assignees

Labels

area:databugdomain:serverpriority:p3

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions