Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
a0e58e3
feat(plugin-approvals): a locked master's detail rows refuse insert/u…
claude Nov 20, 2026
8b9f1ad
feat(plugin-form): record-page body-table editor and one-batch record…
claude Nov 20, 2026
ecf3896
feat(app-shell): record page edit state saves the record and its body…
claude Nov 20, 2026
20ee22c
test(app-shell, plugin-form): pin the record edit state's one-batch s…
claude Nov 20, 2026
64adda2
docs(qa): the record page's edit state joins the master-detail atomic…
claude Nov 20, 2026
f33f3a6
fix(plugin-form): type the body-table editor's affordance source as L…
claude Nov 20, 2026
11e7fea
feat(app-shell): ruling B keeps inline edit on every record page, one…
claude Nov 20, 2026
87f5dc8
test(app-shell): the discard question is the page's dialog, with Engl…
claude Nov 20, 2026
7c49893
fix(plugin-approvals): type the detail-row lock's options; census row…
claude Nov 20, 2026
f45a1b7
fix(plugin-approvals): the detail-row lock's previous-row read passes…
claude Nov 20, 2026
d0bdc9d
Merge remote-tracking branch 'origin/main' into claude/issue-35599-re…
claude Nov 20, 2026
9cb0d10
fix(app-shell): register the body-table editor from a side-effect mod…
claude Nov 20, 2026
216a046
test(plugin-form): enter the record edit state's two saves in the wri…
claude Nov 20, 2026
59d1dbd
fix(app-shell): draw the edit state's body-table editors through a sl…
claude Nov 20, 2026
72de91f
Merge remote-tracking branch 'origin/main' into claude/issue-35599-re…
claude Nov 20, 2026
e428aac
fix(plugin-approvals): a non-scalar FK on a detail write fails closed
claude Nov 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .changeset/35599-record-page-edit-state.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
'@objectstack/plugin-approvals': patch
'@object-ui/plugin-form': patch
'@object-ui/i18n': patch
'@object-ui/plugin-detail': patch
---

feat: edit a record and its line tables together, and lock a record's lines while an approval locks the record

Clause-②: no
Metadata-protocol: none

**A locked record's lines are locked too.** While a record is held by an approval that locks it, writes to its master-detail child rows are refused with `RECORD_LOCKED` (409), the same answer a write to the record itself gets: inserting a row under it, updating or deleting one of its rows, and moving a row into it or out of it (both ends of a reparent are checked). A multi-row write that touches any such row is refused as a whole, and a row whose parent cannot be read is refused when the parent object has a locking approval the writer's run does not own. The approval's own exemptions carry over: system writes and the flow run that opened the approval still write. The refusal names the record by its object's label ("This Opportunity is locked while an approval is in progress, …"). Lookup children are not affected. `@objectstack/plugin-approvals` binds the new `bindDetailRowLockHook` beside the record lock it already binds.

**`@object-ui/plugin-form` exports the record-page body-table editor.** `RecordBodyTableEditor` draws a master-detail body table as editable lines (the `LineItemsField` grid, with the child columns, field permissions and add / remove rules the master-detail form uses) for a host's edit session (`RecordEditSessionContext`). `buildRecordEditBatch` folds a record's field changes and every table's lines into one batch (the `buildMasterDetailEditBatch` diff, table by table), and `attributeRecordEditRefusal` places a refused batch's reasons on the record's field or on the line whose write carried the refused field.

**`@object-ui/i18n`** adds `detail.bodyTableRow`, `detail.bodyTablesReadOnlyBulk` and `detail.discardInlineEditsMessage` to every built-in pack.

**`@object-ui/plugin-detail`** exports `RecordBodyTableEditorSlotContext`: while a host provides it, a `record:related_list` whose relationship id (`CHILD_OBJECT.FK_FIELD`) is in the slot's set draws the host's element in its place instead of the read-only list. The record page's edit state draws its body-table editors through it; no new node type is registered.

In the console, Edit on a record page that draws master-detail body tables now opens the page's edit state: the fields become inputs, the body tables editable lines, and one Save writes all of it in one batch. Per-field inline edit stays on every record page, those included, and saves the record alone through its save bar. One mode runs at a time: the edit state offers no per-field inline edit, and pressing Edit while inline changes are unsaved first asks whether to discard them.
3 changes: 2 additions & 1 deletion content/docs/permissions/system-context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ One of the largest consumers of the flag;

| # | Behaviour when `isSystem` | Package | What you get / what you lose | Symbol |
|:--|:---|:---|:---|:---|
| 41 | **Approval record lock released** — a locked record is writable | plugin-approvals | Get: engine self-writes (the status mirror) pass. Lose: the lock that stops edits while an approval is live. Note there is deliberately **no admin exemption** here — only `isSystem` | `bindApprovalLockHook` |
| 41 | **Approval record lock released** — a locked record, and its master-detail rows, are writable | plugin-approvals | Get: engine self-writes (the status mirror) pass, and so do system writes to a locked master's detail rows. Lose: the lock that stops edits to the record and its detail rows while an approval is live. Note there is deliberately **no admin exemption** here — only `isSystem` | `bindApprovalLockHook`, `bindDetailRowLockHook` |
| 42 | Delegation write guard bypassed | plugin-approvals | Get: service / seed / import may write delegation rows naming another delegator | `bindDelegationWriteGuard` |
| 43 | Approval actor / submitter / pending-approver checks bypassed (9 sites) | plugin-approvals | Get: approve, reject, recall, reassign without being a pending approver or the submitter, and a decision or comment that attaches files the actor did not upload (every other caller attaches only files it uploaded, in the request's organization) | `isOverrideActor`, `resolveActor`, `sendBack`, `resubmit`, `reassign`, `remind`, `requestInfo`, `comment`, `assertAttachmentsUploadedByCaller` |
| 44 | Attachment access hooks return early (insert + update + delete, the referenced-file check on insert + update, and the read AST) | service-storage | Lose: attachment visibility scoping | `installAttachmentAccessHooks`, `installAttachmentFileReferenceGate`, `installAttachmentReadVisibility` |
Expand Down Expand Up @@ -579,6 +579,7 @@ and CI refuses one that differs from what the tree produces.
| `packages/plugins/plugin-approvals/src/approval-service.ts#sendBack` | 1 | 43 |
| `packages/plugins/plugin-approvals/src/lifecycle-hooks.ts#bindApprovalLockHook` | 1 | 41 |
| `packages/plugins/plugin-approvals/src/lifecycle-hooks.ts#bindDelegationWriteGuard` | 1 | 42 |
| `packages/plugins/plugin-approvals/src/lifecycle-hooks.ts#bindDetailRowLockHook` | 1 | 41 |
| `packages/plugins/plugin-approvals/src/payload-predicate-guard.ts#bindSnapshotPredicateGuard` | 1 | 17 |
| `packages/plugins/plugin-approvals/src/payload-redaction-middleware.ts#bindSnapshotRedactionMiddleware` | 1 | 17 |
| `packages/plugins/plugin-approvals/src/reader-locale-labels-middleware.ts#bindReaderLocaleLabelsMiddleware` | 1 | 17 |
Expand Down
23 changes: 19 additions & 4 deletions docs/qa/platform-checklist/areas/records-forms.json
Original file line number Diff line number Diff line change
Expand Up @@ -1523,7 +1523,7 @@
"title": "Master + line items save as one atomic batch, with server-side roll-up",
"since": "v16",
"status": "active",
"revision": 10,
"revision": 11,
"priority": "P1",
"surface": "browser",
"personas": [
Expand All @@ -1546,7 +1546,9 @@
"re-read master + lines via GET /api/v1/data/showcase_invoice?$filter=[[\"name\",\"=\",\"os-qa-<runid>\"]] and the lines by the returned invoice id; check invoice.total against the sum of line amounts",
"add a third line via the edit form and save; re-read invoice.total; delete that line; re-read total again",
"repeat the create with one child made deliberately invalid (product empty on a line); attempt save; capture the failure",
"verify no partial writes: filtered GET for the failed invoice name returns 0 rows and no orphan lines exist"
"verify no partial writes: filtered GET for the failed invoice name returns 0 rows and no orphan lines exist",
"record-page edit (#35599): open a saved invoice's record page (its Line Items draw as a body table) and press Edit: the fields become inputs, the body table becomes editable lines, and the header shows Cancel and Save in Edit's place. Change the invoice name, one line's quantity, add a line in the trailing blank row and remove another line; Save ONCE; capture the network trace of the save and re-read the invoice and its lines",
"on the same page, Edit again, clear one line's product and Save: capture the error and where it is drawn; re-read the invoice and lines; then press Cancel and check the page reads as stored"
],
"acceptance": [
{
Expand Down Expand Up @@ -1584,19 +1586,26 @@
"oracle": "api",
"verify": "change qty, watch amount update without save; after save the API row carries qty × unit_price",
"evidence": "screenshot + line read"
},
{
"clause": "the record page's edit state saves the record's changes and every body table's line creates, updates and deletes in ONE POST /api/v1/batch, one transaction; a refused save writes nothing, keeps every edit on screen, and draws the reason on the line whose write carried the refused field; Cancel discards every edit",
"oracle": "network",
"verify": "the save sends exactly one batch call whose payload opens with the invoice update (only the changed fields) and carries the line create, update and delete; after the invalid-line save the re-read shows the invoice and lines unchanged and the line's error sits under the table naming that line; after Cancel the lines and fields read as stored",
"evidence": "the batch payload, the two re-reads, the error screenshot"
}
],
"negative": [
"the invalid-child case must not partially commit: ANY surviving master or sibling row after the failed save is a FAIL — check by API read, not by the grid",
"a save that issues one write per row (N requests) is a FAIL of the atomicity clause even when all rows land"
"a save that issues one write per row (N requests) is a FAIL of the atomicity clause even when all rows land",
"a record-page save that sends the record update and the line writes as separate requests (or one request per line) is a FAIL of the edit-state clause even when every row lands"
],
"traps": [
"automation-input",
"hydration-race"
],
"automated": {
"kind": "e2e",
"ref": "objectui: e2e/live/master-detail.spec.ts (acceptance[0], carrier-neutrally: the showcase 'New Project + Tasks' page, one showcase_task child staged through the per-row form, not this item's invoice grid with two lines), e2e/live/form-view-subforms.spec.ts (acceptance[4] ONLY: the stock New Invoice dialog renders the relationship-derived Line Items section, found by its heading, and its line grid). The roll-up spec dropped at revision 5 is not a pin of this item (history, revision 5). packages/qa/dogfood/test/master-detail-batch-atomic.dogfood.test.ts, at the cross-object POST /api/v1/batch the form saves through (child ops pointing at the parent by {$ref: 0}), on the showcase invoice and lines as shipped: acceptance[1] (the invoice and two catalog-product lines re-read over REST with the values sent), acceptance[5]'s persisted half (each stored amount is quantity × unit_price; a client-sent amount does not stand), acceptance[2] (total equals the sum of line amounts on the atomic create, after a line is added and after one is deleted) and acceptance[3] with negative[0] (a batch whose second line has no product is 400 VALIDATION_FAILED naming product, and neither the invoice nor its valid sibling line exists afterwards). acceptance[0]'s batch count, negative[1] and acceptance[5]'s live client recompute stay network/dom legs"
"ref": "objectui: e2e/live/master-detail.spec.ts (acceptance[0], carrier-neutrally: the showcase 'New Project + Tasks' page, one showcase_task child staged through the per-row form, not this item's invoice grid with two lines), e2e/live/form-view-subforms.spec.ts (acceptance[4] ONLY: the stock New Invoice dialog renders the relationship-derived Line Items section, found by its heading, and its line grid). The roll-up spec dropped at revision 5 is not a pin of this item (history, revision 5). packages/qa/dogfood/test/master-detail-batch-atomic.dogfood.test.ts, at the cross-object POST /api/v1/batch the form saves through (child ops pointing at the parent by {$ref: 0}), on the showcase invoice and lines as shipped: acceptance[1] (the invoice and two catalog-product lines re-read over REST with the values sent), acceptance[5]'s persisted half (each stored amount is quantity × unit_price; a client-sent amount does not stand), acceptance[2] (total equals the sum of line amounts on the atomic create, after a line is added and after one is deleted) and acceptance[3] with negative[0] (a batch whose second line has no product is 400 VALIDATION_FAILED naming product, and neither the invoice nor its valid sibling line exists afterwards). acceptance[0]'s batch count, negative[1] and acceptance[5]'s live client recompute stay network/dom legs. acceptance[6] (the record page's edit state, #35599): ui/packages/app-shell/src/views/RecordDetailView.harness.test.tsx block 'RecordDetailView.recordEditState-35599' (the real record page over a mocked adapter: one batchTransaction carrying the record update and two body tables' create, update and delete; a refused batch keeps every edit and draws the reason on its line; Cancel restores) and ui/packages/plugin-form/src/RecordBodyTableEditor.recordEditBatch-35599.test.ts (the batch and the refusal placement). Neither drives a live server: the one-transaction and nothing-lands halves are the batch route's, pinned by the dogfood battery above"
},
"source": [
"#3358 §4",
Expand Down Expand Up @@ -1663,6 +1672,12 @@
"date": "2026-11-15",
"change": "steps[1] gains a driver note: 'Add line' beside the grid's trailing blank row makes it a middle all-null row that the save submits and the batch refuses (400 'Product is required', nothing written). QA run #33861, ledger row 146. No clause changed. Ledger 6896511848 of the v18.5.0 sweep anchor #33761, carried by batch-A card #33963; read at base 895783a1.",
"ref": "#33990"
},
{
"revision": 11,
"date": "2026-11-20",
"change": "the record page's edit state (#35599) saves through the same batch door: steps[7] and [8], acceptance[6] and negative[2] added for it, and automated.ref names its two unit pins. The form clauses above are unchanged",
"ref": "#35599"
}
]
},
Expand Down
4 changes: 4 additions & 0 deletions packages/plugins/plugin-approvals/src/approvals-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
} from './approval-service.js';
import {
bindApprovalLockHook,
bindDetailRowLockHook,
bindDelegationWriteGuard,
bindRecordDeleteCancelHook,
unbindAllHooks,
Expand Down Expand Up @@ -369,6 +370,9 @@ export class ApprovalsServicePlugin implements Plugin {
// …and it is worded in the writer's locale, with the object's label in
// that locale, through the same lazily-read `i18n` service.
bindApprovalLockHook(engine, ctx.logger, fieldVisibility, i18nService);
// Ruling A on the record-page edit card: a locked master's detail rows
// refuse insert / update / delete as well.
bindDetailRowLockHook(engine, ctx.logger, i18nService);
bindRecordDeleteCancelHook(engine, this.service, ctx.logger);
bindDelegationWriteGuard(engine, ctx.logger);
// [#10749] Generic-door snapshot redaction. Registered here so the
Expand Down
Loading
Loading