diff --git a/.changeset/37269-permission-set-review-link.md b/.changeset/37269-permission-set-review-link.md
new file mode 100644
index 00000000000..0285a706ee8
--- /dev/null
+++ b/.changeset/37269-permission-set-review-link.md
@@ -0,0 +1,12 @@
+---
+'@object-ui/app-shell': patch
+---
+
+fix(studio): a permission set's review link shows what its draft changes
+
+Clause-②: no
+Metadata-protocol: none
+
+A review link on a permission-set draft opened the set's matrix page with nothing on it saying what the draft changed. Two places write such a link: the Packages page's list of a package's pending drafts, and the chat's 「Review N change(s)」 button. Both now open the matrix with the draft review the other metadata pages show: a side sheet listing what the pending draft adds, changes and removes against the published set. Studio's permission-set page opens it the same way. The matrix stays editable under the sheet and after it closes, and the link's `?review=1` leaves the address once the review is open, so a refresh or Back does not open it again.
+
+A set with no pending draft opens no review, and a permission-set page opened without a review link reads and shows exactly what it did before. The review links of flows, objects and every other type are unchanged. No locale keys, props or entry exports change.
diff --git a/ui/packages/app-shell/src/views/metadata-admin/DraftReviewSheet.tsx b/ui/packages/app-shell/src/views/metadata-admin/DraftReviewSheet.tsx
new file mode 100644
index 00000000000..71e46c42b72
--- /dev/null
+++ b/ui/packages/app-shell/src/views/metadata-admin/DraftReviewSheet.tsx
@@ -0,0 +1,58 @@
+// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
+
+/**
+ * The draft review (ADR-0033 Phase B) as an item page opens it: the sheet that
+ * shows a pending draft's change against the published item
+ * ({@link DraftReviewPanel}), and the `?review=1` arrival that opens it.
+ *
+ * One presentation for every item page that honours a review link: the generic
+ * item page (`ResourceEditPage`) and the permission set's matrix
+ * (`PermissionMatrixEditPage`, Studio's page and the routed one,
+ * objectstack#37269). Both producers of a review link write `?review=1` for any
+ * draft item: the Packages page's per-draft link and the chat's 「Review N
+ * change(s)」.
+ */
+
+import * as React from 'react';
+import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from '@object-ui/components';
+import { DraftReviewPanel } from './DraftReviewPanel.js';
+import { t, type SupportedLocale } from './i18n.js';
+
+export interface DraftReviewSheetProps {
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+ type: string;
+ name: string;
+ /** The published (effective) item: the baseline. `null` for an item never published. */
+ published: unknown;
+ /** The pending draft's body. */
+ draft: unknown;
+ locale?: SupportedLocale | string;
+}
+
+/** The generic draft↔published review, in a right-hand sheet over the item page. */
+export function DraftReviewSheet({
+ open,
+ onOpenChange,
+ type,
+ name,
+ published,
+ draft,
+ locale,
+}: DraftReviewSheetProps): React.ReactElement {
+ return (
+
+
+
+ {t('designer.draftReview.title', locale)}
+
+ {type} / {name} · {t('designer.canvas.reviewVsPublished', locale)}
+
+
+
+
+
+
+
+ );
+}
diff --git a/ui/packages/app-shell/src/views/metadata-admin/PermissionMatrixEditor.tsx b/ui/packages/app-shell/src/views/metadata-admin/PermissionMatrixEditor.tsx
index 93541cee3c2..eaa04cdb317 100644
--- a/ui/packages/app-shell/src/views/metadata-admin/PermissionMatrixEditor.tsx
+++ b/ui/packages/app-shell/src/views/metadata-admin/PermissionMatrixEditor.tsx
@@ -93,6 +93,8 @@ import { HistoryPanel } from '../item-tools/ResourceHistoryPage.js';
import { useMetadataClient, useMetadataTypes, type RichMetadataTypeEntry } from './useMetadata.js';
// objectui#11773 — the package door's draft save sends the version it was built on.
import { readDraftForSave, useDraftSaveGuard } from './DraftConflictDialog.js';
+import { DraftReviewSheet } from './DraftReviewSheet.js';
+import { useDraftReviewArrival } from './useDraftReviewArrival.js';
// objectstack#26858 — the served verdict the RLS clause editors read at their paths.
import {
DraftVerdictBodyContext,
@@ -922,6 +924,55 @@ export function PermissionMatrixEditPage({ type, name, packageId, onDraftSaved,
[locale, catalogueResident],
);
+ // objectstack#37269 — a review link (`?review=1`: the Packages page's
+ // per-draft link, the chat's 「Review N change(s)」) opens the draft review
+ // here, the generic item page's (`useDraftReviewArrival`, `DraftReviewSheet`):
+ // a set's item page is this editor, on Studio's page and the routed one alike.
+ // Read on its own at the arrival, the pending draft and the published set, at
+ // the address the load reads (the page's package, else the route's, else the
+ // name alone, as the generic page reads it). The matrix's load is not asked
+ // again, so an unsaved edit it holds stays, and editing stays open under the
+ // sheet.
+ const [reviewRead, setReviewRead] = React.useState<{ published: unknown; draft: PermissionSetDraft } | null>(null);
+ const [reviewReading, setReviewReading] = React.useState(false);
+ const [reviewReadNonce, setReviewReadNonce] = React.useState(0);
+ const [reviewOpen, setReviewOpen] = React.useState(false);
+ React.useEffect(() => {
+ if (reviewReadNonce === 0) return undefined;
+ let cancelled = false;
+ Promise.all([
+ readDraftForSave<{ item?: PermissionSetDraft } | PermissionSetDraft>(client, type, name, layeredPackageId),
+ client.layered(type, name, layeredPackageId ? { packageId: layeredPackageId } : {}),
+ ]).then(
+ ([pending, lay]) => {
+ if (cancelled) return;
+ const body = pendingDraftBody(pending.answer ?? null);
+ setReviewRead(body ? { published: lay?.effective ?? null, draft: body } : null);
+ setReviewReading(false);
+ },
+ // An unread published set is no baseline: nothing to compare, no review.
+ () => {
+ if (cancelled) return;
+ setReviewRead(null);
+ setReviewReading(false);
+ },
+ );
+ return () => {
+ cancelled = true;
+ };
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- read once per arrival; the item is the nonce's
+ }, [reviewReadNonce]);
+ useDraftReviewArrival({
+ enabled: true,
+ loading: reviewReading,
+ hasDraft: reviewRead !== null,
+ reload: () => {
+ setReviewReading(true);
+ setReviewReadNonce((n) => n + 1);
+ },
+ open: () => setReviewOpen(true),
+ });
+
const [draft, setDraft] = React.useState({
name,
objects: {},
@@ -2442,6 +2493,18 @@ export function PermissionMatrixEditPage({ type, name, packageId, onDraftSaved,
)}
+ {/* objectstack#37269 — the draft review a `?review=1` link opens. */}
+ {reviewRead && (
+
+ )}
{draftConflictDialog}
>
);
diff --git a/ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.tsx b/ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.tsx
index 8552b4b6fcf..e7d48dbac20 100644
--- a/ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.tsx
+++ b/ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.tsx
@@ -48,13 +48,6 @@ import {
import { toast } from 'sonner';
import { Button } from '@object-ui/components';
import { Badge } from '@object-ui/components';
-import {
- Sheet,
- SheetContent,
- SheetHeader,
- SheetTitle,
- SheetDescription,
-} from '@object-ui/components';
import {
ResizableHandle,
ResizablePanel,
@@ -96,7 +89,9 @@ import {
type ItemToolTab,
} from '../item-tools/ItemToolTabs.js';
import { MetadataTypeActions } from './MetadataTypeActions.js';
-import { DraftReviewPanel, computeDraftChangeCount } from './DraftReviewPanel.js';
+import { computeDraftChangeCount } from './DraftReviewPanel.js';
+import { DraftReviewSheet } from './DraftReviewSheet.js';
+import { useDraftReviewArrival } from './useDraftReviewArrival.js';
import {
SchemaForm,
DRAWER_METADATA_ID_SCOPE,
@@ -684,7 +679,7 @@ function MetadataResourceEditPageImpl({
embedded,
}: MetadataResourceEditPageImplProps) {
const navigate = useNavigate();
- const [searchParams, setSearchParams] = useSearchParams();
+ const [searchParams] = useSearchParams();
// ADR-0048 — the owning package of the item being edited, carried on the
// edit URL as `?package=` (emitted by the metadata list links). Scopes the
// layered/draft read so a same-name collision resolves to the right
@@ -1628,30 +1623,17 @@ function MetadataResourceEditPageImpl({
// The draft review is the header's status chip (decision 8), opened here.
const [reviewOpen, setReviewOpen] = React.useState(false);
- // ADR-0033 Phase B — `?review=1` arrival (from the chat's "Review N change(s)"
- // affordance). The AI may have drafted this item *after* the page mounted, so
- // we first force a fresh fetch, then — once the draft is loaded — open the
- // generic review/diff sheet and consume the query param (so a refresh/back
- // doesn't re-trigger it). The same-item-already-open case is covered by the
- // reload bump (the load effect keys off `reloadKey`, not the search string).
- const reviewParam = searchParams.get('review');
- const reviewBumpedRef = React.useRef(false);
- React.useEffect(() => {
- if (reviewParam !== '1' || createMode) return;
- if (!reviewBumpedRef.current) {
- reviewBumpedRef.current = true;
- setReloadKey((k) => k + 1);
- return; // wait for the reload to settle before reading hasDraft
- }
- if (!loading) {
- if (hasDraft) setReviewOpen(true);
- const next = new URLSearchParams(searchParams);
- next.delete('review');
- setSearchParams(next, { replace: true });
- reviewBumpedRef.current = false;
- }
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [reviewParam, createMode, loading, hasDraft]);
+ // ADR-0033 Phase B — `?review=1` arrival (the chat's "Review N change(s)"
+ // and the Packages page's per-draft link): read the item afresh, then open
+ // the review once the draft is loaded, and drop the query param
+ // (`useDraftReviewArrival`, shared with the permission set's matrix).
+ useDraftReviewArrival({
+ enabled: !createMode,
+ loading,
+ hasDraft,
+ reload: () => setReloadKey((k) => k + 1),
+ open: () => setReviewOpen(true),
+ });
// Inspector tabs: properties form vs raw JSON source view. Source view
// is for power users who need to edit fields the form doesn't expose
@@ -3981,24 +3963,16 @@ function MetadataResourceEditPageImpl({
{/* ADR-0033 Phase B — generic draft↔published review/diff. Available for
ANY type whenever a pending draft exists; opened by the chat's
- "Review N change(s)" affordance (?review=1) or the toolbar button. */}
-
-
-
- {t('designer.draftReview.title', locale)}
-
- {type} / {name} · {t('designer.canvas.reviewVsPublished', locale)}
-
-
-
-
-
-
-
+ "Review N change(s)" affordance (?review=1) or the header's chip. */}
+ void;
+ /** Open the review. */
+ open: () => void;
+}
+
+/**
+ * ADR-0033 Phase B — a `?review=1` arrival. The draft may have been written
+ * after the page mounted (the AI drafted it), so the page first reads the item
+ * afresh; once that read settles it opens the review when a draft is pending,
+ * and drops `?review=1` from the address (replacing the history entry), so a
+ * refresh or Back does not open it again. The same-item-already-open case is
+ * covered too: the fresh read is asked whatever the page already holds.
+ */
+export function useDraftReviewArrival({ enabled, loading, hasDraft, reload, open }: DraftReviewArrivalInput): void {
+ const [searchParams, setSearchParams] = useSearchParams();
+ const reviewParam = searchParams.get(DRAFT_REVIEW_PARAM);
+ // The latest callbacks and query, for the arrival effect below; refreshed
+ // in an effect of their own, which runs before it.
+ const latest = React.useRef({ reload, open, searchParams, setSearchParams });
+ React.useEffect(() => {
+ latest.current = { reload, open, searchParams, setSearchParams };
+ });
+ const reloadAskedRef = React.useRef(false);
+ React.useEffect(() => {
+ if (reviewParam !== DRAFT_REVIEW_VALUE || !enabled) return;
+ if (!reloadAskedRef.current) {
+ reloadAskedRef.current = true;
+ latest.current.reload();
+ return; // wait for the fresh read to settle before reading hasDraft
+ }
+ if (!loading) {
+ if (hasDraft) latest.current.open();
+ const next = new URLSearchParams(latest.current.searchParams);
+ next.delete(DRAFT_REVIEW_PARAM);
+ latest.current.setSearchParams(next, { replace: true });
+ reloadAskedRef.current = false;
+ }
+ }, [reviewParam, enabled, loading, hasDraft]);
+}
diff --git a/ui/packages/app-shell/src/views/studio-design/StudioPermissionSetPage.fullScreen-36905.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioPermissionSetPage.fullScreen-36905.test.tsx
index 8cf799f6c8b..e03e523bbb1 100644
--- a/ui/packages/app-shell/src/views/studio-design/StudioPermissionSetPage.fullScreen-36905.test.tsx
+++ b/ui/packages/app-shell/src/views/studio-design/StudioPermissionSetPage.fullScreen-36905.test.tsx
@@ -549,3 +549,47 @@ describe('the sharing chip asks before it leaves a dirty matrix (objectstack#369
expect(window.confirm).not.toHaveBeenCalled();
});
});
+
+// objectstack#37269 — a review link (`?review=1`) on a set's page opens the
+// draft review the generic item page opens (`DraftReviewSheet`): the set's
+// pending draft against the published set, with `?review=1` dropped once it is
+// open and the matrix still editable under it.
+describe('a review link opens the draft review on the matrix (objectstack#37269)', () => {
+ const reviewPanel = () => screen.findByTestId('draft-review-panel', undefined, { timeout: 8000 });
+ const SET_ADDRESS = `/studio/${CUSTOM_PKG}/metadata/permission/${SET}?package=${CUSTOM_PKG}`;
+
+ it('`?review=1` shows what the draft changes against the published set, then leaves the address', async () => {
+ clientImpl = makeClient([SET], draftOf('studio'));
+ mount(CUSTOM_PKG, '&review=1');
+ const panel = await reviewPanel();
+ // BODY is the published set; the draft relabels it, and nothing else.
+ expect(within(panel).getByText('label')).toBeInTheDocument();
+ expect(within(panel).getByText('Sales rep (AI)')).toBeInTheDocument();
+ expect(within(panel).queryByText('objects')).toBeNull();
+ expect(screen.getByText(en('designer.draftReview.title'))).toBeInTheDocument();
+ // Read at the page's package, as the matrix's own load reads it.
+ expect(clientImpl.layered).toHaveBeenCalledWith('permission', SET, { packageId: CUSTOM_PKG });
+ await waitFor(() => expect(where()).toBe(SET_ADDRESS));
+ });
+
+ it('editing stays: the review closes onto the matrix, whose rows still take an edit', async () => {
+ clientImpl = makeClient([SET], draftOf('studio'));
+ mount(CUSTOM_PKG, '&review=1');
+ await reviewPanel();
+ fireEvent.keyDown(document.activeElement ?? document.body, { key: 'Escape' });
+ await waitFor(() => expect(screen.queryByTestId('draft-review-panel')).toBeNull());
+ const bulk = await screen.findByTestId('perm-bulk-crm_lead');
+ for (const button of within(bulk).getAllByRole('button')) expect(button).toBeEnabled();
+ });
+
+ it('CONTROL: without `?review=1` a set with a pending draft opens no review', async () => {
+ clientImpl = makeClient([SET], draftOf('studio'));
+ mount(CUSTOM_PKG);
+ await screen.findByTestId('perm-row-crm_lead', undefined, { timeout: 8000 });
+ expect(screen.queryByTestId('draft-review-panel')).toBeNull();
+ expect(screen.queryByText(en('designer.draftReview.title'))).toBeNull();
+ // The matrix's own load is the one draft read: no review read was asked.
+ expect(clientImpl.getDraft).toHaveBeenCalledTimes(1);
+ expect(where()).toBe(SET_ADDRESS);
+ });
+});
diff --git a/ui/packages/app-shell/src/views/studio-design/permissionReviewLinks-37269.test.tsx b/ui/packages/app-shell/src/views/studio-design/permissionReviewLinks-37269.test.tsx
new file mode 100644
index 00000000000..5c0f4c44138
--- /dev/null
+++ b/ui/packages/app-shell/src/views/studio-design/permissionReviewLinks-37269.test.tsx
@@ -0,0 +1,238 @@
+// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
+
+/**
+ * objectstack#37269 — both producers of a review link reach a permission
+ * set's draft review.
+ *
+ * The two producers write `?review=1` for any draft item, a permission set
+ * included, and name no package:
+ * - the Packages page's per-draft link (`PackageDetailSheet`, rendered here
+ * for real with a permission-set draft), to `APP/metadata/TYPE/NAME?review=1`,
+ * which Setup's metadata route sends on to Studio (`SetupMetadataRoute` in
+ * `AppContent.tsx`, re-stated below from the same two helpers; the route
+ * itself is pinned in `AppContent.setupMetadataStudio-28578.test.tsx`);
+ * - the chat's 「Review N change(s)」 (`DraftReviewNavigator` in
+ * `AppContent.tsx`), which navigates to `setupMetadataStudioPath(item,
+ * 'review=1')`, called here with the same arguments.
+ *
+ * Both land on Studio's cross-package leg, where the REAL area hands the set
+ * to its type's own item page, the REAL matrix (`PermissionMatrixEditPage`,
+ * the editor `builtinComponents` registers), with no package. The matrix
+ * opens the generic draft review there (`DraftReviewSheet`): the draft read
+ * by name, as the generic item page reads it, against the published set.
+ */
+
+import '@testing-library/jest-dom/vitest';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import * as React from 'react';
+import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react';
+import { MemoryRouter, Navigate, Route, Routes, useLocation, useNavigate } from 'react-router-dom';
+// The matrix reaches `@objectstack/lint`'s dynamic imports; their first load is
+// paid here, at collection, never inside a case's clock (`check:test-source-alias`).
+import '@objectstack/lint';
+
+const PKG = 'com.acme.crm';
+const SET = 'acme_sales_rep';
+const PUBLISHED = { name: SET, label: 'Sales rep', objects: { acme_lead: { allowRead: true } }, fields: {} };
+const DRAFT = {
+ type: 'permission',
+ name: SET,
+ item: { ...PUBLISHED, objects: { acme_lead: { allowRead: true, allowEdit: true } } },
+};
+
+function makeClient(draft: typeof DRAFT | null) {
+ return {
+ save: vi.fn(async (_t: string, _n: string, body: Record) => body),
+ reset: vi.fn(async () => ({})),
+ withPreviewDrafts() {
+ return this;
+ },
+ list: vi.fn(async (type: string) => {
+ if (type === 'object') return [{ name: 'acme_lead', label: 'Lead' }];
+ return type === 'permission' ? [{ name: SET, label: 'Sales rep', _packageId: PKG }] : [];
+ }),
+ listDrafts: vi.fn(async () => (draft ? [{ type: 'permission', name: SET, packageId: PKG }] : [])),
+ layered: vi.fn(async () => ({ effective: PUBLISHED, code: null, overlay: null, overlayScope: null })),
+ getDraft: vi.fn(async () => draft),
+ get: vi.fn(async () => ({ fields: [] })),
+ };
+}
+
+let clientImpl: ReturnType;
+vi.mock('../metadata-admin/useMetadata', async (importOriginal) => ({
+ ...(await importOriginal>()),
+ useMetadataClient: () => clientImpl,
+ useMetadataTypes: () => ({
+ loading: false,
+ error: null,
+ entries: [{ type: 'permission', label: 'Permission', allowEnvironmentOverlay: false, allowRuntimeCreate: true }],
+ }),
+}));
+vi.mock('../../hooks/useCanAuthorMetadata', async (importOriginal) => ({
+ ...(await importOriginal>()),
+ useCanAuthorMetadata: () => true,
+ useCanReadAuthoringTrail: () => true,
+}));
+vi.mock('../metadata-admin/catalog-scope', async (importOriginal) => ({
+ ...(await importOriginal>()),
+ useWalledCatalogReadOnly: () => false,
+}));
+vi.mock('./packages-io.js', async (importOriginal) => ({
+ ...(await importOriginal>()),
+ fetchListedPackageManifests: vi.fn(async () => new Map()),
+}));
+vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn() } }));
+
+import { t } from '../metadata-admin/i18n';
+import { registerMetadataResource } from '../metadata-admin/registry';
+import { PermissionMatrixEditPage } from '../metadata-admin/PermissionMatrixEditor';
+import { PackageDetailSheet, type InstalledPackageRow } from '../metadata-admin/PackagesPage';
+import { StudioMetadataArea } from './StudioMetadataArea';
+import { setupMetadataRest, setupMetadataStudioPath } from './setupMetadataRedirect';
+
+window.matchMedia = ((query: string) => ({
+ matches: false,
+ media: query,
+ onchange: null,
+ addEventListener: () => {},
+ removeEventListener: () => {},
+ addListener: () => {},
+ removeListener: () => {},
+ dispatchEvent: () => false,
+})) as unknown as typeof window.matchMedia;
+
+const PACKAGE_ROW: InstalledPackageRow = {
+ manifest: { id: PKG, name: 'Acme CRM', version: '1.0.0', type: 'app' },
+ enabled: true,
+ status: 'installed',
+ source: 'authored',
+ writable: true,
+};
+
+function respond(body: unknown) {
+ const text = JSON.stringify(body);
+ return { ok: true, status: 200, text: async () => text, headers: new Headers(), json: async () => JSON.parse(text) } as unknown as Response;
+}
+
+/** Setup's metadata route as `AppContent` declares it (`SetupMetadataRoute`): on to Studio, query kept. */
+function SetupMetadataRoute() {
+ const location = useLocation();
+ const target = setupMetadataStudioPath(setupMetadataRest(location.pathname) ?? '', location.search, location.hash);
+ return target ? : ;
+}
+
+/** The chat's 「Review N change(s)」, as `DraftReviewNavigator` navigates it. */
+function ChatReview({ type, name }: { type: string; name: string }) {
+ const navigate = useNavigate();
+ return (
+