Skip to content

fix(setup)!: serve the Audit Log entry to a view_all_audit_log holder who lacks manage_platform_settings - #33349

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/area-A2-33224
Nov 14, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/area-A2-33224

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread

Part of #33224 — this PR lands the navigation half (the Audit Log entry reaches the auditor). The Setup landing half (Packaged Actions answering activation ledger HTTP 403) stays open on the card; the seat ruled route A (below), and it follows in its own PR.

Clause-②: yes (narrowing) — GET /meta/app/setup now serves group_diagnostics with the Audit Log entry (nav_audit_logs) to a member who holds view_all_audit_log without manage_platform_settings; before, the whole group was withheld from them. Every shipped permission set is served what it was before: admin_full_access holds both capabilities and still sees Sessions, Notification Events and Audit Log; organization_admin and the member sets hold neither and still see no Diagnostics group. One custom-set audience narrows: a set granting manage_platform_settings without view_all_audit_log is no longer served the Audit Log entry. A gate is all-of, so the entry cannot be gated on either capability.
Metadata-protocol: none

BREAKING for a custom permission set that grants manage_platform_settings without view_all_audit_log. Its holders were served the Setup › Diagnostics › Audit Log entry and no longer are. The Audit Log page itself is unchanged: it still opens by URL and still shows them the organization-attributed ledger rows it showed before. What to do: grant view_all_audit_log to that set if its holders should keep the menu entry, or open the page by URL. A third-party package that contributes an entry into group_diagnostics without its own requiredPermissions is now shown to every member who can open Setup, where before only manage_platform_settings holders saw it: declare requiredPermissions on the entry (see below).

Maintainer quick read

  • What changes: Setup's Diagnostics group no longer requires manage_platform_settings for the whole group; each entry carries its own gate. Sessions and Notification Events still require manage_platform_settings; Audit Log now requires its own read capability, view_all_audit_log.
  • Why: a group's gate prunes the whole group before any child is judged, so an auditor holding view_all_audit_log without platform-settings power (the auditor of a separation-of-duties setup) never saw the Audit Log entry in Setup and had to type the URL.
  • Risk and rollback: declared narrowing (BREAKING for one custom-set audience). Shipped permission sets see the same menu as before (admins hold both capabilities; organization admins and members hold neither). The only audience that narrows is a custom set holding manage_platform_settings without view_all_audit_log: it no longer sees the Audit Log entry (the page still opens by URL). Rollback is a revert of this PR.
  • Read first: packages/platform-objects/src/apps/setup.app.ts (the removed group gate), packages/plugins/plugin-audit/src/audit-plugin.ts (the entry's requiredPermissions), packages/platform-objects/src/apps/setup-nav.contributions.ts (Sessions and Notification Events take the former group gate).
  • Two-minute check: pnpm --filter @objectstack/cli exec vitest run --project unit test/setup-diagnostics-audience.pin.test.ts; expect 3 green cases: a view_all_audit_log-only holder sees only Audit Log under Diagnostics; a caller without it sees Audit Log nowhere in Setup; an admin still sees all three entries.
  • Needed from you: nothing; the seat lands it.

What changes

  • packages/platform-objects/src/apps/setup.app.ts — group_diagnostics no longer carries requiredPermissions: ['manage_platform_settings']. A group's gate prunes its whole subtree before any child is judged (filterAppForUserWithReason in @objectstack/rest; the console's sidebar guard does the same), so no entry inside it could reach a member without that power, whatever the entry's own gate said. The slot now gates nothing, as group_configuration already does, and a comment says that a contributor into it gates its own entry.
  • packages/platform-objects/src/apps/setup-nav.contributions.ts — Sessions (nav_sessions) and Notification Events (nav_notifications) carry the manage_platform_settings gate the group used to, so they reach exactly the members they reached before.
  • packages/plugins/plugin-audit/src/audit-plugin.ts — the Audit Log entry (nav_audit_logs) is gated on view_all_audit_log (LEDGER_AUDIT_CAPABILITY), the ledger's own read capability. Platform administrators hold it by default (ADMIN_FULL_ACCESS_CAPABILITIES).
  • Changeset: @objectstack/platform-objects and @objectstack/plugin-audit, patch, with the (narrowing) arm, the BREAKING paragraph above and adr-0087: not-required (no-migration-prescription).

Who is served what, by shipped permission set: admin_full_access holds both capabilities, so it still sees all three entries; organization_admin and the member sets hold neither, so they still see no Diagnostics group. A member granted view_all_audit_log alone now sees Diagnostics with Audit Log only. A custom set granting manage_platform_settings without view_all_audit_log no longer sees Audit Log (it still sees Sessions and Notification Events, and the page still opens by URL).

Tests

  • New packages/cli/test/setup-diagnostics-audience.pin.test.ts (unit tier): composes SETUP_APP, SETUP_NAV_CONTRIBUTIONS and AuditPlugin's real contribution through the real SchemaRegistry, and reads GET /api/v1/meta/apps/setup through the real RestServer route per caller:
    • view_all_audit_log alone: Diagnostics is served with exactly nav_audit_logs;
    • manage_platform_settings alone: Diagnostics holds Sessions and Notification Events, and nav_audit_logs is served nowhere in Setup; setup.access alone: no Diagnostics group and no nav_audit_logs (with a control that the app itself is served);
    • the platform administrator (ADMIN_FULL_ACCESS_CAPABILITIES): all three entries.
      It lives in packages/cli/test/ because cli is the one package that depends on the shell, the plugin, the registry and the per-request filter; @objectstack/plugin-audit resolves to source there through the existing alias.
  • packages/plugins/plugin-audit/src/audit-nav-contribution.test.ts: the entry-shape case now also asserts requiredPermissions equals [LEDGER_AUDIT_CAPABILITY], and that the constant is view_all_audit_log.

Acceptance notes

The landing half, not done here. For all three officer roles the Setup landing is Packaged Actions, which shows activation ledger HTTP 403. Measured cause: the console lands on the first entry the member is shown (resolveLandingRoute → firstRouteAcross in ui/packages/app-shell/src/console/AppContent.tsx, over navEntriesShownToMember in ui/packages/app-shell/src/hooks/useNavMemberGates.ts). The first served Setup group for a member without manage_platform_settings is group_apps, whose one entry nav_packaged_actions (type: 'component') carries no gate (packages/platform-objects/src/apps/setup-packaged-actions-nav.test.ts). The console's object-read prune judges type: 'object' entries only, so a component entry whose page reads /data/sys_metadata_activation is landed on even when that read answers 403. The seat ruled route A: give nav_packaged_actions an audience (visible: "current_user.can('sys_metadata_activation', 'read')"), reword the pin's reason, and pin where an officer lands instead. It follows in its own PR on #33224.

Contributors into group_diagnostics. The slot no longer gates what is put in it. Every contributor in this tree is gated now (the three entries above), and no contributor exists in the HotCRM checkout. A third-party package that relied on the slot's gate now shows its entry to every setup.access holder; the BREAKING paragraph says so.

Verification

Code head: 136a7b67; 63d6af9d changes only the changeset text (the (narrowing) arm, BREAKING paragraph and ADR-0087 marker; check-adr-0087-registration reads it as [BREAKING+bang+clause-②-narrowing] not-required (no-migration-prescription)). Build closure: turbo run build --filter=@objectstack/rest... --filter=@objectstack/plugin-audit... --filter=@objectstack/platform-objects... (31 tasks, exit 0). The full dogfood battery owed by the (narrowing) arm runs on the final head and is reported in a comment.

New pin and ablations
  • test/setup-diagnostics-audience.pin.test.ts: 3/3 passed.
  • Ablation 1, the group gate put back (setup.app.ts, group_diagnostics given requiredPermissions: ['manage_platform_settings']; platform-objects resolves to dist/ in this suite, so it was rebuilt and ablation-dist-preflight found the marker in 4 built files): the auditor case went red (1 failed, 2 passed). Restored (blob equal to HEAD, git diff HEAD empty), rebuilt, preflight --absent clean: 3/3 passed. The first try of this ablation was a no-op (its replacement contained its own anchor, which ablation-replace refused and restored); its green run is void and was not counted.
  • Ablation 2, the entry gate removed (audit-plugin.ts, aliased to source in this suite): the "without view_all_audit_log" case went red (1 failed, 2 passed). Restored (blob equal to HEAD, git status --porcelain empty): 3/3 passed.
Package suites

At 136a7b67, each part's exit captured separately:

  • pnpm --filter @objectstack/plugin-audit exec vitest run --maxWorkers=2: exit 0, Test Files 93 passed (93), Tests 1495 passed (1495).
  • pnpm --filter @objectstack/platform-objects exec vitest run --maxWorkers=2: exit 0, Test Files 122 passed (122), Tests 1957 passed (1957).
  • pnpm --filter @objectstack/cli exec vitest run --project unit test/setup-diagnostics-audience.pin.test.ts: 3 passed (3). Same run: console-page-nav-entries.pin.test.ts and vitest-tiers-partition.test.ts passed; setup-integrations-order.pin.test.ts could not load (@objectstack/cloud-connection has no build in this worktree), NOT MEASURED locally.
  • pnpm --filter @objectstack/plugin-audit typecheck: exit 0. pnpm --filter @objectstack/platform-objects typecheck: exit 0.
  • pnpm --filter @objectstack/cli typecheck: NOT MEASURED, reason: the cli build closure is not built here (260 TS2307/TS2882 errors, all unresolved imports of unbuilt workspace packages such as @objectstack/runtime; none in the new file). CI's TypeScript Type Check covers it.
Gates

node scripts/pm/dispatch-gates.mjs --commands at 136a7b67: 72 derived. Reconciled with --ran: 72 derived famil(ies) accounted for — 67 run, 5 NOT-MEASURED.

  • 67 exited 0, among them check:changeset-no-major, check:adr-0087-registration, check:empty-changeset, check:test-source-alias, check:cross-package-test-inputs, check:registry-log-declared, check:tier-file-adoption, check:type-check-coverage, check:nul-bytes, check:doc-authoring, check:issue-citations.
  • NOT MEASURED, PREREQUISITE NOT MET (exit 3): check:i18n and check:dual-build-cjs-loads (both need the whole workspace built); check-plugin-teardown-shape.mjs --self-test (its fixture commit is outside this shallow clone).
  • NOT MEASURED, timed out at 300 s on a shared box: check:query-options-erasure, check:type-check-debt.
    CI runs every one of these.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes.
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec is not touched.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM

…who lacks manage_platform_settings

group_diagnostics no longer carries a group gate; its entries carry their own:
Sessions and Notification Events keep manage_platform_settings, and Audit Log
is gated on view_all_audit_log, the ledger's own read capability.

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

Copy link
Copy Markdown
Contributor Author

domain:server#5 · os-elon-musk · session_016WV4cz2MxDkQYCC4U8indM

Request: review · area A2 · head 136a7b6 · Part of #33224 (navigation half)

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/platform-objects, @objectstack/plugin-audit, touching 9 documentable anchor(s).

21 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 e0ce1b523c9cdb625211fc866593f57aee9223ee.

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

What this run could not see

Coarse fallback — 14 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 e0ce1b523c9cdb625211fc866593f57aee9223ee → packageMentionDocs.

Which tree this was computed on

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

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

⚠️ 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 e0ce1b523c9cdb625211fc866593f57aee9223ee → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract-review-claim: session_016WV4d1PGptBW3QRQNmy5e6 · head 136a7b6 · 2026-11-14T17:16:40Z

review#3.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 136a7b679f4e48ba30b779607bda0b89bf492970
Local-runs: none
Scope: packages/platform-objects/src/apps/setup.app.ts, packages/platform-objects/src/apps/setup-nav.contributions.ts, packages/plugins/plugin-audit/src/audit-plugin.ts + packages/rest/src/meta-item-read-gate.ts (filterAppForUserWithReason, holdsRequiredPermissions), packages/plugins/plugin-audit/src/audit-log-read-visibility.ts, packages/cli/test/setup-diagnostics-audience.pin.test.ts

① Derived judgments

  • Mechanics are right. A group's requiredPermissions prunes its subtree before children are judged, so the old manage_platform_settings gate on group_diagnostics could never let a view_all_audit_log-only auditor see the Audit Log entry. Moving the gate onto each entry fixes that: Sessions and Notification Events keep manage_platform_settings, and Audit Log takes LEDGER_AUDIT_CAPABILITY (view_all_audit_log). The per-caller wire pin shows an empty Diagnostics group is not served, so members holding neither capability still see no group, and the platform administrator still sees all three entries.
  • must-fix M1: the narrowing arm is declared as widening. holdsRequiredPermissions is all-of (required.every(...)), so the entry cannot be gated on "either capability", and the move is not pure widening. A custom set granting manage_platform_settings without view_all_audit_log was served nav_audit_logs by GET /meta/app/setup and is not served it at this head. The changeset says so itself ("One custom-set audience moves the other way"). That audience can still use the page: audit-log-read-visibility.ts serves a non-holder the organization-attributed ledger rows. So a working entry is withdrawn from a served answer. That is the same class as fix(plugin-auth)!: the Register SSO Provider bridge takes every endpoint /sso/register takes, and the domain-verification answer carries the registered domain #33314's arms (a changed outcome on a published read for an existing caller). Declare Clause-②: yes (narrowing) (the single arm; AGENTS.md), add a BREAKING paragraph whose fix is "grant view_all_audit_log to that set, or open the page by URL", and the one ADR-0087 marker (not-required (no-migration-prescription) fits: nothing stored or authorable moves). Text-only; the code can stay.
  • nit N1 (already in the changeset, keep it): the slot no longer gates contributions, so a third-party entry contributed into group_diagnostics without its own requiredPermissions becomes visible to every member. No in-tree contributor is affected (only platform-objects and plugin-audit contribute there). The "If you contribute into group_diagnostics" paragraph is the right place for it. It could also go in the BREAKING paragraph, since it is an exposure change for those contributors.

② Semver level

patch on @objectstack/platform-objects and @objectstack/plugin-audit is right for a non-protocol change, widening or narrowing (AGENTS.md). Only the arm and the banner are wrong.

③ Boundary flags

  • The console sidebar guard applies the same group-prunes-first rule (per the code comment), and it reads the served app, so no UI change is owed.
  • CI at this head when read (17:20Z): 14 success, 16 skipped, 18 in progress, none red. The ACCEPT re-reads every check at the landing head.

④ Design judgment

Gating an entry on the capability that governs its data, rather than on its container's admin power, is the right model for separation of duties. It matches group_configuration. Without an any-of gate, a custom-set narrowing is unavoidable, and the platform's own sets are unaffected. Accepting it is a reasonable trade, provided it is declared. The design holds; only the declaration needs to change.

Implemented-by: claude/area-A2-33224
Reviewed-by: session_016WV4d1PGptBW3QRQNmy5e6

VERDICT: FAIL

M1 is text only (changeset arm, banner, marker, PR body). Same reviewer takes the delta.

…tup audit log entry

Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
Co-Authored-By: Claude <noreply@anthropic.com>
@os-elon-musk os-elon-musk changed the title fix(setup): serve the Audit Log entry to a view_all_audit_log holder who lacks manage_platform_settings fix(setup)!: serve the Audit Log entry to a view_all_audit_log holder who lacks manage_platform_settings Nov 14, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract-review-claim: session_016WV4d1PGptBW3QRQNmy5e6 · head 63d6af9 · 2026-11-14T17:25:50Z

review#3 (delta).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 63d6af9d0ffbe5d092431812de8698c2e43a8094
Local-runs: none
Scope: .changeset/33224-setup-audit-log-entry-audience.md, packages/platform-objects/src/apps/setup.app.ts, packages/platform-objects/src/apps/setup-nav.contributions.ts, packages/plugins/plugin-audit/src/audit-plugin.ts + packages/rest/src/meta-item-read-gate.ts, AGENTS.md (changeset declarations)

Delta over my FAIL at 136a7b679f4e48ba30b779607bda0b89bf492970 (comment on this PR, 17:23Z). The diff 136a7b67...63d6af9d is the changeset only (+6/-2). The code is unchanged.

① Derived judgments

  • M1 fixed. Clause-②: yes (narrowing) is the single arm, naming the custom-set audience that loses the entry. The BREAKING paragraph gives the fix ("grant view_all_audit_log to that set, or open the page by URL") and the unchanged page behaviour, and covers third-party contributors into group_diagnostics (my N1). There is exactly one adr-0087: not-required (no-migration-prescription) marker, which fits because nothing stored or authorable moves. The title and summary carry !, and the PR body's risk line matches. The author reports check-adr-0087-registration reads it as BREAKING + bang + narrowing.
  • Everything else in my first record holds unchanged at this head: the per-entry gates, the all-of holdsRequiredPermissions, the empty group not served, and the shipped sets unaffected.

② Semver level

patch on both packages with the BREAKING banner, right for a non-protocol narrowing (AGENTS.md).

③ Boundary flags

  • The author says the full dogfood battery owed by the narrowing arm is running on this head and will be reported on the PR. The ACCEPT must cite it, and must re-read every check at the landing head.

④ Design judgment

Unchanged: gating the entry on the capability that governs its data is the right separation-of-duties model, and the one custom-set narrowing is now declared with its remedy.

Implemented-by: claude/area-A2-33224
Reviewed-by: session_016WV4d1PGptBW3QRQNmy5e6

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · os-elon-musk · session_016WV4cz2MxDkQYCC4U8indM

Dogfood battery (owed by the (narrowing) arm) · head 50bea8a (final head: 63d6af9 + merge of origin/main) · 2026-11-14T18:23Z

pnpm --filter '@objectstack/dogfood^...' build && pnpm --filter @objectstack/dogfood test under scripts/pm/os-verify-lock.sh:

  • os-verify-lock: VERDICT command-exit 0 · held the lock 38m31s
  • Test Files 464 passed | 3 skipped (467) · Tests 3928 passed | 42 skipped (3970) · 0 failed.

Also re-run on this head: @objectstack/plugin-audit 93 files / 1495 tests, @objectstack/platform-objects 122 files / 1957 tests, all green.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · os-elon-musk · session_016WV4cz2MxDkQYCC4U8indM

ACCEPT · area A2 · Part of #33224 (navigation half; no Fixes) · head d0bbf71 · 2026-11-14T19:10Z

  • Reviewer: review#3 contract record PASS @63d6af9d (comment 6881426720), over its FAIL M1 at 136a7b6 (text-only fix: narrowing arm, BREAKING paragraph, one ADR-0087 marker). d0bbf71 = 63d6af9 + merges of origin/main only; neither merge touched a file in this PR's list.
  • Narrowing arm: full dogfood battery under os-verify-lock @50bea8aa (comment 6882171990): VERDICT command-exit 0, 464 files / 3928 tests passed, 0 failed. 50bea8a → d0bbf71 is a main merge with no overlap on the PR's files.
  • Declaration: Clause-②: yes (narrowing), Metadata-protocol: none, patch on @objectstack/platform-objects and @objectstack/plugin-audit with the BREAKING banner; title carries !.
  • Governed: check-governed-merges --pr 33349 → NOT governed (0 of 6 paths); +234 / -9.
  • Checks @d0bbf71f: 51 total = 35 success + 16 expected skips (check-expected-skips OK), 0 failed, 0 pending.
  • K = 3. Main has not changed any file this PR touches since its merge base.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 14, 2026 19:11
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 14, 2026
Merged via the queue into main with commit 8a8c21e Nov 14, 2026
52 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/area-A2-33224 branch November 14, 2026 20:50
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…n entry they can open, not on Packaged Actions (objectstack-ai#33410)

<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DXuamRUC67fx2TTYrFfyuSH)_

Fixes objectstack-ai#33224 — the Setup landing half (the navigation half is objectstack-ai#33349).
Route A, as the seat ruled.

Clause-②: no — the served `GET /meta/app/setup` tree is unchanged for
every caller except that `nav_packaged_actions` now carries `visible:
current_user.can('sys_metadata_activation', 'read')`, which the console
asks with the member's `/auth/me/permissions` map. A member who may read
the ledger is shown the entry and lands as before (the platform
administrator still lands on System Overview). A member who may not read
it stops being shown an entry whose page rendered only `activation
ledger HTTP 403`; nothing they could use is withdrawn.
Metadata-protocol: none

## Maintainer quick read

- What changes: Setup's Packaged Actions entry is shown only to a member
who may read the activation ledger its page reads. Everyone else lands
on the first Setup entry they can open.
- Why: Packaged Actions is the first entry Setup serves, and the
console's object-read prune judges `type: 'object'` entries only. So
every member landed on it, including a separation-of-duties officer (an
auditor holding `view_all_audit_log`) whose ledger read answers 403, and
their Setup opened on `activation ledger HTTP 403`.
- Risk and rollback: low. Admins (who read the ledger) see the same menu
and landing as before. The entry still carries no `requiredPermissions`
and no `requiresService`; the activation write doors keep their
server-side gates. Rollback is a revert.
- Read first:
`packages/platform-objects/src/apps/setup-nav.contributions.ts` (the
`visible` and its comment).
- Two-minute check: `pnpm --filter @objectstack/cli exec vitest run
test/setup-landing-audience.pin.test.ts`; expect 4 green cases.
- Needed from you: nothing.

## What changes

- `packages/platform-objects/src/apps/setup-nav.contributions.ts` —
`nav_packaged_actions` gains `visible:
"current_user.can('sys_metadata_activation', 'read')"`. The console asks
a nav entry's `visible` in both its sidebar and its landing walk
(`AppRootLanding` → `findFirstRoute` over the tree `useNavMemberGates`
gates, `ui/packages/app-shell/src/console/AppContent.tsx`), with `can`
bound to `/auth/me/permissions` (pinned in ui/ by
`UnifiedSidebar.navCanPermissions-12700.test.tsx`). No Setup entry used
`can` before; HotCRM and `examples/app-crm` already do.
-
`packages/platform-objects/src/apps/setup-packaged-actions-nav.test.ts`
— the pin header no longer calls the entry deliberately ungated. It says
the earlier "no audience" was a developer choice (objectstack-ai#12491), not a ruling,
and why the entry now carries the ledger-read audience. A new case pins
the predicate exactly. The "no `requiresService`" and "no
`requiredPermissions`" cases stay, with their reasons.
-
`packages/platform-objects/src/system/sys-metadata-activation.object.test.ts`
— the "no shipped app or nav names the ledger" pin now allows exactly
this one predicate (a permission question no row changes) and still
refuses any other mention.
- Changeset: `@objectstack/platform-objects` patch.

## Tests

- New `packages/cli/test/setup-landing-audience.pin.test.ts` (unit
tier): composes `SETUP_APP`, `SETUP_NAV_CONTRIBUTIONS` and
`AuditPlugin`'s contribution through the real `SchemaRegistry`, reads
`GET /api/v1/meta/apps/setup` through the real `RestServer` route, and
walks the served tree the way the console lands (groups walked, `url`
skipped, first `object`/`page`/`dashboard`/`report`/`component` wins;
`visible` asked with the real CEL engine and the member's object map; an
`object` entry pruned without read on its object):
- Packaged Actions is served with the predicate, and is still the first
landing-type entry for the officer (so the predicate, not the order,
moves the landing);
- an officer holding `view_all_audit_log` who may read `sys_audit_log`
and `sys_user` but not the ledger lands on `nav_users` (People & Org ›
Users);
- the same served tree, with ledger read, lands on
`nav_packaged_actions`;
- the platform administrator still lands on `nav_system_overview` and is
still shown Packaged Actions.

## Verification

- `pnpm --filter @objectstack/platform-objects exec vitest run`: 120 of
122 files green; the 2 failing cases are
`object-collapsed-sections-echo-decisions.test.ts`, which fails
identically on `origin/main` in this worktree (stale local build), so
not this change.
- `packages/cli`: `setup-landing-audience`, `console-page-nav-entries`,
`setup-integrations-order`, `i18n-contributed-nav-coverage`,
`translation-contributed-nav-validate-door`: 5 files / 22 tests passed
(`platform-objects` rebuilt first; the cli suite reads its `dist/`).
- Pre-push hooks passed.

## Human Minimum

- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` is not touched.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant