Repository navigation
Commit d5ae7a4
fix(studio): a permission set's review link opens the draft review on its matrix page (#37347)
Fixes #37269
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户能看到的变化:在软件包页点某个权限集草稿的链接,或在聊天里点「审阅 N
处改动」,打开权限集矩阵页时会弹出审阅面板,列出这份草稿相对已发布版本改了什么;Studio 的权限集页也一样,矩阵照常可以编辑。
- 为什么做:属于「Studio 重构」专题;以前这两个入口打开的矩阵页上看不到任何改动,审阅链接等于失效。
-
出错会怎样:最坏情况是审阅链接打开后面板不弹出或内容不对:权限集之外,其他类型的审阅也改走同一段共享代码(已有测试钉住,行为不变);矩阵编辑不受影响。纯界面改动,直接撤回即可。
- 要你做什么:无。
## What changes
A review link (`?review=1`) on a permission-set draft now opens the
draft review on the set's matrix page, the same review sheet the generic
item page opens.
- **Shared presentation, not a second one.** The generic item page's
review sheet (`ResourceEditPage`'s `Sheet` around `DraftReviewPanel`)
moves into `DraftReviewSheet`, and its `?review=1` arrival effect into
`useDraftReviewArrival` (read afresh, open once the read settles and a
draft is pending, then drop `?review=1` with a history replace).
`ResourceEditPage` now uses both; its behaviour is unchanged and its
existing pins (`ResourceEditPage.detailTabs-36901`) pass on the shared
hook.
- **The matrix honours `?review=1`.** `PermissionMatrixEditPage` uses
the same hook and sheet. That covers Studio's `StudioPermissionSetPage`
(which embeds the matrix, package leg) and the routed matrix on the
cross-package leg, where both producers' links land
(`/studio/~all/metadata/permission/NAME?review=1`, through Setup's
metadata redirect).
- At the arrival the matrix reads the pending draft and the published
set on their own, at the matrix's layered address (`layeredPackageId`:
the page's package, else the route's `?package=`), else by name alone,
as the generic page reads a draft. The matrix's own load is not asked
again, so an unsaved matrix edit is kept, and the matrix stays editable
under the sheet and after it closes.
- No pending draft: no review opens, and `?review=1` still leaves the
address. No published set readable: no review (nothing to compare
against).
- Without `?review=1` the matrix reads exactly what it read before.
- **Address.** `?review=1` is dropped the way the generic page drops it;
`AreaItemOpen` decides its page once per item
(`StudioMetadataArea.tsx`), so dropping the query does not move the set
off its matrix page. No routing changed.
- **Not changed:** the two producers (`PackagesPage.tsx`,
`AppContent.tsx`), the flow and object review links,
`StudioMetadataArea.tsx`, server, spec and routes. No locale key added.
Changeset: `.changeset/37269-permission-set-review-link.md`
(`@object-ui/app-shell` patch).
### Read first (by risk)
1.
`ui/packages/app-shell/src/views/metadata-admin/PermissionMatrixEditor.tsx`,
the new block above `const [draft, setDraft]`: the arrival's own draft
and published read, and the sheet added to `dialogsEl`.
2.
`ui/packages/app-shell/src/views/metadata-admin/useDraftReviewArrival.ts`:
the arrival effect moved out of `ResourceEditPage`; callbacks are read
through a ref refreshed in an effect that runs before the arrival
effect.
3.
`ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.tsx`:
the inline effect and sheet replaced by the shared hook and component.
### Two-minute verification
On a showcase dev server, open Setup, then Packages, then a package with
a pending permission-set draft, and click that draft's link. Expected:
Studio opens the set's matrix with a right-hand sheet titled "Draft
review" listing the changed keys, and the address no longer carries
`review=1`.
## Tests
New pins, all at head of this branch:
- `StudioPermissionSetPage.fullScreen-36905.test.tsx`, new top-level
`describe` (the real Studio page and matrix):
- `?review=1` shows the draft's change against the published set (only
`label` differs), read at the page's package, then leaves the address;
- editing stays: Escape closes the review onto the matrix, whose bulk
buttons are enabled;
- CONTROL: without `?review=1`, a set with a pending draft opens no
review, and the matrix's load is the only draft read.
- `permissionReviewLinks-37269.test.tsx` (new; the real
`PackageDetailSheet`, the real `StudioMetadataArea` on the cross-package
leg, the real matrix registered as the type's `EditPage`):
- the Packages page's per-draft link (href asserted, then clicked)
reaches the matrix with the review shown, the matrix cells enabled, the
draft read by name;
- the chat's 「Review N change(s)」 (`setupMetadataStudioPath(item,
'review=1')`, as `DraftReviewNavigator` calls it) reaches the same;
- CONTROL: the same page without `?review=1` opens no review and reads
no draft;
- a set with no pending draft opens no review, and `?review=1` still
leaves the address.
- Unchanged and green: the flow and object review links
(`StudioMetadataArea.routes-28561`), the generic page's review
(`ResourceEditPage.detailTabs-36901`), the redirect tables
(`setupMetadataRedirect`, `AppContent.setupMetadataStudio-28578`).
<details><summary>Runs (head f781168)</summary>
- `@object-ui/app-shell` `type-check` (both programs, `tsc --noEmit` and
`tsconfig.test.json`): os-verify-lock `VERDICT command-exit 0` (at the
feature commit; the later refactor commit only moved the hook to its own
module, and `eslint` on the moved files is clean).
- The new pins plus every suite that reads `?review=1` or the review
panel (11 files): `Test Files 11 passed (11)`, `Tests 281 passed (281)`,
`VERDICT command-exit 0`.
- Every `ResourceEditPage.*`, `PermissionMatrixEditor.*` and
`StudioPermissionSetPage.*` suite (113 files): `Test Files 113 passed
(113)`, `Tests 664 passed (664)`, `VERDICT command-exit 0`.
- `eslint` on the changed files: 0 errors; no warning on a changed line.
</details>
<details><summary>Ablations (one per pin, each through
scripts/ablation-replace.mjs, restored to the HEAD blob with git diff
HEAD empty)</summary>
| Mutation | Result |
| --- | --- |
| matrix arrival off (`enabled: true` to `false` in
`PermissionMatrixEditor.tsx`) | 5 red: both Studio review pins, both
producer pins, the no-draft address pin; both CONTROLs green |
| arrival ignores the param (`useDraftReviewArrival.ts`) | 3 red: both
CONTROLs (Studio, cross-package leg), plus one detailTabs case |
| generic page arrival off (`ResourceEditPage.tsx`) | 2 red: detailTabs
`?review=1 opens the review and is consumed`, and its CONTROL |
| `?review=1` kept in the address (`useDraftReviewArrival.ts`) | 6 red:
the generic page's two, the Studio address pin, both producer pins, the
no-draft address pin |
| area never asks the generic page (`StudioMetadataArea.tsx`) | 2 red:
the object CONTROL and the flow review case in `routes-28561` |
Each leg ran the four suites
(`StudioPermissionSetPage.fullScreen-36905`,
`permissionReviewLinks-37269`, `ResourceEditPage.detailTabs-36901`,
`StudioMetadataArea.routes-28561`; 76 tests) under the lock; each
mutation landed (anchor 1 to 0) and was restored to its HEAD blob.
</details>
## Acceptance notes
- The matrix offers no chip to reopen the review once it is closed (the
generic page has its header chip). The card asks for the arrival only; a
reopen affordance on the matrix header would be a separate UX change.
- On the cross-package leg the matrix shows the published set (it has no
package to read a draft at), while the review sheet shows the pending
draft read by name. That is the matrix's existing behaviour on that leg;
the sheet is what says what the draft changes.
- The arrival reads afresh at every `?review=1`, as the generic page
does; unlike the generic page it does not reload the editor, so a
same-item arrival keeps unsaved matrix edits.
## Verification
Local, on `f781168f` (exit code read before any pipe):
- `pnpm check:test-source-alias`: exit 0.
- `pnpm --dir ui check:i18n-keys`: exit 0.
- `node scripts/pm/overlap-check.mjs`: exit 0 (`VERDICT clean`; no open
PR shares a file). With `--pr=37341,37338`: exit 0, both merge cleanly.
The `claude/issue-37236-*` and `claude/issue-37237-*` branches share no
file with this diff.
- `node scripts/pm/dispatch-gates.mjs --commands` derived 39 commands.
At the time of writing 28 had run locally: 27 exit 0 (the changeset
gates, `check:nul-bytes`, `check:cross-package-test-inputs`,
`check:adr-anchors`, `check:published-files`, `check:sdui-manifest`
among them), and `check:query-options-erasure` hit the local 300 s
wrapper timeout (exit 124): NOT MEASURED locally, left to CI. The rest,
and `pnpm --dir ui exec vitest run scripts/` (this diff touches no
script), are left to CI.
CI: in progress at the time of writing.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QSeKYnq7io51czLb81MZMd)_
<!-- signed: repo:objectstack#4 · os-justin ·
session_01QSeKYkkwuF6UuFtu85Yd5H -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 80da086 commit d5ae7a4
7 files changed
Lines changed: 505 additions & 51 deletions
File tree
- .changeset
- ui/packages/app-shell/src/views
- metadata-admin
- studio-design
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
96 | 98 | | |
97 | 99 | | |
98 | 100 | | |
| |||
922 | 924 | | |
923 | 925 | | |
924 | 926 | | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
925 | 976 | | |
926 | 977 | | |
927 | 978 | | |
| |||
2442 | 2493 | | |
2443 | 2494 | | |
2444 | 2495 | | |
| 2496 | + | |
| 2497 | + | |
| 2498 | + | |
| 2499 | + | |
| 2500 | + | |
| 2501 | + | |
| 2502 | + | |
| 2503 | + | |
| 2504 | + | |
| 2505 | + | |
| 2506 | + | |
| 2507 | + | |
2445 | 2508 | | |
2446 | 2509 | | |
2447 | 2510 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | 51 | | |
59 | 52 | | |
60 | 53 | | |
| |||
96 | 89 | | |
97 | 90 | | |
98 | 91 | | |
99 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
100 | 95 | | |
101 | 96 | | |
102 | 97 | | |
| |||
684 | 679 | | |
685 | 680 | | |
686 | 681 | | |
687 | | - | |
| 682 | + | |
688 | 683 | | |
689 | 684 | | |
690 | 685 | | |
| |||
1628 | 1623 | | |
1629 | 1624 | | |
1630 | 1625 | | |
1631 | | - | |
1632 | | - | |
1633 | | - | |
1634 | | - | |
1635 | | - | |
1636 | | - | |
1637 | | - | |
1638 | | - | |
1639 | | - | |
1640 | | - | |
1641 | | - | |
1642 | | - | |
1643 | | - | |
1644 | | - | |
1645 | | - | |
1646 | | - | |
1647 | | - | |
1648 | | - | |
1649 | | - | |
1650 | | - | |
1651 | | - | |
1652 | | - | |
1653 | | - | |
1654 | | - | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
1655 | 1637 | | |
1656 | 1638 | | |
1657 | 1639 | | |
| |||
3981 | 3963 | | |
3982 | 3964 | | |
3983 | 3965 | | |
3984 | | - | |
3985 | | - | |
3986 | | - | |
3987 | | - | |
3988 | | - | |
3989 | | - | |
3990 | | - | |
3991 | | - | |
3992 | | - | |
3993 | | - | |
3994 | | - | |
3995 | | - | |
3996 | | - | |
3997 | | - | |
3998 | | - | |
3999 | | - | |
4000 | | - | |
4001 | | - | |
| 3966 | + | |
| 3967 | + | |
| 3968 | + | |
| 3969 | + | |
| 3970 | + | |
| 3971 | + | |
| 3972 | + | |
| 3973 | + | |
| 3974 | + | |
| 3975 | + | |
4002 | 3976 | | |
4003 | 3977 | | |
4004 | 3978 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
549 | 549 | | |
550 | 550 | | |
551 | 551 | | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
0 commit comments