Repository navigation
feat(console): the record page reads a closed record from its one payload request (ADR-0162 item 4) - #39011
Conversation
…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
…uest Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzhKEbEnW8pwZRgK2gJ
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzhKEbEnW8pwZRgK2gJ
…cord-page-lock Claude-Session: https://claude.ai/code/session_01WGufzhKEbEnW8pwZRgK2gJ Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhKEbEnW8pwZRgK2gJ Final green head · 2026-12-02T00:51Z · zone osa-data
|
|
repo:objectstack@os-support-ai · os-support-ai · session_01WGufzhGA3zoCFquQgku4pm L1 review · PR #39011 (#37773) · head fef530c · 2026-12-02T00:56ZVERDICT: ACCEPT. No must-fix and no should-fix.
Next: zone landing. The merge closes #37773. |
|
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 |
Fixes #37773
Clause-②: no
Metadata-protocol: none
维护者速读
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.
POST /api/v1/data/{object}/{id}/page) now asksdataLock: true.seedRecordPageReadershands that part touseRecordApprovalsthroughseedRecordApprovals, and the hook publishes it asdataLockin 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 secondGET /data/:object/:id/lock.dataLock, not the approvals-family lock.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 eitherlockSource, and master-detail lines draw no New, Edit or Delete.lockReason: 'approval'): unchanged. The record's own approval keeps Delete; a line under a held master does not (recordDeleteRefusedByLock, which replacesrecordDeleteHeldByMaster).recordLock.GET /data/:object/:id/lock. That meansrefresh()after the record changes, and a consumer with no page payload behind it. A part refused501latches like the GET's501, so neither is asked again.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) readsopenApprovalOf(formApprovals)as before, which now readsdataLock. Request counts, measured in the browser and pinned where noted:?form=ID): 3 reads, pinned inAppContent.editDialogApprovalLock-27138: approvals list, approvals lock, and the data lock read. On main it sends 2.?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.recordClosedByLockandDataRecordLockstay 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'sdataLockpart as the spec'sRecordLockor a part refusal.detail.lockedClosedanddetail.lockedClosedTooltipin all 11 console locales.Read first, by risk:
ui/packages/app-shell/src/hooks/useRecordApprovals.ts:startRead'sdataLockReadchoice (seeded vs own read) andsettleSeededDataLock.ui/packages/app-shell/src/views/recordPagePayload.ts: thedataLockseed passed beside the approvals seed.ui/packages/app-shell/src/views/RecordDetailView.tsx:recordClosedin 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 assertsdataLock: truein the one request body. A new block mounts the adapter the way the console'sAdapterProviderdoes, which is what lets the hook send reads of its own:GET /data/.../lockitself, which shows the detector can see that read.useRecordApprovals.lockSource-37195:answeredwithoutdataLock;refresh()asks the data lock door once;501part latches, so no later GET goes out.RecordDetailView.harness(closedLock-37773,deleteFollowsLockSource-37195) andRecordDetailView.approvalLock-25934: the hook's own-read path, carried over from the backup. They cover: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 runon the harness,approvalLock-25934,AppContent.editDialogApprovalLock-27138,recordOpenOneRequest-28470,feedLoadFailure-29188,recordReadFailure-11902andapprovalRequestPage-28546: Test Files 7 passed, Tests 139 passed. The 27138 file was re-run after its new pin: 6 passed.startReadwas 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 withgit checkout HEAD:git diff HEADempty 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.eslinton the 21 changed ts/tsx files underui/: 0 errors. The 266 warnings are existingno-explicit-anywarnings in the touched files.dispatch-gates.mjs --commands, reconciled with--ran): 41 derived, 39 run (all exit 0, includingpnpm --dir ui exec vitest run scripts/: 172 files passed, 2 skipped), 2 NOT MEASURED:check:query-options-erasureandcheck: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 becauserecordDeleteHeldByMasterwas renamed.pnpm --dir ui run check:new-line-citations: exit 0.Acceptance notes
.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.77d15643under the same dev server, so it does not come from this change.locked: false. That case is pinned by the unit tests above.refresh()asksGET /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 .../pagecarryingdataLock: trueand no.../lockrequest.The paid invoice also carries authored
edit.disabledWhenanddelete.visibleWhenpredicates, 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