Skip to content

fix(cli): the protocol-19 switch writes moved stored forms without data, and never switches over a form the form schema refuses - #39478

Draft
objectstack-fleet[bot] wants to merge 10 commits into
mainfrom
claude/issue-39393-wip
Draft

objectstack-fleet[bot] wants to merge 10 commits into
mainfrom
claude/issue-39393-wip

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4cxRh6Sbfo2Xm49JPx6

Requested by Elon · project thread

Part of #39393 — this PR lands the moved-form body (data dropped), the census verdict, and package-named fix lines in both the switch and os migrate meta --stored. Two things stay open on the card: the flattened 18.6 overlay row (K4), and the maintainer's decision on forms whose served name the 19 naming rule refuses (this PR refuses them, option A). Details under Acceptance notes.

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:管理员从 18.x 升级到 19 时,执行数据库表单切换后,在 Studio 里保存过的表单不再变成"无效",切换前的检查也会列出任何会被判无效的表单,并给出带包名、能直接执行的修复办法。
  • 为什么做:这是 19 正式版升级路径上的阻断问题,每个在 18.x 用 Studio 改过表单的客户都会遇到,属于 19 升级 epic。
  • 出错会怎样:最坏情况是某个表单被检查拦下,升级暂停、什么都不写,管理员按提示处理后重跑即可;本改动只影响升级命令,可直接撤回。
  • 要你做什么:裁决一件事——表单名被 19 命名规则拒绝(例如不在对象所属包里保存的视图容器里的表单)时,升级是拦下、改名,还是照原样迁移后再提示修复。

What changes

  • The moved form keeps no data (protocol-stored-form-bodies.ts, new). An 18.x Studio save stores each form's binding as data: { provider: 'object', object }; a form item refuses data by name, so every form the switch moved was served valid: false. The move now drops a plain object binding, with the same test the source conversion view-forms-to-form-items applies. Any other data is kept and refused by the verdict below.
  • The census judges every body it writes or keeps with the runtime's own servedInvalidVerdict('form', …): StoredFormCensus.bodyRefusals. applyStoredForms throws before any write when a body it would write is refused. os migrate protocol --to 19 (preview and --apply) exits 1 while one stands, censusVerifiesSwitch never records the switch over one, and os migrate stored-forms is no longer green over one (canSwitch: false in --json).
  • The action names the package's door: PUT /api/v1/meta/form/NAME?package=PKG for a kept form row, the form that QA run · upgrade:18.6.0-to-19.0.0-next.4 (2/2) · e009d815 · 2026-12-03 · 0 PASS / 1 PARTIAL / 1 FAIL #39391 D2 measured as the only one the door accepts. os migrate meta --stored's fix line (servedInvalidFix, stored-migration.ts) does the same for every row saved in a package, of any type.
  • A refused container form name names the remedy that works. A container whose package is not the one that owns its object (package-less, a customization pair, any other package) serves each form the object's package does not ship as OBJECT.CONTAINER.KEY (the runtime door's own-name arm, isAnotherPackagesObject). The upgrade renames no form, and re-saving the container in another package does not change the name. The action says to delete the container on the running release (its DELETE door, with ?package= where it is bound), re-create each form as its own OBJECT.KEY item, re-point what opened the old name, and run again.
  • formBodyOf, destinationRow and switchedOff moved from protocol-stored-form-apply.ts into the new module, because the census (protocol-stored-form-migration.ts, 1,903 lines) must compute the very body the ceremony writes, and the ceremony imports the census. Keeping them in apply would make a cycle, and the 1,000-line rule keeps the new concern out of migration.

Tests

  • packages/metadata-protocol/src/protocol-stored-form-39393.test.ts (new, 10 cases): the written body keeps no data and FormSchema accepts it; a non-plain binding is named; a package-less container named apart from its object, and a container bound to a package that does not own its object, are refused at name with the delete door and the OBJECT.KEY remedy; a kept row with data is named with ?package=; a kept row that takes a withdrawal is written without data; os migrate meta --stored's fix line names ?package= for a package-bound row (control: none for a package-less row).
  • packages/rest/src/stored-forms-switch-37112.test.ts (through both doors on a real engine and SQL store): a new case moves a stored container's form (formViews with data, the D2 shape) and reads the stored row back with no data. The package-less-container case is triaged (see Acceptance notes), and a container bound to an installed package that does not own the object is refused with nothing written. runSwitch now mirrors the command's verdict.
  • packages/cli/src/commands/migrate/stored-forms.test.ts: censusVerifiesSwitch is false over a refused kept row (control: true without one).
Ablations (each red on mutation, green on restore; metadata-protocol rebuilt and checked in dist both ways where rest reads it)
  • Move writes the projected body as it is (movedFormBody without the strip): rest 4 failed / 11 passed (the container move, the view-item move, idempotence, the name case); unit the written row keeps no data red. Restored: 15/15.
  • Apply guard removed: rest a container stored under a name apart from its object… red (1 failed / 14 passed). Restored and rebuilt: dist marker absent, tree clean.
  • ?package= dropped from the door: unit …with the door of the package it is saved in red (1 failed / 6 passed).
  • censusVerifiesSwitch without the verdict: cli a kept form row the schema refuses… red (1 failed / 4 passed).
  • ?package= dropped from servedInvalidFix: unit a row saved in a package: the fix line… red (1 failed / 8 passed).
  • The refused-name remedy branch disabled: unit, both container cases red (2 failed / 8 passed).
Suites at b063f18
  • @objectstack/metadata-protocol full: 387 files passed, 24008 tests passed.
  • @objectstack/rest src/stored-forms-switch-37112.test.ts and src/public-form-two-type-withdrawal.test.ts: 121 passed. The full --project local run (451 files, 9370 tests) was green at 2e8f486; this round changes no rest source.
  • @objectstack/cli src/commands/migrate/stored-forms.test.ts and meta.stored-served-invalid.test.ts: 8 passed. The full --project unit layer is NOT MEASURED locally (past the foreground limit); CI's Test Core runs it.
  • typecheck of metadata-protocol, rest and cli: exit 0.
  • dispatch-gates --ran: 73 derived, 72 run (all exit 0), 1 NOT-MEASURED (check:dual-build-cjs-loads: prerequisite needs a whole-workspace build).

Acceptance notes

Verification

Read first (by risk):

  1. packages/metadata-protocol/src/protocol-stored-form-bodies.ts: withoutPlainObjectBinding and storedFormBodyRefusals.
  2. packages/metadata-protocol/src/protocol-stored-form-apply.ts: the guard before any write, and the keep branch that now goes through plannedFormWrite.
  3. packages/cli/src/commands/migrate/protocol.ts: censusVerifiesSwitch and the --apply refusal branch.

Two-minute check: pnpm --filter @objectstack/metadata-protocol build && pnpm --filter @objectstack/rest exec vitest run src/stored-forms-switch-37112.test.ts shows 15 passed, including a stored container's form moves as a form row without the old data binding.


Generated by Claude Code

…rms without the old data binding

The stored-form ceremony moved each form "with its body as written", which
kept an 18.x Studio save's `data: { provider: 'object', object }` binding: a
`form` item refuses `data` by name, so every moved form was served invalid.
The move now drops a plain object binding (the source conversion's own test),
and the census judges every body the run writes or keeps with the runtime's
`form` schema: a refused body refuses the run before anything is written,
and the switch is never recorded over one. The action for a kept row names
its package's door (`?package=`).

Claude-Session: https://claude.ai/code/session_016WV4cxRh6Sbfo2Xm49JPx6
Co-authored-by: Claude <noreply@anthropic.com>
…n name, as the runtime door does

Claude-Session: https://claude.ai/code/session_016WV4cxRh6Sbfo2Xm49JPx6
Co-authored-by: Claude <noreply@anthropic.com>
… `data`, and writes nothing under a name the form schema refuses

The #37112 pin for a package-less container's member moved it to
`OBJECT.intake.contact`, a name ADR-0159 D3 refuses: the row it wrote was
served invalid. It now pins the census naming that body and the ceremony
refusing before any write; the stored-withdrawal move pins the written row
without the old `data` binding. `runSwitch` mirrors the command's verdict.

Claude-Session: https://claude.ai/code/session_016WV4cxRh6Sbfo2Xm49JPx6
Co-authored-by: Claude <noreply@anthropic.com>
…ata`, the shape an 18.x Studio save stores

Claude-Session: https://claude.ai/code/session_016WV4cxRh6Sbfo2Xm49JPx6
Co-authored-by: Claude <noreply@anthropic.com>
…ol-19 form schema refuses

Claude-Session: https://claude.ai/code/session_016WV4cxRh6Sbfo2Xm49JPx6
Co-authored-by: Claude <noreply@anthropic.com>
…lection (check:test-source-alias)

Claude-Session: https://claude.ai/code/session_016WV4cxRh6Sbfo2Xm49JPx6
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Dec 4, 2026
@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/cli, @objectstack/metadata-protocol, touching 49 documentable anchor(s).

28 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json bbc64113715561ef2f58039eae435ccd06e963bb.

⛔ 14 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 1 anchor(s) matched too much of the corpus to be a work list: /api/v1/meta (route, 57 pages)
  • 6 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 71 of 256 client-bound route-ledger rows — the other 185 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 185: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 60 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 125 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 — 48 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 bbc64113715561ef2f58039eae435ccd06e963bb → packageMentionDocs.

Which tree this was computed on

This run read content/docs from d37ea8c701a2c2e963616f6a9008844d40c7db1a — the merge of head b063f1895915653b05abab4169799e87912d7703 into base bbc64113715561ef2f58039eae435ccd06e963bb, 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 d37ea8c701a2c2e963616f6a9008844d40c7db1a && git checkout d37ea8c701a2c2e963616f6a9008844d40c7db1a
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin bbc64113715561ef2f58039eae435ccd06e963bb b063f1895915653b05abab4169799e87912d7703 && git checkout -B drift-repro bbc64113715561ef2f58039eae435ccd06e963bb && git merge --no-ff b063f1895915653b05abab4169799e87912d7703

node scripts/docs-audit/affected-docs.mjs --json bbc64113715561ef2f58039eae435ccd06e963bb

⚠️ 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 bbc64113715561ef2f58039eae435ccd06e963bb → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…for a package-bound row, and a refused container form name gets the remedies that exist

`os migrate meta --stored` printed `PUT /api/v1/meta/TYPE/NAME` for a row
served invalid; the save door addresses a package's row only by
`?package=`, so the printed fix was refused for every package-bound row.

A form the switch refuses because its served name is `OBJECT.CONTAINER.KEY`
(ADR-0159 D3) cannot be fixed by correcting the body: the upgrade renames no
form. Its action now names the two remedies that exist on the running
release: delete the container, or save its forms again in a container named
after the object, bound to the package that ships it or its customization
package.

Claude-Session: https://claude.ai/code/session_016WV4cxRh6Sbfo2Xm49JPx6
Co-authored-by: Claude <noreply@anthropic.com>
…y that works, for any container whose package does not own its object

The own-name arm applies wherever the container's package is not the one
that owns its object (package-less, a customization pair, any other
package), so re-saving the container in the pair does not change the name.
The action now says: delete the container, re-create each form as its own
`OBJECT.KEY` item, re-point what opened the old name, run again. A unit and
a both-doors case pin a container bound to another package.

Claude-Session: https://claude.ai/code/session_016WV4cxRh6Sbfo2Xm49JPx6
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4czfEjskBjZM6jhKWFR

2026-12-04T02:49Z · L1-a verdict: REWORK at head b063f18959 (zone em-upgrade, Part of #39393; delta 2e8f486ee..b063f1895, 3 commits)

席位核对

What holds in the delta.

  • (1) servedInvalidFix (stored-migration.ts:685) appends ?package=${row.packageId} when packageId !== null. The field is string | null (line 236), so that test is exact. It applies to every row type, as the claim amendment says. The new pair of cases (package row versus a package-less CONTROL) pins both arms.
  • (3) Widening the class: actionFor now takes verdict.path and the body's object. It branches on path === 'name', a view row and grain === 'expansion'. The unit case for a container in com.other.app and the rest case for an installed com.example.other37112 both assert path: 'name', the package-bound delete door, and (rest) switched: false with rows byte-identical. The changeset bullet and the module doc state the same class.

Must-fix: the new remedy text deletes more than it tells the admin to re-create.

The D3 action now reads: delete the container (DELETE /api/v1/meta/view/<container>…), then "re-create each of its forms as its own form named 'OBJECT.KEY'". But a protocol-18 container is not forms only. expandViewContainerWithDiagnostics (packages/spec/src/ui/view.zod.ts:8353) expands its list family (listViews, list) first and its form family (formViews, form) second. Deleting the container therefore also deletes every list view it serves, including the object's default list. The remedy text never mentions those, so an admin who follows it word for word loses the lists and is not told to rebuild them. The new cases cannot see this, because their containers carry only a form.

Fix, either way, in the action text and in the changeset bullet "A form whose name cannot move says what can be done":

  • (a) Keep the lists. Tell the admin to save the container again without form and formViews (its lists stay where they are, through the same PUT …/view/<container>?package=… door), then re-create each form as OBJECT.KEY. Delete the container only if it holds no lists. Or:
  • (b) Keep the delete, but have the action name what else goes with it. The census holds the place, so it can list the container's list members, and the text tells the admin to re-create them too.

(a) is the smaller remedy, and it is what the ruled option A ("refusal unchanged, remedy names what works") reads as: the remedy should not cost data the refusal did not touch. Whichever you choose, add a case whose container carries a listViews entry beside the form, and pin that the action does not tell the admin to delete it unqualified (or that it names the list).

Gates. At read time: 12 success, 20 skipped, 27 pending. This verdict does not depend on them. The next round needs a final green head.

Landing. This stays held for Elon's ruling on #39393, whatever the verdict, as you noted. I'll re-read the remedy delta when the next head is announced.

This branch has not been deployed

No deployments
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 size/l 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.

2 participants