Skip to content

fix(console): Notification Settings is read-only, with its reason, for a caller with no write grant - #35313

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-35192-notification-settings-read-only
Nov 19, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-35192-notification-settings-read-only

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread
Fixes #35192

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:外部成员(org_external)打开 Account 应用的「通知设置」时,页面现在整页只读:所有开关、摘要下拉和免打扰时段都置灰,顶部一行说明原因(已译成全部 11 种内置语言),每个置灰控件都把这行原因作为无障碍描述,且不会发出任何写请求。
  • 为什么改:external_default 权限集对 sys_notification_preference 没有新建或编辑授权,之前页面照样给出可操作的控件,每次点击都回 403。判断依据是框架自己给当前用户的权限答复(/me/permissions,经 usePermissions() 读取),页面不看身份名称。
  • 风险与回滚:风险低,只改一个页面的前端呈现;服务端拒绝逻辑与权限集均未改动。没有挂载权限答复的宿主保持原样(可写,由服务端裁决)。回滚即还原本 PR。
  • 先看:① NotificationSettingsPage.tsx 中 writeGranted 的取值与 apply 里的守卫;② 同文件新增的只读提示 Alert 及各控件的 aria-describedby;③ NotificationSettingsPage.test.tsx 末尾三种身份的新测试。
  • 两分钟验证:在 worktree 的 ui/ 下运行 npx vitest run --root . packages/app-shell/src/console/notification-settings/,预期 2 个测试文件、31 个测试全部通过。
  • 需要你做的:无,席位落地。

What changes

  • NotificationSettingsPage reads the caller's grant on sys_notification_preference through usePermissions() (the console's /me/permissions answer, the same read ObjectView's personal-view grant uses). A write is a create (no own row yet) or an edit (the person's own row), so the page is read-only when the caller holds neither.
  • Read-only means: every switch, the digest select and the quiet-hours Save are disabled, the quiet hours render as text (the field widget's readonly face), one visible reason sits at the top of the page (notificationSettings.readOnly), and each disabled control points aria-describedby at it. apply also refuses to send while the grant is missing, so no write leaves the page even if a handler fires (a change event still reaches a disabled select).
  • The reason is one visible line rather than one tooltip per control: the reason is the same for every control on the page (the InspectorReadOnlyReason rationale), and the page already explains its other limits as visible hint lines (digestNoOff, quietHoursNoClear). Per the claim's Choice line, the nav entry stays: the external member still sees what is in force for them.
  • With no permission answer (no provider mounted, or not loaded yet) the page stays writable and the server's refusal decides, as every other console grant read does (!perms.isLoaded || perms.can(...)).
  • New locale key notificationSettings.readOnly in all 11 built-in locales (en, ar, de, es, fr, ja, ko, pt-BR, ru, zh-Hans, zh-Hant).
  • Changeset: @object-ui/app-shell patch, @object-ui/i18n patch.

Tests

Head 28e8973f5b. Three persona pins in NotificationSettingsPage.test.tsx (new top-level describe), each through the real MePermissionsProvider over that persona's /me/permissions answer, shaped as the default sets serve it:

  • org_external (external_default: no row for the object, no '*'): reason shown, cell / digest / Save disabled and described by the reason, quiet hours read as text, the in-force sources still drawn; clicking a cell, changing the digest and clicking Save send no create and no update, and the door is read once.
  • member (member_default: create + edit on the object) and organization administrator (organization_admin's '*' row): no reason, controls enabled, a switch creates the person's own row. These are the controls.
Test run (targeted)
npx vitest run --root . --maxWorkers=2 packages/app-shell/src/console/notification-settings/
 Test Files  2 passed (2)
      Tests  31 passed (31)
os-verify-lock: VERDICT command-exit 0
Ablations (two, both red, both restored)

Each through scripts/ablation-replace.mjs on the committed head (the page is imported from source by relative path, so no build sits between the edit and the run):

  1. writeGranted forced to true: anchor 1 to 0, blob e7f9c1e8b056 to 11dcab5d0934; the external-member pin fails (Tests 1 failed | 14 passed (15)), the member and admin pins stay green. Restored: blob equals HEAD, git diff HEAD empty.
  2. The !writeGranted guard in apply removed: anchor 1 to 0, blob e7f9c1e8b056 to fb6e88e32901; the external-member pin fails on expected "vi.fn()" to not be called at all, but actually been called 1 times (the digest change). Restored: blob equals HEAD, git diff HEAD empty.

Acceptance notes

  • A caller holding exactly one of create / edit (no default set does) still sees the page writable; a write of the other kind answers 403 and the page shows its existing save-failed line. Per-write precision was not taken, because the card asks for "no create or edit grant".
  • @object-ui/app-shell type-check was not run locally: the package is a composite program whose references need the built declarations of about 70 workspace packages. Type Check UI measures it on this PR. @object-ui/i18n type-check ran green locally after building its closure.
  • The full app-shell suite was not run locally (dispatch order: targeted tests plus derived gates); CI Test UI runs it.

Verification

Derived gates (dispatch-gates --commands, 40 families) at 28e8973

All 40 derived commands exit 0, plus pnpm check:changeset-fixed (its roster sits under .changeset/). Reconciliation: dispatch-gates --ran: 40 derived famil(ies) accounted for — 40 run, 0 NOT-MEASURED (a DERIVED zero — all 40 recorded an exit code and none of them is 3). pnpm --dir ui exec vitest run scripts/: Tests 5092 passed | 2 skipped (5094). overlap-check: VERDICT clean exit 0 against origin/main and the one open PR sharing the locale files (#35261).

Fix round (head 0973664e61)

The first head 28e8973f5b turned two Test UI shards red; both were this PR's and both are fixed. The Tests section above describes the first round.

  • Shard 15/16: ui/packages/plugin-form/src/affordanceGrantMap-12082.test.tsx (the census of raw CRUD grant reads) received NotificationSettingsPage.tsx as a new reader. Added an OUT_OF_FAMILY entry with its reason (the caller's own preference row, already graded out of family as myPreferences.ts :: sendPreferenceWrite), and amended those WRITE_SITES reasons to name the read that now gates the writes. No AFFORDANCE_GRANTS row (that would change published @object-ui/core). This file is outside the dispatch fence, edited because this PR turned it red.
  • Shard 4/16: zh-hant-generated.test.ts — zh-Hant.ts is generated from zh-Hans; the hand-written line was replaced by pnpm --filter @object-ui/i18n gen:zh-hant (one line).
  • Local on 0973664e61: those two files + console/notification-settings/ → 4 files / 97 tests passed; census red leg reproduces the CI failure under ablation, restored blob == HEAD; 40/40 derived gates exit 0; overlap-check clean (incl. PR feat(security, create-objectstack): an AI-built app with its own capabilities and no connector plugins installs as an unmanaged copy #35261, which shares the locale files).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Utp6CbSphdunq2aJq7ktuY

… write grant on sys_notification_preference

Claude-Session: https://claude.ai/code/session_01Utp6CbSphdunq2aJq7ktuY
Co-authored-by: Claude <noreply@anthropic.com>
@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 Nov 19, 2026
… own-row grant read

Claude-Session: https://claude.ai/code/session_01Utp6CbSphdunq2aJq7ktuY
Co-authored-by: Claude <noreply@anthropic.com>
…ngs read-only line

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CbSphdunq2aJq7ktuY

Final head for L1: 0973664e612deefc03859ef9688b87ccee3c20bf · 2026-11-19T05:12Z

  • CI on this head: 47 success, 15 skipped, 0 failed or pending. Mergeable state: clean.
  • Diff 178 lines (15 files): above the 50-line self-landing bar, so the L1-a thread reads it. Clause-②: no · Metadata-protocol: none.
  • Fix round from 28e8973f5b (two Test UI shards, both this PR's) is in the body's "Fix round" section: census OUT_OF_FAMILY entry in plugin-form/affordanceGrantMap-12082.test.tsx (outside the dispatch fence, needed) and zh-Hant.ts regenerated.
  • Choice per the claim: read-only with a reason, nav entry kept; decided from usePermissions() (/me/permissions), no identity names.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4

维护者速读

  • 改了什么:外部成员打开「通知设置」时整页只读:开关、摘要、免打扰全部置灰,顶部一行原因(11 种语言),不发任何写请求;成员和组织管理员不变。
  • 为什么改:卡 console: Notification Settings shows external members switches whose writes all answer 403 #35192。external_default 对 sys_notification_preference 没有新建/编辑授权,以前页面给出可点的控件、每次都回 403。
  • 风险与回滚:只改一个页面的前端;判断来自框架的 /me/permissions 答复,不看身份名;没挂权限答复时保持可写、由服务端裁决。回滚即 revert 本 PR。
  • 先看:NotificationSettingsPage.tsx 的 writeGranted 与 apply 里的守卫。
  • 两分钟验证:跑 console/notification-settings/ 下的测试,三种身份各一条。
  • 需要你做的:无,区内落地(非受管面、178 行)。L1 意见:可落。

席位核对 — ACCEPT (L1-a) · repo:objectstack#5 · head 0973664e612deefc03859ef9688b87ccee3c20bf · 2026-11-19T05:15Z

  • 形态: draft → main, 15 files, +172/−6, 5 commits, one fix round. Fixes #35192. check-governed-merges --pr 35313: 0 of 15 paths governed, 178 lines ≤ 3000 → ordinary queue landing. Clause-②: no holds: one additive key notificationSettings.readOnly in @object-ui/i18n's 11 built-in locales, and no props or exports change. @object-ui/app-shell is private, and @object-ui/permissions is already a dependency of it. Metadata-protocol: none.
  • Fixes vs the card: the card asks for disabled controls with a reason, or a hidden nav entry, with the choice recorded. Disabled was picked, and the body records why: the external member still sees what is in force for them, and one visible line matches the page's other hint lines. The decision comes from usePermissions().can(sys_notification_preference, create | update), the framework's answer, so the page names no identity. Done-when is met on all three counts:
    • External: read-only, and no write is sent. apply refuses as well, which covers a change event reaching a disabled select.
    • Member and admin: unchanged.
    • One pin per persona, through the real MePermissionsProvider.
      So Fixes is right.
  • Semantics checked: with no provider, usePermissions() answers isLoaded: false and can: () => true. writeGranted = !isLoaded || … therefore keeps a host without the provider writable, and the server decides. This is the console's usual fail-open for UI gating, and the server refusal is unchanged, so it is not a security surface. Holding exactly one of create or edit (no default set does) stays writable, and the other write gets the existing save-failed line. The body notes this, and it matches the card's "no create or edit grant".
  • Fix round: the two red shards were both this PR's and both fixed correctly:
    • The affordanceGrantMap-12082 census gains an OUT_OF_FAMILY entry for the page. It is the caller's own preference row, already graded out-of-family at myPreferences.ts :: sendPreferenceWrite, and the two WRITE_SITES reasons now name the gating read. No AFFORDANCE_GRANTS row was added, which would have changed published @object-ui/core. The file is outside the fence, but this PR turned it red, so editing it is in scope.
    • zh-Hant.ts was regenerated with gen:zh-hant instead of hand-written.
  • Changeset: .changeset/35192-notification-settings-read-only.md, patch on @object-ui/app-shell and @object-ui/i18n. I read each sentence against the diff:
    • "neither a create nor an edit grant" matches writeGranted.
    • "every control disabled" matches canWrite: the cells, the digest, the quiet-hours Save, and the quiet-hours widget readonly.
    • "one visible line ... in every built-in locale" matches the Alert and 11 locale lines.
    • "named by each disabled control as its accessible description" matches aria-describedby on the cell, digest and Save. The quiet hours render as text in their readonly face.
    • "no write sent" matches the apply guard.
    • "member and administrator ... as before", "no permission answer ... stays writable" and "server's refusal is unchanged" all match the diff.
  • 接受的偏差: (1) While /me/permissions is loading, an external member briefly sees enabled controls. A write in that window gets the existing 403 line. This follows the shared console fail-open rule, and no card is owed. (2) The PR body's Tests section names the first head 28e8973f; the Fix round section covers head 0973664e.
  • Pins:
    • org_external: the reason is shown; cell, digest and Save are disabled and described by it; the quiet hours read as text; a click, a change and Save send no create or update.
    • Member and org admin: no reason, and a switch creates the person's own row.
    • Ablation 1 (writeGranted forced true) reddens only the external pin. Ablation 2 (no apply guard) reddens it on the digest change.
  • 门禁: check-runs on head 0973664e: 47 success, 15 skipped, 0 failure. The successes include Test UI and all 16 shards, among them 4/16 and 15/16 that were red on the first head. They also include Type Check UI, Lint UI, Build & E2E UI, Live E2E UI, Lint & Repo Gates, and Check Changeset.
  • 范围外去向: none.
  • 落地条款: K = 9 first-parent commits on main since merge base bc75bcdb (< 15). Locale pack: 11 lines, one per locale, and zh-Hant is generated. The body reports overlap-check clean against feat(security, create-objectstack): an AI-built app with its own capabilities and no connector plugins installs as an unmanaged copy #35261, which shares these locale files. Whichever lands second re-checks the overlap. Non-governed ⇒ ux-1 lands per landing-operations.md (pr_ready + auto-merge) after this ACCEPT. On MERGED, close-out on console: Notification Settings shows external members switches whose writes all answer 403 #35192.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CbSphdunq2aJq7ktuY

Landing · area ux-1 · 2026-11-19T05:17Z

Reading Value
check-governed-merges --pr 35313 0 of 15 paths governed, 178 lines → ordinary queue landing
K (merge base..origin/main, first-parent) 9 (< 15); overlap-check against origin/main and open PR heads (incl. #35261, shared locale files) re-run at landing: clean

ACCEPT 7000445730 (L1-a) at head 0973664e612deefc03859ef9688b87ccee3c20bf. Ready + auto-merge now. #35192 closes on merge.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 19, 2026 05:18
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 05e0eb8 Nov 19, 2026
63 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-35192-notification-settings-read-only branch November 19, 2026 05:37
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

Development

Successfully merging this pull request may close these issues.

console: Notification Settings shows external members switches whose writes all answer 403

2 participants