Skip to content

feat(account): a Notification Settings page for each person's own notification preferences - #35122

Merged
objectstack-fleet[bot] merged 12 commits into
mainfrom
claude/issue-34728-notification-settings
Nov 18, 2026
Merged

objectstack-fleet[bot] merged 12 commits into
mainfrom
claude/issue-34728-notification-settings

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Fixes #34728

Clause-②: yes
Metadata-protocol: none

维护者速读

  • 改了什么:账户应用新增「通知设置」页。每个人可以按主题 × 渠道开关通知,并设置摘要和免打扰时段。新增只读接口 GET /api/v1/messaging/me/preferences,member_default 增加对 sys_notification_preference 的读、建、改授权(不含删除)。本人行策略对每个持有该授权的人生效,另有一条只给组织所有者和管理员的放行策略。
  • 为什么改:console: a personal Notification Settings page in the Account app over sys_notification_preference (per topic × channel, digest, quiet hours) #34728 要一个个人通知偏好页。裁决 6968686390(路线 A)定了只读新路由加数据门写入,裁决 6969143776 定了行范围加写检查;裁决 6973785798 把策略的适用范围改成所有持授权者,并为所有者和管理员加放行策略(关闭合同评审 F1)。
  • 风险与回滚:风险集中在两条行策略。本人行策略的写检查若失效,成员可以把自己的行改给别人或改成组织默认;放行策略的写检查 topic != null 依赖 topic 必填且有默认值。测试和四次消融钉住了每一项。回滚就是 revert 本 PR,所有者和管理员的 Setup 网格行为不变。
  • 先看:① packages/plugins/plugin-security/src/objects/default-permission-sets.ts(sys_notification_preference_self 与 sys_notification_preference_org_admin 两条策略和授权行);② packages/services/service-messaging/src/preference-resolver.ts(effectiveFor,与 emit 同一套解析);③ packages/services/service-messaging/src/my-preferences-routes.ts(门的拒收顺序)。
  • 两分钟验证:pnpm --filter @objectstack/plugin-security exec vitest run --maxWorkers=2 src/default-permission-sets.notification-preference.integration.test.ts,预期 37/37 通过。
  • 需要你做的:无,席位落地(冻结期内保持 draft,不置 ready)。

What changes

  • Permission (rulings 6969143776 and 6973785798). member_default grants sys_notification_preference read/create/edit, with no delete. Two row policies come with it:

    • sys_notification_preference_self: operation: 'all', using and check both user_id == current_user.id, no positions. It binds every principal that resolves the grant.
    • sys_notification_preference_org_admin: operation: 'all', using: 'id != null', check: 'topic != null', positions: [BUILTIN_IDENTITY_ORG_OWNER, BUILTIN_IDENTITY_ORG_ADMIN] (the sys_invitation_org_admin precedent). delegated_admin is not in it. The check holds on a row being created because topic is required with a default; the policy comment names that coupling (if topic ever becomes optional, an administrator's create is refused, never widened).

    external_default is unchanged. Owner and administrator Setup-grid access is unchanged.

  • Resolver. PreferenceResolver.effectiveFor(userId, organizationId, topics, channels) builds the effective matrix from the same index and lookup filter() uses. It reads under the documented EFFECTIVE_PREFERENCES_SYSTEM_CONTEXT and never fails open. MessagingService.effectivePreferencesFor delegates to it.

    • (fix round 3, L1 M1 / review F2) It reads only what the answer needs: the caller's rows and the organization's default rows. Each is read by equality on user_id under the organization_id term: the caller's id, null and '', the stored spellings isGlobalDefaultUser accepts. This is the equality shape loadRows uses.
    • No other person's row is read.
    • A read that answers more than EFFECTIVE_PREFERENCES_READ_CAP (10000) rows rejects, so the door answers 500, never a partial matrix.
    • The Effective* return types are exported from the package index (review F5). The route docblock states the no-organization case (review F3).
  • Route. GET /api/v1/messaging/me/preferences (my-preferences-routes.ts) is mounted by MessagingServicePlugin. It keeps the preference-options posture: caller resolution, then held sign-in 403, then anonymous 401, then an empty closed query set (400 VALIDATION_ERROR), then 500 INTERNAL_ERROR on any unreadable source. It is added to the messaging route ledger and to the check-route-envelope MODULES declaration (zero counts, shared sendOk/sendError).

  • Account app. The nav entry nav_account_notification_settings (componentRef: 'account:notification_settings', requiresService: 'messaging') is added in all 11 app translation packs.

  • Console page. NotificationSettingsPage in @object-ui/app-shell:

    The notificationSettings namespace is added to every @object-ui/i18n pack, with zh-Hant generated by gen:zh-hant.

  • Only values that take effect are offered (fix round, option B). The rule, measured in preference-resolver.ts:

    • parseDigest reads a stored digest only as 'daily' or 'weekly'. A stored 'none' (the field's defaultValue), an empty value or anything else is "no opinion". resolveDigest then falls through, (user, topic, *) → (user, *, *) → the organization's rows → no digest.
    • parseQuietHours reads quiet_hours only as a window with both start and end. An empty value falls through the same way in resolveQuietHours.
    • So saving 'none' or an empty window never turns off a digest or quiet hours that is in force. It only lets the next row decide, and the door does not say what that row holds.

    On the page:

    • Digest: while a digest is in force (source own or default), only Daily and Weekly are offered, and a hint says why "No digest" is not. "No digest" is listed only while it is already the effective value (source builtin).
    • Quiet hours: Save is enabled only for a complete window. Clearing a window that is in force shows a hint, and nothing is written.
    • Writes: generalWrite now takes only overriding values in its type: digest is 'daily' | 'weekly', and quiet_hours is a window, never null.
    • The "own (*, *) row shadows more specific defaults" warning is unchanged.
  • CI reds at the first head (3d8f3a0), fixed:

    • Lint UI: the quiet-hours face is resolved once at module scope (react-hooks: cannot create components during render).
    • Test UI: the affordanceGrantMap-12082 write census enters sendPreferenceWrite create/update as outOfFamily (the caller's own row, refused otherwise by the server's row scope and write check).
    • Test Core: connect-agent-both-halves-wire.pin.test.ts counts the account app's served nav at 15 with the new entry.
  • Changeset. .changeset/34728-notification-settings.md (patch × 5). Fix round 4 corrects its grant sentence to what ships: the grant is in the set every signed-in member resolves, the own-row policy binds every holder, and owners and administrators get the widener.

Tests

Head 93f5f8b530 (earlier heads 08d51040cf, 6801953715, 3d8f3a0831).

  • plugin-security default-permission-sets.notification-preference.integration.test.ts runs 37 tests on a real kernel with SqlDriver and SecurityPlugin, with five personas the real caller resolver seats: two members, a delegated administrator, an administrator and an owner. Refusals are pinned as mapDataError code+status.

    • (fix round 4) The fixture is armed: each persona holds the position the suite is about; the delegated administrator holds none of org_member, org_admin, org_owner.
    • Member and delegated administrator (fix round 4 adds the second persona, the same pins):
      • may create, list and edit their own rows;
      • delete is refused 403;
      • a create whose user_id is omitted, null, '' or bob's is refused 403 PERMISSION_DENIED, and nothing is stored;
      • moving their own row to bob or to empty is refused 403, and the owner is kept;
      • moving an admin-written row of theirs is refused 403;
      • (fix round 4) a create with topic and channel omitted is refused 403, and nothing is stored;
      • the default row and bob's row answer 404 RECORD_NOT_FOUND and are not listed.
    • Administrator and owner (fix round 4 adds the owner): each lists every row, creates the default and bob's row, creates a default with topic omitted (stored topic *), edits the default and bob's row, and deletes a row.
    • Emit effect: alice's mute drops only her email channel. A mandatory topic is still delivered.
  • (fix round 3) my-preferences-routes.integration.test.ts adds:

    • an organization holding more than the cap of another person's rows on each side of the caller's row and the default row: the caller's cell still answers own with its ownRowId, and the default cell answers default;
    • the caller's own rows past the cap: 500 INTERNAL_ERROR and no data;
    • the leak test pins the three reads, each organization_id + user_id (caller, null, '').

    14 tests in the file.

  • service-messaging my-preferences-routes.integration.test.ts checks:

    • the matrix and its sources;
    • the general own row;
    • cell-by-cell equality with filter();
    • no leak of another person or organization;
    • the 401/403/400/500 refusals.

    The route-ledger conformance test is updated. rbac-objects.test.ts lists the new policy names (fix round 4 adds sys_notification_preference_org_admin).

  • app-shell: myPreferences.test.ts and NotificationSettingsPage.test.tsx (22 tests) cover:

    • strict parse;
    • which write each change becomes;
    • a mandatory topic writing nothing;
    • the page drawing what the door answers;
    • a create or an update followed by a re-read;
    • a refused write being shown;
    • a failed read drawing no matrix;
    • locale key and placeholder parity;
    • registry resolution;
    • (fix round) with an organization default digest 'daily', the select offers only daily/weekly, shows the source default and the no-off hint;
    • with no digest in force, "No digest" is the current value and no hint is shown;
    • with organization quiet hours in force, clearing the window keeps Save disabled and writes nothing, while a complete window saves the own (*, *) row;
    • digestChoices / quietHoursSaveable unit cases.

    28 tests in total.

Acceptance notes

  • Out of claim surface, declared here:
    • ui/packages/i18n/src/locales/*.ts: the page's strings follow the mobileApp precedent.
    • packages/plugins/plugin-security/package.json devDependency, its vitest.config.ts source alias, and pnpm-lock.yaml: the integration test uses the real NotificationPreference object and PreferenceResolver.
    • scripts/check-route-envelope.mjs: the MODULES declaration that check:route-envelope requires for a new route module.
    • ui/packages/plugin-form/src/affordanceGrantMap-12082.test.tsx and packages/cli/test/connect-agent-both-halves-wire.pin.test.ts: census and count pins that the new write sites and the new nav entry move.
  • overlap-check against fix(settings)!: offer the knowledge settings only where the knowledge service is mounted #34223: it reports a conflict in connect-agent-both-halves-wire.pin.test.ts. The four conflict regions are fix(settings)!: offer the knowledge settings only where the knowledge service is mounted #34223's own regions against main, the same four whether merged with main or with this branch. The one hunk this PR adds (line 224 to 231) is in none of them.
  • Members of external_default can read the route but have no grant to write rows. This is unchanged by design and was not ruled.
  • A person's own (*, *) row comes before the organization's rows in the lookup. Once it is written (digest or quiet hours), it decides every cell not set by a more specific row of theirs. The page says so beside the control.
  • Resolver behaviour, filed messaging: a member's own 'none' digest or empty quiet hours falls back to the organisation default #35123: a stored digest of 'none' or an empty quiet_hours on a person's own row falls through to the organization default. It is not an override. Dedupe words: digest none override default, preference resolver fall-through, quiet hours empty user row. This PR does not change the resolver (not ruled). The page offers only values that take effect (above).
  • Emit's loadRows cap, filed messaging: PreferenceResolver.loadRows reads an org's preferences with an unordered 10,000-row cap, so a large org can miss a recipient's own row #35136: emit's loadRows reads with a per-topic cap of the same size (L1 N1). It is older than this PR and not in its surface.
  • Contract review F1, closed by ruling 6973785798: the own-row policy's reach was narrower than the object grant's. The policy now carries no positions domain, so it binds every principal that holds the grant, and owners and administrators are widened back by their own domained policy. The delegated-administrator persona in the suite pins the closure, and the ablations below show each part is load-bearing.
  • Contract review: FAIL on F1, recorded at 6971590801. F1 is closed in fix round 4 by ruling 6973785798. F2, F3 and F5 were taken in fix round 3. F4 (disabling controls for a caller with no write grant) is a follow-up, not this round.
  • Merge from main: fix round 4 merged origin/main at a6cf988eb3 without conflicts. Main carries an unrelated fix(objectql)! commit; this PR's title has no ! and its Clause-② line has no (narrowing) arm, so the full dogfood battery is not owed here.

Verification

Ablations (one-time, `scripts/ablation-replace.mjs` wrap mode, restore proven blob == HEAD and `git diff HEAD` empty)
  • Fix round 4, at head 93f5f8b530 (each restore proved blob == HEAD 841439950bb2 and git diff HEAD empty; 37 tests in the file; the subject resolves from src/, so no build sits between mutation and run):
    • Widener deleted: mutation landed (anchor 1 → 0, blob 84143995 → 2349d435). Result: 10 failed | 27 passed, the five administrator and five owner tests (list, both creates, edits, delete).
    • Widener positions removed: the first attempt was refused by the tool before running (the replacement was contained in the anchor, count 1 → 1). No test ran. The retry also changed the check's quoting so the replacement no longer contained the anchor. Mutation landed (anchor 1 → 0, blob 84143995 → e6b8388b). Result: 20 failed | 17 passed, every member and delegated-administrator refusal and list pin.
    • Self policy re-domained to ['org_member']: mutation landed (anchor 1 → 0, blob 84143995 → 6c9821e3). Result: 10 failed | 27 passed, exactly the ten delegated-administrator pins (list and every refusal); the member's stay green.
    • Widener check written id != null: mutation landed (anchor 1 → 0, blob 84143995 → d62fcc01). Result: 4 failed | 33 passed, the administrator's and owner's two create tests.

Earlier rounds (restore proven blob == HEAD f2444a76d904):

  • Write check removed:

    • The first attempt was refused by the tool before running: a replacement of an existing string, count 4 → 4. No test ran.
    • The retry deleted the line. Mutation landed (anchor 1 → 0, blob f2444a76 → 442a55e5). Result: 2 failed | 14 passed:
      • "refuses moving a row they created to another member";
      • "refuses moving a row they created to the empty user".
    • The admin-written-row move stays refused without check, because the owner floor keys on created_by.
  • positions removed: mutation landed (anchor 1 → 0, blob f2444a76 → 7e8bfaee). Result: 2 failed | 14 passed:

    • "lists every row of the organization";
    • "creates and edits the organization's default, and edits another person's row".
  • Fix round, digestChoices made to always offer none: mutation landed (anchor 1 → 0, blob d4b1649e → 779176e8). Result: 2 failed | 26 passed (the unit case and the organization-digest page test).

  • Fix round, quietHoursSaveable made to accept any defined draft: mutation landed (blob d4b1649e → ddde8830). Result: 2 failed | 26 passed (the unit case and the organization-quiet-hours page test).

    • The first attempt was refused by the tool before running, because the replacement contained the anchor (count 1 → 1). No test ran.
  • Each restore proved blob == HEAD d4b1649e61a9 and git diff HEAD empty.

  • Fix round 3, user_id push-down reverted to the single whole-organization read capped at the page: mutation landed (anchor 1 → 0, blob 5e9da8c8 → 7030b5c6). Result: 3 failed | 11 passed:

    • the leak test's read pin;
    • the past-the-cap own + ownRowId pin;
    • the past-the-cap 500 pin.

    The first run, with the caller's row seeded after the bulk only, had left the own pin green under this mutation (2 failed). The pin was then re-seeded to bracket the row on both sides and re-run (3 failed). The restore proved blob == HEAD 5e9da8c84b11 and git diff HEAD empty.

Local runs (under the verify lock)
  • (fix round 4, head 93f5f8b530) plugin-security whole package: 278 files, 6973 passed, 45 skipped; plugin-security typecheck (tsc, scripts tsconfig, check:test-typecheck): exit 0. Notification-preference integration + rbac-objects + default-permission-sets: 3 files, 82 passed. ui scripts/: 171 files, 5092 passed, after building @objectstack/client (the first run went red only because the fresh worktree had no @objectstack/client dist; no ui file changed this round).

  • service-messaging / plugin-security / platform-objects typecheck: exit 0.

  • service-messaging test: 74 files, 1013 tests passed.

  • plugin-security integration + rbac-objects: 29/29 passed.

  • platform-objects test: 123 files, 2045 tests passed.

  • app-shell type-check (both projects): exit 0.

  • ui packages/i18n/ + notification-settings: 105 files, 1969 passed, 13 skipped (fix round: 1975 passed, 13 skipped).

  • (fix round) app-shell type-check: exit 0. eslint --no-inline-config src/console/notification-settings/: exit 0.

  • (fix round) the cli unit pin connect-agent-both-halves-wire: 2/2 passed. affordanceGrantMap-12082 + notification-settings: 3 files, 83 passed.

  • ui scripts/: 171 files, 5092 passed (both rounds).

  • check-i18n-bundles --filter=platform-objects: in sync.

  • check:app-nav-i18n: OK.

  • (fix round 3) service-messaging typecheck: exit 0. service-messaging test: 74 files, 1015 tests passed. plugin-security notification-preference integration: 16/16. ui scripts/: 171 files, 5092 passed.

Derived gates (dispatch-gates --commands, re-derived after each change)
  • Fix round 4, head 93f5f8b530: 115 derived, 115 run, 0 NOT-MEASURED, 0 UNRUN, every one exit 0 (dispatch-gates --ran reconciles). check:i18n and check:dual-build-cjs-loads first exited 3 (prerequisite: no dist in the fresh worktree) and were exit 0 after building the package tree. overlap-check: origin/main merges cleanly; fix(settings)!: offer the knowledge settings only where the knowledge service is mounted #34223 reads as before (its own conflict regions in the CLI pin file).

  • Final head 08d51040cf: 115 derived, 115 run, 0 NOT-MEASURED, 0 UNRUN, every one exit 0. check:dual-build-cjs-loads was measured after building the package tree. Roster gates rerun by hand, all exit 0: route-ledger-census, error-code-casing, filter-alias-parity, tenant-chokepoint, i18n-stale-fill, published-readme-exports.

  • CI at 08d51040cf, read to conclusion: 69 check-runs, 60 success and 9 skipped by their own if:. None failed.

  • Head 6801953715: 115 derived, 115 run, 0 NOT-MEASURED, 0 UNRUN, every one exit 0. dispatch-gates --ran reconciles with recorded exit codes. check:dual-build-cjs-loads measured this time, with dist built. Roster gates rerun by hand: all exit 0.

  • CI at 6801953715: 69 check-runs, 60 success and 9 skipped by their own if:. The skipped runs are the dogfood and Temporal jobs (not run on PRs), UI Published Artifacts, the two opt-in jobs, and the queue and schedule verdicts. None failed.

  • First round, head 3d8f3a0831:

    • 114 derived, 113 run, 1 NOT-MEASURED. dispatch-gates --ran reconciles 114/114 with exit codes. All exit 0, except:
      • check:dual-build-cjs-loads: exit 3, PREREQUISITE NOT MET. It needs whole-tree dist. NOT MEASURED locally; CI runs it.
      • check-plugin-teardown-shape --self-test: first exit 3 (shallow clone). It was green after fetching the pinned fixture commit.
    • check:route-envelope went red on the undeclared module, and was green after the declaration.
    • Roster gates under packages/ were run by hand: route-ledger-census, error-code-casing, filter-alias-parity, tenant-chokepoint, i18n-stale-fill, nul-bytes. All exit 0.

Generated by Claude Code

… preferences

The own-row policy declares the write check and binds ordinary members
only (rulings 6968686390 and 6969143776); an integration suite pins the
member and administrator readings and the effect on the next emit.

Claude-Session: https://claude.ai/code/session_01JQwxbXh6yuW2pNn3XoA8sB
Co-authored-by: Claude <noreply@anthropic.com>
…ler's effective preferences

The resolver emit filters with computes, per topic and channel, whether it is
on and where that comes from, plus the general digest and quiet hours; the
Account app gains the Notification Settings entry.

Claude-Session: https://claude.ai/code/session_01JQwxbXh6yuW2pNn3XoA8sB
Co-authored-by: Claude <noreply@anthropic.com>
…erences door

The account app's `account:notification_settings` component: the
signed-in person's topic x channel matrix, digest and quiet hours, read
from GET /api/v1/messaging/me/preferences through the host's
authenticated fetch, written as their own sys_notification_preference
rows through the data door, then read again. Locale keys in every
built-in pack, and the changeset.

Claude-Session: https://claude.ai/code/session_01JQwxbXh6yuW2pNn3XoA8sB
Co-authored-by: Claude <noreply@anthropic.com>
zh-Hant is generated from zh-Hans (gen:zh-hant), never hand-written.

Claude-Session: https://claude.ai/code/session_01JQwxbXh6yuW2pNn3XoA8sB
Co-authored-by: Claude <noreply@anthropic.com>
GET /api/v1/messaging/me/preferences writes every body through the
shared sendOk / sendError / sendServerFault, so it is declared with zero
counts beside the preference options door.

Claude-Session: https://claude.ai/code/session_01JQwxbXh6yuW2pNn3XoA8sB
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/xl dependencies Pull requests that update a dependency file 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 Nov 18, 2026
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/platform-objects, @objectstack/plugin-security, @objectstack/service-messaging, touching 37 documentable anchor(s). ⚠️ 2 changed file(s) yielded no anchor (packages/plugins/plugin-security/vitest.config.ts, packages/services/service-messaging/src/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

38 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json 4b1eb0eab7ac41708a6775d1e6116ac4c038a5a3.

⛔ 11 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 2 changed file(s) yielded no anchor (packages/plugins/plugin-security/vitest.config.ts, packages/services/service-messaging/src/index.ts) — pages documenting those are invisible to this run
  • 15 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 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 — 21 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 4b1eb0eab7ac41708a6775d1e6116ac4c038a5a3 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 4bb0758239d0a682f18bf749719f9c5439014fba — the merge of head 12e6f622b85c234d07c50a28b4218c27a4105206 into base 4b1eb0eab7ac41708a6775d1e6116ac4c038a5a3, 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 4bb0758239d0a682f18bf749719f9c5439014fba && git checkout 4bb0758239d0a682f18bf749719f9c5439014fba
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 4b1eb0eab7ac41708a6775d1e6116ac4c038a5a3 12e6f622b85c234d07c50a28b4218c27a4105206 && git checkout -B drift-repro 4b1eb0eab7ac41708a6775d1e6116ac4c038a5a3 && git merge --no-ff 12e6f622b85c234d07c50a28b4218c27a4105206

node scripts/docs-audit/affected-docs.mjs --json 4b1eb0eab7ac41708a6775d1e6116ac4c038a5a3

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

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 4b1eb0eab7ac41708a6775d1e6116ac4c038a5a3 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

objectstack-fleet Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbXh6yuW2pNn3XoA8sB
os-dev-report

{
  "issue": 34728,
  "status": "done",
  "branch": "claude/issue-34728-notification-settings",
  "pr": "https://github.com/objectstack-ai/objectstack/pull/35122",
  "session": "session_01JQwxbXh6yuW2pNn3XoA8sB",
  "premise_still_valid": true,
  "summary": "Fix round 4 on ruling 6973785798 (option A), claim 6973829714. sys_notification_preference_self now carries no positions: operation all, using and check both user_id == current_user.id, binding every principal that resolves the member_default grant. The new widener sys_notification_preference_org_admin (operation all, using id != null, check topic != null, positions [BUILTIN_IDENTITY_ORG_OWNER, BUILTIN_IDENTITY_ORG_ADMIN], the sys_invitation_org_admin precedent; delegated_admin not in it) keeps owners and administrators on every row. Its comment names the coupling: if topic ever becomes optional, an administrator's create is refused, never widened. The object grant is unchanged (read/create/edit, no delete). The integration suite gains delegated-administrator and owner personas (37 tests). The rbac census lists the new policy, and the changeset grant sentence says what ships. Contract review F1 is closed by ruling 6973785798; the PR body states it at the rule level. origin/main was merged at a6cf988eb3 without conflicts. The PR stays a draft.",
  "tests": "Final head 93f5f8b530. default-permission-sets.notification-preference.integration.test.ts: 37/37. Personas are seated by the real caller resolver: member, delegated_admin, admin, owner. Narrowed (member, delegated_admin): each creates, lists and edits only their own rows; delete is 403; creates with user_id omitted, null, '' or another person's are 403 PERMISSION_DENIED with nothing stored; a default create with topic and channel omitted is 403; moves to another person or to empty are 403 with the owner kept; the admin-written row move is 403; the default and another person's row answer 404 RECORD_NOT_FOUND and are not listed. Widened (admin, owner): each lists every row, creates the default and another person's row, creates a default with topic omitted (stored topic *), edits the default and another person's row, and deletes. Ablations (scripts/ablation-replace.mjs wrap mode; each restore proved blob == HEAD 841439950bb2 and git diff HEAD empty; the subject resolves from src): (1) widener deleted: 10 failed | 27 passed (the admin and owner tests); (2) widener positions removed: 20 failed | 17 passed (every narrowed pin). The first attempt was refused by the tool (the replacement was contained in the anchor) and no test ran; the retry changed the check's quoting. (3) self re-domained to ['org_member']: 10 failed | 27 passed (exactly the delegated_admin pins); (4) widener check id != null: 4 failed | 33 passed (admin and owner creates). plugin-security whole package: 278 files, 6973 passed, 45 skipped; typecheck exit 0 (tsc, scripts, check:test-typecheck). The integration file + rbac-objects + default-permission-sets: 82/82. ui scripts/: 171 files, 5092 passed after building @objectstack/client (the first run's only red was an unresolvable @objectstack/client dist in the fresh worktree).",
  "gates": "dispatch-gates --commands at 93f5f8b530: 115 derived, 115 run, every one exit 0. dispatch-gates --ran: 115 accounted, 0 NOT-MEASURED. check:i18n and check:dual-build-cjs-loads first exited 3 (prerequisite: no dist) and were exit 0 after building the package tree. overlap-check exit 1: origin/main merges cleanly; #34223 reads as in round 3 (its own conflict regions in the CLI pin file). CI at 93f5f8b530, read to conclusion: 73 check-runs, 62 success and 11 skipped by their own if:, 0 failure. Test Core, TypeScript Type Check, Lint & Repo Gates, Test UI and its 16 shards: success.",
  "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
  "mcp_calls": "0",
  "api_writes": "3 — git push (not REST); relay issue_patch on PR #35122 body (fleet-write run 44280837039, read-back identical); relay comment_edit on os-dev-report 6970102872",
  "open_questions": [],
  "security_findings": "withheld",
  "out_of_scope_findings": [
    "class: a · reach: public door GET /api/v1/messaging/me/preferences and the page: a stored 'none' digest or an empty quiet_hours on a user row falls through to the org default · carrier: #35123 (filed by the seat)",
    "class: a · reach: emit (PreferenceResolver.filter / loadRows) reads per topic with limit 10000 and no fault at the cap · carrier: #35136 (filed by the seat, L1 N1)",
    "carrier: none · noted, not filed: a person's own (*,*) row shadows the organization's more specific default rows (by design; the page warns)"
  ],
  "deviations": "(1) The out-of-surface files declared earlier stand; this round added none (default-permission-sets.ts, its integration test and rbac-objects.test.ts are in the claim's plugin-security surface). (2) The merge commit from origin/main was amended, before any push, to carry the trailer pair. (3) The first scripted edit of default-permission-sets.ts used an empty anchor slice and wrote garbage; it was restored with git checkout HEAD (diff HEAD empty) before the bounded edit, and never committed. (4) One locked run began with a wasted `pnpm test --` (passthrough) leg whose output was discarded; the verdict cited is the && joined vitest run + typecheck that followed. (5) The PR body was patched through relay issue_patch with the PR trailer the relay requires."
}

Generated by Claude Code

…s values that take effect

The resolver reads a stored digest only as 'daily' / 'weekly' and quiet
hours only as a window with a start and an end; a stored 'none' or an
empty window is "no opinion" and falls through to the organization's
default. So the page no longer offers "No digest" while a digest is in
force, and never saves an empty quiet-hours window: both would save a
value the platform then ignores. The writes accept only overriding
values, and the page says why the choice is not offered.

Claude-Session: https://claude.ai/code/session_01JQwxbXh6yuW2pNn3XoA8sB
Co-authored-by: Claude <noreply@anthropic.com>
- The quiet-hours face is resolved once at module scope, not during
  render (react-hooks: cannot create components during render).
- The write census enters the page's two own-row writes
  (sendPreferenceWrite create / update) as out of family.
- The account app's served nav count pin grows by the new entry (15).

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbXh6yuW2pNn3XoA8sB

Final green head · 2026-11-18T06:53Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbXh6yuW2pNn3XoA8sB

Contract-review-claim: session_01JQwxbXh6yuW2pNn3XoA8sB · head 6801953 · 2026-11-18T06:54Z

Face: declaration (Clause-②: yes; reviewFace on the 45 committed paths finds no published-schema and no governed hit) ⇒ TIER_DEFAULT. Reviewer: one isolated sub-agent, not the dev, read-only. Scope: the new route GET /api/v1/messaging/me/preferences and the member_default permission face (grant + own-row policy with the write check).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbXKtHccbeakAgquNs9

L1 review (#34728) · 2026-11-18T06:55Z

L1: REWORK (one must-fix, in PreferenceResolver.effectiveFor)
Head-sha: 6801953

This is the first L1 on this PR. I read the full diff against the merge-base 0e46840fca: 45 files, +2446/−36. I also read ruling 6968686390 (route A) as amended by 6969143776 (the policy shape), the claim 6969181499, and the os-dev report 6970102872 (final round).

Against the rulings.

  • Member policy. member_default grants sys_notification_preference read, create and edit, with no allowDelete. The new policy sys_notification_preference_self is operation: 'all', using: user_id == current_user.id, check: user_id == current_user.id, positions: ['org_member']. That is exactly ruling 6969143776's shape, and the comment beside it says why each key is load-bearing.
  • The readings pinned. The integration suite drives the real write gate and the real caller resolver:
    • a member's create with user_id omitted, null, empty or another person's is refused 403 PERMISSION_DENIED, with nothing stored;
    • moving a self-created row, or a row an administrator wrote in their name, to another person or to empty is refused 403, and the owner is kept;
    • the default row and another member's row answer 404;
    • delete is refused;
    • the administrator lists every row, writes the default, and edits another person's row;
    • a member's own mute affects only them on the next emit, and a mandatory topic still goes through.
      The report records the check and positions ablations as red.
  • The read route. GET /api/v1/messaging/me/preferences is new and caller-scoped:
    • it takes no user parameter, and any query parameter is refused 400 VALIDATION_ERROR;
    • the order is caller, held sign-in 403, then anonymous 401, the preference-options posture;
    • it is computed by PreferenceResolver.effectiveFor with the same resolveRow, resolveDigest, resolveQuietHours and isMandatory that filter uses, and a pin asserts every cell equals what filter decides;
    • preference-options is not extended, and there is no reset or delete door.
      This matches ruling 6968686390's route A.
  • What leaves the door. Rows of other users are dropped in indexRows before anything is computed, and only the caller's own row ids are answered (ownRowId). The pin "nothing of another person or another organization leaves the door" holds that. A missing organization reads no row.

Shape and scope.

  • Fixes #34728 is on the first card line, with no closing keyword next to another open card. Clause-②: yes (a new public route) and Metadata-protocol: none match the diff.
  • The out-of-surface paths are declared in the Acceptance notes with reasons, and I accept each:
    • the i18n locales (the mobileApp precedent);
    • the plugin-security devDependency on service-messaging, its vitest source alias and the lockfile, with no cycle (service-messaging does not depend on plugin-security);
    • scripts/check-route-envelope.mjs (the gate requires a new route module to be declared);
    • the two census and count pins.
  • The overlap-check conflict with fix(settings)!: offer the knowledge settings only where the knowledge service is mounted #34223 is in that PR's own regions of connect-agent-both-halves-wire.pin.test.ts, not in this PR's added hunk, and I accept the reading.
  • The route ledger row is server-only, and the conformance test mounts the new registrar. Not governed (0 of 45 paths), 2,482 changed lines, under the threshold.
  • Owed beyond L1: the contract review for Clause-②: yes plus the permission face (the body's own line).

Changeset. .changeset/34728-notification-settings.md is new and edits no changeset on main. It bumps service-messaging, plugin-security, platform-objects, app-shell and i18n as patch. I checked its sentences against the diff:

  • The page lives under Inbox and appears only when the messaging service runs (requiresService: 'messaging').
  • The read's posture (401, held sign-in 403, any parameter 400, an unreadable source 500) matches the route.
  • The policy's row scope, write check and org_member, plus the refusal list, match the policy and its pins.
  • "Administrators are unchanged" matches the policy and its pins.
  • The digest and quiet-hours paragraph matches generalWrite (it creates or edits the caller's own (*, *) row) and the page hint.
  • One sentence is undercut by M1: "a source it cannot read is 500 … never a partial … answer".

CI at this head, read from check-runs (73): 62 success, 11 skipped, none failed, none in progress.

Must-fix

  • M1. effectiveFor reads the whole organization's preference rows with limit: 10000, so a large organization gets a silently partial answer about the caller.
    • The read is data.find('sys_notification_preference', { where: { organization_id }, limit: 10000 }) under the system context, with no order. It then keeps only the caller's rows and the default rows in memory.
    • Failure scenario: an organization holds more than 10,000 preference rows (about 700 people with 15 rows each). Some or all of the caller's own rows fall outside the page. Their cells then answer source: 'default' or 'builtin' with no ownRowId, and the door returns 200. That breaks its own promise ("never a partial … answer") and the changeset's.
    • The page then acts on it. cellWrite and generalWrite take the create branch for a cell that already has a row, which stores a second (user, topic, channel) row. indexRows keeps whichever of the two it sees last, for this door and for emit.
    • Fix: read only what the answer needs, which is the caller's rows and the default rows. For example, use equality queries on user_id (the caller's id, and each global-default spelling isGlobalDefaultUser accepts) under the organization_id term, as loadRows uses equality queries per topic. Also treat a read that fills its limit as a fault (500) rather than an answer.
    • Pin both with one case: an organization whose rows exceed the page, where the caller's row still comes back as own with its id. If the cap stays, the fault arm needs its own pin.
    • I'll read that delta alone.

Should-fix

None.

Notes

  • N1. filter's loadRows for emit has a per-topic cap of the same size: two equality queries, each limit: 10000. That is older than this PR and not in its surface. If you agree it matters at that scale, a card for the emit side would keep the two readings honest together.
  • N2. generalWrite copies the effective general on/off into the caller's new (*, *) row, even when that value came from the organization default. From then on the organization's later change to the general default no longer reaches them. The changeset and the page hint say this ("applies in place of the organization's defaults"), so I accept it as disclosed.
  • N3. messaging: a member's own 'none' digest or empty quiet hours falls back to the organisation default #35123 (the resolver's fall-through on a stored none digest or empty quiet hours) is filed, and the page offers only values that take effect. I agree that the resolver change is not this card's.
  • Landing. Owed: M1 and its delta L1, then the contract review (Clause-②: yes and the permission face).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbXh6yuW2pNn3XoA8sB

The brief handed to the isolated contract reviewer (a sub-agent, not the dev, model at TIER_DEFAULT), posted beside its record for the seat to adopt:

Contract review brief — PR #35122 @ 68019537156d21f61065afcac1df87ef6958dcf5 (card #34728)

You review at TIER_DEFAULT. Render ONE ## Contract review record on this head — its shape is
node scripts/pm/record-recognisers.mjs --template --face declaration — with a PASS or FAIL verdict, and post it as ONE comment
on the PR or its card.

Inputs — these and nothing else:
· card #34728: its body and EVERY comment (rulings and earlier records included)
· PR #35122: its body, its file list, and the net diff against main at 68019537156d21f61065afcac1df87ef6958dcf5
· the check-runs on 68019537156d21f61065afcac1df87ef6958dcf5: their conclusions ARE the gate verdicts
⛔ Not the dispatch order, ⛔ not the dispatching seat's own conclusions — this brief is adversarial by design.

⛔ READ-ONLY. No worktree, no checkout, no build, no test run, no gate re-run, no ablation: the check-runs
on the head already answered every derived gate family, and a local run costs more than it returns.
If ONE probe is unavoidable, the record's Local-runs: line says probe — REASON; otherwise none.
Scratch space is /tmp/claude-0/-home-user/92a8a5be-4d24-581a-ae87-31e940c6ddda/scratchpad/pr-35122/ alone; nothing there you did not write this round is read.

Judge, in the record's own sections:
① Derived judgments — every accept-set and public-surface change the diff implies, each named right or wrong.
② Semver level — the changeset (or skip-changeset) matches what the diff publishes, and the Clause-②: line.
③ Boundary flags — every dev flag and every open_questions entry answered, or escalated.
On every face, SQL push-down: a new id materialisation or in-app join where SQL could push down is a
finding unless a reason is given (AGENTS.md, Prime Directive 5: SQL first).
Sign Implemented-by: with the dev's branch and Reviewed-by: with your session id — the value is the FIRST
thing after each colon.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbXh6yuW2pNn3XoA8sB

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 68019537156d21f61065afcac1df87ef6958dcf5
Local-runs: none

Inputs: card #34728 (body and every comment, rulings 6968686390 and 6969143776 and os-dev-report 6968930571 included), the PR #35122 body, its 46-file list and the net diff against main, and the check-runs on this head. Code outside the diff (writeCheckPolicies and the layered RLS filter, builtin-positions.ts, mapMembershipRole, heldPositionNames, PreferenceResolver.filter, readPreferenceOptions) was read at the head to judge the diff. It was not reviewed. Gate verdicts: 73 check-runs, 62 success, 11 skipped by their own if:, none failed.

① Derived judgments

  • New accept set: GET /api/v1/messaging/me/preferences (my-preferences-routes.ts). Right.
    • It refuses in this order: caller resolution (an authz-store or API-key-lifecycle refusal is relayed with its own status, anything else is 500), then a held sign-in 403, then anonymous 401, then any query parameter 400 VALIDATION_ERROR. The closed query set is empty and there is no user parameter. This matches the posture of preference-options.
    • It answers only the caller's effective matrix. ownRowId is looked up on the caller's own index key alone, the rows of other people are dropped in indexRows, and the organization's default reaches the caller only as source: 'default' plus the effective value. That is the ruled answer (6968686390, "What is ruled", first bullet).
    • The topic list comes from readPreferenceOptions, the same read GET /api/v1/messaging/preference-options already answers to any signed-in member, so the stored-topic names add no new exposure.
    • The read is bounded by organization_id = context.tenantId, the same organization source the options door uses. No row or value outside the caller's own effective preference leaves. See F2 for the cost of how it reads.
  • New public surface: member_default grants sys_notification_preference read, create and edit, with no delete. Right in its bits, wrong in its reach (F1). The grant has no positions domain, so it reaches every principal that holds the everyone anchor. Only its row-scope policy is limited to org_member.
  • New policy sys_notification_preference_self: operation: 'all', using and check both user_id == current_user.id, positions: ['org_member']. Right as ruled, and right in how it composes, for org_member.
    • In writeCheckPolicies case 1, a declared check puts the owner_only_writes floor out of the post-image check. A member therefore cannot move a row they created to another person or to the empty user. The pre-image still takes the OR of the floor and the self using, so a member can edit a row an administrator wrote in their name, and the check keeps it theirs.
    • This is the first shipped policy that declares a check. Ablations on the head blob f2444a76 show each of the two added keys is load-bearing.
    • The ruling's unmeasured note still applies: a member who also holds another set that widens writes on this object is narrowed to their own rows by case 1. No shipped set does this today.
  • PreferenceResolver.effectiveFor and MessagingService.effectivePreferencesFor: new public methods on exported classes, additive. Right.
    • filter() behaves the same after the refactor. indexRows is the old inline loop with id, user, topic and channel added. resolveDigest and resolveQuietHours now return the row, and every call site in filter() reads .digest, .quietHours or .quietHours.tz from it.
    • effectiveFor does not fail open, which matches the door's posture.
    • Its return types are not re-exported from the package index (F5).
  • Account app nav entry nav_account_notification_settings. Right. It has componentRef: 'account:notification_settings' and requiresService: 'messaging', it is in all 11 translation packs, and the CLI nav-count pin moves from 14 to 15.
  • The route ledger row (server-only) and the check-route-envelope MODULES declaration (0/0/0, shared sendOk/sendError/sendServerFault). Right.
  • Console: NotificationSettingsPage, myPreferences.ts, the @object-ui/i18n notificationSettings namespace. Right.
    • The page reads through the host's authenticated apiFetch and writes through useAdapter() as the person. A mandatory topic writes nothing.
    • It offers only digest and quiet-hours values that take effect.
    • The census entry in affordanceGrantMap-12082 marks these writes outOfFamily.
  • The plugin-security devDependency on service-messaging, its vitest alias and the lockfile. Right. They are test-only, and Validate Package Dependencies is green.

② Semver level

  • The changeset is right. .changeset/34728-notification-settings.md is patch on @objectstack/service-messaging, @objectstack/plugin-security, @objectstack/platform-objects, @object-ui/app-shell and @object-ui/i18n. These are the five packages whose published source the diff moves. The CLI pin and the scripts publish nothing.
  • The level is right. Metadata-protocol: none is right: no spec key, value or metadata type changes, and the nav entry is metadata content, not protocol. Under AGENTS.md, Post-Task Checklist step 3, none takes patch, so patch on all five is correct even with the new route and the new public methods.
  • Clause-②: yes. The line is present at the start of a line in both the PR body and the changeset body. It is correctly declared, because a new public route and a widened member_default grant are a widening. No (narrowing) arm is owed.
  • Should-fix, part of F1. The changeset's sentence "member_default now grants ordinary members (positions: ['org_member']) read, create and edit" misdescribes what ships. Only the policy is domained; the grant reaches every holder of everyone. The sentence ships as the CHANGELOG, so it must be corrected with F1.

③ Boundary flags

  • F1 · must-fix. The grant is wider than the policy that scopes it. This needs escalating for a supplementary ruling.
    • Who gets unscoped access. The object grant sits in member_default, which every principal with the everyone anchor resolves. The own-row policy binds org_member only. So does the platform ownership floor (owner_only_writes). A principal that holds everyone with neither org_member nor an admin bypass therefore gets the object with no Layer 1 narrowing at all. Two populations do:
      • membership role delegated_admin. mapMembershipRole passes it through as its own position, and membership-role.ts says it "carries NO ObjectStack authority by construction";
      • any other custom membership role that mapMembershipRole passes through. The sys_comment_moderation comment in the same file records that this population exists.
    • Why nothing narrows them.
    • What they can do. Such a principal can list every member's preference rows, edit any of them, and create or edit the organization's default (an empty user_id). That mutes a topic for everyone, the failure ruling 6969143776 was ruled to close and that the card's acceptance names ("看不到也改不了别人的设置和管理员的全局默认"). Before this PR they had no grant on the object.
    • Evidence. This is read from the code at the head, not measured. The integration suite's personas are alice and bob (member) and carol (admin), so no case covers it.
    • Why it is the ruling's. positions: ['org_member'] is the ruled text, and the analysis behind it (comment 6969012199, os-dev-report 6968930571) assumed that everyone outside org_member who resolves member_default is an organization administrator. The fix shape is therefore the maintainer's to rule. Two candidates:
      • keep the self policy undomained, and give org_owner/org_admin a domained widener that declares both using and check id != null, as sys_invitation_org_admin does. Under case 1 the declared checks OR, so administrators keep the Setup grid;
      • a domain that names every population that is not an administrator.
    • What the fix must also carry. The correction must add a delegated_admin persona to default-permission-sets.notification-preference.integration.test.ts, and correct the changeset sentence in ②.
  • F2 · should-fix. SQL push-down (AGENTS.md Prime Directive 5).
    • What it materialises. PreferenceResolver.effectiveFor reads every sys_notification_preference row of the organization (every person, every topic) under the system context with limit: 10000. indexRows then drops every row except the caller's and the default's, in memory. That is a new in-app materialisation, and the diff gives no reason for it.
    • Why it can push down. filter() states its own reason: two equality queries on topic, to avoid relying on IN. The same equality shape pushes user_id down here, as the caller's id plus the empty reference.
    • What goes wrong without it. Each page load costs a read of the whole organization's rows. Past 10000 rows the unordered read is silently truncated: the caller's own or default rows can drop out, and the door answers wrong builtin sources. That contradicts the door's own docblock ("never a partial ... answer").
    • Fix. Push user_id into the where, or state the reason and refuse loudly at the cap.
  • F3 · nit. With no organization, effectiveFor reads no row, while filter() with no organizationId reads without the organization term. The door's "what emit would do" therefore does not hold for an emit with no organization. The behaviour is deliberate and documented (ADR-0131 D1). A sentence on the route's docblock would close it.
  • F4 · nit, the dev's flag on external_default. The flag is answered: an org_external caller reads only their own effective cells, and nothing leaks. But the nav entry shows them switches that all answer 403 on write. Disabling the controls when the caller has no write grant can be a follow-up; it is not a contract matter.
  • F5 · nit. EffectivePreferences, EffectiveTopic, EffectiveCell and EffectiveSource are the return types of public methods on exported classes, but they are not re-exported from @objectstack/service-messaging's index, so a consumer cannot name them.
  • The dev's flags and open questions:
    • The single open_questions entry, in os-dev-report 6968930571 (how to close the move-your-row and admin-regression faults), was answered by ruling 6969143776, letter A. It is implemented as ruled, with the F1 gap in the ruled domain.
    • The premise gate of ruling 6968686390 was measured and reported as a fork, as that ruling required.
    • The PR body flag "a person's own (*, *) row shadows the organization's rows" is answered. It is the existing resolver rule, which was not ruled to change, and the page warns beside the control.
    • The flag "stored none or empty quiet_hours falls through" is answered. messaging: a member's own 'none' digest or empty quiet hours falls back to the organisation default #35123 is filed, the resolver is unchanged, and the page offers only values that take effect.
    • The overlap with fix(settings)!: offer the knowledge settings only where the knowledge service is mounted #34223 is answered. It is outside this PR's hunk and is not a contract matter.
    • The release freeze is honoured: the PR stays draft.

Implemented-by: claude/issue-34728-notification-settings
Reviewed-by: session_01JQwxbXh6yuW2pNn3XoA8sB

VERDICT: FAIL

…rows

The caller-scoped preferences door read every preference row of the
organization in one capped, unordered read, so past the cap the caller's
own rows could drop out and the door answered a partial matrix with 200.
It now reads by equality on user_id under the organization term: the
caller's id and each stored spelling of the empty default reference (the
equality shape loadRows uses). A read past EFFECTIVE_PREFERENCES_READ_CAP
rejects, so the door answers 500, never a page.

Also: the Effective* return types are exported from the package index,
the route docblock states the no-organization case, and the changeset
says which part is domained to org_member (the policy, not the grant).

Claude-Session: https://claude.ai/code/session_01JQwxbXh6yuW2pNn3XoA8sB
Co-authored-by: Claude <noreply@anthropic.com>
…tification-settings

Claude-Session: https://claude.ai/code/session_01JQwxbXh6yuW2pNn3XoA8sB
Co-authored-by: Claude <noreply@anthropic.com>
… holder

Ruling 6973785798 (option A): sys_notification_preference_self drops its
positions, so it binds every principal that resolves the member_default
grant, a delegated administrator included. A new widener,
sys_notification_preference_org_admin (operation all, using id != null,
check topic != null, positions the organization owner and administrator
identities), keeps owners and administrators on every row. Its check
holds on a row being created because topic is required with a default;
the policy comment names that coupling.

The integration suite gains delegated-administrator and owner personas:
the narrowed personas list and write only their own rows, the widened
ones list every row, create the default and another person's row, edit
and delete. The rbac census records the new policy, and the changeset's
grant sentence says what ships.

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbXh6yuW2pNn3XoA8sB

Final green head · 2026-11-18T10:24Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbXh6yuW2pNn3XoA8sB

Contract-review-claim: session_01JQwxbXh6yuW2pNn3XoA8sB · head 93f5f8b · 2026-11-18T10:25Z

Delta of FAIL 6971590801 (TIER_DEFAULT, declaration face), by the same isolated reviewer sub-agent, read-only.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbXKtHccbeakAgquNs9

L1 review, delta for REWORK 6971481347 (#34728) · 2026-11-18T10:28Z

L1: ACCEPT
Head-sha: 93f5f8b

Delta read: 6801953 → 93f5f8b, covering the PR's own commits c67293d, 08d5104 and 93f5f8b, plus the merge of origin/main ad357b3. Read against each head's merge base, the merge brought only main. The PR's file list gains one path, service-messaging/src/index.ts, which is inside the claim's service-messaging/src/**.

M1 is closed. effectiveFor no longer reads the whole organization.

  • It runs three equality reads under the organization_id term: user_id equal to the caller, then null, then ''. These are the two stored spellings of the empty default that isGlobalDefaultUser accepts.
  • Each read asks for EFFECTIVE_PREFERENCES_READ_CAP + 1 rows. A read that answers more than the cap rejects, so the door answers 500, never a page.
  • No other person's row is read.

Three pins cover it:

  • The door pins the three where shapes exactly.
  • On the real SqlDriver, Bob holds more than a cap of rows on each side of Alice's row and the default row. Alice's cell still answers own with its row id, the default cell answers default, and none of Bob's topics leaves the door.
  • When the caller's own rows exceed the cap, the door answers 500 INTERNAL_ERROR with no data.

The changeset sentence ("never a partial … answer") is true now. A new paragraph says what is read and that a read past the cap is a fault, and that matches the code.

Ruling 6973785798 is built as ruled. I state this at the level of the policy shape.

  • sys_notification_preference_self carries no positions, so it binds every principal that resolves the grant. Its using and check are unchanged.
  • A new widener, sys_notification_preference_org_admin, applies to the organization owner and administrator identities only. It is operation: 'all', using: id != null, check: topic != null, which is the sys_invitation_org_admin shape.
  • The comment beside it states why the check is topic (a required field with a default) and what happens if that ever changes: the create is refused, never widened.
  • The member_default grant is unchanged: read, create and edit, no delete.
  • The changeset's write paragraph now names both policies and who each binds, and it matches the code.
  • The integration suite has 37 cases with delegated-administrator and owner personas added. Report 6970102872 records three ablations, each restored with blob == HEAD:
    • widener deleted: the 10 admin and owner cases go red;
    • widener positions removed: the 20 narrowed cases go red;
    • self re-domained to ['org_member']: red.
  • The rbac census records the new policy.

The contract review's nits F3 and F5 are in c67293d: the Effective* return types are exported from the package index, the route docblock states the no-organization case, and the changeset says the policy, not the grant, is domained.

Shape. Fixes #34728, Clause-②: yes and Metadata-protocol: none are unchanged and still right. The paths are inside round-3 claim 6973829714, with the earlier declared exceptions. The overlap reading against #34223 is the same one I accepted before.

CI at this head, from check-runs: 62 success, 11 skipped, none failed or in progress.

Must-fix

None.

Should-fix

None.

Notes

  • N1 from 6971481347 stands. loadRows for emit keeps its per-topic limit: 10000, which is older than this PR. That belongs on a separate card if the area wants it.
  • Owed after L1, not mine. The contract review's delta at this head (running in parallel).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbXh6yuW2pNn3XoA8sB

The brief handed to the isolated contract reviewer (the same sub-agent as FAIL 6971590801, not the dev, model at TIER_DEFAULT), posted beside its delta record for the seat to adopt:

Contract review brief — PR #35122 @ 93f5f8b5304f087c888d64e8bfef6cdb469a0b79 (card #34728)

You review at TIER_DEFAULT. Render ONE ## Contract review record on this head — its shape is
node scripts/pm/record-recognisers.mjs --template --face declaration — with a PASS or FAIL verdict, and post it as ONE comment
on the PR or its card.

Inputs — these and nothing else:
· card #34728: its body and EVERY comment (rulings and earlier records included)
· PR #35122: its body, its file list, and the net diff against main at 93f5f8b5304f087c888d64e8bfef6cdb469a0b79
· the check-runs on 93f5f8b5304f087c888d64e8bfef6cdb469a0b79: their conclusions ARE the gate verdicts
⛔ Not the dispatch order, ⛔ not the dispatching seat's own conclusions — this brief is adversarial by design.

⛔ READ-ONLY. No worktree, no checkout, no build, no test run, no gate re-run, no ablation: the check-runs
on the head already answered every derived gate family, and a local run costs more than it returns.
If ONE probe is unavoidable, the record's Local-runs: line says probe — REASON; otherwise none.
Scratch space is /tmp/claude-0/-home-user/92a8a5be-4d24-581a-ae87-31e940c6ddda/scratchpad/pr-35122/ alone; nothing there you did not write this round is read.

Judge, in the record's own sections:
① Derived judgments — every accept-set and public-surface change the diff implies, each named right or wrong.
② Semver level — the changeset (or skip-changeset) matches what the diff publishes, and the Clause-②: line.
③ Boundary flags — every dev flag and every open_questions entry answered, or escalated.
On every face, SQL push-down: a new id materialisation or in-app join where SQL could push down is a
finding unless a reason is given (AGENTS.md, Prime Directive 5: SQL first).
Sign Implemented-by: with the dev's branch and Reviewed-by: with your session id — the value is the FIRST
thing after each colon.

Delta of FAIL 6971590801: answer F1–F5 of that record at this head (each closed or still open, by the code), and judge
everything the head changed since 68019537, ruling 6973785798 (third ruling, r3) included. Keep F1 at the rule level:
describe the policy shape that ships, not how the pre-fix head could be used.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbXh6yuW2pNn3XoA8sB

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 93f5f8b5304f087c888d64e8bfef6cdb469a0b79
Local-runs: none

This is the delta of FAIL 6971590801, which was recorded at 68019537.

Inputs:

Code outside the diff (writeCheckPolicies, the layered RLS filter, collectRLSPolicies, the object's topic field) was read at this head to judge the diff. It was not reviewed.

Gate verdicts: 73 check-runs, 62 success and 11 skipped by their own if:. None failed.

① Derived judgments

Changes since 68019537:

  • sys_notification_preference_self drops positions. Right, as r3 rules. The policy is operation: 'all', with using and check both user_id == current_user.id. It now binds every principal that resolves the member_default grant, which is the sys_invitation_org_admin principle recorded at default-permission-sets.ts:588-594. A positions domain belongs on the widening policy, never on the narrowing one.
  • New widener sys_notification_preference_org_admin. Right, as r3 rules. It is operation: 'all', using: 'id != null', check: 'topic != null', positions: [BUILTIN_IDENTITY_ORG_OWNER, BUILTIN_IDENTITY_ORG_ADMIN].
  • Composition per persona, at the rule level:
    • org_member. The applicable policies are _self and the owner_only_writes floor (on update, domain org_member). The widener is out of domain.
      • Read is the _self using.
      • The update pre-image is _self OR the floor.
      • The post-image is case 1 of writeCheckPolicies: the only declared check is _self's, so a row as written must be the caller's own and the floor drops out.
      • This is unchanged from the first round.
    • delegated_admin. The resolver gives it delegated_admin and everyone.
      • _self is the only applicable policy, because both the floor and the widener are out of domain.
      • Read, the update pre-image and the post-image are therefore all own rows. Delete is refused by the grant's missing delete bit.
    • A custom membership role that mapMembershipRole passes through. It is the same as delegated_admin. _self carries no domain, so no role can fall outside it. Analysis 6973242296 premise 2 also reads the data door as refusing roles outside the five.
    • org_admin and org_owner. The applicable policies are _self and the widener. Neither holds org_member, so the floor does not apply.
      • Read and the update pre-image are the OR of user_id == current_user.id and id != null, which is every row inside the Layer 0 tenant wall.
      • The post-image is case 1: both checks are declared, so they OR, giving user_id == current_user.id OR topic != null.
      • Delete takes the same OR under operation: 'all'. That equals today, where on main no policy applies to them on this object.
    • Platform admin. Unaffected, through the superuser bypass ahead of Layer 1.
  • check: 'topic != null' is sound.
    • The topic field is Field.text({ required: true, defaultValue: '*', maxLength: 200 }). Every stored row, and every insert image after defaulting, carries a non-null topic. On an admin, the check therefore admits every row the widener's using reaches, and never more, because the tenant wall is AND-composed separately on the post-image.
    • The coupling fails closed. If topic ever becomes optional, the result is a refused admin create, never a wider one. The policy comment and the changeset name this.
    • Two pins hold it: the integration case "creates a default with topic omitted: the check judges the defaulted topic", and the ablation in the PR body (round 4). That ablation removed the widener's positions; it ran on a blob proven equal to the head, and 20 tests failed. Analysis 6973242296 premise 6 records the id != null control that refuses every create. A literal always-true spelling is not ruled (r3) and is not owed here.
  • PreferenceResolver.effectiveFor reads by equality. Right. It now makes three reads: user_id equal to the caller, to null and to '', each under the organization_id term with limit: EFFECTIVE_PREFERENCES_READ_CAP + 1. Any read over the cap rejects, so the door answers 500.
    • The new exported const EFFECTIVE_PREFERENCES_READ_CAP is additive.
    • The integration test asserts the three where shapes, the case past the cap with another person's rows, which still answers own and ownRowId, and the case past the cap with the caller's own rows, which answers 500.
  • @objectstack/service-messaging index exports. Right, additive. It now exports EffectivePreferences, EffectiveTopic, EffectiveCell, EffectiveSource and EffectiveSetting.
  • The route docblock now states the no-organization case. Right.
  • Tests. Right.
    • The suite has five personas, all seated by the real resolver. The fixture asserts that dave holds none of org_member, org_admin or org_owner.
    • The narrowed pins are run for both alice and dave. The widened pins, including create of the default and of another person's row, edit and delete, are run for both carol and owen.
    • rbac-objects.test.ts lists the widener.

Unchanged since 68019537 and judged right in FAIL 6971590801, still right at this head:

  • the accept set of GET /api/v1/messaging/me/preferences: no parameter, refusals in the order 401, 403, 400, 500, and only the caller's own effective preferences answered;
  • the object grant: read, create and edit in member_default, no delete;
  • the Account nav entry and its 11 translations;
  • the route ledger row and the route-envelope MODULES declaration;
  • the console page and the i18n namespace;
  • the test-only devDependency.

② Semver level

  • The level is right. .changeset/34728-notification-settings.md stays patch on the five packages the diff moves (service-messaging, plugin-security, platform-objects, @object-ui/app-shell, @object-ui/i18n). Metadata-protocol: none is right, since no spec key, value or type changes, and under AGENTS.md Post-Task Checklist step 3 none takes patch. The new index exports and the cap constant are additive.
  • Clause-②: yes. The line is present at the start of a line in both the PR body and the changeset body. It is correctly declared for the new route and the new grant.
  • The changeset sentence F1 flagged is corrected. It now says the grant sits in member_default with two row policies, _self binding every holder of the grant and the widener for owners and administrators, and it names the topic coupling.

③ Boundary flags

Findings of FAIL 6971590801, at this head:

  • F1 (must-fix): closed. Ruling r3 (6973785798) set the shape, and that is the shape that ships:
    • the narrowing policy carries no domain, so its reach equals the grant's;
    • the only domain is on the widener, and the widener names org_owner and org_admin, not delegated_admin;
    • the changeset sentence is corrected;
    • a delegated_admin persona pins it.
  • F2 (should-fix, SQL first): closed. effectiveFor pushes user_id into the query by equality, which is the equality shape loadRows gives its reason for (no IN). It no longer reads another person's rows. A read past the cap is a loud 500, never a partial matrix. No new id materialisation or in-app join remains in the diff.
  • F3 (nit): closed. The route docblock states that a caller with no organization is answered from no rows, where emit can decide otherwise.
  • F4 (nit): open, deferred. The PR body defers it as a follow-up, so it carries no grade change. An org_external caller still sees switches whose writes answer 403, and nothing leaks.
  • F5 (nit): closed. The Effective* types are exported from the package index.

New at this head:

  • N1 (nit): the undomained _self also narrows app-authored grants. collectRLSPolicies collects the policies of every set the principal holds. So a deployment that granted sys_notification_preference to some role other than owner or administrator through its own permission set is now held to its own rows, on read as well as write, unless the app declares its own widener. On main no policy on this object reaches that role.
    • This is the ruled principle working as intended. Ruling 6969143776's "Not measured" noted the write half, and no shipped set does this.
    • The changeset, which ships as the CHANGELOG, could say it in one line for app authors.
  • N2 (nit): the changeset's audience is slightly off. It describes member_default as "the set every signed-in member of an organization resolves". org_external holders do not resolve it, and org-less signed-in sessions do. Neither case changes behaviour: the tenant wall denies the org-less session, and the external has no grant.

The dev's flags and open questions:

Implemented-by: claude/issue-34728-notification-settings
Reviewed-by: session_01JQwxbXh6yuW2pNn3XoA8sB

VERDICT: PASS

…ification_preference (#34728)

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbXh6yuW2pNn3XoA8sB

Regen-provenance: 6975907450 · 93f5f8b5304f087c888d64e8bfef6cdb469a0b79 → 12e6f622b85c234d07c50a28b4218c27a4105206 · git diff --name-only → .changeset/34728-notification-settings.md

Prose-only hop, made at the seat's request after adoption. It touches the changeset prose face alone, and the record of 6975907450 carries forward over it:

  • N1 from that record: one bullet now names that the undomained sys_notification_preference_self also narrows app-authored grants.
  • N2: the member_default audience is reworded as "the baseline set every signed-in person resolves (external members excepted)".

CI at the new head: 69 check-runs, 60 success, 9 skipped by their own conditions, 0 failure. mergeable clean.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbabAdcWyApSTGBYJNY

Seat prose ACCEPT · 2026-11-18T11:08Z · Head-sha: 12e6f62

  • Hop 93f5f8b5..12e6f622 touches only .changeset/34728-notification-settings.md (+2/−1); read at the head.
  • N2: "member_default, the baseline set every signed-in person resolves (external members excepted)" matches the code. An external member resolves external_default, not member_default (baseline-composition.test.ts).
  • N1: the new "App-authored grants are narrowed too" bullet matches default-permission-sets.ts at this head. sys_notification_preference_self declares no positions, and its using and check are both user_id == current_user.id. Only sys_notification_preference_org_admin carries positions, and those are organization owner and administrator.
  • Check-runs at this head: 60 success, 9 skipped, 0 red; mergeable clean.

ACCEPT. Both sentences close the notes. With L1 6975854678 and record 6975907450, the card thread may land this head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-warren · session_01JQwxbXh6yuW2pNn3XoA8sB

Landing PR #35122 at 12e6f622b85c234d07c50a28b4218c27a4105206 · 2026-11-18T11:09Z

Probe Reading
L1 ACCEPT 6975854678 at 93f5f8b5. Since then the only change is the changeset prose; the seat ACCEPTed it sentence by sentence in 6976793778.
Contract review PASS 6975907450 at 93f5f8b5 (TIER_DEFAULT, declaration face), adopted by the seat. It carries to this head through Regen-provenance 6976764947: git diff --name-only shows .changeset/ only.
CI at this head 69 check-runs: 60 success, 9 skipped by their own conditions, 0 failure. mergeable clean.
check-governed-merges --pr 35122 NOT governed; 2,660 changed lines, under 3,000.
Behind main K = 9 first-parent commits since PRBASE a6cf988eb3. No merge=os-regen path and no label-budget input is touched on either side.

State change: ready for review and auto-merge armed. Fixes #34728 closes the card at MERGED.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 18, 2026 11:10
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit c9b3f7a Nov 18, 2026
70 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-34728-notification-settings branch November 18, 2026 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation size/xl 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.

console: a personal Notification Settings page in the Account app over sys_notification_preference (per topic × channel, digest, quiet hours)

2 participants