…nly dirty cells in a master-detail batch
The write-side roster in sanitize.ts and the render-side roster in
autoLayout.ts were two hand-written copies of one list, and they drifted: the
render copy had learned to drop owner_id, the write copy never did. A form
showed the user business inputs only and sent back every ownership and audit
column it had read.
The platform cannot tell a round-trip of the value it just served from an
attempted ownership transfer, so an echoed owner_id is a 403 for any caller
without the transfer grant — and a master-detail save commits as one atomic
batch, so one echoed column on one row refuses the parent and every sibling.
One roster now serves both readings, sanitizeFormData also refuses any field
the schema marks `system: true`, and a master-detail edit batch sends only the
cells that differ from the loaded snapshot — a row where nothing moved emits no
operation at all.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018HrVaotisyhgmot9o2MLRq
Fixes #10108
Clause-②: no — measured from the diff, not asserted: the package publishes
.only, built fromindex.tsx, andindex.tsxdoes not re-exportsanitize. After a build on this head,grep -c SERVER_OWNED_FIELD_NAMES packages/plugin-form/dist/index.d.tsprints0, andfilterSystemFields/ the rest of the face keep their signatures. Nothing an author writes changes; no accept set is relaxed; no public surface moves.Step 1 — what reproduced on today's
main, and what did notEverything on the card was relayed. It was re-derived here on
87af769e9before a line was changed, with a probe that asserted the presence of the injected columns and the absence of ones the same filter already refused — so the finding is a live injection, not an absence a fixture invented.The payload-building sites. Both paths the card names run through ONE builder,
sanitizeFormDatainpackages/plugin-form/src/sanitize.ts:POST /api/v1/batch—MasterDetailForm'ssubmitViaBatchhands the parent values and each child collection tobuildMasterDetailEditBatch/buildMasterDetailBatchinpackages/plugin-form/src/masterDetailTx.ts; the child rows go through itstoWritable, which callssanitizeFormData.LineItemsPanel'ssaveis the second caller of the same builder.PATCH—ObjectForm's submit chain callssanitizeFormData(formData, objectSchema)and hands the result tosaveWithOcc.What reproduced, exactly as written. One filter, two answers, in the same call on the same fixture:
owner_id,owning_business_unit_id,created_by,updated_bycreated_at,updated_at,organization_id,idThat split is the whole diagnosis: the refusal is a hand-written NAME roster, and the emitted four were simply never in it. Nothing about the schema, the field types or the readonly flags distinguishes the two rows of that table — the injected columns are neither
hiddennorreadonly, because ownership is reassignable.The card's two claims about the plain edit form both reproduced. A form declaring three business fields and no ownership column rendered two inputs and still sent
owner_id— so the payload injects it rather than echoing a displayed field. And every child row was rewritten in full, including the two the user never touched.What did not reproduce as stated: the card says the message naming the refused field "only appears in the network response". It also reaches the browser console — the renderer logs
[form] write denied:with the whole error before it substitutes the user-facing text. See the secondary item below.What shipped — both tiers
1. One roster, and the invariant it expresses. The write-side roster in
sanitize.tsand the render-side roster inautoLayout.tswere two hand-written copies of the same list. They drifted: the render copy had learned to dropowner_id, the write copy never did. They are now the same object,SERVER_OWNED_FIELD_NAMES, whose header carries the rationale — a form never writes a field it refuses to render. The unified list addsowning_business_unit_id,company_id,space,_id,__v,created,modified,modified_byand the camelCase ownership spellings to both sides.2. The flag, because a name list cannot shut the class.
sanitizeFormDatanow refuses any field the object schema markssystem: true— the registry's own mark on everything it injects, the same flagisSystemManagedFieldin@object-ui/typesreads. The next injected column needs no edit here. This is the half the triage comment asked for: the roster alone would let the next one bite the same way.3. Dirty fields only, in the batch. A master-detail edit batch now sends only the cells that differ from the loaded snapshot, and a row where nothing moved emits no operation at all (every row with an id used to be routed to "update" whether or not anything had moved). The comparison resolves everything it cannot settle towards SENDING —
1000and'1000'read as different, objects compare by serialization, and a snapshot that does not show a row already linked still gets its FK re-asserted. Saying "changed" about an equal pair costs one column on the wire; saying "unchanged" about a changed pair would discard a user's edit with a 200 back, and that is the one failure this diff must not have.4. The builder no longer trusts its caller.
buildMasterDetailBatch/buildMasterDetailEditBatchapply the roster to the PARENT payload too. Both production callers already hand it a sanitized payload, but that is the caller's habit, not the builder's contract — and a payload builder trusting what it was handed is this card's whole defect.The measured end state for the card's own scenario — one cell changed on one of three child rows:
Secondary item: NOT done, and why
The card asks for the server's message to reach the user. Left alone, per the dispatch's own instruction for when it needs more than a small local change — and it does, in the direction that matters: doing it here would reverse a ruling, not fill a gap.
The form renderer substitutes a localized
form.noPermissionToSavefor every permission denial on purpose. Its comment records why: rendering the server text verbatim put raw diagnostics in front of end users, untranslated and leaking the object's machine name and the record id, and that was ruled and repaired — the record is objectstack#3821, restated for a 403 at objectui#5210. Printing the refusal text again would reintroduce that for every permission denial in the product, not only this one.⭐ And the seam for doing it correctly already exists, on the other side of the wire:
declaredUserMessagereadsuserMessage, the producer-side marking a hook sets at throw time to say "this text is for the end user" (objectstack#9934). ⇒ The correct change is for the platform's ownership-transfer refusal to carryuserMessage, after which this console surfaces it with no code change here at all. That is an objectstack change, outside this card's repo. Reported to the PM rather than filed.Meanwhile the diagnosis is not invisible: the renderer logs the full error under
[form] write denied:before substituting.Scope boundary I did not cross
The parent operation of a master-detail batch, and the plain record edit
PATCH, still send the full sanitized form values rather than a dirty diff. The card scopes "send only dirty fields" to the batch, and the batch's child rows are where the snapshot lives: the parent's persisted record is fetched insideObjectFormand never handed back out, so a parent dirty diff needs a new seam through the form'ssubmitHandlercontract — a wider change than this card, on the most-used write path in the product, where a false-clean silently drops a user's edit. The 403 no longer happens either way: it was caused by the roster, not by volume.Verification
Reverse verification, with the fix committed first so the restore leg has a real restore point. The three implementation files were reverted to the branch point, each mutation proven on disk by comparing
git hash-objectagainst theHEADblob (three distinct hashes, no empty reads), restored under atrap, and the restore proven bygit diff HEADbeing empty:All 11 reds are the new and retriaged pins, and they cover both paths — the
/batchrows and theplain record edit form PATCHrow both went red — plus two system-managed fields beyondowner_id(owning_business_unit_id,created_by/updated_by) and one that no roster in this repository names, refused by itssystemflag alone. No rebuild was needed for the ablation: all three files are consumed as sources through relative imports inside the same package, so nothing reads adist/.Checks on this head (
origin/mainmerged in, so PR #10151's bundle-analysis repair for incident #10148 is included — that gate and its ceilings are untouched by this branch):pnpm exec vitest run packages/plugin-form/pnpm --filter @object-ui/plugin-form run type-check(src +tsconfig.test.json)pnpm --filter @object-ui/plugin-form lintno-explicit-anybaseline; the three in the new test file match its neighbours)node scripts/check-changeset-presence.mjscheck:changeset-*,check:pending-changeset-literalspnpm check:new-line-citationspnpm check:control-bytescheck:*Declared narrowing on the repo-wide lint.
pnpm lintisturbo run lint, i.e. each package's owneslint .; the run above IS that command for the one package this diff touches, over its whole tree rather than only the changed files. Every changed file lives inpackages/plugin-form(plus one.changeset/*.md, which eslint does not read).eslint.config.jsconfigures noparserOptions.projectand noprojectService, so type-aware linting is not enabled and no rule in this repository can read across a file boundary — a change inside this package therefore cannot move the verdict on any file it does not touch. The remaining packages' lint runs are CI's.Every exit code above was captured before any pipe. What is NOT measured here: remote CI, which has not run on this head yet.
Acceptance notes
locked,instance_state,deleted,is_deleted) are deliberately left OUT of the roster. They are plausibly author-writable — a workflow form driving record state writes business meaning, not provenance — and nothing has measured them refusing a write. Adding one on the strength of the pattern alone would silently drop a value a form was asked to persist, which is the failure direction this module must not take.masterDetailTx.test.tswere retriaged rather than deleted, because each pinned the pre-fix full-row rewrite. One of them,emits only the parent update when children are unchanged, was false under its own name before this branch: the batch also carried a full-row rewrite of the child. Its snapshot was also missing the back-reference FK the real loader always returns, so it has been given the runtime's shape, and a new row pins what the builder does with a snapshot that lacks it.update carries routing id but a sanitized data payloadwas kept able to fail: the computed columns it asserts absent DIFFER from the snapshot, so only the sanitizer can be keeping them out — the dirty diff would let both through.packages/types/src/system-fields.tsholds a third roster of the same family (display-oriented) andpackages/plugin-detaila fourth (inline-edit "never editable"). Each has a written reason to be separate and none is wrong today. Successor: none — nothing in flight touches them, and folding four purpose-specific rosters together is a decision, not a cleanup.recordActivityFeed.tsand therecord:historyrow-cap path,packages/plugin-calendar/**,useSettledSchema*, and the three publish-drafts call sites inapp-shell.🤖 Generated with Claude Code
https://claude.ai/code/session_018HrVaotisyhgmot9o2MLRq
Generated by Claude Code