Skip to content

fix(approvals): draw the served snapshot to an approver whose read comes from the approval - #39736

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

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-39709-wip

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread
Part of #39709
Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:审批人本身没有这类单据的查看权限、只是因为待审才能看时,审批页左侧现在会显示提交的全部字段;字段被权限全部挡掉时显示"无权访问"的提示,不再是一片空白;权限说明里这一条改为先说"因待审批而可读"。
  • 为什么做:审批中心的修复,替只靠待审批才能看单据的审批人(例如提交人的上级)解决盲批的问题。
  • 出错会怎样:最坏是审批页多显示了服务端已经下发的字段,服务端早已按读者去掉了不该看的字段,所以不会多看到服务端没给的内容;改动可以直接撤回。
  • 要你做什么:单据详情页同样显示为空的问题这次没有改,需要你在决策线程里决定它是否也按待审批放行。

What changes

Part of rather than a closing reference: the card's Expected list includes "Decide whether the record page should honour the same approval read". That decision is forked to the decision thread and not built here, so merging this must not close the card.

  1. Request page, served definition, no client object read. In the request page's submitted-record hook (useSubmittedRecord), the declared face ran both rows through withoutDeniedFields. For a pending approver whose permission sets do not name the object, the client's field verdicts fail closed for every field, so the snapshot was emptied. noFieldAccess was computed from the unfiltered payload (it had keys), so the card returned nothing: a blank left pane. Now:
    • When the reader's permissions grant no read of the object (readThroughApproval), the snapshot and the current row are drawn as served. The service has already redacted the snapshot per reader by field (resolveReadableSnapshotFields in plugin-approvals: the read projection intersected with the queryable fields, so masked fields are dropped too), and the data API serves the current row redacted the same way. The client re-filter added nothing there except the fail-closed artefact.
    • When the reader's permissions do grant read of the object, the client field filter still applies, unchanged. Those verdicts are the same ones the service applied.
    • noFieldAccess is now computed from what is left after the filter. It is true when no served field is left, or when the filter withheld a served field and the plan draws nothing. So a pane narrowed to nothing shows the ruling-E notice instead of staying blank. A snapshot of undeclared keys with nothing withheld still draws nothing and claims no gap, as before.
    • Labels: with the definition served, the fields are drawn in the declared face, under the definition's labels. Those are the labels the server's payload_labels are derived from (the target object's field labels per snapshot key). The declared face also keeps the typed cells and the default record page's sections. The served face (plain text, payload_labels) remains the face for a withheld definition.
  2. Explain wording (object_crud layer). For a read granted by a pending approval, the detail used to open with "No resolved permission set grants read on 'X'; …". It now opens with the grant: "read on 'X' is granted via approval request N: the principal may read, as a pending approver, the records the request's pending step waits on them for, and no other, until the step resolves (see readFilter). No resolved permission set grants read on 'X'." The verdict, the read filter and every other branch are unchanged. The dogfood pin on this layer (approval snapshot, no object read) asserts toContain('No resolved permission set grants') and the request id, and both still hold.

Not in this PR: the record page (/OBJECT/record/ID). It fails closed at the same client gate (see Acceptance notes) and is forked to the decision thread.

Tests

  • ApprovalDecisionPanel.noReadableFields-39406.test.tsx (the shared harness for this surface, new top-level describe for this card):
    • definition served, no object read, snapshot served whole: every field drawn under its label, no notice;
    • a field the service withheld appears nowhere;
    • no field served: the notice;
    • the record read through the approval: a field changed since submission is marked;
    • object read, field permissions withhold every declared field and leave an undeclared key: the notice;
    • CONTROL: undeclared keys only, nothing withheld: nothing drawn and no gap claimed;
    • CONTROL: object read, one field denied: that field is not drawn, the others are.
    • Case 5 of the approvals: an approver without read on the object sees a blank request page, and nothing warns when the flow is saved #39406 block pinned the blank pane (fields served, field permissions deny every one: no value and no notice). It now asserts the notice.
  • pending-approver-read-admission.test.ts: the object_crud detail starts with read on 'X' is granted via approval request N: (both the public_read and the private object).
Red on main, then green (worktree at 3191f8f, then the fix)

Red, tests committed before the fix (e4fcb2e, 6409023):

× 5: definition served, fields served, the reader's field permissions deny every one: no value, and the notice in place of a blank pane
× definition served, no object read, snapshot served whole: every served field, under its label, no notice
× definition served, no object read: a field the service withheld appears nowhere
× definition served, no object read, the record read through the approval: a field changed since is marked
Tests  4 failed | 8 passed (12)

AssertionError: No resolved permission set grants read on 'qa_open_order'; the records a pending approval step waits on the principal for are read via approval request req_open, ...
Tests  2 failed | 12 passed (14)

Green on the fix:

pnpm --dir ui exec vitest run packages/app-shell/src/views/approval-decision/   Test Files 11 passed (11) · Tests 119 passed (119)
pnpm --filter @objectstack/plugin-security exec vitest run                      Test Files 294 passed (294) · Tests 7461 passed | 52 skipped
pnpm --filter @objectstack/plugin-security typecheck                            exit 0

Ablation of the "withheld and draws nothing" arm of noFieldAccess (scripts/ablation-replace.mjs, anchor hit once, restored to the HEAD blob): exactly the pin "object read, the field permissions withhold every declared field and leave an undeclared key" goes red (1 failed | 13 passed).

Acceptance notes

  • Record page (forked, not built). /OBJECT/record/ID hides the fields at two client gates, both reading checkField(object, field, 'read') from the /auth/me/permissions answer, which fails closed for an authenticated reader whose permission sets do not name the object: readableRow in RecordDetailView.tsx (app-shell) runs the page record through withoutDeniedFields before every block reads it, so the H1 falls back to the object label plus the id; and the gatedSchema memo in DetailView.tsx (plugin-detail) drops every section field whose checkField read verdict is false. The server serves the row (the pending approver's read admission). The question goes to the decision thread.
  • Same shape, other branch. The object_crud detail for a read granted by delegated administration (ADR-0090 D12) also opens with "No resolved permission set grants …" while the verdict grants. Not changed here (out of this card's scope); noted only.
  • typecheck of @object-ui/app-shell was not measured locally: tsc --noEmit there needs the built @object-ui/* declarations, and this worktree has none (every error was a module-not-found or follows from one). Type Check UI in CI measures it.

Verification

Risk-ranked files to read first:

  1. ui/packages/app-shell/src/views/approval-decision/SubmittedRecord.tsx: the useSubmittedRecord memo (readThroughApproval, asServed, noFieldAccess).
  2. packages/plugins/plugin-security/src/explain-engine.ts: the pendingApprover !== null arm of the object_crud detail.
  3. The new describe in ApprovalDecisionPanel.noReadableFields-39406.test.tsx.

Two-minute check: pnpm --dir ui exec vitest run packages/app-shell/src/views/approval-decision/ApprovalDecisionPanel.noReadableFields-39406.test.tsx. Expect 14 passed.

…omes from the approval (red on main)

Claude-Session: https://claude.ai/code/session_01L9qibvMXrDPhCt3pGziYWE
Co-Authored-By: Claude <noreply@anthropic.com>
…detail (red on main)

Claude-Session: https://claude.ai/code/session_01L9qibvMXrDPhCt3pGziYWE
Co-Authored-By: Claude <noreply@anthropic.com>
…mes from the approval; name that read first in explain

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

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

1 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • the SDK route bridge reached 71 of 255 client-bound route-ledger rows — the other 184 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 184: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 60 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 18 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json fb26c1cc7a77b5ab3260f9a29d0c0784cfc099be → packageMentionDocs.

Which tree this was computed on

This run read content/docs from e9a8d6569acb1c19b5e966e334da277607bc5aa1 — the merge of head fef22768d2ceeeebd6e7d6e8ca00da800f2e40af into base fb26c1cc7a77b5ab3260f9a29d0c0784cfc099be, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin e9a8d6569acb1c19b5e966e334da277607bc5aa1 && git checkout e9a8d6569acb1c19b5e966e334da277607bc5aa1
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin fb26c1cc7a77b5ab3260f9a29d0c0784cfc099be fef22768d2ceeeebd6e7d6e8ca00da800f2e40af && git checkout -B drift-repro fb26c1cc7a77b5ab3260f9a29d0c0784cfc099be && git merge --no-ff fef22768d2ceeeebd6e7d6e8ca00da800f2e40af

node scripts/docs-audit/affected-docs.mjs --json fb26c1cc7a77b5ab3260f9a29d0c0784cfc099be

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

席位核对

L1-b · 2026-12-04T17:25Z · ACCEPT · head fef22768d2 · claim 7416452759 · report 7418855722 (on #39709)

  • Face (l1-face.mjs --pr 39736): one flag, read and not a red. Draft, base main, one changeset (app-shell, plugin-security patch), Clause-②: no · Metadata-protocol: none. 53 success, 11 expected skip, 0 failed, 0 pending. mergeable_state is clean. Not governed, 204 lines.
  • Relation: Part of #39709 is right. This PR delivers the request-page half and the explain wording. The record-page question ("decide whether the record page should honour the same approval read") is open and goes to the decision thread. pm:dispatched stays on the card.

(1) SubmittedRecord.tsx, read as a permission surface:

  • Nothing the server withholds is drawn. The change only stops a client-side second filter. It never adds a value the server did not send: both rows are the responses already in the browser, the approval service's snapshot and the data API's row.
    • When readThroughApproval holds (permissions loaded and !perms.can(target, 'read')), the client field verdicts fail closed only because no permission set names the object. So they carry no field-level information about this reader, and dropping them hides nothing the server judged.
    • The snapshot is redacted per reader by resolveReadableSnapshotFields, as the read projection intersected with getQueryableFields (payload-redaction.ts). The current row is the Approver without object read cannot open the live record or attachments under review #39485 read door's answer.
    • hidden: true and isSystemManagedField still gate the plan, as before.
    • Where the reader's permission sets do grant read, withoutDeniedFields still narrows both rows, unchanged.
  • The predicate is shared. definitionWithheld now reuses readThroughApproval, so option E's withheld branch and this branch answer one question.
  • No blank pane. noFieldAccess is now left.length === 0 || (withheld && drawsNothing), computed on the filtered snapshot. A snapshot of undeclared keys with nothing withheld still claims no gap (the fix(app-shell): tell an approver who may read none of the submitted fields, instead of an empty pane #39479 rule). Case 5 of the approvals: an approver without read on the object sees a blank request page, and nothing warns when the flow is saved #39406 block flipping to the notice is correct under the new rule.
  • Residual, pre-existing, not this PR's: the snapshot redaction's documented case 3 serves the snapshot un-narrowed on a transient throw from the read projection (availability trade, logged). Option E already draws that same served snapshot when the definition is withheld, so this PR adds no new exposure class. If the seat wants that trade revisited for approvers, it is a server card.

(2) explain-engine.ts: the sentence change is text only. The verdict and readFilter are untouched. The pin asserts that the detail opens with "read on '…' is granted via approval request …:".

  • L2 not owed, in my reading. No server read or write path changes. The client change narrows its own filter only to what the server already decided, and the explain change is wording. Clause-②: no holds. A contract-tier read would add little over the above, but the seat can still ask for one on a p1 permission surface.
  • Deviations: accepted. The explain pin sits in pending-approver-read-admission.test.ts, which is the Approver without object read cannot open the live record or attachments under review #39485 pin file for that very sentence, so it is the right home. The -wip branch name is the os-dev convention (as on fix(plugin-approvals): delegation form dates say local time; Delegator locked by hand #39618).
  • Changeset, read sentence by sentence: true, including "Field permissions still narrow the page for a reader whose permission sets do grant read of the object" and "The record page … is unchanged here".

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

Copy link
Copy Markdown
Contributor Author

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

Landing · 2026-12-04T17:26Z · head fef22768d2 · L1-b ACCEPT 7418921592 (L2 not owed in L1-b's reading: no server read or write path moves; the client stops a second filter only where its verdicts fail closed for an unnamed object; the explain change is wording)

Reading Result
check-governed-merges.mjs --pr 39736 NOT governed · 204 changed lines ≤ 3000
landing-k.mjs --pr 39736 K = 2 < 15
check-runs on fef22768d2 53 success, 12 skip (dogfood matrix placeholder /4 unexpanded, aggregator success); one guard re-run after ready in progress; mergeable_state clean
File surface inside claim 7416452759 on #39709 (SubmittedRecord.tsx, explain-engine.ts, tests, changeset)

State: ready + auto-merge through the merge queue. Part of #39709: the record-page question is with the decision thread; pm:dispatched stays on the card.

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 tests 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.

2 participants