Repository navigation
feat(app-shell, plugin-approvals): edit a record and its line tables in one save; a locked record locks its lines - #35755
Conversation
…pdate/delete Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ Co-authored-by: Claude <noreply@anthropic.com>
… edit builder Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ Co-authored-by: Claude <noreply@anthropic.com>
… tables in one batch Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ Co-authored-by: Claude <noreply@anthropic.com>
…ave, refusal placement, rulings A and B The body-table editor reads its adapter from the record context, as the page's related lists do: the schema context is not mounted on every host. Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ Co-authored-by: Claude <noreply@anthropic.com>
…-save item; changeset Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ Co-authored-by: Claude <noreply@anthropic.com>
…ineItemsPanel does Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ Co-authored-by: Claude <noreply@anthropic.com>
… mode at a time Inline edit stays on pages that draw body tables and saves the record alone through the save bar; Edit there enters the edit state, which saves the record and its lines in one batch. The edit state occupies the record's single inline session, so no per-field inline edit is offered inside it, and Edit over unsaved inline changes asks to discard them first (an AlertDialog). The Edit button's eligibility is state set during render, so its disabled flag never lags. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ
…ish fallbacks for its strings Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ
…; regenerated zh-Hant The detail-row lock's previous-row read and its test reads carry the declared EngineQueryOptions type instead of an erasing cast, so the erasure ratchet holds. The system-context census lists bindDetailRowLockHook beside the record lock it extends. zh-Hant is regenerated from zh-Hans. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ
… mutable context arrays Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ
…ule the barrel keeps record:body_table_editor registered at load time inside recordEditState.tsx, which no sideEffects-covered chain reaches from the barrel, so a bundler could shake the registration away. It moves to record-body-table-editor-renderer.tsx, imported from the barrel and listed in sideEffects like the other record renderers; recordEditState.tsx imports it too. KNOWN_SCHEMA_TYPES is regenerated to include the type. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ
📓 Docs Drift CheckThis PR changes 1 package(s): 47 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 9 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 6 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 09dcae50da66f5f3f33d387dd97fe7ab607dcbf7 && git checkout 09dcae50da66f5f3f33d387dd97fe7ab607dcbf7
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 0e2de25149ec81ecb00094300ad2f1e506ddc1fd e428aacfe2fceaf55b1ea324dabf01c26d4aa853 && git checkout -B drift-repro 0e2de25149ec81ecb00094300ad2f1e506ddc1fd && git merge --no-ff e428aacfe2fceaf55b1ea324dabf01c26d4aa853
node scripts/docs-audit/affected-docs.mjs --json 0e2de25149ec81ecb00094300ad2f1e506ddc1fd
|
…te census The edit state's Save writes the record alone (update) or the record and its body tables as one batch; both sites were unlisted. Map the update behind recordEdit (the page) and the batch behind recordEdit, relatedNew, relatedRowDelete (the body-table editor) and editFormFields (the field write gate's edit columns). Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ
…ot, not a registered node type The edit state rewrote each body-table `record:related_list` node into a `record:body_table_editor` node registered through ComponentRegistry, which grew `objectui validate`'s namespaced-at-type count past its falling pin and put an internal node into the known schema types. The page now keeps its `record:related_list` nodes: the edit state's controller provides plugin-detail's new `RecordBodyTableEditorSlotContext` (the edited ids and a render function), and the related-list renderer draws the host's `RecordBodyTableEditor` in place of a list whose id is in the set. The registration module, its barrel import and sideEffects entries are gone; KNOWN_SCHEMA_TYPES is regenerated back to main's list; the swap helper and its unit cases are retired, replaced by a renderer pin with two CONTROLs. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ
|
repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4 维护者速读
席位核对ACCEPT · head Routing: seat ruled no L2 (no Server guard (
Client:
Required before landing:
Recommended (not blocking):
Nits (no action required):
|
A supplied master-detail FK that is not a scalar id (an object such as
`{ id }`, or an array) read as no master, so the detail-row lock was
silent on insert and on the new end of a reparent. Such a value now marks
the write unresolved and is refused while any record of that master object
is held by a locking approval. The unresolved refusal now carries the same
end-user sentence naming the master as the resolved one.
Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ
|
repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4 维护者速读
席位核对delta ACCEPT (on ACCEPT 7032276125) · head
R (CI). 20 checks were running at this head. Land on all green. |
|
repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ Landing · area ux-2 · 2026-11-20T06:57Z
State: draft → ready + auto-merge (merge queue). |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 44691577418 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
|
repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ Re-queue · area ux-2 · 2026-11-20T07:20Z Queue run 44691577418 ejected this PR on
Head unchanged, with both L1-a ACCEPTs (7032276125, 7032383142) and green PR CI, so auto-merge is re-armed once. A second ejection on the same signature goes to triage, not to another re-queue. |
Fixes #35599
Part of #35590
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
Server, ruling A (settled, 「一起锁」).
@objectstack/plugin-approvalsbinds a second lock hook,bindDetailRowLockHook, beside the existing record lock. While a master record is held by a locking pending approval (lockRecordnot false), writes to itsmaster_detailchild rows are refusedRECORD_LOCKED(409), with the same user sentence the record lock uses, naming the master by its object label:beforeInsertreads the new row's FK;beforeUpdateandbeforeDeletereadprevious[fk]. An update that moves the FK also checks the new master, so a reparent is checked at both ends.previousbound (ADR-0058 Addendum II), so any touched row under a locked master refuses the whole write.previous, and the id read finds nothing), the write fails closed: it is refused if the master object has any locking request the writer's run does not own.session.isSystem, and the flow run that opened the approval (provenance.flowRunId === request.flow_run_id).sys_approval*masters are skipped.recordHeldByLockingApprovalnow shares one private helper,lockingRequestsForRecords, with the new hook. Its own behaviour is unchanged.Client, edit state (items 1-4, 6). On a record page that draws master-detail body tables, Edit now opens the page's edit state instead of the record form.
record:related_listnodes. While the edit state is open (and one batch can carry the tables), its controller provides@object-ui/plugin-detail's newRecordBodyTableEditorSlotContext: the edited relationship ids and a render function. Therecord:related_listrenderer reads it first, and a list whoseobjectName.relationshipFieldid is in the set draws the host's editor in its place instead of the read-only list. No node type is registered for the editor. The editor is@object-ui/plugin-form's newRecordBodyTableEditor, built fromMasterDetailForm's pieces: theLineItemsFieldgrid,deriveDetailcolumns,applyColumnPermissions, and therelatedNew/relatedRowDeleteadd and remove rules.POST /api/v1/batchwithbuildRecordEditBatch: op 0 is the record update (only the edited fields), followed by each table'sbuildMasterDetailEditBatchdiff (create / dirty-fields update / delete). It is the same constructionMasterDetailFormandLineItemsPanelpersist through, reused without a fork, andMasterDetailForm.tsxis untouched.attributeRecordEditRefusalplaces each reason the server names on the record field, or on the line whose write carried that field, or on the table when several lines carry it. A reason with no field, such as a lock, becomes the summary line.useRegisterUnsavedEdits,form.unsavedChanges).RecordDetailView, so it gets the same edit state.Ruling B (settled: 「全部保留」). Both edit modes stay, on every object, including objects with master-detail body tables. The provisional
canEditterm that turned inline edit off on such pages is gone.update, no batch.canEditterm is needed for this. Adding!recordEditStateto the conjunction would in fact break the edit state: the controller enters the record-level inline session, and the provider refusesenter()whencanEditis false.AlertDialog(the components primitive, notwindow.confirm): Keep editing leaves the inline draft in place, Discard drops it and enters the edit state over the stored values. An inline session with no changes is ended and the edit state opens without a question.Item 5 choice: option 2, UI-only.
POST /api/v1/batchis a bulk surface, gated onbulk ∧ childfor every object it writes.bodyTablesSaveTogetherreads that gate from the objects'enableblocks the page already holds, through the spec's owncanServeApiOperation. When the record lacksbulk ∧ update, or any table's child lacksbulk ∧ create/update/delete, the edit state still opens: the tables stay read-only with a notice saying why, and the record's own fields save through the plain update the inline session always used. Option 1 (auto-allow the batch path) would changebatch-routes.tsor the enable rules, which is a REST contract change (Clause-② yes). Option 2 offers no edit the server would refuse and changes no contract.Client half of ruling A. While
approvalLocked, the page passesRelatedRecordActionsBridgeaservewrapper through the bridge's existingserveprop (withDetailWritesWithheld). The wrapper stripsonCreate,onEditandonDeletefor master-detail children only.RelatedList.tsxand the bridge are not edited. The edit state never opens on a locked record, because the header draws no Edit there (objectstack#35593).Tests
Server: ruling A through the real engine (plugin-approvals)
packages/plugins/plugin-approvals/src/detail-row-lock.integration.test.tsuses a realObjectQLwith the better-sqlite3 in-memory driver and the real hook:multi: true) are refused;lockRecord: falsenode, and a lookup child.Each refusal asserts
codeRECORD_LOCKED,statusCode409 and the userMessage sentence.Readings:
detail-row-lock.integration.test.tson the merged treed0bdc9da, under the verify lock:Test Files 1 passed (1),Tests 10 passed (10). Noplugin-approvalsfile changed after that commit; the head is9cb0d100.plugin-approvalssuite before the resume, on the branch at that time:Test Files 125 passed (125),Tests 1780 passed (1780).pnpm --filter @objectstack/plugin-approvals typecheckexit 0 ond0bdc9da. That includescheck:test-typecheck.Server guard ablation (one-off, not committed)
Through
scripts/ablation-replace.mjsonpackages/plugins/plugin-approvals/src/lifecycle-hooks.ts:const edges = masterEdgesOf(engine, object);was replaced by an empty edge list (anchor count 1 to 0, blobdef2d354757ato589ab177c306).Tests 7 failed | 3 passed (10). Every refusal cell and the opening-run cell turned red. The three that stayed green are the controls that write anyway (system write,lockRecord: false, lookup child).def2d354757a) andgit diff HEADis empty.Client: the record page's edit state (app-shell harness, plugin-form, app-shell helpers)
RecordDetailView.harness.test.tsxblockRecordDetailView.recordEditState-35599renders the real record page at 1440 px on the app route:updateof the record alone and no batch. Edit then opens the edit state, not the record form; there no pencil and no save bar are drawn, and the header shows Save and Cancel instead of Edit;window.confirmnever called). Keep editing keeps the draft and opens no edit state; Discard opens the edit state over the stored value, with no write;batchTransactionONCE, and neverupdate,createordelete, with op 0{object: quote, action: update, id, data: {summary}}plus line create, line update (dirty field only), line delete and task update. That covers two body tables in one batch;fields: [{field: product}]) keeps every edit (the field input, the edited quantity, the new line) and draws the reason under the line table on the new line (data-body-table-row-error="1"). Cancel then leaves the edit state with no second write, and re-entering shows the stored values;bulkkeeps its table read-only with the notice, and the record saves through oneupdatewith no batch;RecordBodyTableEditor.recordEditBatch-35599.test.tscovers batch construction and owner tracing (a blank ghost line emits no op, a removed line is drawn nowhere) and refusal placement (on the record field, on a line, on the table, and as the summary).recordEditState.helpers-35599.test.tscovers the item-5 decision acrossbulkcombinations, and the detail-only strip, with a lookup CONTROL.On the head
9cb0d100, with--maxWorkers=1 --pool=forksunder the verify lock, these five files gaveTest Files 5 passed (5),Tests 141 passed (141):RecordDetailView.harness.test.tsx, all 70 tests, the sevenrecordEditState-35599cells among them;recordEditState.helpers-35599.test.ts;RecordBodyTableEditor.recordEditBatch-35599.test.ts;scripts/__tests__/check-side-effects-array.test.ts;scripts/__tests__/known-schema-types-derivation-5115.test.ts.On the merged tree
d0bdc9da, the three edit-state files pluspackages/i18n/gaveTest Files 108 passed (108),Tests 2039 passed | 13 skipped (2052). That includes the zh-Hant generated-catalogue pin.type-checkexit 0 for@object-ui/app-shelland@object-ui/clion9cb0d100, and for@object-ui/plugin-form,@object-ui/i18nand@object-ui/app-shellond0bdc9da.Two one-off mutations, each restored with blob == HEAD and an empty
git diff HEAD:serve={approvalLocked→serve={false: the ruling-A client cell turned red (expected 2 to be +0).&& !inlineEditOffForBodyTablesterm (provisional B, now retired): that cell turned red (expected 1 to be +0).setConfirmDiscard(true)swapped forenterNow()in the controller'srequestEnter, throughscripts/ablation-replace.mjs(anchor 1 to 0): the one-mode cell turned red (Tests 1 failed | 6 passed), and the restore was proved by blob == HEAD (b0b0e192465c) with an emptygit diff HEAD.Retired or migrated tests: the two
swapBodyTablesForEditorscases inrecordEditState.helpers-35599.test.tsare retired with the helper (see "Fixes after 9cb0d10");record-related-list.editorSlot-35599.test.tsxpins the slot instead. The provisional ruling-B cell (a page drawing body tables offers no per-field inline edit; a page with none keeps it (CONTROL)) is retired, and thechildren: falsefixture option it alone used goes with it. Its replacement is the three ruling-B cells above, in the same block. Nothing else existing was rewritten.Acceptance notes
content/docs/permissions/system-context.mdx:check:system-context-censusrequires a keyed row for the new hook'sisSystemexemption.bindDetailRowLockHookjoins row 41 besidebindApprovalLockHook, and the generated register was rewritten with--write.ui/packages/plugin-detail/src/renderers/record-related-list.tsxandrelatedListCompact.ts: the editor slot (see "Fixes after 9cb0d10"). The original dispatch fencedrecord-related-list.tsxwhile 相关子表的页签:不放筛选排序,右上角只留「添加」和「在列表中打开」;批量添加要么全成要么全不成 #35601 is in flight; the follow-up fix order named that block file as the place for the slot check. The change is one import and one new wrapper component in front of the bound block.RelatedList.tsxis not edited.zh-Hant.ts: regenerated from zh-Hans (gen:zh-hant).ui/packages/plugin-formandui/packages/i18n: for the reuse and the strings described above.satisfies EngineQueryOptions, solifecycle-hooks.tsstays at its ceiling of 4 and the test surface does not grow.setRecordEditEligibleis called during render, not from an effect, because that point is below the view's early returns, where no hook may run. React re-renders before it commits, and the call does nothing once the value agrees.serveprop.RelatedList.tsxand the bridge are not edited.Fixes after 9cb0d10
Two CI reds at
9cb0d100came from registering the body-table editor as a component type,record:body_table_editor:registered-types-validate-ratchet-10859read 309 registered namespaced keys refused attypeagainst its falling pin of 308, andexclusion-reason-truthfulnessfound the registration file was not imported there.216a0464enters the edit state's two saves in the write census (affordanceGrantMap-12082.test.tsx): the record-aloneupdatemapped torecordEdit, and the batch mapped torecordEdit,relatedNew,relatedRowDeleteandeditFormFields.59d1dbd8stops making the editor a registered type.swapBodyTablesForEditorsandBODY_TABLE_EDITOR_TYPEare removed, and the page keeps itsrecord:related_listnodes.@object-ui/plugin-detailexportsRecordBodyTableEditorSlotContextbesideRecordBodyTablesContext, andRecordEditStateControllerprovides it with the edited ids and a render function forRecordBodyTableEditor. Therecord:related_listrenderer checks it before either binding.record-body-table-editor-renderer.tsx, its barrel import and bothsideEffectsentries are removed, andKNOWN_SCHEMA_TYPES, regenerated, is back to main's list. The changeset drops its@object-ui/cliline and names@object-ui/plugin-detailinstead. The ratchet's pin was not raised, and no type was added to the authoring face.72de91f6mergesorigin/main(K was 16; clean). The write census and the slot cell re-ran green on it (Tests 58 passed (58)).e428aacf(L1-a R2): a supplied master-detail FK that is not a scalar id (an object such as{ id }, or an array) no longer reads as "no master". It marks the write unresolved, which is refused while any record of that master object is held by a locking approval, on insert and on the new end of a reparent. The unresolved refusal now carries the same end-user sentence naming the master as the resolved one. New cell indetail-row-lock.integration.test.ts: an insert with{ id: <locked master> }is refused and nothing lands (Tests 11 passed (11)). Ablation (the insert branch's unscalar check removed):Tests 1 failed | 10 passed. Restored, then the wholeplugin-approvalssuite:Test Files 125 passed (125),Tests 1784 passed (1784);typecheckexit 0.Readings on 59d1dbd (verify lock, --maxWorkers=1)
registered-types-validate-ratchet-10859,exclusion-reason-truthfulness,check-side-effects-array,known-schema-types-derivation-5115:Test Files 4 passed (4),Tests 101 passed (101).packages/plugin-detail/src/renderers/__tests__/record-related-list.*(8 existing files plus the neweditorSlot-35599):Test Files 9 passed (9),Tests 59 passed (59).RecordDetailView.harness.test.tsxandrecordEditState.helpers-35599.test.ts:Test Files 2 passed (2),Tests 75 passed (75).RecordBodyTableEditor.recordEditBatch-35599.test.tsandaffordanceGrantMap-12082.test.tsx:Test Files 2 passed (2),Tests 60 passed (60).type-checkexit 0 for@object-ui/plugin-detail,@object-ui/plugin-formand@object-ui/app-shell.plugin-detailwas rebuilt first, and itsdist/index.d.tsnames the new context.scripts/ablation-replace.mjs:slot.ids.has(was replaced byslot.ids.size < 0 && ((anchor 1 to 0). Result:Tests 1 failed | 2 passed (3). The slot cell turned red and both CONTROLs stayed green. Restored: blob == HEAD (b8aa9e5da87d),git diff HEADempty. The first attempt used a replacement that still contained the anchor; the tool refused it before running anything, so that attempt was a no-op.check:nul-bytes,check:undeclared-dep-imports,check-sdui-manifest.mjs,check:test-source-alias,check:cross-package-test-inputs,check:platform-checklistand its--changed-from origin/mainform,check-empty-changeset.mjs,check-changeset-no-major.mjs,check:issue-citations. This is a declared narrowing to the families that read the files this fix changes. CI runs the rest.Browser reading (A4)
NOT MEASURED. A container restart killed the first run while it was building the dogfood server and console. The resumed run was limited to the affected test files, so no headless Chromium reading was taken and no screenshots exist. The record page's edit state, the discard dialog and the locked-rows gate are pinned only by the harness cells above.
Verification
Read these files first, ordered by risk:
packages/plugins/plugin-approvals/src/lifecycle-hooks.ts,bindDetailRowLockHook. Check the fail-closed branch (no row resolvable) and the per-master exemption filter.ui/packages/app-shell/src/views/recordEditState.tsx,RecordEditStateController.save. Check how op 0 is dropped when the draft is empty, the update-vs-batch choice, and the refusal fan-out.ui/packages/app-shell/src/views/RecordDetailView.tsxandrecordEditState.tsx'srequestEnter. Check the header IIFE hunk (Cancel / Save, and Edit'sdisableDuringInlineEdit), the render-timesetRecordEditEligible, and howenterNowends an open inline session without reading that as leaving the edit state.Two-minute check: from
ui/, runpnpm exec vitest run packages/app-shell/src/views/RecordDetailView.harness.test.tsx -t recordEditState-35599. ExpectTests 7 passed.Gates
node scripts/pm/dispatch-gates.mjs --commands: 121 families on the final tree.d0bdc9da. The 13 families thepackage.jsonedit added were run on9cb0d100.--ranreconciliation:121 derived famil(ies) accounted for — 121 run, 0 NOT-MEASURED.pnpm --dir ui exec vitest run scripts/exit 1 ond0bdc9da. Four failures came from this diff: the editor registration was outside thesideEffectschain, andKNOWN_SCHEMA_TYPESwas stale. Both are fixed in9cb0d100, and the two files re-ran green there (above).pnpm check:query-options-erasureandpnpm check:system-context-censuswere red on the previous run's tree, from this diff's server half. Both were fixed, and both are green on the final run.check:dts-closure(exit 1, nodistfor unbuilt packages such asplugins/organizations),check:dual-build-cjs-loads(exit 3), and@objectstack/spec check:skill-examples(exit 3,client-reactnot built).check-plugin-teardown-shape.mjs --self-test(exit 3). This checkout is shallow, and the gate's fixture commit is out of reach.node scripts/check-sdui-manifest.mjsexit 0 on9cb0d100. The byte comparison against a regenerated manifest is CI's (Build & E2E UI).node scripts/check-platform-checklist.mjs --changed-from origin/main:OK — … 4 anchor(s) judged, 0 lost.check:nul-bytesexit 0.