From 1f679fe5dded8a4319b60569304b7af60c0eff7b Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Dec 2026 16:26:30 +0000 Subject: [PATCH 1/9] feat(console): read the data layer's one lock read, word closed apart from in approval, save a closing header last (ADR-0162 item 4) Claude-Session: https://claude.ai/code/session_01WGufzhKEbEnW8pwZRgK2gJ Co-authored-by: Claude --- .../app-shell/src/hooks/useRecordApprovals.ts | 150 ++++++++++++++-- .../app-shell/src/views/RecordDetailView.tsx | 85 ++++++--- .../src/views/recordDeleteHeldByMaster.ts | 37 ++-- ui/packages/i18n/src/locales/ar.ts | 3 + ui/packages/i18n/src/locales/de.ts | 3 + ui/packages/i18n/src/locales/en.ts | 3 + ui/packages/i18n/src/locales/es.ts | 3 + ui/packages/i18n/src/locales/fr.ts | 3 + ui/packages/i18n/src/locales/ja.ts | 3 + ui/packages/i18n/src/locales/ko.ts | 3 + ui/packages/i18n/src/locales/pt-BR.ts | 3 + ui/packages/i18n/src/locales/ru.ts | 3 + ui/packages/i18n/src/locales/zh-Hans.ts | 3 + ui/packages/i18n/src/locales/zh-Hant.ts | 3 + .../plugin-form/src/MasterDetailForm.tsx | 56 ++++-- ui/packages/plugin-form/src/masterDetailTx.ts | 56 +++++- ui/packages/plugin-grid/src/ObjectGrid.tsx | 16 +- .../src/hooks/useRowApprovalLocks.ts | 170 +++++++++++------- .../src/objectGridActionsColumn.tsx | 43 ++--- .../plugin-grid/src/objectGridCellFacts.ts | 9 + .../plugin-grid/src/objectGridTranslations.ts | 1 + 21 files changed, 496 insertions(+), 160 deletions(-) diff --git a/ui/packages/app-shell/src/hooks/useRecordApprovals.ts b/ui/packages/app-shell/src/hooks/useRecordApprovals.ts index 561d41985b1..998ac184c2e 100644 --- a/ui/packages/app-shell/src/hooks/useRecordApprovals.ts +++ b/ui/packages/app-shell/src/hooks/useRecordApprovals.ts @@ -39,6 +39,16 @@ * a composition without the approvals service answers it 501, the designed * "no lock service", which is read silently and never asked again * (objectstack#26632); any other failure still logs. + * + * Beside the approvals reads, the hook asks the data layer's ONE lock read + * (`GET /data/:object/:recordId/lock`, ADR-0162 D9) and hands it back as + * `dataLock`: whether the record is locked, by which lock (`lockReason`: + * `closed_state` or `approval`) and whose (`lockSource`). That answer, not the + * approvals-family lock, is what the record page's Edit and Delete and the + * console's edit dialog read ({@link openApprovalOf}, + * {@link recordClosedByLock}); the approvals-family `recordLock` stays the + * approvals panel's and the approval tag's. The record page payload carries no + * data-layer lock, so this is one GET per read beside it. */ import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react'; @@ -282,22 +292,58 @@ export function recordLockAnswerOf(answer: { locked?: unknown; lockSource?: unkn return source === 'record' || source === 'master' ? { locked: true, lockSource: source } : { locked: true }; } +/** Which lock holds a locked record, as the data layer's lock read names it. */ +export type RecordLockReason = 'closed_state' | 'approval'; + /** - * The open approval on the record as the approvals read found it, reduced to - * its lock policy — `resolveApprovalLock`'s `openApproval` input - * (`@object-ui/react`). A pending request the viewer can read decides with its - * own node's `lock_record`; without one, the server's record lock - * (objectstack#25934) stands in for a reader outside the slate. `null` when - * neither shows an open approval. + * The data layer's lock read for one record (`GET /data/:object/:id/lock`, + * ADR-0162 D9): `locked`, and on a locked record which lock holds it + * (`lockReason`, `closed_state` winning when both hold) and whose + * (`lockSource`). It answers every reader who can read the record, whether or + * not field permissions let them read the state field. + */ +export interface DataRecordLock { + locked: boolean; + lockSource?: ApprovalLockSource; + lockReason?: RecordLockReason; +} + +/** The data lock read's answer off the wire, kept to the values the door serves (`RecordLockSchema`). */ +export function dataRecordLockOf(answer: { locked?: unknown; lockSource?: unknown; lockReason?: unknown } | null | undefined): DataRecordLock { + if (answer?.locked !== true) return { locked: false }; + const source = answer.lockSource === 'record' || answer.lockSource === 'master' ? answer.lockSource : undefined; + const reason = answer.lockReason === 'closed_state' || answer.lockReason === 'approval' ? answer.lockReason : undefined; + return { locked: true, ...(source ? { lockSource: source } : {}), ...(reason ? { lockReason: reason } : {}) }; +} + +/** + * Is the record closed (ADR-0162), as the data lock read answered it: its own + * declared closed state, or its master's for a master-detail line. Only an + * answer says so; no answer is not closed (fail open: the server still refuses + * a write to a closed record). A record both closed and held answers closed. + */ +export function recordClosedByLock(approvals: Pick): boolean { + return approvals.dataLock?.locked === true && approvals.dataLock.lockReason === 'closed_state'; +} + +/** + * The open approval on the record, reduced to its lock policy — + * `resolveApprovalLock`'s `openApproval` input (`@object-ui/react`). A pending + * request the viewer can read decides with its own node's `lock_record`; + * without one, the data layer's lock read answering `lockReason: 'approval'` + * stands in for a reader outside the slate (objectstack#25934): it is answered + * to every reader, and also says when an approval holds the record between its + * steps (ADR-0162 D5). `null` when neither shows an open approval. The + * approvals-family `recordLock` is not read here: it is the approvals panel's. * * The record page and the console's edit dialog (objectstack#27138) both read * the lock through this, so the dialog cannot offer an edit the page locks. */ export function openApprovalOf( - approvals: Pick, + approvals: Pick, ): { locked: boolean } | null { if (approvals.pendingRequest) return { locked: recordLockedByApproval(approvals.pendingRequest) }; - return approvals.recordLock?.locked === true ? { locked: true } : null; + return approvals.dataLock?.locked === true && approvals.dataLock.lockReason === 'approval' ? { locked: true } : null; } /** @@ -399,6 +445,14 @@ interface UseRecordApprovalsResult { * while its master is held. */ lockSource: ApprovalLockSource | null; + /** + * The data layer's lock read for the record (ADR-0162 D9), the answer the + * record page's Edit and Delete read. `null` when there is no answer to + * give: no adapter is mounted, the read has not answered, the record is not + * one the reader can read (404), or the data engine has no lock read (501, + * latched). A later failed read keeps the last answer. + */ + dataLock: DataRecordLock | null; refresh: () => Promise; } @@ -409,6 +463,7 @@ export function __resetRecordApprovalsStore(): void { listeners.clear(); latestSeq.clear(); recordLockAbsent = false; + dataLockAbsent = false; } function apiBase() { @@ -541,6 +596,8 @@ interface ApprovalsSnapshot { recordLock: RecordLockAnswer | null; /** Which approval holds the record, whenever a lock answer named it. */ lockSource: ApprovalLockSource | null; + /** The data layer's lock read (ADR-0162 D9), when it answered. */ + dataLock: DataRecordLock | null; } const EMPTY_ROWS: ApprovalRequestLite[] = []; @@ -551,6 +608,7 @@ const INITIAL_SNAPSHOT: ApprovalsSnapshot = Object.freeze({ rows: EMPTY_ROWS, recordLock: null, lockSource: null, + dataLock: null, }) as ApprovalsSnapshot; interface ApprovalsEntry { @@ -637,6 +695,50 @@ async function readRecordLock(objectName: string, recordId: string): Promise { + const path = `/data/${encodeURIComponent(objectName)}/${encodeURIComponent(recordId)}/lock`; + try { + const body = await fetchJson(path); + return dataRecordLockOf(body && typeof body.success === 'boolean' && 'data' in body ? body.data : body); + } catch (err: any) { + if (err?.status === 404) return null; + if (err?.status === 501) { + dataLockAbsent = true; + return null; + } + lockReadLogger.error('HTTP request failed', undefined, { + method: 'GET', + url: `${apiBase()}${path}`, + status: err?.status, + error: { code: err?.code, message: err?.message }, + }); + throw err; + } +} + +/** The data lock read did not answer: the last answer stands. */ +const KEEP_DATA_LOCK = Symbol('keep'); + +/** Send the data lock read; a failure, or a latched 501 before it, keeps the last answer. */ +async function readDataLock(objectName: string, recordId: string): Promise { + if (dataLockAbsent) return KEEP_DATA_LOCK; + try { + return await readDataRecordLock(objectName, recordId); + } catch { + // Logged by the read. + return KEEP_DATA_LOCK; + } +} + /** * What the record page's ONE read answered for this record's approvals * (objectstack#27627): the request rows, the pending one already enriched by @@ -673,14 +775,27 @@ function startRead( recordId: string, readsLock: boolean, seeded?: Promise, + approvalsOff = false, ): Promise { const seq = ++readSeq; latestSeq.set(key, seq); const entry = entries.get(key); if (entry) entry.read = true; publish(key, { loading: true }); + // The data lock read goes out beside the approvals reads wherever an adapter + // is mounted, approvals routes served or not (ADR-0162 D9). + const dataLockRead = readsLock ? readDataLock(objectName, recordId) : Promise.resolve(KEEP_DATA_LOCK); + // The data lock's patch, for the approvals answer to carry: both land in one + // publish, so a closed record never draws an Edit between the two answers. + let dataLockPublished = false; + const dataLockPatch = async (): Promise> => { + const dataLock = await dataLockRead; + dataLockPublished = true; + return dataLock === KEEP_DATA_LOCK ? {} : { dataLock }; + }; const promise = (async () => { try { + if (approvalsOff) return; if (seeded) { // The payload asked the list, the pending row's `getRequest` and the // lock as one read; the rows come enriched and the lock is answered @@ -689,6 +804,7 @@ function startRead( const rows = answer.requests ?? []; const pending = rows.find((r) => r.status === 'pending'); if (!answer.lock) recordLockAbsent = true; + const dataLockAnswer = await dataLockPatch(); if (latestSeq.get(key) !== seq) return; // Typed by the payload (`RecordPagePayload.approvals.lock`, the spec's // `RecordPageApprovalsSchema`): the kind rides a locked answer only. @@ -699,6 +815,7 @@ function startRead( answered: true, recordLock: !pending ? lock : null, lockSource: lock?.locked === true ? lock.lockSource ?? null : null, + ...dataLockAnswer, }); return; } @@ -724,8 +841,10 @@ function startRead( // leaves none; a failure after an answer keeps it, as the rows are. } } + const dataLockAnswer = await dataLockPatch(); if (latestSeq.get(key) !== seq) return; publish(key, { + ...dataLockAnswer, rows: full ? rows.map((r) => (r === pending ? full : r)) : rows, available: true, answered: true, @@ -741,6 +860,11 @@ function startRead( } // Other errors are transient — silently keep last state. } finally { + // Not carried by an approvals answer (none came): published on its own. + if (!dataLockPublished) { + const dataLock = await dataLockRead; + if (dataLock !== KEEP_DATA_LOCK && latestSeq.get(key) === seq) publish(key, { dataLock }); + } if (inFlight.get(key)?.seq === seq) inFlight.delete(key); if (latestSeq.get(key) === seq) publish(key, { loading: false }); if (!entries.has(key) && !inFlight.has(key)) latestSeq.delete(key); @@ -811,8 +935,9 @@ export function useRecordApprovals( // Join the read on the wire, or the answer another consumer already has; // read only when neither exists. The entry may be new while a read is in // flight (StrictMode's replayed mount): that read publishes into it. - if (entry && !entry.read && !inFlight.has(readKey) && !unavailableRef.current) { - void startRead(readKey, objectName, recordId, readsLock); + // With the approvals routes absent, the data lock is still read. + if (entry && !entry.read && !inFlight.has(readKey) && (!unavailableRef.current || readsLock)) { + void startRead(readKey, objectName, recordId, readsLock, undefined, unavailableRef.current); } else if (entry && inFlight.has(readKey)) { entry.read = true; if (!entry.snapshot.loading) publish(readKey, { loading: true }); @@ -822,8 +947,8 @@ export function useRecordApprovals( const refresh = useCallback(async () => { if (!objectName || !recordId || !readKey) return; - if (unavailableRef.current) return; - await startRead(readKey, objectName, recordId, readsLock); + if (unavailableRef.current && !readsLock) return; + await startRead(readKey, objectName, recordId, readsLock, undefined, unavailableRef.current); }, [objectName, recordId, readKey, readsLock]); const requests = readKey === null ? EMPTY_ROWS : snapshot.rows; @@ -862,6 +987,7 @@ export function useRecordApprovals( latestRequest, recordLock: readKey === null ? null : snapshot.recordLock, lockSource: readKey === null ? null : snapshot.lockSource, + dataLock: readKey === null ? null : snapshot.dataLock, refresh, }; } diff --git a/ui/packages/app-shell/src/views/RecordDetailView.tsx b/ui/packages/app-shell/src/views/RecordDetailView.tsx index b6cfec49cec..fee0302fa33 100644 --- a/ui/packages/app-shell/src/views/RecordDetailView.tsx +++ b/ui/packages/app-shell/src/views/RecordDetailView.tsx @@ -95,8 +95,8 @@ import type { DataSource, FeedItem, Reaction, RecordPageOperation, RecordPagePay import { arrangedHeaderActions, placedHeaderActions } from '@object-ui/types'; import type { ActionContext, ActionDef, ActionParamDef, ActionResult, ConfirmationHandler, ParamCollectionHandler } from '@object-ui/core'; import type { ConsoleActionDispatch } from '../consoleActionDispatch.js'; -import { useRecordApprovals, openApprovalOf, isSubmitterOf } from '../hooks/useRecordApprovals.js'; -import { recordDeleteHeldByMaster } from './recordDeleteHeldByMaster.js'; +import { useRecordApprovals, openApprovalOf, isSubmitterOf, recordClosedByLock } from '../hooks/useRecordApprovals.js'; +import { recordDeleteRefusedByLock } from './recordDeleteHeldByMaster.js'; import { RecordAttachmentsPanel } from './RecordAttachmentsPanel.js'; import { RecordApprovalsPanel, stepDisplayText } from './RecordApprovalsPanel.js'; import { ApprovalBandOnceScope, RecordStageMenu, RelatedListConditionsSlotContext } from '@object-ui/plugin-detail'; @@ -2577,16 +2577,28 @@ export function RecordDetailView({ dataSource, objects, onEdit, objectNameOverri // // The list serves a request only to its participants, so a reader outside // the slate reads it empty while a locking approval runs (objectstack#25934). - // For them the open approval is the server's record lock: `{ locked: true }` - // says a pending request from a locking node exists, which is rule 1's input - // exactly. No lock answer (no approvals service answers its route 501) is no - // open approval, so rule 2 is unchanged. + // For them the open approval is the data layer's lock read answering + // `lockReason: 'approval'` (ADR-0162 D9, `openApprovalOf`), which is rule 1's + // input exactly. No such answer is no open approval, so rule 2 is unchanged. + // The approvals-family lock (`recordLock`) still names the approval in the + // header's tag below; it decides no affordance. const lockedForReader = !approvals.pendingRequest && approvals.recordLock?.locked === true; const { pending: approvalPending, locked: approvalLocked } = resolveApprovalLock({ readAnswered: approvals.answered, openApproval: openApprovalOf(approvals), recordStatus: (pageRecord as any)?.approval_status, }); + // ADR-0162 — the record is CLOSED (its own declared closed state, or its + // master's for a master-detail line), as the data layer's lock read says to + // every reader, whether or not they may read the state field. "Closed" and + // "in approval" are different things to tell a reader: a closed record + // keeps its Edit drawn, greyed, with this sentence, and a record both closed + // and held reads as closed. Nothing else is shown: not the state field, not + // its value. + const recordClosed = recordClosedByLock(approvals); + const closedLockReason = String(t('detail.lockedClosedTooltip', { + defaultValue: 'This record is closed, so it can\'t be changed.', + })); // objectstack#35599 — the record page's EDIT STATE (`recordEditState.tsx`): // on a page that draws master-detail body tables, Edit turns the overview // into a form — the fields become inputs, the body tables editable lines — @@ -5421,9 +5433,10 @@ export function RecordDetailView({ dataSource, objects, onEdit, objectNameOverri // subtracts. const affordances = { edit: objectAffordances.edit && recordWriteAllowed && editVisible, - // objectstack#37195: a line held by its MASTER's approval offers no - // Delete — the server refuses it — as the grid's row menu does. - delete: objectAffordances.delete && recordDeleteAllowed && deleteVisible && !recordDeleteHeldByMaster(approvals), + // objectstack#37195 / ADR-0162 D6: a closed record (either source), and a + // line held by its MASTER's approval, offer no Delete — the server + // refuses it — as the grid's row menu does. + delete: objectAffordances.delete && recordDeleteAllowed && deleteVisible && !recordDeleteRefusedByLock(approvals), }; const items: ActionDef[] = []; // [objectstack ADR-0142 D4] Claim, ahead of Edit: on a record sitting in a @@ -5443,10 +5456,11 @@ export function RecordDetailView({ dataSource, objects, onEdit, objectNameOverri } // objectstack#35593 — a record an approval locks draws no Edit at all: the // header's approval tag says why it cannot be changed. Every other reason - // for "off" keeps Edit drawn and greyed, as below. + // for "off" keeps Edit drawn and greyed, as below — a closed record + // (ADR-0162) among them, also when an approval holds it too. // objectstack#35599 — in the edit state the Edit button's place holds the // state's Cancel and Save, through the same system-action props. - if (affordances.edit && !approvalLocked && recordEditState) { + if (affordances.edit && !approvalLocked && !recordClosed && recordEditState) { items.push({ name: 'sys_record_edit_cancel', label: t('detail.cancel', { defaultValue: 'Cancel' }), @@ -5474,15 +5488,18 @@ export function RecordDetailView({ dataSource, objects, onEdit, objectNameOverri onClick: () => { void recordEditControlRef.current?.save(); }, } as any); } - if (affordances.edit && !approvalLocked && !recordEditState) { - const editOff = approvalLocked || editDisabledByPredicate || editLockedByState; + if (affordances.edit && (!approvalLocked || recordClosed) && !recordEditState) { + const editOff = approvalLocked || recordClosed || editDisabledByPredicate || editLockedByState; // objectstack#35135 — the reason a predicate-disabled Edit gives. The // approval band and the state-lock badge explain their own locks, so // the generic sentence is spoken only when `edit.disabledWhen` is what // turned Edit off and neither of those draws: one reason at a time. - const editReason = editDisabledByPredicate && !approvalLocked && !editLockedByState - ? predicateDisabledReason - : undefined; + // ADR-0162 — a closed record's Edit says it is closed, first. + const editReason = recordClosed + ? closedLockReason + : editDisabledByPredicate && !approvalLocked && !editLockedByState + ? predicateDisabledReason + : undefined; // Single primary Edit CTA → opens the full record form. Inline editing // is no longer a standalone header button; it is entered by // double-clicking a field (or its hover pencil) in the record body, @@ -6133,7 +6150,20 @@ export function RecordDetailView({ dataSource, objects, onEdit, objectNameOverri // only), as the DetailView lock band draws the approval lock's. Not while // an approval lock already explains a disabled Edit. const stateLockLabel = t('detail.lockedByState', { defaultValue: 'Not editable in its current state' }); - const stateLockChip = editLockedByState && !approvalLocked ? ( + // ADR-0162 — a closed record's chip, in the state chip's place: it names no + // field and no value, so a reader who may not see the state field reads it too. + const closedLockLabel = t('detail.lockedClosed', { defaultValue: 'Closed' }); + const stateLockChip = recordClosed ? ( + + + ) : editLockedByState && !approvalLocked ? ( {approvalTagText} @@ -6372,11 +6402,14 @@ export function RecordDetailView({ dataSource, objects, onEdit, objectNameOverri resolveRecordHeaderActionGates(objectDef, perms).edit && recordWriteAllowed && !approvalLocked + && !recordClosed && editVisible && !editDisabledByPredicate && !editLockedByState } - locked={approvalLocked} + // ADR-0162 — a record both closed and held reads as closed: the band + // keeps the approval's status, and the closed chip names the lock. + locked={approvalLocked && !recordClosed} approvalPending={approvalPending} approvalReadAnswered={approvals.answered} approvalProgress={approvalProgress} @@ -6599,9 +6632,11 @@ export function RecordDetailView({ dataSource, objects, onEdit, objectNameOverri parentRecord={pageRecord} parentObjectFields={predicateFields} /* objectstack#35599, ruling A (「一起锁」) — while an approval - locks this record, its master-detail children draw no New, - Edit or Delete: the server refuses each RECORD_LOCKED. */ - serve={approvalLocked + locks this record, or it is closed (ADR-0162 D3: a closed + record's master-detail lines are closed with it), its + master-detail children draw no New, Edit or Delete: the + server refuses each RECORD_LOCKED. */ + serve={approvalLocked || recordClosed ? (bridge) => withDetailWritesWithheld(bridge, (child, fk) => isMasterDetailChild(objects, objectName, child, fk)) : undefined} > @@ -6751,8 +6786,8 @@ export function RecordDetailView({ dataSource, objects, onEdit, objectNameOverri data={pageRecord} refresh={notifyRecordChanged} fieldLabelFor={(name: string) => (objectDef as any)?.fields?.[name]?.label || fieldLabel(objectName || '', name, name)} - locked={approvalLocked} - lockedHint={t('detail.lockedTooltip', { + locked={approvalLocked || recordClosed} + lockedHint={recordClosed ? closedLockReason : t('detail.lockedTooltip', { defaultValue: 'This record has a pending approval request; editing is locked', })} />} diff --git a/ui/packages/app-shell/src/views/recordDeleteHeldByMaster.ts b/ui/packages/app-shell/src/views/recordDeleteHeldByMaster.ts index 182769d3c7a..5a435d64db0 100644 --- a/ui/packages/app-shell/src/views/recordDeleteHeldByMaster.ts +++ b/ui/packages/app-shell/src/views/recordDeleteHeldByMaster.ts @@ -1,21 +1,30 @@ /** - * objectstack#37195 — does the record page's Delete go, because the record is - * a master-detail line held by its MASTER's approval? + * Does the record page's Delete go, because the server refuses a caller's + * delete of this record under the lock that holds it? * - * The lock doors say which approval holds a locked record (`lockSource`, - * ruling 7148474531 on objectstack#37151): its own (`'record'`) or its - * master's (`'master'`, which wins when both hold). The server deletes a - * record held by its own approval and cancels the request, so that Delete - * stays; the detail-row lock hook refuses a line's delete with - * `RECORD_LOCKED` while its master is held, so that Delete goes. This is the - * rule the grid's row menu applies (`useRowApprovalLocks.heldByMaster`, - * `objectGridActionsColumn`): only an answer says so — no answer, or one that - * names no kind, keeps Delete (fail open; the server still refuses). + * Read off the data layer's one lock read (ADR-0162 D9, `dataLock`), reason + * first: + * + * - `lockReason: 'closed_state'` — a closed record, by its own state or its + * master's: a caller's delete is refused for either source (ADR-0162 D6). + * - `lockReason: 'approval'` — the published rule (objectstack#37195, ruling + * 7148474531 on objectstack#37151): a record held by its OWN approval + * (`lockSource: 'record'`) is deleted by the server, which cancels the + * request, so that Delete stays; a master-detail line held by its MASTER's + * approval (`'master'`) is refused by the detail-row lock hook with + * `RECORD_LOCKED`, so that Delete goes. + * + * This is the rule the grid's row menu applies + * (`useRowApprovalLocks.deleteRefused`, `objectGridActionsColumn`): only an + * answer says so — no answer keeps Delete (fail open; the server still + * refuses). * * Feedback only: it decides which affordance is SHOWN, never who may delete. */ -import type { ApprovalLockSource } from '../hooks/useRecordApprovals.js'; +import type { DataRecordLock } from '../hooks/useRecordApprovals.js'; -export function recordDeleteHeldByMaster(approvals: { lockSource: ApprovalLockSource | null }): boolean { - return approvals.lockSource === 'master'; +export function recordDeleteRefusedByLock(approvals: { dataLock: DataRecordLock | null }): boolean { + const lock = approvals.dataLock; + if (lock?.locked !== true) return false; + return lock.lockReason === 'closed_state' || lock.lockSource === 'master'; } diff --git a/ui/packages/i18n/src/locales/ar.ts b/ui/packages/i18n/src/locales/ar.ts index c5a7f4ded6a..f026a7d9694 100644 --- a/ui/packages/i18n/src/locales/ar.ts +++ b/ui/packages/i18n/src/locales/ar.ts @@ -621,6 +621,7 @@ const ar = { viewOff: "التحرير في القائمة متوقف لهذا العرض.", objectReadOnly: "لا يمكن تحرير هذه السجلات هنا.", noPermission: "ليس لديك إذن بتحرير هذه السجلات.", + closedLocked: "هذا السجل مغلق ولا يمكن تغييره.", approvalLocked: "هذا السجل مقفل أثناء الموافقة عليه.", checking: "جارٍ التحقق مما إذا كان يمكن تعديل هذا السجل…", noRecordPermission: "ليس لديك إذن بتحرير هذا السجل.", @@ -1785,6 +1786,8 @@ const ar = { lockedByApproval: "مقفل للموافقة", lockedTooltip: "يحتوي هذا السجل على طلب موافقة معلق؛ التعديل مقفل", lockedByState: "غير قابل للتعديل في حالته الحالية", + lockedClosed: "مغلق", + lockedClosedTooltip: "هذا السجل مغلق ولا يمكن تغييره.", bodyTableRow: "الصف {{row}}", bodyTablesReadOnlyBulk: "تبقى جداول البنود هذه للقراءة فقط أثناء التعديل: حفظها مع السجل يتطلب تمكين الكتابة المجمعة على كائناتها. لا يزال بإمكانك تعديل حقول السجل نفسه وحفظها.", discardInlineEditsMessage: "لديك تغييرات غير محفوظة على حقول هذا السجل. تجاهلها لتعديل السجل بالكامل، أو تابع التعديل واحفظها أولاً.", diff --git a/ui/packages/i18n/src/locales/de.ts b/ui/packages/i18n/src/locales/de.ts index d87ac0943a5..76b505ec64a 100644 --- a/ui/packages/i18n/src/locales/de.ts +++ b/ui/packages/i18n/src/locales/de.ts @@ -587,6 +587,7 @@ const de = { viewOff: "Das Bearbeiten in der Liste ist für diese Ansicht ausgeschaltet.", objectReadOnly: "Diese Datensätze können hier nicht bearbeitet werden.", noPermission: "Sie haben keine Berechtigung, diese Datensätze zu bearbeiten.", + closedLocked: "Dieser Datensatz ist abgeschlossen und kann nicht mehr geändert werden.", approvalLocked: "Dieser Datensatz ist während der Genehmigung gesperrt.", checking: "Es wird geprüft, ob dieser Datensatz bearbeitet werden kann…", noRecordPermission: "Sie haben keine Berechtigung, diesen Datensatz zu bearbeiten.", @@ -1600,6 +1601,8 @@ const de = { lockedByApproval: "Zur Genehmigung gesperrt", lockedTooltip: "Dieser Datensatz hat eine ausstehende Genehmigungsanfrage; die Bearbeitung ist gesperrt", lockedByState: "Im aktuellen Status nicht bearbeitbar", + lockedClosed: "Abgeschlossen", + lockedClosedTooltip: "Dieser Datensatz ist abgeschlossen und kann nicht mehr geändert werden.", bodyTableRow: "Zeile {{row}}", bodyTablesReadOnlyBulk: "Diese Positionstabellen bleiben beim Bearbeiten schreibgeschützt: Um sie zusammen mit dem Datensatz zu speichern, müssen für ihre Objekte Massenschreibvorgänge aktiviert sein. Die Felder des Datensatzes selbst können weiterhin bearbeitet und gespeichert werden.", discardInlineEditsMessage: "Sie haben ungespeicherte Änderungen an den Feldern dieses Datensatzes. Verwerfen Sie sie, um den ganzen Datensatz zu bearbeiten, oder bearbeiten Sie weiter und speichern Sie sie zuerst.", diff --git a/ui/packages/i18n/src/locales/en.ts b/ui/packages/i18n/src/locales/en.ts index 83a496784a7..a12e5f3b8da 100644 --- a/ui/packages/i18n/src/locales/en.ts +++ b/ui/packages/i18n/src/locales/en.ts @@ -866,6 +866,7 @@ const en = { viewOff: 'Editing in the list is turned off for this view.', objectReadOnly: 'These records can\'t be edited here.', noPermission: 'You don\'t have permission to edit these records.', + closedLocked: 'This record is closed, so it can\'t be changed.', approvalLocked: 'This record is locked while it\'s in approval.', checking: 'Checking whether this record can be edited…', noRecordPermission: 'You don\'t have permission to edit this record.', @@ -1722,6 +1723,8 @@ const en = { lockedByApproval: 'Locked for approval', lockedTooltip: 'This record has a pending approval request; editing is locked', lockedByState: 'Not editable in its current state', + lockedClosed: 'Closed', + lockedClosedTooltip: 'This record is closed, so it can\'t be changed.', bodyTableRow: 'Row {{row}}', bodyTablesReadOnlyBulk: 'These line tables stay read-only while you edit: saving them together with the record needs bulk writes enabled on their objects. The record\'s own fields can still be edited and saved.', discardInlineEditsMessage: 'You have unsaved changes to this record\'s fields. Discard them to edit the whole record, or keep editing and save them first.', diff --git a/ui/packages/i18n/src/locales/es.ts b/ui/packages/i18n/src/locales/es.ts index 39c54f6adfb..6c8ff1706b5 100644 --- a/ui/packages/i18n/src/locales/es.ts +++ b/ui/packages/i18n/src/locales/es.ts @@ -599,6 +599,7 @@ const es = { viewOff: "La edición en la lista está desactivada para esta vista.", objectReadOnly: "Estos registros no se pueden editar aquí.", noPermission: "No tiene permiso para editar estos registros.", + closedLocked: "Este registro está cerrado y ya no se puede modificar.", approvalLocked: "Este registro está bloqueado mientras está en aprobación.", checking: "Comprobando si este registro se puede editar…", noRecordPermission: "No tiene permiso para editar este registro.", @@ -1646,6 +1647,8 @@ const es = { lockedByApproval: "Bloqueado para aprobación", lockedTooltip: "Este registro tiene una solicitud de aprobación pendiente; la edición está bloqueada", lockedByState: "No editable en su estado actual", + lockedClosed: "Cerrado", + lockedClosedTooltip: "Este registro está cerrado y ya no se puede modificar.", bodyTableRow: "Fila {{row}}", bodyTablesReadOnlyBulk: "Estas tablas de líneas quedan en solo lectura mientras editas: guardarlas junto con el registro requiere habilitar escrituras masivas en sus objetos. Los campos del propio registro aún se pueden editar y guardar.", discardInlineEditsMessage: "Tienes cambios sin guardar en los campos de este registro. Descártalos para editar el registro completo, o sigue editando y guárdalos primero.", diff --git a/ui/packages/i18n/src/locales/fr.ts b/ui/packages/i18n/src/locales/fr.ts index 1aa82b126fd..6e6689e3775 100644 --- a/ui/packages/i18n/src/locales/fr.ts +++ b/ui/packages/i18n/src/locales/fr.ts @@ -594,6 +594,7 @@ const fr = { viewOff: "La modification dans la liste est désactivée pour cette vue.", objectReadOnly: "Ces enregistrements ne peuvent pas être modifiés ici.", noPermission: "Vous n'avez pas l'autorisation de modifier ces enregistrements.", + closedLocked: "Cet enregistrement est clôturé et ne peut plus être modifié.", approvalLocked: "Cet enregistrement est verrouillé pendant son approbation.", checking: "Vérification de la possibilité de modifier cet enregistrement…", noRecordPermission: "Vous n'avez pas l'autorisation de modifier cet enregistrement.", @@ -1650,6 +1651,8 @@ const fr = { lockedByApproval: "Verrouillé pour approbation", lockedTooltip: "Cet enregistrement a une demande d'approbation en attente ; la modification est verrouillée", lockedByState: "Non modifiable dans son état actuel", + lockedClosed: "Clôturé", + lockedClosedTooltip: "Cet enregistrement est clôturé et ne peut plus être modifié.", bodyTableRow: "Ligne {{row}}", bodyTablesReadOnlyBulk: "Ces tableaux de lignes restent en lecture seule pendant la modification : les enregistrer avec la fiche exige que les écritures en masse soient activées sur leurs objets. Les champs de la fiche elle-même restent modifiables et enregistrables.", discardInlineEditsMessage: "Vous avez des modifications non enregistrées dans les champs de cet enregistrement. Ignorez-les pour modifier l'enregistrement entier, ou continuez la modification et enregistrez-les d'abord.", diff --git a/ui/packages/i18n/src/locales/ja.ts b/ui/packages/i18n/src/locales/ja.ts index 1f1879a2262..2ad40b73947 100644 --- a/ui/packages/i18n/src/locales/ja.ts +++ b/ui/packages/i18n/src/locales/ja.ts @@ -587,6 +587,7 @@ const ja = { viewOff: "このビューでは一覧での編集がオフになっています。", objectReadOnly: "これらのレコードはここでは編集できません。", noPermission: "これらのレコードを編集する権限がありません。", + closedLocked: "このレコードはクローズ済みのため変更できません。", approvalLocked: "このレコードは承認中のためロックされています。", checking: "このレコードを編集できるか確認しています…", noRecordPermission: "このレコードを編集する権限がありません。", @@ -1684,6 +1685,8 @@ const ja = { lockedByApproval: "承認のためロック中", lockedTooltip: "このレコードには承認待ちのリクエストがあります。編集はロックされています", lockedByState: "現在の状態では編集できません", + lockedClosed: "クローズ済み", + lockedClosedTooltip: "このレコードはクローズ済みのため変更できません。", bodyTableRow: "{{row}} 行目", bodyTablesReadOnlyBulk: "編集中、これらの明細テーブルは読み取り専用です。レコードと一緒に保存するには、それぞれのオブジェクトで一括書き込みを有効にする必要があります。レコード自体のフィールドは引き続き編集・保存できます。", discardInlineEditsMessage: "このレコードの項目に未保存の変更があります。破棄してレコード全体を編集するか、編集を続けて先に保存してください。", diff --git a/ui/packages/i18n/src/locales/ko.ts b/ui/packages/i18n/src/locales/ko.ts index 09afeebf1df..4e04adcc9fe 100644 --- a/ui/packages/i18n/src/locales/ko.ts +++ b/ui/packages/i18n/src/locales/ko.ts @@ -587,6 +587,7 @@ const ko = { viewOff: "이 보기에서는 목록 편집이 꺼져 있습니다.", objectReadOnly: "이 레코드는 여기에서 편집할 수 없습니다.", noPermission: "이 레코드를 편집할 권한이 없습니다.", + closedLocked: "이 레코드는 마감되어 변경할 수 없습니다.", approvalLocked: "이 레코드는 승인 중이라 잠겨 있습니다.", checking: "이 레코드를 편집할 수 있는지 확인하는 중…", noRecordPermission: "이 레코드를 편집할 권한이 없습니다.", @@ -1600,6 +1601,8 @@ const ko = { lockedByApproval: "승인을 위해 잠김", lockedTooltip: "이 레코드에 대기 중인 승인 요청이 있습니다. 편집이 잠겨 있습니다", lockedByState: "현재 상태에서는 편집할 수 없습니다", + lockedClosed: "마감됨", + lockedClosedTooltip: "이 레코드는 마감되어 변경할 수 없습니다.", bodyTableRow: "{{row}}행", bodyTablesReadOnlyBulk: "편집하는 동안 이 항목 표는 읽기 전용입니다. 레코드와 함께 저장하려면 해당 개체에서 일괄 쓰기를 사용하도록 설정해야 합니다. 레코드 자체의 필드는 계속 편집하고 저장할 수 있습니다.", discardInlineEditsMessage: "이 레코드의 필드에 저장하지 않은 변경 사항이 있습니다. 변경 사항을 버리고 레코드 전체를 편집하거나, 계속 편집하여 먼저 저장하세요.", diff --git a/ui/packages/i18n/src/locales/pt-BR.ts b/ui/packages/i18n/src/locales/pt-BR.ts index 4932d7d36f1..a9d836ce3ab 100644 --- a/ui/packages/i18n/src/locales/pt-BR.ts +++ b/ui/packages/i18n/src/locales/pt-BR.ts @@ -594,6 +594,7 @@ const pt = { viewOff: "A edição na lista está desativada para esta visualização.", objectReadOnly: "Estes registros não podem ser editados aqui.", noPermission: "Você não tem permissão para editar estes registros.", + closedLocked: "Este registro está fechado e não pode mais ser alterado.", approvalLocked: "Este registro está bloqueado enquanto está em aprovação.", checking: "Verificando se este registro pode ser editado…", noRecordPermission: "Você não tem permissão para editar este registro.", @@ -1650,6 +1651,8 @@ const pt = { lockedByApproval: "Bloqueado para aprovação", lockedTooltip: "Este registro tem uma solicitação de aprovação pendente; a edição está bloqueada", lockedByState: "Não editável no estado atual", + lockedClosed: "Fechado", + lockedClosedTooltip: "Este registro está fechado e não pode mais ser alterado.", bodyTableRow: "Linha {{row}}", bodyTablesReadOnlyBulk: "Estas tabelas de itens ficam somente leitura durante a edição: salvá-las junto com o registro exige gravações em massa habilitadas em seus objetos. Os campos do próprio registro ainda podem ser editados e salvos.", discardInlineEditsMessage: "Você tem alterações não salvas nos campos deste registro. Descarte-as para editar o registro inteiro ou continue editando e salve-as primeiro.", diff --git a/ui/packages/i18n/src/locales/ru.ts b/ui/packages/i18n/src/locales/ru.ts index 4d58e74579b..581c33ab50e 100644 --- a/ui/packages/i18n/src/locales/ru.ts +++ b/ui/packages/i18n/src/locales/ru.ts @@ -604,6 +604,7 @@ const ru = { viewOff: "Редактирование в списке отключено для этого представления.", objectReadOnly: "Эти записи нельзя изменить здесь.", noPermission: "У вас нет прав на изменение этих записей.", + closedLocked: "Эта запись закрыта, её нельзя изменить.", approvalLocked: "Эта запись заблокирована, пока находится на согласовании.", checking: "Проверяем, можно ли изменить эту запись…", noRecordPermission: "У вас нет прав на изменение этой записи.", @@ -1798,6 +1799,8 @@ const ru = { lockedByApproval: "Заблокировано для согласования", lockedTooltip: "У этой записи есть ожидающий запрос на согласование; редактирование заблокировано", lockedByState: "Недоступно для редактирования в текущем состоянии", + lockedClosed: "Закрыта", + lockedClosedTooltip: "Эта запись закрыта, её нельзя изменить.", bodyTableRow: "Строка {{row}}", bodyTablesReadOnlyBulk: "Эти таблицы строк при редактировании доступны только для чтения: чтобы сохранять их вместе с записью, для их объектов должна быть включена массовая запись. Поля самой записи по-прежнему можно редактировать и сохранять.", discardInlineEditsMessage: "В полях этой записи есть несохранённые изменения. Отмените их, чтобы редактировать всю запись, или продолжите редактирование и сначала сохраните их.", diff --git a/ui/packages/i18n/src/locales/zh-Hans.ts b/ui/packages/i18n/src/locales/zh-Hans.ts index a824247db3a..e2de293d0ce 100644 --- a/ui/packages/i18n/src/locales/zh-Hans.ts +++ b/ui/packages/i18n/src/locales/zh-Hans.ts @@ -600,6 +600,7 @@ const zh = { viewOff: '此视图已关闭列表内编辑。', objectReadOnly: '这些记录不能在这里编辑。', noPermission: '您没有编辑这些记录的权限。', + closedLocked: '此记录已关闭,无法更改。', approvalLocked: '此记录正在审批中,已锁定。', checking: '正在确认这条记录能否编辑…', noRecordPermission: '您没有编辑此记录的权限。', @@ -1437,6 +1438,8 @@ const zh = { lockedByApproval: '审批中已锁定', lockedTooltip: '该记录有待审批的请求,编辑已被锁定', lockedByState: '当前状态下不可编辑', + lockedClosed: '已关闭', + lockedClosedTooltip: '此记录已关闭,无法更改。', bodyTableRow: '第 {{row}} 行', bodyTablesReadOnlyBulk: '编辑时这些明细表保持只读:要和主记录一起保存,需要在它们的对象上开启批量写入。主记录本身的字段仍可编辑和保存。', discardInlineEditsMessage: '此记录的字段有未保存的更改。放弃这些更改以编辑整条记录,或继续编辑并先保存。', diff --git a/ui/packages/i18n/src/locales/zh-Hant.ts b/ui/packages/i18n/src/locales/zh-Hant.ts index 612b8bb838c..dc865868c9a 100644 --- a/ui/packages/i18n/src/locales/zh-Hant.ts +++ b/ui/packages/i18n/src/locales/zh-Hant.ts @@ -600,6 +600,7 @@ const zhHant = { viewOff: '此檢視已關閉列表內編輯。', objectReadOnly: '這些記錄不能在這裡編輯。', noPermission: '您沒有編輯這些記錄的權限。', + closedLocked: '此記錄已關閉,無法變更。', approvalLocked: '此記錄正在審批中,已鎖定。', checking: '正在確認這條記錄能否編輯…', noRecordPermission: '您沒有編輯此記錄的權限。', @@ -1437,6 +1438,8 @@ const zhHant = { lockedByApproval: '審批中已鎖定', lockedTooltip: '該記錄有待審批的請求,編輯已被鎖定', lockedByState: '當前狀態下不可編輯', + lockedClosed: '已關閉', + lockedClosedTooltip: '此記錄已關閉,無法變更。', bodyTableRow: '第 {{row}} 行', bodyTablesReadOnlyBulk: '編輯時這些明細表保持只讀:要和主記錄一起儲存,需要在它們的物件上開啟批次寫入。主記錄本身的欄位仍可編輯和儲存。', discardInlineEditsMessage: '此記錄的欄位有未儲存的更改。放棄這些更改以編輯整條記錄,或繼續編輯並先儲存。', diff --git a/ui/packages/plugin-form/src/MasterDetailForm.tsx b/ui/packages/plugin-form/src/MasterDetailForm.tsx index 91e74bda150..6a2044f2bd4 100644 --- a/ui/packages/plugin-form/src/MasterDetailForm.tsx +++ b/ui/packages/plugin-form/src/MasterDetailForm.tsx @@ -56,6 +56,7 @@ import { FormSlotStore, type FormSlotHandoff, type FormSlotRequest } from './for import { buildMasterDetailBatch, buildMasterDetailEditBatch, + editBatchParentIndex, idOf, isBlankRow, sumRows, @@ -269,7 +270,8 @@ function isBuiltFrom( * the server's `/batch` and `emulateBatchTransaction` both do). The edit * builder puts the parent at index 0 and then, collection by collection in * the order it was handed them, one `create` per non-blank row without an - * id, in row order. Each such row is paired with the next create operation, + * id, in row order; a parent update that closes the record goes last + * instead (ADR-0162 D4), so the parent is skipped by its index, `parentIndex`. Each such row is paired with the next create operation, * and the pair is checked ({@link isBuiltFrom}) before it is trusted. A pair * that does not check out stops the pairing: the rows left unpaired stay * creates, which is the behaviour before this advance, never a row updating @@ -287,11 +289,12 @@ function childRowsAfterSave( ops: BatchTransactionOperation[], results: unknown, details: SavedDetailInput[], + parentIndex: number, ): SavedChildRows[] { const echoes = Array.isArray(results) ? results : []; const creates: Array<{ op: BatchTransactionOperation; echo: unknown }> = []; ops.forEach((op, k) => { - if (k > 0 && op.action === 'create') creates.push({ op, echo: echoes[k] }); + if (k !== parentIndex && op.action === 'create') creates.push({ op, echo: echoes[k] }); }); let nextCreate = 0; let pairingLost = false; @@ -317,9 +320,9 @@ function childRowsAfterSave( createdIds.set(row, id); written.set(id, pair.op.data ?? {}); } - for (let k = 1; k < ops.length; k++) { + for (let k = 0; k < ops.length; k++) { const op = ops[k]; - if (op.action === 'update' && op.object === childObject && op.id != null) { + if (k !== parentIndex && op.action === 'update' && op.object === childObject && op.id != null) { written.set(op.id, op.data ?? {}); } } @@ -687,13 +690,19 @@ interface HeaderRecordFeed { * when the object declares none. */ objectHandLock: unknown; + /** + * The header object's `closedStates`, landed with its field names: the edit + * save writes a header write that closes the record last (ADR-0162 D4). + * `undefined` until then or when the object declares none. + */ + objectClosedStates: unknown; /** Bumped per header record read started, so only the newest answer lands. */ seq: number; listeners: Set<(landed: 'record' | 'objectFields') => void>; } function createHeaderRecordFeed(opening: Record): HeaderRecordFeed { - return { record: opening, objectFields: null, objectHandLock: undefined, seq: 0, listeners: new Set() }; + return { record: opening, objectFields: null, objectHandLock: undefined, objectClosedStates: undefined, seq: 0, listeners: new Set() }; } /** @@ -749,10 +758,15 @@ function observeHeaderReads( const answer = call(args); if (args[0] === objectName) { observe(answer, (objectSchema) => { - const served = objectSchema as { fields?: Record; uiReadonlyWhen?: unknown } | null; + const served = objectSchema as { + fields?: Record; + uiReadonlyWhen?: unknown; + closedStates?: unknown; + } | null; const fields = served?.fields; feed.objectFields = fields ? Object.keys(fields) : []; feed.objectHandLock = served?.uiReadonlyWhen ?? undefined; + feed.objectClosedStates = served?.closedStates ?? undefined; feed.listeners.forEach((listener) => listener('objectFields')); }); } @@ -940,21 +954,28 @@ const preventSubmit = (event: React.FormEvent) => event.preventDefault(); * reads the same evidence): the operation the server names as the failed one, * else each field it names that only line operations write (a field the * parent's own operation carries is the header form's to mark). The parent is - * operation 0 in both batch builders. A refusal that names neither, a lock or - * a permission denial, is on no collection. + * operation `parentIndex`: 0 in both batch builders, or the last operation of + * an edit batch whose header write closes the record (ADR-0162 D4). A refusal + * that names neither, a lock or a permission denial, is on no collection. */ -function refusedChildObjects(err: unknown, ops: readonly BatchTransactionOperation[]): Set { +function refusedChildObjects( + err: unknown, + ops: readonly BatchTransactionOperation[], + parentIndex: number, +): Set { const out = new Set(); const failed = (err as { details?: { failedOperation?: { index?: unknown } } } | null)?.details?.failedOperation?.index; if (typeof failed === 'number') { - if (failed > 0 && ops[failed]?.object) out.add(ops[failed].object); + if (failed !== parentIndex && ops[failed]?.object) out.add(ops[failed].object); return out; } const carries = (op: BatchTransactionOperation | undefined, field: string) => !!op && op.action !== 'delete' && !!op.data && Object.prototype.hasOwnProperty.call(op.data, field); for (const { field } of extractFieldErrors(err) ?? []) { - if (carries(ops[0], field)) continue; - for (const op of ops.slice(1)) if (carries(op, field)) out.add(op.object); + if (carries(ops[parentIndex], field)) continue; + ops.forEach((op, k) => { + if (k !== parentIndex && carries(op, field)) out.add(op.object); + }); } return out; } @@ -2233,12 +2254,16 @@ export const MasterDetailForm: React.FC = ({ }, })) : null; + // [ADR-0162 D4] A header write that closes the record goes after the + // line writes, judged against the header object's `closedStates` as the + // header's own schema read served it. const ops = editDetails ? buildMasterDetailEditBatch( schema.objectName, String(schema.recordId), parentData, editDetails.map((d) => d.input), + { closedStates: headerReadRef.current?.feed.objectClosedStates }, ) : buildMasterDetailBatch( schema.objectName, @@ -2251,12 +2276,15 @@ export const MasterDetailForm: React.FC = ({ childSchema: childSchemasRef.current[e.config.childObject], })), ); + const parentIndex = editDetails + ? Math.max(0, editBatchParentIndex(ops, schema.objectName, String(schema.recordId))) + : 0; let res: Awaited>; try { res = await runBatchTransaction(dataSource, ops); } catch (err) { // A refusal on a placed collection marks the tab that holds it. - const refused = refusedChildObjects(err, ops); + const refused = refusedChildObjects(err, ops, parentIndex); slotStore.refuse(entries.filter((e) => refused.has(e.config.childObject)).map((e) => e.id)); throw err; } @@ -2269,7 +2297,7 @@ export const MasterDetailForm: React.FC = ({ // as a failed save with one baseline moved. Create mode has no baseline: // `handleSaved` empties the rows for the next entry. if (editDetails) { - const saved = childRowsAfterSave(ops, res?.results, editDetails); + const saved = childRowsAfterSave(ops, res?.results, editDetails, parentIndex); // objectui#10853 — these lines are now what the server holds, so a bus // re-read held behind them (this save's own echo included) is replayed // once the save has settled. diff --git a/ui/packages/plugin-form/src/masterDetailTx.ts b/ui/packages/plugin-form/src/masterDetailTx.ts index a02e66fec37..9e1cb0b944d 100644 --- a/ui/packages/plugin-form/src/masterDetailTx.ts +++ b/ui/packages/plugin-form/src/masterDetailTx.ts @@ -136,20 +136,56 @@ export function buildMasterDetailBatch( return ops; } +/** + * [ADR-0162 D4] Does this header payload put the record into one of its + * object's closed states? `closedStates` is the object's declaration as the + * served definition carries it (`{