Skip to content

feat(console): the record page reads a closed record from its one payload request (ADR-0162 item 4) - #39011

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-37773-record-page-lock
Dec 2, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-37773-record-page-lock

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Fixes #37773

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:在记录详情页上打开一张已关闭的单据(如已付款发票),「编辑」按钮变灰并提示「此记录已关闭,无法修改」,「删除」不再出现;打开记录页仍只发一个请求。
  • 为什么做:属于「关闭态单据」(ADR-0162)这条线,网格那一半已合并,本次补上记录详情页,让读者不再把「已关闭」误认为「审批中」。
  • 出错会怎样:最坏情况是按钮显示与服务端不一致,但服务端照样拒绝对已关闭记录的写入,数据不会被改坏;本改动只动界面,可直接撤回。
  • 要你做什么:无。

What changes

This is the record-page half of #37773. The grid, line grid and closing-header-last save landed in #38994; this half waited for the record page payload to carry the data lock, which #38999 added.

  • The record page reads the data layer's lock from its one request. The page's payload request (POST /api/v1/data/{object}/{id}/page) now asks dataLock: true. seedRecordPageReaders hands that part to useRecordApprovals through seedRecordApprovals, and the hook publishes it as dataLock in the same publish as the approvals answer. Opening a record page sends no lock read of its own. This is the one change against the backup branch, which sent a second GET /data/:object/:id/lock.
  • Edit and Delete read dataLock, not the approvals-family lock.
    • Closed record (lockReason: 'closed_state', its own state or its master's): Edit is drawn greyed with "This record is closed, so it can't be changed.", a "Closed" chip shows where the header draws tags, Delete is hidden for either lockSource, and master-detail lines draw no New, Edit or Delete.
    • Closed and also held by an approval: reads as closed.
    • Held by an approval (lockReason: 'approval'): unchanged. The record's own approval keeps Delete; a line under a held master does not (recordDeleteRefusedByLock, which replaces recordDeleteHeldByMaster).
    • The approvals panel and the header's approval tag keep the approvals-family recordLock.
  • Reads the hook sends itself still ask GET /data/:object/:id/lock. That means refresh() after the record changes, and a consumer with no page payload behind it. A part refused 501 latches like the GET's 501, so neither is asked again.
  • The console's full-record edit dialog (AppContent, not edited here; Console: the record page edit-state save writes a closing header last, and the edit dialog locks on a closed record #38997 owns that file) reads openApprovalOf(formApprovals) as before, which now reads dataLock. Request counts, measured in the browser and pinned where noted:
    • Edit pressed on a record page: the dialog joins the page's answer and sends 0 lock or approvals reads.
    • Opened over a list (?form=ID): 3 reads, pinned in AppContent.editDialogApprovalLock-27138: approvals list, approvals lock, and the data lock read. On main it sends 2.
    • Deep-linked straight to a record page with ?form=ID: the dialog's hook mounts before the page asks its payload, so the dialog sends its own 3 reads. The page still sends its one payload request.
  • recordClosedByLock and DataRecordLock stay exported for Console: the record page edit-state save writes a closing header last, and the edit dialog locks on a closed record #38997's dialog wording.
  • RecordPagePayload (@object-ui/types) declares the payload's dataLock part as the spec's RecordLock or a part refusal.
  • New strings detail.lockedClosed and detail.lockedClosedTooltip in all 11 console locales.

Read first, by risk:

  1. ui/packages/app-shell/src/hooks/useRecordApprovals.ts: startRead's dataLockRead choice (seeded vs own read) and settleSeededDataLock.
  2. ui/packages/app-shell/src/views/recordPagePayload.ts: the dataLock seed passed beside the approvals seed.
  3. ui/packages/app-shell/src/views/RecordDetailView.tsx: recordClosed in the Edit item (editOff, editReason) and the Delete affordance.

Two-minute check: pnpm --dir ui exec vitest run packages/app-shell/src/views/RecordDetailView.recordPagePayload-27627.test.tsx. Expect 11 passed. Its last block opens a closed record and asserts one page request, no lock read and a greyed Edit.

Tests

All run at fef530c6 (this branch's head) unless marked.

  • RecordDetailView.recordPagePayload-27627: the cold-open pin now also asserts dataLock: true in the one request body. A new block mounts the adapter the way the console's AdapterProvider does, which is what lets the hook send reads of its own:
    • a closed record opens with one page request, no lock read, Edit greyed, and the Closed chip carrying the sentence;
    • CONTROL: an unlocked record gets the same single request and a live Edit;
    • ablation: with no payload behind the page, the hook reads GET /data/.../lock itself, which shows the detector can see that read.
  • useRecordApprovals.lockSource-37195:
    • the seeded data lock is published with no lock GET;
    • no render sees answered without dataLock;
    • an approval-held record opens an approval;
    • CONTROL: the approvals-family lock alone opens none;
    • refresh() asks the data lock door once;
    • a 501 part latches, so no later GET goes out.
  • RecordDetailView.harness (closedLock-37773, deleteFollowsLockSource-37195) and RecordDetailView.approvalLock-25934: the hook's own-read path, carried over from the backup. They cover:
    • closed, line of a closed master, closed and held, approval-held CONTROL, unlocked CONTROL;
    • a reader whose object has no state field still gets the closed wording, with no field or value on the page.
  • AppContent.editDialogApprovalLock-27138: plus the request-set pin for the dialog over a list.
Test and type-check readings
  • pnpm --dir ui exec vitest run packages/app-shell/src/hooks/useRecordApprovals.lockSource-37195.test.tsx packages/app-shell/src/views/RecordDetailView.recordPagePayload-27627.test.tsx: 11 passed, 11 passed.
  • pnpm --dir ui exec vitest run on the harness, approvalLock-25934, AppContent.editDialogApprovalLock-27138, recordOpenOneRequest-28470, feedLoadFailure-29188, recordReadFailure-11902 and approvalRequestPage-28546: Test Files 7 passed, Tests 139 passed. The 27138 file was re-run after its new pin: 6 passed.
  • Ablation, run once and restored. startRead was mutated so that seeded reads send the GET instead of taking the payload part. On-disk marker count 1, original anchor 0. Result: 13 failed across the two files, including every one-request pin in 27627 and the five payload tests in 37195. Restored with git checkout HEAD: git diff HEAD empty and the blob hash matches HEAD.
  • pnpm --filter @object-ui/app-shell run type-check, @object-ui/types, @object-ui/i18n: exit 0, after rebuilding types and i18n.
  • eslint on the 21 changed ts/tsx files under ui/: 0 errors. The 266 warnings are existing no-explicit-any warnings in the touched files.
  • Derived gates (dispatch-gates.mjs --commands, reconciled with --ran): 41 derived, 39 run (all exit 0, including pnpm --dir ui exec vitest run scripts/: 172 files passed, 2 skipped), 2 NOT MEASURED: check:query-options-erasure and check:type-check-debt, both killed by a 200 s timeout on the shared box and left to CI.
  • node scripts/check-platform-checklist.mjs --changed-from origin/main: 0 anchored files. Run because recordDeleteHeldByMaster was renamed.
  • pnpm --dir ui run check:new-line-citations: exit 0.

Acceptance notes

  • The changeset is a new file, .changeset/37773-record-page-closed-lock.md. The dispatch named .changeset/37773-console-closed-lock.md, but that file landed on main with fix(console): word a closed record apart from one in approval, and save a closing header last (ADR-0162 item 4) #38994 and describes the grid half. Re-wording it would rewrite that half's pending note, so this half gets its own.
  • The edit dialog over a list sends one more read than main (3 instead of 2): the data lock read. The approvals lock read it still sends decides nothing in the dialog, which draws no approvals panel. Dropping it would change what the hook reads for its other consumers, which is out of scope.
  • Pressing Edit on a record page re-asks the page payload (the same body twice). Measured identical on main by restoring the four app-shell files to 77d15643 under the same dev server, so it does not come from this change.
  • The Closed chip shows only where the page header draws tags. It shows on the invoice line page but not on the showcase invoice's authored page; the greyed Edit and its sentence show on both. The state-lock chip on main is placed the same way.
  • The approval-held case was not browser-verified. The showcase's invoice sign-off flow does not lock the record: after submitting INV-1002, both lock doors answered locked: false. That case is pinned by the unit tests above.
  • The record page re-reads the data lock after a change. On a record-invalidation refresh, refresh() asks GET /data/:object/:id/lock, so a record closed by an edit on the page reads as closed without a reload. This is a read after a change, not an open.

Verification

Local showcase app on this branch: our own backend on a random port plus the console dev server proxied to it, 1440 x 900, signed in as admin. Every open sent one POST .../page carrying dataLock: true and no .../lock request.

Paid invoice INV-1003: Edit greyed, closed sentence on hover Paid invoice: overflow has no Delete
paid edit paid overflow
A line of the paid invoice (closed by its master, no authored predicate): Closed chip, Edit greyed with the sentence The same line: overflow has no Delete
line edit line overflow
CONTROL: draft invoice INV-1004: live Edit, Delete offered CONTROL: a line of the draft invoice: Delete offered
draft draft line

The paid invoice also carries authored edit.disabledWhen and delete.visibleWhen predicates, so its greyed Edit and missing Delete are not by themselves evidence for this change. Its Edit reason now reads the closed sentence. The invoice line has no such predicates, so the line rows isolate this change, with the draft-invoice line as control.

Claim on the card for this branch: #37773 comment 7330313783 (re-stating claim 7317217442 on claude/issue-37773-record-page-lock).

🤖 Generated with Claude Code

https://claude.ai/code/session_01WGufzhKEbEnW8pwZRgK2gJ

…ad request (ADR-0162 item 4)

Re-applies the record-page half held back from #38994. Edit and Delete
read the data layer's lock (`dataLock`), which the page payload now
carries (`dataLock: true` on `POST /data/:object/:id/page`), so a closed
record is greyed and worded as closed without a second request. Reads
the hook sends itself (the edit dialog over a list, a refresh after a
change) keep asking `GET /data/:object/:id/lock`.

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

Copy link
Copy Markdown
Contributor Author

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

Final green head · 2026-12-02T00:51Z · zone osa-data
Head-sha: fef530c

  • CI at this head: 46 success, 17 skipped, 0 running. The one failed row is the first PR-body guards run (2026-12-02T00:09Z): check:closing-target-claim found no Claim: naming this branch; the card's branch record 7330313783 was posted and the re-run (2026-12-02T00:16Z) passed. Mergeable: clean.
  • Diff: 22 files, +768 / −83 (851 lines ≤ 3000). Not governed (0 of 22 paths). Fixes #37773: the grid half merged in PR fix(console): word a closed record apart from one in approval, and save a closing header last (ADR-0162 item 4) #38994; this is the record-page half, re-applied from backup ca71605f.
  • The one change against the backup, per the seat ruling that one request per record-page open is a contract: the record page asks dataLock: true in its payload (PR feat(spec,rest): the record page payload answers the data lock read, so a record page learns a closed record in its one request #38999) and hands that part to useRecordApprovals, so a record page open is still ONE request with no lock GET. Only the hook's own reads (refresh(), a consumer with no payload) ask GET /data/:object/:id/lock; a 501 part latches like the GET's.
  • Behaviour: a closed record (its own state or its master's) greys Edit with the closed sentence, drops Delete for either lock source, offers no New/Edit/Delete on master-detail lines, and shows a Closed chip; closed and held reads as closed; approval-held is unchanged (Delete still follows lockSource through recordDeleteRefusedByLock, which replaces recordDeleteHeldByMaster). Edit dialog: joins the page's answer on a record page (0 extra reads); over a list it reads for itself (3 reads, main sends 2), pinned in AppContent.editDialogApprovalLock-27138.
  • Readings (dev report 7330244887): one-request pins in RecordDetailView.recordPagePayload-27627 (closed, unlocked control, ablation); 7 app-shell files / 139 tests green plus 37195 (11) and 27627 (11); one ablation (seeded reads send the GET) turns 13 red incl. every one-request pin. Type-check app-shell, types, i18n exit 0. 41 derived gates: 39 exit 0, 2 NOT MEASURED (local timeout; CI ran them). Browser-verified on the showcase paid invoice and its line with draft controls (screenshots in the body); approval-held and the reader without the state field are covered by tests only.
  • Surface: amendment 7330280533 adds recordPagePayload.ts, types/src/data.ts, the 27627 pin and a new changeset. AppContent.tsx untouched (Console: the record page edit-state save writes a closing header last, and the edit dialog locks on a closed record #38997 item 2 builds on recordClosedByLock).
  • Out of scope, not filed: pressing Edit on a record page re-asks the identical payload, measured the same on main 77d15643.
  • Backup claude/issue-37773-record-page-half-wip could not be deleted from the container; left for the maintainer.
  • 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 #39011 (#37773) · head fef530c · 2026-12-02T00:56Z

VERDICT: ACCEPT. No must-fix and no should-fix.

Next: zone landing. The merge closes #37773.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

2026-12-02T00:57Z · Landing: L1 ACCEPT on head fef530c (7331140596; no must-fix, no should-fix; two cosmetic nits accepted). Not governed (0 of 22 paths), 851 lines ≤ 3000, no L2 owed, CI 46 success with the one stale first PR-body guards run superseded by its passing re-run on this head, mergeable clean. Ready for review and auto-merge (squash). Fixes #37773: the merge closes the card; #38997 item 2 (the edit dialog's closed wording) builds on this.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review December 2, 2026 00:58
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge December 2, 2026 00:58
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Dec 2, 2026
Merged via the queue into main with commit 67d87f3 Dec 2, 2026
64 of 65 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-37773-record-page-lock branch December 2, 2026 01:21
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/l 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: read the one lock read, word "closed" apart from "in approval", and save a closing header last (ADR-0162 item 4)

2 participants