Skip to content

feat(approvals): register an approvals:inbox component ref and de-hardcode Home's approvals entry - #4071

Merged
os-zhuang merged 2 commits into
mainfrom
claude/issue-7231-approvals-inbox-component-ref
Aug 10, 2026
Merged

feat(approvals): register an approvals:inbox component ref and de-hardcode Home's approvals entry#4071
os-zhuang merged 2 commits into
mainfrom
claude/issue-7231-approvals-inbox-component-ref

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Fixes objectstack-ai/objectstack#7231

Part of objectstack-ai/objectstack#7213 — entry convergence at the metadata level. This is the objectui half: give the Approvals Inbox an addressable registry key, and stop Home's only approvals entry from routing every user through the setup app.

Premise re-verified against origin/main

Every fact the issue states still holds, re-read at 59df371f7:

  • system/approvals is declared in apps/console/src/AppContent.tsx's systemRoutes fragment and passed as both extraRoutes and extraRoutesNoApp, so /apps/{any app}/system/approvals already resolves — the page was never bound to setup.
  • packages/app-shell/src/console/home/HomePage.tsx hardcoded navigate('/apps/setup/system/approvals').
  • No approvals:* key existed in the component registry.

One PM assumption was worth measuring rather than assuming, and it held: the component/:ns/:name/* route and the system/approvals route are both relative routes under /apps/:appName/* (apps/console/src/App.tsx), so ApprovalsInboxPage reads the same :appName and the same ?request={id} on either. ApprovalsInboxPage is therefore unmodified — objectui#2763's rebuild is explicitly not started here.

One assumption did not survive contact, and shaped the fix: Home renders at /home, outside the /apps/:appName/* router, so InboxPopover's currentAppName ?? params.appName cannot be copied literally — params.appName does not exist there. currentAppName is the only signal, it is published by ConsoleLayout on app mount, and it is stale by construction (undefined on a cold landing at /home; it outlives the app it names). See below for what that made the resolution.

Changes

1. approvals:inbox in the component registry — new apps/console/src/registerApprovalsComponents.tsx, lazy-loading ApprovalsInboxPage, side-effect-imported from main.tsx beside the developer / studio / account registrations. A { type: 'component', componentRef: 'approvals:inbox' } nav item now renders the full inbox at /apps/{app}/component/approvals/inbox.

The standalone system/approvals route is untouched: server notification and email deep links carry /system/approvals?request={id} and InboxPopover app-prefixes them. The ref is purely additive indirection, which is the point — objectui#2763 repoints the key later and no nav metadata churns.

2. Home's card navigates within an app the user can actually open. Resolution order:

  1. the app they last had open, re-checked against the live active-app list (matchAppBySegment), so a remembered app that has since been deactivated or hidden is not resurrected as a dead link;
  2. their first active app — arbitrary but reachable, and on a business user's workspace that is a business app rather than setup;
  3. setup, which is not the zero-app case: activeApps.length === 0 returns Home's welcome empty state before the action center exists, so this producer never runs there. What is left is the degenerate app with neither _packageId nor name — nothing to build a URL from, so the historical target is the least-surprising last resort. That unreachability is pinned as a precondition case, so it goes red if it ever stops being true.

InboxPopover is deliberately untouched — it was already correct, and rewriting it into a shared helper is not this card's scope.

Tests

  • apps/console/src/__tests__/approvalsInboxComponentRef.test.tsx — the ref resolves; componentRefToUrlSegments maps it to component/approvals/inbox (URLs in the test are built from the ref through that helper, so key and URL cannot drift); the page mounted via the component route sees :appName and ?request=; the standalone route hands it the identical inputs. The page is stubbed at its module boundary with a probe echoing exactly those two router inputs — the entry exercised is the real registered one, Suspense wrapper included.
  • packages/app-shell/src/console/home/__tests__/HomePage.approvalsTarget.test.tsx — five cases: remembered app, _packageId spelling, cold landing at /home, deactivated remembered app, and the zero-app precondition.

pnpm exec vitest run apps/console/ packages/app-shell/343 files, 3222 passed, 1 skipped. type-check green for both packages. ESLint on the touched files: 0 errors (the no-explicit-any / react-refresh warnings are the same ones the sibling register*Components files and the rest of HomePage already carry).

Reverse verification, direction predicted before running: reverting HomePage.tsx and main.tsx to origin/main turned the four Home target cases red naming /apps/setup/system/approvals, while the zero-app precondition stayed green (it is about the empty state, not the target). The registry cases stayed green, as expected — the registration module itself was not reverted.


Generated by Claude Code

claude added 2 commits August 10, 2026 03:40
…ovals link

Give the Approvals Inbox an addressable identity — `approvals:inbox` in the
component registry — and stop Home's "pending approvals" card from sending
every user into the setup app (objectstack#7231).

- apps/console: new registerApprovalsComponents module, imported by main.tsx
  alongside the developer/studio/account registrations. The standalone
  `system/approvals` route stays: notification and email deep links carry it.
- app-shell: HomePage resolves the approvals target from the app the user last
  had open, re-checked against the live active-app list, then their first
  available app; `setup` only as the last resort.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9U1G2piXmYrhYQX96XUyv
`apps/console`'s tsconfig ships no `@types/node`, so the "does main.tsx
side-effect-import the registration" guard could not be typechecked there.
Dropped rather than widening the app's `types` for a test; the docblock now
says so instead of implying coverage that is not present.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9U1G2piXmYrhYQX96XUyv
@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
objectui Ignored Ignored Aug 10, 2026 3:59am

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

Metric Value Budget
Main entry (gzip) 28.3 KB 350 KB
Entry file index-AXMOdCxM.js
Status PASS

📦 Bundle Size Report

Package Size Gzipped
app-shell (index.js) 8.66KB 3.13KB
app-shell (runtime-config.js) 7.42KB 2.32KB
app-shell (types.js) 0.01KB 0.04KB
app-shell (urlParams.js) 7.57KB 2.97KB
auth (AuthContext.js) 0.31KB 0.24KB
auth (AuthGuard.js) 1.17KB 0.53KB
auth (AuthProvider.js) 22.10KB 4.37KB
auth (AuthShell.js) 3.49KB 1.40KB
auth (ForgotPasswordForm.js) 12.21KB 3.45KB
auth (LoginForm.js) 18.13KB 5.39KB
auth (PreviewBanner.js) 0.90KB 0.50KB
auth (RegisterForm.js) 6.64KB 2.21KB
auth (SocialSignInButtons.js) 9.60KB 3.89KB
auth (UserMenu.js) 3.40KB 1.22KB
auth (auth-gate-events.js) 1.29KB 0.66KB
auth (authStyles.js) 5.04KB 1.72KB
auth (createAuthClient.js) 35.76KB 9.11KB
auth (createAuthenticatedFetch.js) 4.37KB 1.69KB
auth (index.js) 2.35KB 1.07KB
auth (org-roles.js) 6.66KB 2.78KB
auth (phone-identifier.js) 1.11KB 0.66KB
auth (types.js) 0.59KB 0.35KB
auth (useAuth.js) 4.91KB 0.87KB
auth (useIsWorkspaceAdmin.js) 1.61KB 0.85KB
collaboration (CommentThread.js) 26.07KB 7.56KB
collaboration (LiveCursors.js) 3.17KB 1.27KB
collaboration (PresenceAvatars.js) 6.49KB 2.64KB
collaboration (PresenceProvider.js) 2.79KB 1.13KB
collaboration (index.js) 1.65KB 0.73KB
collaboration (useCollaborationTranslation.js) 6.05KB 2.52KB
collaboration (useCommentSearch.js) 1.98KB 0.88KB
collaboration (useConflictResolution.js) 7.75KB 1.86KB
collaboration (useMentionNotifications.js) 1.81KB 0.68KB
collaboration (usePresence.js) 6.33KB 1.84KB
collaboration (useRealtimeSubscription.js) 7.91KB 2.01KB
components (index.js) 483.72KB 106.71KB
core (index.js) 3.04KB 1.15KB
create-plugin (index.js) 10.08KB 3.26KB
data-objectstack (index.js) 139.61KB 35.99KB
fields (index.js) 228.51KB 56.69KB
i18n (LocalizationContext.js) 1.76KB 0.96KB
i18n (currency.js) 1.22KB 0.64KB
i18n (i18n.js) 4.32KB 1.77KB
i18n (index.js) 2.65KB 1.06KB
i18n (pickLocalized.js) 1.70KB 0.83KB
i18n (provider.js) 9.48KB 3.27KB
i18n (useObjectLabel.js) 27.59KB 6.63KB
i18n (useSafeTranslation.js) 4.52KB 1.96KB
layout (index.js) 38.84KB 10.80KB
mobile (MobileProvider.js) 0.92KB 0.49KB
mobile (ResponsiveContainer.js) 0.94KB 0.38KB
mobile (breakpoints.js) 1.51KB 0.70KB
mobile (createOfflineDataSource.js) 5.61KB 1.74KB
mobile (index.js) 1.50KB 0.62KB
mobile (offlineQueue.js) 3.91KB 1.35KB
mobile (pwa.js) 0.97KB 0.49KB
mobile (serviceWorker.js) 1.48KB 0.62KB
mobile (serviceWorkerSource.js) 3.41KB 1.48KB
mobile (useBreakpoint.js) 1.54KB 0.65KB
mobile (useGesture.js) 6.96KB 1.98KB
mobile (useOfflineSync.js) 1.99KB 0.72KB
mobile (usePullToRefresh.js) 2.53KB 0.85KB
mobile (useResponsive.js) 0.71KB 0.42KB
mobile (useResponsiveConfig.js) 1.36KB 0.63KB
mobile (useSpecGesture.js) 4.32KB 1.64KB
mobile (useTouchTarget.js) 1.01KB 0.54KB
permissions (MePermissionsProvider.js) 8.75KB 3.06KB
permissions (PermissionContext.js) 0.31KB 0.25KB
permissions (PermissionGuard.js) 0.89KB 0.45KB
permissions (PermissionProvider.js) 3.67KB 1.12KB
permissions (evaluator.js) 4.41KB 1.44KB
permissions (index.js) 0.91KB 0.41KB
permissions (store.js) 0.91KB 0.42KB
permissions (useFieldPermissions.js) 1.28KB 0.52KB
permissions (usePermissions.js) 1.55KB 0.71KB
plugin-ai (index.js) 15.71KB 3.79KB
plugin-calendar (index.js) 45.23KB 12.45KB
plugin-charts (index.js) 61.49KB 17.48KB
plugin-chatbot (index.js) 180.33KB 42.79KB
plugin-dashboard (index.js) 118.50KB 30.66KB
plugin-designer (index.js) 210.51KB 42.51KB
plugin-detail (index.js) 237.80KB 59.48KB
plugin-editor (index.js) 2.46KB 1.10KB
plugin-form (index.js) 113.81KB 27.53KB
plugin-gantt (index.js) 162.79KB 39.67KB
plugin-grid (index.js) 187.97KB 49.79KB
plugin-kanban (index.js) 48.53KB 13.38KB
plugin-list (index.js) 109.73KB 26.55KB
plugin-map (index.js) 17.00KB 5.32KB
plugin-markdown (index.js) 13.72KB 4.69KB
plugin-report (index.js) 40.58KB 10.58KB
plugin-timeline (index.js) 26.21KB 7.52KB
plugin-tree (index.js) 8.50KB 2.88KB
plugin-view (index.js) 84.03KB 20.55KB
providers (DataSourceProvider.js) 0.75KB 0.39KB
providers (MetadataProvider.js) 1.37KB 0.59KB
providers (ThemeProvider.js) 1.90KB 0.85KB
providers (UploadProvider.js) 11.71KB 3.53KB
providers (index.js) 0.44KB 0.22KB
providers (types.js) 0.01KB 0.04KB
react-runtime (index.js) 5.67KB 2.37KB
react (LazyPluginLoader.js) 3.77KB 1.33KB
react (SchemaRenderer.js) 23.71KB 7.95KB
react (data-invalidation.js) 5.05KB 2.08KB
react (index.js) 1.23KB 0.66KB
react (spec-input.js) 0.20KB 0.18KB
sdui-parser (codegen.js) 4.09KB 1.74KB
sdui-parser (index.js) 4.47KB 2.03KB
sdui-parser (parse.js) 10.04KB 2.82KB
sdui-parser (types.js) 0.29KB 0.24KB
sdui-parser (validate.js) 4.69KB 1.48KB
types (ai.js) 0.20KB 0.17KB
types (api-types.js) 0.20KB 0.18KB
types (app.js) 2.87KB 0.99KB
types (base.js) 0.20KB 0.18KB
types (blocks.js) 0.20KB 0.18KB
types (complex.js) 0.20KB 0.18KB
types (crud.js) 0.20KB 0.18KB
types (data-display.js) 0.20KB 0.18KB
types (data-protocol.js) 0.20KB 0.19KB
types (data.js) 0.20KB 0.18KB
types (designer.js) 1.87KB 0.85KB
types (disclosure.js) 0.20KB 0.18KB
types (error-code.js) 1.54KB 0.88KB
types (feedback.js) 0.20KB 0.18KB
types (field-types.js) 0.20KB 0.18KB
types (form.js) 0.20KB 0.18KB
types (http-retry.js) 4.32KB 2.02KB
types (index.js) 2.71KB 1.34KB
types (layout.js) 0.20KB 0.18KB
types (managed-by.js) 0.19KB 0.18KB
types (mobile.js) 2.59KB 1.31KB
types (navigation.js) 0.20KB 0.18KB
types (objectql.js) 0.20KB 0.18KB
types (overlay.js) 0.20KB 0.18KB
types (permissions.js) 0.20KB 0.18KB
types (plugin-scope.js) 0.20KB 0.18KB
types (record-components.js) 0.20KB 0.19KB
types (record-semantics.js) 1.28KB 0.67KB
types (registry.js) 0.20KB 0.18KB
types (reports.js) 0.20KB 0.18KB
types (spec-report.js) 5.05KB 1.93KB
types (system-fields.js) 3.33KB 1.54KB
types (theme.js) 0.20KB 0.18KB
types (ui-action.js) 3.40KB 1.71KB
types (views.js) 0.20KB 0.18KB
types (widget.js) 0.20KB 0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

@os-zhuang
os-zhuang marked this pull request as ready for review August 10, 2026 04:10
@os-zhuang
os-zhuang added this pull request to the merge queue Aug 10, 2026
Merged via the queue into main with commit 28c3856 Aug 10, 2026
21 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-7231-approvals-inbox-component-ref branch August 10, 2026 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[approvals][console] Register an approvals:inbox component-registry key and de-hardcode the Approvals Inbox entry links

2 participants