You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9aabb7e
Browse filesBrowse the repository at this point in the historyBrowse files
fix(app-shell): the record page draws the record the server served to a pending approver with no object read (#39739)
<!-- claude-projects-attribution: {"github_login":"os-tesla"} -->
_Requested by **Tesla** · [project
thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6Jao6b3sg9unxpwCQHMkkc6XxT)_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.
<details><summary>Ablations (each restored from the commit, `git status
--porcelain` empty after)</summary>
- 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.
</details>
<details><summary>Local runs</summary>
- `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 #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`.
</details>
## 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.com/claude-code)
https://claude.ai/code/session_01L9qibvMXrDPhCt3pGziYWE
<!-- signed: repo:objectstack@os-tesla · os-tesla ·
session_01L9qibvMXrDPhCt3pGziYWE -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
fix(app-shell): the record page draws the record the server served to a pending approver with no object read
6
+
7
+
Clause-②: no
8
+
Metadata-protocol: none
9
+
10
+
A pending approver may read the one record an approval request is about while their step waits, even without read on its object. The server served that record, but the record page showed only its id: the console's permissions answer grants no read on the object, so the page hid the title and every field the server had already filtered for this reader.
11
+
12
+
The record page now draws the served record when two things hold: the server answered the read of this record, and the loaded permissions answer grants no read on its object. Only that page's reads of that object are left to the server. Edit, delete, inline editing, export and actions stay gated as before, related lists of other objects and every other page are unchanged, and a reader whose answer grants the read keeps today's field-level hiding (objectstack#39709).
expect(screen.getByText('Please review the laptop order')).toBeTruthy();
336
+
// The rows came from the actions route, not the data API.
337
+
expect(timelineGets().length).toBeGreaterThan(0);
331
338
});
332
339
333
-
it('control: the same answer strips the served row to its id when the routed reads are mounted without ApprovalRecordReads',async()=>{
340
+
it("control: without ApprovalRecordReads the page draws its own served row (objectstack#39709), and the Timeline's other approval object stays dark",async()=>{
334
341
openAsMember(routedReadsOnly);
335
-
// The page is up and the approvals get answered: the tab strip is drawn
336
-
// and the heading names the request by its object label and id, the
337
-
// title's last rung, as the blank page the report describes does.
@@ -455,6 +455,9 @@ export function resolveRecordHeaderActionGates(
455
455
};
456
456
}
457
457
458
+
/** `ServerReadScope`'s object list on a record page the server reads no record for (objectstack#39709): one identity, so the scope's value is cached once. */
0 commit comments