Repository navigation
feat(spec): the view and dashboard forms offer the audience gate (requiredPermissions) - #37839
Conversation
…ermissions (wip) Claude-Session: https://claude.ai/code/session_01L9qibxDBbvf7dEeutsepbm Co-authored-by: Claude <noreply@anthropic.com>
…ng forms (wip) Claude-Session: https://claude.ai/code/session_01L9qibxDBbvf7dEeutsepbm Co-authored-by: Claude <noreply@anthropic.com>
…rop the not-enforced ledger entries (wip) Claude-Session: https://claude.ai/code/session_01L9qibxDBbvf7dEeutsepbm Co-authored-by: Claude <noreply@anthropic.com>
… (wip) Claude-Session: https://claude.ai/code/session_01L9qibxDBbvf7dEeutsepbm Co-authored-by: Claude <noreply@anthropic.com>
… audience rows (wip) Claude-Session: https://claude.ai/code/session_01L9qibxDBbvf7dEeutsepbm Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check7 anchor(s) derived from 2 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 177 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 2c2bc8501344021b437d42b11ee78a0c6e7a4264 && git checkout 2c2bc8501344021b437d42b11ee78a0c6e7a4264
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin e69fa46dd326c4dcbbce206f35c8b3398776e76e 7ef98ab887129f0f0a27f06e359fd8a0f3cbb986 && git checkout -B drift-repro e69fa46dd326c4dcbbce206f35c8b3398776e76e && git merge --no-ff 7ef98ab887129f0f0a27f06e359fd8a0f3cbb986
node scripts/docs-audit/affected-docs.mjs --json e69fa46dd326c4dcbbce206f35c8b3398776e76e |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 Contract-review-claim: session_01L9qibwSEecrzDjKjbk24r1 · head bd91d5c · 2026-11-27T06:29Z L1-a (the seat's L1 thread) runs the isolated |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 Contract reviewServed-tier: Inputs read: card #34908 (body and all five comments: triage 6953426292, split 7016189680, analysis 7098042572, ruling 7103739693, claim 7210714615), PR #37839 (body, 26-file list, net diff against Check-runs on this head at the time of reading: 11 completed ① Derived judgments
② Semver level
Nit (changeset prose, not reviewed further): the body says "zh-CN reads ... the other locales fall back to the English source", while the tree also carries authored ja-JP and es-ES leaves. ③ Boundary flags
④ Design judgment
What holds:
Tried to break it: S1 (should-fix) — the two hints, and their zh-CN, ja-JP, es-ES and console-overlay copies, never tell the person setting the gate that it applies to them too. The gate refuses ONE view and a dashboard "on every door and to an author as to anyone" ( Nits (no effect on correctness or the contract):
No must-fix. One should-fix (S1), open on this head. Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 The brief L1-a handed its isolated contract-review sub-agent for the record above, filled from
|
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 L1-a, the seat's L1 thread · 2026-11-27T06:35Z 席位核对 — L1 REWORK @
|
… it too A list view or dashboard whose requiredPermissions names a capability the editor does not hold, or a misspelt one, is refused to that editor as well, on every door (Studio included). Both hints now say so, in the English source, the zh-CN, ja-JP and es-ES leaves and the console's zh-CN overlays; the seven fill locales carry the new English. The changeset names the three translated locales. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibxDBbvf7dEeutsepbm
|
repo:objectstack#3 · os-tesla · session_01L9qibxDBbvf7dEeutsepbm
Gates at |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 Contract-review-claim: session_01L9qibwSEecrzDjKjbk24r1 · head 98b17b2 · 2026-11-27T07:43Z L1-a runs the delta contract review (the same isolated |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 Contract reviewServed-tier: Delta record. It follows the record on head Check-runs on this head: every run is completed; 59 ① Derived judgments
② Semver levelUnchanged: ③ Boundary flags
④ Design judgmentS1: closed The added sentence, in both The copies, each read against the English:
Earlier nits:
New in the delta:
No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 L1-a, the seat's L1 thread · 2026-11-27T07:46Z 席位核对 — L1 ACCEPT @
|
…-16f1ht The translated-label positive control is re-derived as 844: 840, plus the `form` type's label from #37086, plus the three audience labels of #34908. The dashboard form's comment names the renamed `view.metadata-form.ts`. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibxDBbvf7dEeutsepbm
|
repo:objectstack#3 · os-tesla · session_01L9qibxDBbvf7dEeutsepbm
|
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 Contract-review-claim: session_01L9qibwSEecrzDjKjbk24r1 · head 7ef98ab · 2026-11-27T08:33Z L1-a has the same reviewer read the merge delta |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 Contract reviewServed-tier: Second delta record. It follows the records on Read this round: Check-runs on this head: every run is completed; 59 ① Derived judgments
② Semver levelUnchanged: ③ Boundary flags
④ Design judgment
The implementing files (the reconciliation ledger, the two console overlays, the round-trip test) are untouched by the merge resolution and carry the same hunks as before. S1 stays closed. The nits of the earlier records (N2, N3, N4, N5) are unchanged: accepted deviations or follow-up material. The merge introduces no new finding. No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 L1-a, the seat's L1 thread · 2026-11-27T08:35Z 席位核对 — L1 ACCEPT @
|
|
repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU Landing · 2026-11-27T08:37Z · head 7ef98ab
ACCEPT: L1-a 7213715549 at this head; same-head contract record 7213693656 PASS (tier verified), after the origin/main merge (count re-derived 844). CI 59 success, 10 expected skip, 0 failed. Ready + auto-merge now. This is part 1 of 2 for #34908: the card stays |
…own capabilities, with the positions it reaches (objectstack-ai#37906) repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU <!-- claude-projects-attribution: {"github_login":"os-tesla"} --> _Requested by **Tesla** · [project thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6Jao3jNGx6LmWH1CGtjYoMw3yP)_ Fixes objectstack-ai#34908 — the console and Studio half (step 2 of the ruling's execution, with step 3's docs recipe). Part 1 was objectstack-ai#37839. Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:新建共享视图时多出「谁能看此视图」,只能从环境里已有的能力中选,每项显示由哪些权限集授予,下方直接写出「哪些岗位会看到此视图」;Studio 的视图面板和仪表盘设置里的「所需权限」也换成同一个选择器和岗位预览。共享视图的提示不再说「所有能看到列表的人都能看到」。 - 为什么做:维护者选定的「给已有权限门补入口」第二步——管理员自己按岗位分视图、不找厂商;第一步(表单行)已在 objectstack-ai#37839 合入。 - 出错会怎样:选了自己没有的能力,该视图会从自己的视图切换器里消失;单独保存的视图或仪表盘对设置者本人也会被拒绝打开,要先在设置里把能力授予自己再改回。预览只是参考,服务器的权限门才是准绳。不改数据、不改协议。 - 要你做什么:无 ## What changes Ruling 7103739693 (letter B), verbatim: 「B 给已有权限门补入口 — 控制台和设计器加「谁能看此视图」选择,并显示哪些岗位会看到;不改协议,约2个PR。」 The gate is the existing, server-enforced `requiredPermissions` (all-of); no key, value, gate or any-of form is added, and the view surface grants nothing. - **The catalog** — `ui/packages/app-shell/src/views/capabilityAudience.ts` joins three registry reads: `capability` (declared), `permission` (each set's `systemPermissions`) and `position` (each position's `permissionSets`). The names offered are the declared capabilities plus every name a set grants, the same "known capability" set `@objectstack/lint`'s capability references resolve against, so the list is closed. A position holds only what its named sets grant (ADR-0131 D3/D4). A failed position read keeps the catalog and says the positions are unknown; a failed capability or set read fails the load. - **The preview** — `positionsReached`: a position is listed when its sets grant EVERY picked capability. It is advisory: it does not read set activation and cannot name people who hold a set directly. - **新建视图 (the switcher's create card)** — `CreateViewCard` offers 「Who sees this view」 (`ViewAudiencePicker.tsx`) in the shared scope only, read once the reader picks Shared (`ObjectView` hands the loader). Closed list, each option with its granting sets, the position preview under it, and no free-text fallback: a failed read offers nothing to add. It starts from the open view's gate, which `buildInPlaceViewConfig` used to hand on silently; `useCreateViewInPlace` lets the pick replace it, and an empty pick writes no key. With no picker (personal scope, or no loader) the body is built as before. - **The shared hint** (`CreateViewDialog.tsx`) — now "Shared views are seen by everyone who can see this list, unless the view is limited to the holders of a capability", in all eleven console locales. - **Studio** — a `ref-multi:capability` widget (`widgets.tsx`, the `ref-multi:permission` registration's sibling) with the preview as the list's footer. `view.metadata-form.ts` and `dashboard.metadata-form.ts` declare it on the audience row. `ViewVariantInspector`, `DashboardDefaultInspector` and `ResourceEditPage` hand down a loader (`WidgetContext.loadCapabilityAudience`, `useCapabilityAudienceLoader`); the picker reads it once its row is on screen, so a closed Access section sends no request, and a catalog the host already holds still wins. The widget is a closed registry: no typed-name box when the catalog is unread, empty or failed; each option shows "Granted by …". The dashboard inspector handed down no `WidgetContext` before; it now states `conditionScopeForMetadataType('dashboard')` (`none`), and the dashboard form declares no `condition` row, so nothing else renders differently. - **N5 (carried from objectstack-ai#37839)** — the view hint's last sentence now says what holds on every carrier: the person setting the gate no longer sees the view in the list either. (A view item is refused on every door, but an entry kept in its object's view set stays open to that set's editors in the designer.) en source, zh-CN / ja-JP / es-ES leaves, the console zh-CN overlay; the seven fill locales carry the new English. - **Docs** — `content/docs/permissions/capabilities.mdx` gains "Showing a list view to some positions, without code": have a capability, grant it to the positions' permission sets in Setup, pick it on the view, read the preview, and the warning that the gate applies to the person setting it. One checklist line. No page moved; the recipe exists nowhere else in `content/docs/permissions/`. ## Tests <details><summary>Commands and results (head 9731b21, the L1 rework fix, comment 7217699980)</summary> - `ui`: `pnpm exec vitest run packages/app-shell/src/views/viewAudience-34908.test.tsx` → 19 passed: the catalog join, the all-of preview, the failed position read, the card (hint, shared-only and lazy read, closed list with sets, preview, starting gate removable, failed read offers nothing, control: personal / no loader send no gate), the host (pick replaces the inherited gate, empty pick writes none, control: no picker keeps it), the Studio widget (preview, `(not found)` flag, empty, control: no catalog no preview). - `ui`: the above with `inPlaceViewCreate-35553.test.tsx` and `SchemaForm.widgetLabelling.test.tsx` (two new probe cases for `ref-multi:capability`) → 3 files, 126 tests passed. - `ui`: at the fix head, 5 files, 135 tests passed: `viewAudience-34908`, `SchemaForm.widgetLabelling`, `DashboardDefaultInspector.layoutColumns-11796`, `AddWidgetPicker.oneRegistry-26745` (the two that reached `/meta/capability` at `f67c1e60c5`) and `WidgetContext.catalogUnion`; two new cases pin the lazy loader (no request until the collapsed section opens, then exactly one; no loader call when a catalog is given). - `ui/packages/app-shell`: `tsc --noEmit` and `tsc -p tsconfig.test.json` → exit 0. - `check:i18n`, `check:i18n-stale-fill`, `check:test-source-alias` → OK. </details> <details><summary>Derived gates (dispatch-gates --commands)</summary> - 114 derived, 114 run (`--ran` reconciliation: 0 NOT-MEASURED, 0 UNRUN); all 114 exited 0 at head 9731b21 (six spec gates first answered exit 3 on a stale dts and exited 0 after a spec rebuild); the changeset-only last commit re-derives the same 114. CI at `2156f1acc8`: 61 success, 9 skipped, 0 failed. - During development `check:test-source-alias` asked the new test to load `@objectstack/lint` and `@objectstack/formula` at module top (the source reaches both through dynamic imports); done, and the gate is green. </details> ## Acceptance notes - The ruling names the Studio list-view inspector `studio-design/ObjectListViewInspector.tsx`; that file is gone from `main`. The picker lands in Studio's view panel, `metadata-admin/inspectors/ViewVariantInspector.tsx`, through the form row. - The acceptance line reads "业务员 will see this view"; the card says `{{positions}} will see this view` (zh `{{positions}} 会看到此视图`), listing position labels. ## Verification In the console, open a list, 视图 → 添加视图 → 共享: 「谁能看此视图」 lists the environment's capabilities. Pick one granted to the 业务员 position's permission set: the line under it reads 「业务员 会看到此视图」. Create: a user without the capability no longer sees the view in the switcher, and opening its URL answers 403. In Studio, the view's 导航与共享 → 所需权限 shows the same picker and preview. --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L9qibxDBbvf7dEeutsepbm --------- Co-authored-by: Claude <noreply@anthropic.com>
repo:objectstack#3 · os-tesla · session_01L9qibyUSf2nKJWW6qBemSU
Requested by Tesla · project thread
Part of #34908 — the spec half (step 1 of the ruling's execution). The console and Studio picker is the second PR; the card stays open for it.
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
Ruling 7103739693 (letter B) on #34908, verbatim: 「B 给已有权限门补入口 — 控制台和设计器加「谁能看此视图」选择,并显示哪些岗位会看到;不改协议,约2个PR。」 This PR is its step 1: a list view's and a dashboard's
requiredPermissions(declared and server-enforced since ruling 6095014058) gets an authoring row. No key, value, gate or export changes.packages/rest/src/meta-view-audience-save-round-trip.test.ts. The exact envelope the console's add-view door writes (viewEnvelope: the gate underconfig, beside the object binding), drafted (PUT ?mode=draft,If-None-Match: *) and published, keepsrequiredPermissionsin the draft read, the stored active row and the served item; the read gate then serves a holder and refuses a non-holder403 PERMISSION_DENIED. An edit that clears the gate stores no key and serves the non-holder again. Control: an ungated view is served to everyone. Real routes, realsaveMetaItem, better-sqlite3sys_metadata. The save door does not strip or refuse the key, so no fork.packages/spec/src/ui/view.form.ts— thenavigation_sharingsection gains arequiredPermissionsrow (string-tags, the faceapp.form.tsandaction.form.tsuse).packages/spec/src/ui/dashboard.form.ts— a new collapsedAccesssection holding the same row.AUDIENCE_REQUIRED_PERMISSIONS_DESCRIPTION(all of them required, empty is no gate, no any-of form, enforced by the server) in an administrator's words, and add what an administrator needs: a position passes on what its permission sets grant, and the gate applies to the person setting it too (a capability they do not hold, or a misspelt one, refuses the view or dashboard to them on every door, Studio included). They are worded for the person building the view, not copied verbatim from the describe, because the dashboard panel's hints are held to business wording (仪表盘设置面板:提示文字仍是开发者用语(如 gap 的 0.25rem 步长、snake_case) #36816).packages/spec/src/system/metadata-form-zod-reconciliation.test.ts— the twoomitledger entries forview/dashboardrequiredPermissionsare dropped. Their own reason was "declared, not enforced yet … whether to offer it then is a ruling for the enforcement"; the gate has been live since rest(/meta read gate): enforce a list view's and a dashboard'srequiredPermissionson the list read and the by-name read, so each audience is served only its own views and boards (the rest half of #22611) #22639 and the offer is now ruled.node scripts/check-i18n-bundles.mjs --write; zh-CN (「所需权限」 / 「访问权限」), ja-JP and es-ES leaves authored, the other seven locales left as extractor fills. The console's zh-CN overlay (metadata-form-zh-cn.tsforview,metadata-form-i18n.tsfordashboard) carries the same zh words. The translated-label positive control inobject-lifecycle-panel-echo-decisions.test.tsmoves 840 → 843 (two row labels + one section label).Tests
Commands and results (head bd91d5c after merging origin/main)
Round 2 (L1-a 7211677883), head 98b17b2:
platform-objectssrc/apps/translations/28 files, 625 tests passed; specsrc/ui/+metadata-form-zod-reconciliation195 files, 6750 tests passed; uipackages/app-shell/src/views/metadata-admin/804 files, 8686 passed, 1 skipped;check:generated14/14;check:i18nandcheck:i18n-stale-fillOK. The round-1 results below are at bd91d5c.pnpm --filter @objectstack/rest exec vitest run src/meta-view-audience-save-round-trip.test.ts→ Test Files 1 passed, Tests 3 passed (re-run after the merge).packages/spec:vitest run src/ui/ src/kernel/repeater-item-titles.test.ts src/system→ 273 files; 1 failure (the ledger entries this PR drops), green once they were dropped:metadata-form-zod-reconciliation.test.ts79/79; after the merge, that file plusview-form-composite-childrenanddashboard-form-business-wording-36816: 3 files, 110 tests passed.packages/platform-objects:vitest run src/→ 130 files, 2214 tests passed (after the ja-JP / es-ES wording and the 843 control); after the mergesrc/apps/translations/28 files, 625 tests passed.ui:pnpm exec vitest run packages/app-shell/src/views/metadata-admin/ packages/plugin-designer/src/__tests__/designerForms.sharedSelect-11865.test.tsx→ 805 files, 8786 passed, 1 skipped.pnpm --filter @objectstack/rest typecheck→ exit 0 (test layer included).pnpm --filter @objectstack/spec check:generatedafter the merge and a spec rebuild → all 14 generated artifacts up to date.Derived gates (dispatch-gates --commands, 93 families)
Round 2, head 98b17b2: 93 derived, 93 run, 0 NOT-MEASURED, 0 UNRUN. 92 exited 0 on the sweep;
pnpm --dir ui exec vitest run scripts/was SIGKILLed while the ui suite ran beside it and re-ran alone green (172 files passed, 2 skipped). The round-1 lines below are at bd91d5c.93 derived, 93 run (
--ranreconciliation: 0 NOT-MEASURED, 0 UNRUN).87 exited 0 on the first pass. 5 exited 3 (prerequisite) and were re-run green: the four spec
distreaders (check:api-surface,check:dual-source-exports,check:entry-nameability,check:exported-any) after a spec rebuild, andcheck-plugin-teardown-shape --self-testafter unshallowing the clone.check:authorable-surface,check:docs,check:i18nandcheck:i18n-stale-fillwere re-run green after the last translation edit.NOT MEASURED:
check:dual-build-cjs-loads, reason: it needs every package'sdist/(a fullpnpm build); this diff changes no package's build shape. CI runs it.Acceptance notes
ui/packages/app-shell/src/views/studio-design/ObjectListViewInspector.tsx; that file no longer exists onmain. Studio's view panel ismetadata-admin/inspectors/ViewVariantInspector.tsx, which rendersviewFormthroughSchemaForm, so the new row already appears there as a tag box. The capability picker (limited to the capabilities the environment knows) with the "which positions will see it" preview replaces that tag box in the second PR, together with the 新建视图 control, the shared-hint correction and thecapabilities.mdxrecipe.Verification
Open Studio on any list view, expand 导航与共享: the 所需权限 row is there with its hint. Type a capability name and publish: a user without it no longer sees the view in the switcher, and opening its URL answers 403.
Generated by Claude Code