Skip to content

fix(app-shell): a New similar copy in a base's .custom pair lists and counts its grants on the base's objects - #29718

Merged
objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-uytq10
Nov 3, 2026
Merged

objectstack-fleet[bot] merged 3 commits into
mainfrom
claude/project-thread-uytq10

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steedos · project thread
Fixes #29674

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:Studio「权限」里,定制包(.custom)中的权限集现在会列出并统计它在基础包对象上的授权;「新建类似」复制出来的权限集不再显示「已授权 0 个对象」。
  • 为什么改:管理员复制供应商权限集后看到一个空矩阵,会以为复制失败或重新手动授权,而服务端其实已保存了 8 个对象、3 个字段的授权。
  • 风险与回滚:只改 Studio 前端的对象列表范围(定制包 = 本包 + 基础包),保存仍只写定制包的草稿,从不写基础包;普通包的权限集行为不变。回滚即还原本 PR。
  • 先看:ui/packages/app-shell/src/views/metadata-admin/permission-slice.ts(permissionObjectScopePackages)、PermissionMatrixEditor.tsx 的对象列表读取、StudioDesignSurface.tsx 权限页的范围提示。
  • 两分钟验证:pnpm dev:showcase 后对 showcase_contributor 调用 clone 接口,再打开 /_console/studio/com.example.showcase/access?surface=permission%3A新名字,应看到「已授权 8 个对象 · 3 个字段覆盖」,提示条显示「本包及 ObjectStack Showcase 的对象 · 保存为草稿」。
  • 需要你做的:无,席位落地。

What changes

  • Object scope of a pair's set. permissionObjectScopePackages(packageId) (new, permission-slice.ts) answers [pair, base] for a paired BASE.custom package, by the spec's pairing rule (customizationBasePackageId from @objectstack/spec/kernel), and [packageId] for every other package. ADR-0146 D3: the pair receives the permission sets for its base, and it declares none of the base's objects.
  • The package door's load (PermissionMatrixEditor.tsx) lists the draft-overlaid objects of each scope package and keeps one row per object name. The slice, the counts and the save merge all read that list, so a pair's set now shows, counts and edits its grants on the base's objects. The save is unchanged: it writes the set's draft at its own package (the pair), and rows outside the scope are re-merged from a fresh read as before (ADR-0086 P0).
  • How the editor learns the base: derived from its own packageId with the spec's pairing rule. No new prop and no new read.
  • The Studio Access note (StudioDesignSurface.tsx, the access arm only): on an open set the pair adds, the chip reads "This package's and BASE_LABEL's objects · saved as draft" (zh 「本包及 BASE_LABEL 的对象 · 保存为草稿」), with a title that says why. Every other note is unchanged. Two new @object-ui/i18n studio keys, engine.studio.access.bannerPair and engine.studio.access.bannerTitlePair, in both locales the studio namespace has (en, zh).

Tests

  • StudioDesignSurface.accessPairCopy-29674.test.tsx (new): the real StudioDesignSurface, AccessPillar and PermissionMatrixEditPage over the real metadata client and a fetch stub (base read-only, its pair writable). A copy in the pair that grants 8 base objects and 3 field overrides lists the 8 objects, draws their grants and reads "8 objects granted · 3 field overrides"; its note names the base; an edit to a base object's grant PUTs only /meta/permission/COPY?package=PAIR with every grant kept, and no write names the base. CONTROL: the base's own set lists the base's objects and reads no pair object list.
  • PermissionMatrixEditor.pairScope-29674.test.tsx (new): the helper (a pair, a base, an ordinary package, a pair of a pair); a pair's set lists the pair's and the base's objects once each and saves a base-object grant into the pair's draft. CONTROL: an ordinary package's set lists only its own objects, and its save keeps another package's object and field rows byte-identical.
  • Ablations, each through scripts/ablation-replace.mjs with an on-disk proof and a proven restore to HEAD:
    • the helper returns [packageId] again (scope to the pair's own objects): 6 of 9 cases red, the 3 controls green;
    • the note's pair branch forced off: 1 of 4 red (the note case).
Test runs (fix at cbaf5f9 / 82fbfd0; re-run at the merged head 607c05c)
  • New files: Test Files 2 passed (2), Tests 9 passed (9). At 607c05c (after merging main): the new files plus 30 neighbouring suites, Test Files 32 passed (32), Tests 222 passed (222); app-shell and i18n type-check exit 0.
  • Neighbouring suites (every PermissionMatrixEditor*, permission-slice*, Studio access suites, oneSurface-28572, zh-base-term, plus all of packages/i18n): Test Files 154 passed, Tests 1837 passed, 13 skipped.
  • pnpm --filter @object-ui/app-shell run type-check and pnpm --filter @object-ui/i18n run type-check: exit 0.
  • pnpm --dir ui run check:phantom-deps, check:spec-symbols, check:i18n-keys, check:i18n-drift: exit 0.

Acceptance notes

  • Scope chip decision: on a pair's set it names the base by its display label; on the base's own sets, the OWD overview and the empty header it stays "This package's objects".
  • A rejected object-list read still lists nothing, as before this change (one .catch around both reads); no new degradation.

Verification

Live on pnpm dev:showcase --fresh (admin), the card's recipe: POST /api/v1/security/permission-sets/showcase_contributor/clone with {name: qa_contrib_29674, label} answered 200 in com.example.showcase.custom; GET /api/v1/meta/permission/qa_contrib_29674?package=com.example.showcase.custom read 8 objects and 3 fields. The Console ran from source (Vite) against that server.

  • Before (main's sources): header 「已授权 0 个对象 · 0 个字段覆盖」, matrix 「没有匹配的对象。」, chip 「仅本包对象 · 保存为草稿」.
  • After: header 「已授权 8 个对象 · 3 个字段覆盖」, the base's objects listed with their grants, chip 「本包及 ObjectStack Showcase 的对象 · 保存为草稿」 (en: "8 objects granted · 3 field overrides", "This package's and ObjectStack Showcase's objects · saved as draft").
  • Edit: ticking Delete on showcase_invoice sent one PUT, /api/v1/meta/permission/qa_contrib_29674?mode=draft&package=com.example.showcase.custom&surface=studio; the pair's draft read back 8 objects, 3 fields, showcase_invoice.allowDelete: true; the base set showcase_contributor still reads allowDelete: false, and the base holds no drafts.
  • CONTROL: the base's own set showcase_contributor reads 8 objects · 3 field overrides, read-only, as before.

Screenshots (project files issue-29674/shots/): before-qa_contrib_29674-zh.png, after-qa_contrib_29674-zh.png, after-qa_contrib_29674-zh-edited.png, after-qa_contrib_29674-en.png, control-showcase_contributor-zh.png.

Gates

node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 35 derived families, all run locally, all exit 0; --ran reconciliation: "35 derived famil(ies) accounted for — 35 run, 0 NOT-MEASURED (a DERIVED zero)". check:query-options-erasure hit a 300 s per-command cap in the loop (exit 124) and passed rerun alone. --tier: no path-derived mandate. Changed lines 511, under the 3000 threshold.


Generated by Claude Code

…n the base's objects

A New similar copy of a read-only base's permission set lands in the
base's paired .custom package. The package door scoped its matrix to the
objects the pair declares, which are none of the base's, so the copy read
0 objects granted though the server holds its grants. A pair's set is now
scoped to the base's objects as well as its own (ADR-0146 D3), and the
Studio note names the base.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jVCDukgxJSJ3tEvg5W
…osition; add the changeset

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

Copy link
Copy Markdown
Contributor Author

domain:ui#2 · zhuangjianguo · session_01QsR2jRFuJz9QBZqPVHYVhJ

维护者速读

  • 改了什么:在只读软件包上用"新建相似"复制出的权限集,保存在该包的 .custom 定制包里。Studio 权限页现在会把基础包的对象一并列出、计数并允许编辑,抬头说明改为"本包及 {基础包} 的对象 · 保存为草稿"。
  • 为什么改:定制包自己不声明基础包的对象,权限矩阵只列本包对象,于是复制出的权限集显示"已授权 0 个对象"、矩阵为空,而服务端其实持有 8 个对象、3 个字段的授权。管理员会误以为复制失败,或手动重复授权。
  • 风险与回滚:低。只改前端:多读一次基础包的对象列表,按名字去重;保存仍只写定制包的草稿,从不写基础包(测试和实测都钉住)。非定制包的权限集完全不变(有对照测试)。回滚即 revert 本 PR。
  • 先看:ui/packages/app-shell/src/views/metadata-admin/permission-slice.ts 的 permissionObjectScopePackages,以及 PermissionMatrixEditor.tsx 中按它读取对象列表的地方。
  • 两分钟验证:pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/PermissionMatrixEditor.pairScope-29674.test.tsx,预期全绿。
  • 需要你做的:无,席位验收后进合并队列。

席位意见: 复测 main 上为 0/0,修复后 8 个对象 · 3 个字段,与服务端读到的一致;编辑基础包对象的授权只落到定制包草稿。用的是规格自带的 customizationBasePackageId,与定制包地址跳转同一条规则。

席位核对 — ACCEPT · domain:ui#2 · head 607c05c4 · 2026-11-03T02:56Z

  • 形态: draft PR on main, Fixes #29674 on its own line. 8 files, +508/−3, Tier S (check-governed-merges --pr 29718: not governed; under 3000 lines). All inside claim 6592632425 as amended by 6592690624 (permission-slice.ts helper, the two studio chip keys).
  • 前提实测: re-measured on main before code: the copy's Studio Access read 已授权 0 个对象 · 0 个字段覆盖 with an empty matrix while GET /meta/permission/NAME?package=…custom held 8 objects / 3 fields. After (production build at the head, shots in /mnt/project-files/issue-29674/shots/, which the seat looked at): 已授权 8 个对象 · 3 个字段覆盖, 24 objects listed, the note reads 本包及 ObjectStack Showcase 的对象 · 保存为草稿. An edit issued one PUT ?mode=draft&package=com.example.showcase.custom; the base set is unchanged and the base holds no drafts.
  • 门禁 check-runs (pinned to head 607c05c43a53230b5a2628793de768d2286bcd8c): 44 success, 11 skipped, 0 failed, 0 pending (55 runs), including Check Changeset, Type Check UI, Lint UI, Test UI (16 shards) and Build & E2E UI. Dev local gates: 35/35 derived exit 0, --ran 0 NOT-MEASURED; type-check green; new tests 9/9; neighbours 154 files / 1837 passed, then 32 files / 222 again after merging main. Ablations: scope back to the pair alone reds 6 of 9; the chip back to the plain note reds 1 of 4; both restored.
  • Code read: permissionObjectScopePackages answers [pair, base] only when the spec's customizationBasePackageId names a base, else [packageId], so every other package reads one list as before. Rows are deduped by name with the set's own package first, then sorted as before. The save merge keys off the same row list, and saveVersioned keeps packageId = the pair.
  • 接受的偏差: keys ship in en and zh, the only two studio locales (the namespace is Record<string, string>, so no published type widens). The dev made 4 gh api read calls for the open-PR overlap check.
  • 范围外去向: the pair-added set's header still carries the 包内置 badge beside 新增 in the rail (seen in both the before and after shots). That predates this card and is not the bug here, so it is recorded, not filed. No Skills-docs: line is owed.
  • 落地条款: Clause-②: no (app-shell is private; the studio namespace is Record<string, string>, so the new keys widen no published type, the app-shell: a published library that is 66% Console product surface — retire the 67 zero-reference exports now, decide the split, and fold the second i18n table into @object-ui/i18n #25922 reading), Metadata-protocol: none, patch for @object-ui/app-shell and @object-ui/i18n; no contract review is owed. Land by pr_ready + automerge_enable.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 3, 2026 02:57
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 3, 2026 02:57
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit 10e4a77 Nov 3, 2026
56 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-uytq10 branch November 3, 2026 03:24
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/l 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.

Studio Access: a New similar copy of a permission set reads "0 objects granted" in its pair, though the server holds its grants

1 participant