Skip to content

fix(console): the record edit dialog opens locked with the closed sentence on a closed record (ADR-0162) - #39019

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-38997-edit-state-closing-order
Dec 2, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-38997-edit-state-closing-order

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Fixes #38997

Clause-②: yes (widening)
Metadata-protocol: none

The widening (L1 7333040997): the exported lockedBy prop of RecordFieldAccessScopeProps (@object-ui/permissions) and of ModalFormProps (@object-ui/plugin-form) accepts 'closed' beside 'approval'. Level stays patch.

维护者速读

  • 控制台里打开已关闭记录(如已付款发票)的完整编辑弹窗时,弹窗直接只读,提示“此记录已关闭,无法更改”,不再提供保存;以前弹窗可编辑,点保存才被服务器拒绝。审批中的记录与今天一样。
  • 属于“记录关闭态锁”这一组工作,让编辑弹窗与记录页对已关闭记录给出同一个答案。
  • 出错时,已关闭记录的弹窗可能仍可编辑(服务器照旧拒绝保存),或审批中的记录显示成“已关闭”;改动只在控制台,可直接撤回。
  • 无

What changes

Item 2 of the card: the console's full-record edit dialog locks on a closed record. Item 1 (the edit-state save order) landed in #39007.

  • Dialog (ui/packages/app-shell/src/console/AppContent.tsx): reads recordClosedByLock from the useRecordApprovals hook the dialog already uses for its approval lock, and hands ModalForm lockedBy: 'closed'. Precedence: closed wins over an approval hold, as on the record page (recordClosedByLock is true for a record both closed and held). An approval-held record that is not closed keeps lockedBy: 'approval', unchanged.
  • Scope (ui/packages/permissions/src/RecordFieldAccessScope.tsx): lockedBy accepts 'closed' beside 'approval'. The row's update is refused with the new reason record-closed, and every field of it is not writable, exactly as for 'approval'. A projection answering writable: false keeps its own reason, as it already does over 'approval'.
  • Form gate (ui/packages/plugin-form/src/fieldWriteGate.ts): record-closed maps to a new 'closed' affordance, and closedForRecord treats it like 'approval', so the dialog (and the drawer) offer no Save.
  • Notice (closedAffordanceNotice.tsx): 'closed' says the record page's closed sentence, detail.lockedClosedTooltip ("This record is closed, so it can't be changed."). No new locale key; the provider-less defaults row repeats the en value (check:i18n-keys green).
  • ModalForm.tsx and recordFieldAccess.tsx widen lockedBy to the scope's own prop type.
  • Changeset: .changeset/38997-edit-dialog-closed-lock.md (permissions, plugin-form, app-shell; patch).

Tests

Written first and run red (6 red, 23 existing green), then green after the fix.

  • AppContent.editDialogApprovalLock-27138.test.tsx, new describe: a closed record hands lockedBy: 'closed'; a closed record a pending approval also holds hands 'closed'; a closed record sends exactly the three lock reads an open one sends. The approval-held cases above it are the control and are unchanged ('approval').
  • recordFieldAccess.rowWritable-27138.test.tsx, new describe: ModalForm with lockedBy="closed", on a writable row and on a data source without the projection, draws every field read-only, the notice with data-affordance="closed" and the closed sentence, and no Save.
  • RecordFieldAccessScope.rowWritable-27138.test.tsx: lockedBy: 'closed' refuses the update with record-closed before any answer and over writable: true; read stays allowed.
Ablation (restored, blob equal to HEAD)
  • AppContent.tsx: the closed test replaced by false turns the 3 new dialog cases red; the 6 approval and control cases stay green.

Acceptance notes

  • Requests: none added. The dialog reads the hook it already mounted. Over a list it sends the same three lock reads as before (pinned for a closed record too); on a record page the hook joins the page's payload answer. The record page's one-request pins (27627, 28470, 12701, 13010, 28737) pass unedited.
  • Precedence chosen: closed over approval, the record page's rule; stated in the code comment and the changeset.
  • The drawer form (DrawerForm) shares the gate and would draw the 'closed' affordance too, but no host passes it a lockedBy today; not changed here.

Verification

Two-minute check, from ui/: pnpm exec vitest run packages/app-shell/src/console/__tests__/AppContent.editDialogApprovalLock-27138.test.tsx: 9 passed, including the three closed cases.

Read first: AppContent.tsx (the precedence line), then RecordFieldAccessScope.tsx (the refusal reason), then fieldWriteGate.ts.

Local readings, head c564f48
  • plugin-form and permissions suites: 272 files, 3,028 passed, 1 skipped.
  • app-shell: all 55 AppContent* files plus the five one-request record-open pin files: 60 files, 626 passed.
  • type-check: permissions, plugin-form and app-shell exit 0 (after rebuilding the permissions and plugin-form dist the downstream tsc reads).
  • eslint on the nine touched files (package config): 0 errors. With --no-inline-config one error stands in ModalForm.tsx ("Cannot create components during render"), present at the same place on main.
  • dispatch-gates --ran at c564f48: 38 derived, 38 run, 0 NOT-MEASURED. ui check:i18n-keys: exit 0.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WGufzhKEbEnW8pwZRgK2gJ

…tence on a closed record (ADR-0162)

AppContent reads recordClosedByLock from the hook the dialog already
uses and hands ModalForm lockedBy 'closed' (closed wins over an approval
hold, as on the record page). The lock rides the existing chain:
RecordFieldAccessScope refuses the row with 'record-closed',
fieldWriteGate maps it to the 'closed' affordance (no Save), and the
notice says the record page's closed sentence (detail.lockedClosedTooltip).

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhKEbEnW8pwZRgK2gJ

Final green head · 2026-12-02T02:33Z · zone osa-data
Head-sha: c564f48

  • CI at this head: 44 success, 15 skipped, 0 failure, 0 running. Mergeable: clean.
  • Diff: 10 files, +142 / −27 (169 lines ≤ 3000). Not governed (0 of 10 paths). Fixes #38997: item 1 merged in PR fix(console): the record page's edit-state save writes a closing header after its lines (ADR-0162 D4) #39007; this is item 2. Surface = claim amendment 7331665153, no file outside it.
  • Item 2: AppContent reads recordClosedByLock(formApprovals) from the hook the dialog already mounts (the dataLock PR feat(console): the record page reads a closed record from its one payload request (ADR-0162 item 4) #39011 added) and passes lockedBy: 'closed'; closed wins over an approval hold, as on the record page; an approval-only hold keeps 'approval'. The lock travels the existing chain: RecordFieldAccessScope accepts 'closed' and refuses the row's update with reason record-closed; fieldWriteGate maps it to a closed affordance; closedForRecord treats it like 'approval' (no Save); ClosedAffordanceNotice shows the record page's closed sentence (detail.lockedClosedTooltip). No new locale key.
  • Requests: none added. Over a list a closed record sends the same three lock reads as an open one (pinned); on a record page the hook joins the page's payload answer; the one-request record-open pins (27627, 28470, 12701, 13010, 28737) pass unedited.
  • Readings (dev report 7332603951): red first (6 new tests red, 23 existing green), then 29 green; plugin-form + permissions 272 files / 3028 tests, app-shell 60 files / 626 tests (all AppContent* plus the one-request pins). One ablation (closed test → false) turns the 3 new dialog cases red, approval and control cases stay green. Type-check permissions, plugin-form, app-shell exit 0; 38 derived gates, all exit 0.
  • Out of scope, not filed: DrawerForm shares the gate but no host passes it a lockedBy today.
  • Sent to osa-L1-a for L1.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm

L1 review · PR #39019 (#38997) · head c564f48 · 2026-12-02T02:37Z

REWORK — one must-fix, in the declaration only. The code is right.

Must-fix

  1. Clause-② is no, but the diff widens exported types of two published packages. @object-ui/permissions exports RecordFieldAccessScopeProps, whose lockedBy goes from 'approval' to 'approval' | 'closed'. @object-ui/plugin-form exports ModalFormProps, whose lockedBy widens the same way. Neither package is private. A wider accepted value on an exported prop of a published package is a public-surface widening, on the same precedent as a new optional member on an exported interface. It is Clause-②: yes (widening) in both the changeset and the PR body, and it owes a declaration review at TIER_DEFAULT on the fix head. The level stays patch and Metadata-protocol: none stays right. (@object-ui/app-shell is private and does not count.) The card's Clause-②: no was a claim-time estimate; the diff decides.

Read and right

  • AppContent.tsx: formLockedBy gives 'closed' when recordClosedByLock(formApprovals) holds, before the approval lock, so a closed record that is also held reads as closed, as on the record page. A record held only by an approval reads as before. It reuses the hook's dataLock read from feat(console): the record page reads a closed record from its one payload request (ADR-0162 item 4) #39011, with no new request.
  • RecordFieldAccessScope: a 'closed' lock refuses the row with record-closed, after writable: false, the same order as the approval lock. ROW_REFUSALS maps it to the 'closed' affordance, and closedForRecord treats it like 'approval', so there is no Save.
  • ClosedAffordanceNotice uses detail.lockedClosedTooltip, the record page's key (RecordDetailView.tsx), which exists in the locales. The fallback text matches en.
  • Fixes #38997 is right: item 1 merged in fix(console): the record page's edit-state save writes a closing header after its lines (ADR-0162 D4) #39007, and this delivers item 2.
  • Face: l1-face CLEAN. Checks show 44 success, 15 expected skips, 0 failed. Not governed; 169 lines.
  • Changeset read sentence by sentence: true, apart from the declaration line.

Next: fix both declaration lines (changeset body and PR body), then send the green head. I run the TIER_DEFAULT declaration review and the L1 delta on it.

…dening (#38997)

The exported lockedBy prop of RecordFieldAccessScopeProps and ModalFormProps
now accepts 'closed' beside 'approval': a widening of two published packages.

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhKEbEnW8pwZRgK2gJ

Final green head · declaration fix · 2026-12-02T03:02Z · zone osa-data
Head-sha: 9e70d53

  • CI at this head: 46 success, 17 skipped, 0 failure, 0 running. (The red rows on a05e21e are lanes cancelled by the next push.)
  • Closes L1 7333040997's must-fix: Clause-②: yes (widening) in the changeset (commits a05e21e, 9e70d53; readClause2Line reads declared · yes · widening) and in the PR body, each naming the widening: the exported lockedBy prop of RecordFieldAccessScopeProps (@object-ui/permissions) and ModalFormProps (@object-ui/plugin-form) accepts 'closed' beside 'approval'. Level patch, Metadata-protocol: none. Card amendment 7333092193 records the re-read.
  • No code changed since c564f48 (changeset only).
  • Sent to osa-L1-a for the TIER_DEFAULT declaration review and the L1 delta.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm

Contract-review-claim: session_01WGufzhGA3zoCFquQgku4pm · head 9e70d53 · 2026-12-02T03:04Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 9e70d532b4f275d1616bcd338020b549218c9c41
Local-runs: none

Declaration face, PR #39019 (card #38997, item 2). reviewFace on the PR's 10 changed paths, given the changeset and PR body texts, returns declaration / TIER_DEFAULT. No schema hit and no governed path. Treated as hits per the brief: ui/packages/permissions/src/RecordFieldAccessScope.tsx, ui/packages/plugin-form/src/ModalForm.tsx, ui/packages/plugin-form/src/recordFieldAccess.tsx. Inputs read: the card body and all 7 of its comments, the PR body, its 3 comments and 4 commits, the net diff origin/main...9e70d532, and the head's check-runs (46 success, 17 skipped, none red or pending). Commits after 8fe15c8b touch only the changeset.

① Derived judgments

What the published packages export, read from each entry at the head:

  • @object-ui/permissions (published, not private). index.ts exports RecordFieldAccessScope, RecordFieldAccessScopeProps and RecordFieldAccessAnswer. RecordFieldAccessScopeProps.lockedBy goes from 'approval' to 'approval' | 'closed'. This is an input widening, named right. RecordWriteRefusal gains 'record-closed', but the type is module-private (type, no export). The reason reaches consumers only as PermissionCheckResult.reason?: string (@object-ui/types, unchanged), so no exported type changes. RecordFieldAccessAnswer is unchanged.
  • @object-ui/plugin-form (published, not private). Its two entries are . (src/index.tsx) and ./core (src/core.ts). ModalFormProps is exported, and its lockedBy is now RecordFieldAccessForFormProps['lockedBy'], which resolves to RecordFieldAccessScopeProps['lockedBy'], which is 'approval' | 'closed' | undefined. This is an input widening, named right. Neither entry exports ClosedFormAffordance, closedFormAffordance, closedForRecord, ROW_REFUSALS, ClosedAffordanceNotice, RecordFieldAccessForForm or RecordFieldAccessForFormProps. There is no export *. Their changes are internal. The emitted ModalForm.d.ts reaches the widened type through the internal recordFieldAccess declaration and @object-ui/permissions, which is a declared dependency. That is a type path, not a new export.
  • Output side. No widened output union is exported. The new reason string record-closed and the DOM value data-affordance="closed" appear only when a host passes the new input lockedBy: 'closed'. A consumer that never passes it sees exactly what it saw before. The internal output union ClosedFormAffordance has its in-repo readers handled at the head: ClosedAffordanceNotice has an explicit 'closed' arm. closedForRecord includes it, and ModalForm and DrawerForm hide Save and Reset through it. WizardForm gates on truthiness. ObjectForm and TabbedForm pass it to the notice. No consumer loses an accepted value, so this is not a narrowing.
  • Accept set (metadata). lockedBy is a React prop. It is not in the schema or SDUI input registry (index.tsx has no lockedBy input) and not in packages/spec. The only lockedBy in the spec is the unrelated ViewSharing.lockedBy. No metadata author can write the new value, so Metadata-protocol: none is right.
  • @object-ui/app-shell is private: true. The AppContent wiring publishes nothing, and it is the L1's.

Every derived public-surface change is named right: two input widenings, nothing else exported moved.

② Semver level

  • readClause2Line reads declared · yes · widening on both the changeset and the PR body. readMetadataProtocolLine reads declared · none on both. Both lines are line-initial and in the fixed form.
  • AGENTS.md (Changesets, item 3): none takes patch, and "a non-protocol change, widening or breaking, ships patch". The changeset sets @object-ui/permissions and @object-ui/plugin-form to patch. Those are the two packages the diff publishes from. @object-ui/app-shell is private, and the patch entry there is harmless. Check Changeset is green on the head.
  • Clause-②: yes (widening) is right for exactly what is exported. The card claim's Clause-②: no was a claim-time estimate, amended on the card (2026-12-02T02:40Z) to match the diff.

Changeset, sentence by sentence:

  1. "The widening: the exported lockedBy prop … accepts 'closed' beside 'approval'." True for both props.
  2. "now opens read-only on a closed record (one of its object's closedStates holds, its own or its master's, ADR-0162)." True. recordClosedByLock reads dataLock.locked && lockReason === 'closed_state', and dataRecordLockOf keeps lockSource record or master.
  3. "It says '…' (detail.lockedClosedTooltip) and offers no Save." True. The notice's 'closed' arm uses that key, the fallback matches en.ts, the key exists in all 12 locales, and closedForRecord hides Save.
  4. "Before, it opened editable and the server's refusal … was the user's first notice." True of main, where lockedBy was 'approval' or undefined.
  5. "The dialog reads the closed state from the data lock the record page reads … It sends no request of its own: on a record page it uses the page's answer." True in substance: no request is added. Its wording over a list is loose (N1).
  6. "A record that is closed and also held by an approval reads as closed, as on the record page. A record held only by an approval reads as before." True. formLockedBy tests closed first, and RecordDetailView lets recordClosed win over the approval lock.
  7. "RecordFieldAccessScope, ModalForm and RecordFieldAccessForForm accept lockedBy: 'closed' … record-closed … the new 'closed' affordance, which closedForRecord treats like 'approval' (no Save)." True. It names two internal symbols, RecordFieldAccessForForm and closedFormAffordance, beside public ones, but makes no false claim about them.

③ Boundary flags

④ Design judgment

  • RecordFieldAccessScope.tsx. The design holds against ADR-0162 and its first consumer. 'closed' takes the same path as 'approval': refusedRow refuses only update of this row and every field write, while read and create stay allowed. A projection answering writable: false keeps precedence with record-not-writable. The scoped cache key is key|lockedBy, so 'closed' and 'approval' values never share a cache entry. A nested scope adds the lock through the same scoped(..., null, lockedBy) path. The jsdoc agrees with the code. One cosmetic point: a reflowed comment line runs long. That is not a finding.
  • ModalForm.tsx, recordFieldAccess.tsx. Both now derive the prop type from the scope's own lockedBy, so the three can no longer drift. The jsdoc ("Read on an edit form with a recordId only") is unchanged and still true.
  • Implementing files. fieldWriteGate.ts maps record-closed to 'closed', closedForRecord includes it, and the docs agree. closedAffordanceNotice.tsx adds the 'closed' arm and the provider-less default. Both agree with the contract.
  • Attempted breaks. A create form: the hook gets no object or id, so there is no data lock and nothing closes. A lock answer that arrives late: the dialog is editable until then and the server still refuses the save, which is the same rule 'approval' already uses. A record both closed and held: closed wins, as on the record page. A master-closed line: closed. None of these breaks the design.

N1 (nit) — Changeset sentence 5, "It sends no request of its own", reads over a list as if the dialog sends nothing. In fact it adds no request: the useRecordApprovals reads it already mounted for the approval lock (approvals list, approvals lock, data lock) are unchanged, as the PR's own test pins. "It adds no request" would be exact. This nit has no effect on the contract. Leave it as an accepted deviation, or reword it only in the changeset prose.

No must-fix, no should-fix.

Implemented-by: claude/issue-38997-edit-state-closing-order
Reviewed-by: session_01WGufzhGA3zoCFquQgku4pm

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm

L1 delta · PR #39019 (#38997) · head 9e70d53 · 2026-12-02T03:09Z

ACCEPT, on head 9e70d532b4f275d1616bcd338020b549218c9c41. Must-fix 1 of the L1 on c564f48 is closed.

  • The only change since c564f48 is the changeset, which now reads Clause-②: yes (widening) and names the widened lockedBy on RecordFieldAccessScopeProps (@object-ui/permissions) and ModalFormProps (@object-ui/plugin-form). The PR body carries the same line. No code moved, so the code read in the L1 on c564f48 stands.
  • The declaration review at TIER_DEFAULT on this head is a PASS with no must-fix and no should-fix, and one nit (comment 7333595562). It found that nothing else exported moves and that no consumer-facing output narrows. patch and Metadata-protocol: none are right.
  • l1-face is CLEAN: declarations ok, 46 checks succeeded, 17 skips were expected, 0 failed, 0 pending, and mergeable_state is clean.
  • Fixes #38997 closes the card. Item 1 merged in fix(console): the record page's edit-state save writes a closing header after its lines (ADR-0162 D4) #39007.

Next: zone landing.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhKEbEnW8pwZRgK2gJ

2026-12-02T03:10Z · Landing: L1 delta ACCEPT on head 9e70d53 (7333606891) and declaration review at TIER_DEFAULT PASS on the same head (7333595562; one nit, accepted as prose). Clause-②: yes (widening), patch, Metadata-protocol: none. Not governed (0 of 10 paths), 169 lines ≤ 3000, CI 46 success / 0 failure, mergeable clean. Ready for review and auto-merge (squash). Fixes #38997: the merge closes the card (item 1 merged in PR #39007).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review December 2, 2026 03:10
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Dec 2, 2026
Merged via the queue into main with commit 444dce6 Dec 2, 2026
64 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-38997-edit-state-closing-order branch December 2, 2026 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Console: the record page edit-state save writes a closing header last, and the edit dialog locks on a closed record

2 participants