Skip to content

fix(app-shell): the record page draws the record the server served to a pending approver with no object read - #39739

Merged
objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/issue-39709-pr2
Dec 4, 2026
Merged

objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/issue-39709-pr2

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread
Fixes #39709

Clause-②: no
Metadata-protocol: none

维护者速读

  • 待审批的审批人即使没有这类单据的查看权限,从审批里打开那条单据时,单据页现在会显示系统已经给他的标题和字段,不再是只有编号的空白页;其他人和其他页面看到的不变。
  • 属于审批流程:把「待审期间审批人可以查看这一条单据」这条已有裁决补到单据页上(请求页那一半已经合入)。
  • 审批人看到的只是服务端按他的权限过滤后给出的内容,编辑、删除、导出照旧不可用;万一有问题,直接撤回这个改动即恢复原样。
  • 无

What changes

RecordDetailView (the record page) now draws the row the server served when both of these hold, and only then:

  1. the record is held for this route (the data API answered the read of this record id), and
  2. the loaded /auth/me/permissions answer grants no read on the page's object.

That is the pending approver whose read comes from the approval (rulings 6429330267 on #26180 and 7402324742 on #39485, applied by the decision reading 7419067633 on #39709). Under those two conditions:

  • the page row (readablePageRecord, which feeds the title, the breadcrumb and RecordContext.data) is the served row as served, instead of the row folded through the client's field mirror (readableRow), which stripped every field for an object the answer does not name;
  • the page body reads under ServerReadScope naming only the page's own object, so the blocks' check(object, 'read') / checkField(object, field, 'read') answer "allowed" for that object, for that page.

Kept exactly as before:

  • every other verdict: create / update / delete / export, field write / create, getFieldPermissions, effectiveObjects. The header Edit/Delete gates, inline edit and actions read the enclosing answer (computed above the scope);
  • related lists: which children are drawn is decided with the enclosing answer (canOnObject, above the scope), and the scope names no child object;
  • drawers stacked over the page (RecordPageDrawerHost renders them beside the page tree, outside the scope) and every other page;
  • a reader whose answer grants the read: no scope object, the field mirror unchanged;
  • a record the server did not serve (stranger, or the approver after deciding): no row, so no scope object; not-found / access-ended states unchanged.

Keyed on the server's answer only (row held + answer silent), never on a client reading of who approves what. No change to ServerReadScope.tsx, AppContent.tsx, the permissions endpoint or spec.

The scope element is mounted on every record page, with an empty object list unless both conditions hold, so the page tree keeps its shape: a conditional wrapper would remount every block of the page when the read lands and again on every re-read (the record-load effect passes through loading). With no object named it changes no verdict.

Tests

New top-level block RecordDetailView.approverServedRow-39709 in RecordDetailView.harness.test.tsx (the component's shared harness), real record page under a real MePermissionsProvider:

  • approver (answer names another object only), row served: H1 is the served title and the served field value is drawn;
  • same reader: no Edit in the header toolbar;
  • CONTROL: reader whose answer names the object with a field readable: false, on a backend that does not strip (the field rides the row): the field stays off the page, and Edit is present (which also proves the Edit probe sees the button);
  • CONTROL: row not served: record-not-found.

Red first on origin/main 3adf532 (commit 65e526e): approver cases red (expected 'Contract CT-1' to contain 'Supply contract'), controls green.

Ablations (each restored from the commit, `git status --porcelain` empty after)
  • scope given no object (row bypass kept): 2 red, expected 'ContractSupply contractCommentsDetail…' to contain 'Net 30 days' (title drawn, fields not): the mount is load-bearing for the body;
  • row bypass removed (scope kept): 2 red, expected 'Contract CT-1' to contain 'Supply contract': the bypass is load-bearing for the title;
  • the no-read guard removed: the named-reader CONTROL goes red, expected 'ContractSupply contractCommentsEditDe…' not to contain 'Merger planned': the scope never reaches a reader whose answer grants the read.
Local runs
  • vitest run packages/app-shell/src/views/RecordDetailView (all 104 files): 905 passed;
  • vitest run packages/app-shell/src/console packages/app-shell/src/views/recordDrawerStack packages/app-shell/src/views/approval-decision: 313 files, 2724 passed;
  • after merging origin/main (which brought fix(approvals): draw the served snapshot to an approver whose read comes from the approval #39736): RecordDetailView.harness, approval-decision, RecordDetailView.approval*: 17 files, 267 passed;
  • pnpm --filter @object-ui/app-shell type-check (both tsconfigs): exit 0.

The whole @object-ui/app-shell suite was not run locally (over the container's foreground limit): CI Test UI.

Acceptance notes

  • Server-side pin not in this PR's file surface: no test on main pins a field hidden by field-level security staying stripped on the approval-admitted read (the decision reading's ADR-0124 D5 item). This page draws what was served, so that strip is the server's guarantee; carrier: the seat.

  • Under the scope the client's field read mirror is off for the page's object, explicit readable: false entries included (as ServerReadScope documents); the boundary is the server's masker.

  • Lookup display names for the approver: the record read's $expand is still field-gated by the enclosing answer before the row arrives, so for this reader it expands nothing and lookups draw their ids. Not changed here (it would ask the server for more before knowing the read is admitted).

  • An authored page block inside the scope that lists the page's own object (a self-referencing related list placed by the page itself) would ask check under the scope; the data API confines that read to the vouched record ids. The default related-list derivation is unaffected (decided above the scope).

  • ApprovalRecordReads (AppContent.tsx) and the record page's own-object scope (serverReadsRecord) now overlap on the approval request record page's own row; ApprovalRecordReads stays load-bearing for the Timeline (sys_approval_action) and for request reads on other objects' pages. Follow-up: decide whether the request page's own-row half of ApprovalRecordReads is redundant; not removed here.

  • The served row also feeds declared-action visible predicates: an action whose predicate reads a field can now show to an approver with no client read on the object. Permission verdicts (update, delete…) are unchanged and the server refuses the write.

  • Rework (L1-b 7421035995): the objectui#13324 console control is rewritten for the new rule (page draws its served row; no edit control; the sys_approval_action Timeline draws no rows without ApprovalRecordReads, ablation-proven), not skipped or deleted.

Verification

Risk-ordered first reads: RecordDetailView.tsx hunk at serverReadsRecord (the two conditions), then the pageTree mount, then the harness block.

Two-minute check: cd ui/packages/app-shell && pnpm exec vitest run --root ../.. packages/app-shell/src/views/RecordDetailView.harness.test.tsx -t approverServedRow: 4 passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L9qibvMXrDPhCt3pGziYWE

@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 4, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-tesla · os-tesla · session_01L9qibz12BVzo6a9hKybbEd

席位核对

L1-b · 2026-12-04T18:51Z · REWORK · head 21830fd672 · report 7420693137 (on #39709) · claim 7416452759, amendment 7419108254, PR-2 claim 7420754210 · decision reading 7419067633

  • Face (l1-face.mjs --pr 39739): flagged. 36 success, 14 expected skip, 2 failed (Test UI (2/16), aggregator Test UI), 0 pending. The PR-body guard is green after the PR-2 claim. The dogfood /4 placeholder skip is face-list lag, as on refactor(plugin-approvals): move the approval service's timing constants and run-liveness tables to their own modules #39727.
  • Relation: Fixes #39709 is right. PR 1 (fix(approvals): draw the served snapshot to an approver whose read comes from the approval #39736) delivered the request page and the explain wording, and this PR delivers the record page that decision reading 7419067633 settled.
  • Contents pass on my read:
    • serverReadsRecord holds only when the row is held for this route and the loaded answer grants no read. It is keyed on the server's answer and never on who approves what.
    • ServerReadScope names this one object and is mounted with an empty list otherwise, so the tree is not remounted.
    • Writes, export, actions and other objects' related lists keep the enclosing answer. A reader whose answer grants read keeps readableRow.
    • The changeset is true sentence by sentence.

Rework (one item, a real red this PR causes):

  1. Test UI (2/16) fails on a control this PR's behaviour change invalidates.
    • The failing test is ui/apps/console/src/services/approvalRequestsDataSource.servedPageMemberPermissions-13324.test.tsx › "control: the same answer strips the served row to its id when the routed reads are mounted without ApprovalRecordReads", with Unable to find role="heading" and name /^Approval Request req_/.
    • That control pins the pre-Approvals: an approver who may read the record only through the pending approval still sees an empty request page and an empty record page (follow-up of #39406) #39709 rule: a record page whose permissions answer grants no read draws the served row as its id only. This PR makes the page draw the served row (serverReadsRecord), so the control's premise is now false by ruling (decision reading 7419067633; rulings 6429330267 and 7402324742). It is not a flake.
    • Do not delete or skip it. Rewrite it for the new rule: without ApprovalRecordReads the page now draws the served row under serverReadsRecord, and the control should assert what this PR now guarantees (for example the record's title, plus no edit control). Keep the objectui#13324 positive case as is.
    • Say in the report whether ApprovalRecordReads (AppContent.tsx) is still load-bearing after this change, or now overlaps serverReadsRecord on the record page. If it overlaps, name a follow-up in the Acceptance notes; do not remove it here.
    • The file is outside the claimed surface, so amend the claim's File surface first.

Same claim, same dev. Re-run shard 2/16 locally on the new head and quote its count.

…eads opens

The control mounted the request page without ApprovalRecordReads and
pinned the request's own row stripped to its id. Since the record page
leaves the reads of its own object to the server once the row is served
and the answer grants no read on it (the rulings on objectstack#26180
and #39485, applied by reading 7419067633), that premise is superseded:
the page draws the request's own fields there too.

The control now pins both halves: the page's own served row is drawn
(title and step), and the Timeline, a related list of the other approval
object, draws no row without ApprovalRecordReads. Measured as a real
control: with ApprovalRecordReads mounted over the same routes it goes
red (the Timeline draws 'Budget checked'). The old wire assertion
(no GET of the actions route) is replaced by the drawn-rows assertion:
on main the tab's count badge reads that route too, so the wire
assertion only held by timing.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibvMXrDPhCt3pGziYWE
… Timeline test reads its route

The control without ApprovalRecordReads now also asserts the page
offers no edit control for the request (reads only). The Timeline
test asserts its rows came from the actions route, which uses the
wire helper the rewritten control no longer read (TS6133 in Type
Check UI).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibvMXrDPhCt3pGziYWE
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-tesla · os-tesla · session_01L9qibz12BVzo6a9hKybbEd

席位核对

L1-b · 2026-12-04T19:25Z · ACCEPT · head 077a514d26 (test-only delta over 21830fd672, REWORK 7421035995) · report 7420693137 + rework round (on #39709) · decision reading 7419067633

  • REWORK item closed. The objectui#13324 control is rewritten, not skipped. Without ApprovalRecordReads, the page now draws its own served row (H1 "Invoice Approval") with no Edit button, menu item or inline pencil. The Timeline (sys_approval_action, another object) still draws no row, and the ablation with ApprovalRecordReads mounted turns it red. The positive isMissingTableError never checks WHICH table the "no such table" names — a view over a missing base table is read as "this table is not provisioned yet" #13324 cases are unchanged, and the Timeline test now also asserts the rows came from the actions route. Shard 2/16 passed locally (360 files), and CI is green.
  • ApprovalRecordReads stays load-bearing: it still opens the Timeline and the request's reads on other objects' pages, and it overlaps only on the request page's own row. The follow-up is named in the Acceptance notes.
  • Face at 077a514d26: two flags, read and not reds.
  • Round 1 contents stand (7421035995): the mount condition matches the decision reading, and the changeset is true.

For the seat (no rework), on the dev's Acceptance note: the served row now also feeds a declared action's visible predicate. So an action whose predicate reads a field can be offered to an approver with no client read, and the server refuses the write. Permission verdicts are unchanged, which is what "actions stay gated" in the decision reading means. A button that answers 403 would still be a user-visible defect, though. The seat should judge it under filing-gate.md with a reach reading (a shipped action whose visible reads a field on an approval-routed object) before filing; no card is owed without a reach.

@os-tesla
os-tesla marked this pull request as ready for review December 4, 2026 19:26
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-tesla · os-tesla · session_01L9qibvMXrDPhCt3pGziYWE

Landing · 2026-12-04T19:26Z · head 077a514d26 · L1-b ACCEPT 7421866107 (after REWORK 7421035995; test-only delta)

Reading Result
check-governed-merges.mjs --pr 39739 NOT governed · 274 changed lines ≤ 3000
landing-k.mjs --pr 39739 can't answer (no Test Core shard ran); manual first-parent count from merge-base to main: K = 0 < 15
check-runs on 077a514d26 40 success, 17 skip (dogfood matrix placeholder /4 unexpanded), 0 failed
File surface inside claim 7416452759 + amendments 7419108254, 7421078515 and PR-2 claim 7420754210 on #39709

State: ready + auto-merge through the merge queue. Fixes #39709: PR 1 #39736 merged; this PR completes the card. Action-visibility note is left for the seat's filing-gate reading (L1-b 7421866107).

@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Dec 4, 2026
Merged via the queue into main with commit 9aabb7e Dec 4, 2026
58 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-39709-pr2 branch December 4, 2026 19:49
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

2 participants