Skip to content

fix(app-shell,console): publish resolveHostAppSegment from the package root and delete the console's copy - #4318

Merged
yinlianghui merged 1 commit into
mainfrom
claude/issue-4280-resolver-root-export
Aug 11, 2026
Merged

fix(app-shell,console): publish resolveHostAppSegment from the package root and delete the console's copy#4318
yinlianghui merged 1 commit into
mainfrom
claude/issue-4280-resolver-root-export

Conversation

@yinlianghui

Copy link
Copy Markdown
Collaborator

Part of #4280 — the mechanical dedup half only. The card's optional rider (mounting ConsoleLayout on the internal /forms/:name route) is deliberately NOT in this PR and was not ruled; #4280 stays open for that decision.

History: #4109 / PR #4279 disclosed this duplication rather than smuggling it, and #4074 is where the resolution order was won.

What was wrong

resolveHostAppSegment answers "which app should host a framework-owned, app-INDEPENDENT page for this user", and its docblock argues at length that its resolution order is one hard-won definition. It lived in packages/app-shell/src/utils/appRoute.ts, and packages/app-shell published only its . export — whose barrel re-exported ./utils nowhere. The definition was therefore unreachable from every consumer outside the package.

Something outside the package needed it anyway. #4109 had to name a host app for the record an internal /forms/:name submit creates, could not import the resolver, and shipped a documented local subset in apps/console/src/components/createdRecordPath.ts: steps 1 and 2 only, returning null where upstream falls through further. Two readers of one prose contract (#3367 / #3842) — the next edit to the order lands on one copy.

What this PR does

  1. packages/app-shell/src/index.ts — publishes resolveHostAppSegment from the package root, alongside the two predicates it is defined in terms of (appRouteSegment, filterActiveApps). Sourced from the existing ./utils sub-barrel, which already re-exported all three, matching the barrel's grouped-named-re-export idiom (./layout, ./views, ./hooks, ./context). matchAppBySegment and the appStudio* family are deliberately left unpublished — no consumer outside the package, so no surface.
  2. apps/console/src/components/createdRecordPath.ts — pure deletion. routeSegment, openableApps and resolveRecordHostAppSegment are gone; the module keeps the URL shape and delegates the choice. The app-record type it accepts is now derived from the resolver's own signature (NonNullable< Parameters< typeof resolveHostAppSegment > [0] > [number]) rather than re-declared — the package publishes the function but not its parameter type, and re-stating the field set was itself part of the duplication. The call site cannot drift from the shape the resolver accepts.
  3. Tests and a changeset (@object-ui/app-shell minor, @object-ui/console minor — never major, per the fixed-group rule).

InternalFormRoute.tsx and FormPage.tsx are untouched: the import path did not change and HostAppLike keeps its name and its meaning.

Behaviour delta — deliberate, not incidental

Converging on the full resolver kills the documented divergence, which is what the card exists for. Two cases that answered null now name an app:

casebeforeafter
empty openable list, preferred setnullpreferred, unchecked (upstream step 3)
no apps and nothing preferrednullsetup (upstream step 4)
apps that all filter out (inactive/hidden)nullsetup
an app carrying neither _packageId nor namenullsetup

The first row is upstream's judgement that an empty list means "not loaded yet" at least as often as "this user has no apps", and that demoting someone demonstrably rendering inside /apps/{preferred}/... would reintroduce the defect #4074 removed.

User-visible consequence, on the created-record redirect only.FormPage reads a null path as "no record page to land on" and answers by confirming the submit in place (setSubmitted(true)) instead of navigating. With the host app now always named, a submit that previously stopped on that confirmation navigates to the record under the resolved app — the same answer every other record link in the console already gives (RecordDetailView, SearchResultsPage, useObjectActions, InterfaceListPage). The write itself was never at stake; only where the user is put afterwards. A user with zero openable apps who previously saw the confirmation now lands on /apps/setup/{object}/record/{id}.

The one nullbuildCreatedRecordPath still returns means what it always should have: there is no record to point at, because the caller has no object or no id. That is pinned.

Verification

The built surface, not just the source.apps/console's tsconfig carries no path aliases, so its tsc resolves @object-ui/app-shell through the package's exports field to dist/index.d.ts — the published surface. After pnpm --filter '@object-ui/app-shell...' build:

  • dist/index.d.ts:23 carries export { resolveHostAppSegment, appRouteSegment, filterActiveApps } from './utils';, and dist/utils/appRoute.d.ts:80 the full signature returning string;
  • dist/index.js:33 carries the same line, so the runtime surface matches the type surface;
  • reverse verification — deleting that one line from the built dist/index.d.ts and re-running the console's tsc --noEmit produced exactly the predicted red, which is what proves the console resolves through dist rather than through src:
src/components/createdRecordPath.test.ts(14,10): error TS2305: Module '"@object-ui/app-shell"' has no exported member 'resolveHostAppSegment'.
src/components/createdRecordPath.ts(57,10): error TS2305: Module '"@object-ui/app-shell"' has no exported member 'resolveHostAppSegment'.

Testspnpm exec vitest run apps/console/src/components/createdRecordPath.test.ts (repo root, per #3378): 16 passed. The wider sweep packages/app-shell/src/utils/ apps/console/src/components/: 28 files, 491 tests, all passing. Type-check green for both packages (4 tsc invocations: --noEmit plus the typetests/node project each). ESLint clean on all three changed files.

The suite gained a pin on the package-root export itself, imported from @object-ui/app-shell and never from the deep path — the deep path resolves either way and would hold the pin green through exactly the regression it exists to catch.

Reverse verification, predictions first.

  • Restore the deleted local subset (git checkout origin/main -- createdRecordPath.ts). Predicted: exactly the 4 delta cases go red, the 2 root-export pins and the other 10 stay green. Actual: Tests 4 failed | 12 passed (16), each failure reading AssertionError: expected null to be '/apps/.../obj/record/1'. Match.
  • Drop only the barrel line (git checkout origin/main -- app-shell/src/index.ts). Predicted: the ESM link fails and the whole file fails to collect, 0 tests run. Actual: the direction held but the failure mode did not — Vite's SSR transform turns a missing named export into undefined at runtime rather than a link error, so the file collected and 15 of 16 failed with TypeError: resolveHostAppSegment is not a function (the 16th is the no-object/no-id case, which returns before reaching the resolver). Recorded as measured rather than as predicted.

Reverting was done with git checkout against a committed HEAD throughout — never git stash, which shares one stack across every worktree of the repo (objectui#3430).

One piece of drift this PR creates and does not fix

FormPage.tsx (around line 123) justifies its FORM_RECORD_ID_PARAM literal by pointing at "the same unreachability createdRecordPath.ts documents for resolveHostAppSegment". Its own claim stays true — the root still does not re-export ./urlParams — but the comparison it draws is now stale, because createdRecordPath.ts documents no such unreachability any more. Left alone deliberately: FormPage was fenced off for this dispatch (#4292 had just landed there), and the fix is a one-clause comment edit rather than anything behavioural.


Generated by Claude Code

…e root and delete the console's copy (#4280)
`resolveHostAppSegment` lived in `app-shell/src/utils/appRoute.ts`, and the
package published only its `.` export — whose barrel re-exported `./utils`
nowhere. objectui#4109 needed the host-app resolution order for the record an
internal `/forms/:name` submit creates, could not import it, and shipped a
documented local subset (steps 1-2, `null` where upstream falls through).
The root barrel now exports `resolveHostAppSegment` alongside the two
predicates it is defined in terms of, and `createdRecordPath.ts` keeps only
the URL shape. Its app-record type is derived from the resolver's signature
rather than re-declared, so the call site cannot drift from it.
Semantics converge on the full resolver: an empty openable list with a
preferred app keeps that app unchecked, and anything else unresolvable lands
on `setup`. A created-record redirect that used to stop on FormPage's in-place
confirmation now navigates to the record — the same answer every other record
link in the console gives.
Part of #4280.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Qqyix2QcnpUC9XeYVDzx3
@vercel

vercelBot commented Aug 11, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
objectuiIgnoredIgnoredAug 11, 2026 1:49pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

MetricValueBudget
Main entry (gzip)29.5 KB350 KB
Entry fileindex-CyvWbXTM.js
StatusPASS

📦 Bundle Size Report

PackageSizeGzipped
app-shell (index.js)9.56KB3.59KB
app-shell (runtime-config.js)7.42KB2.32KB
app-shell (types.js)0.01KB0.04KB
app-shell (urlParams.js)8.92KB3.41KB
auth (AuthContext.js)0.31KB0.24KB
auth (AuthGuard.js)1.17KB0.53KB
auth (AuthProvider.js)22.10KB4.37KB
auth (AuthShell.js)3.49KB1.40KB
auth (ForgotPasswordForm.js)12.21KB3.45KB
auth (LoginForm.js)18.13KB5.39KB
auth (PreviewBanner.js)0.90KB0.50KB
auth (RegisterForm.js)6.64KB2.21KB
auth (SocialSignInButtons.js)9.60KB3.89KB
auth (UserMenu.js)3.40KB1.22KB
auth (auth-gate-events.js)1.29KB0.66KB
auth (authStyles.js)5.04KB1.72KB
auth (createAuthClient.js)35.76KB9.11KB
auth (createAuthenticatedFetch.js)4.37KB1.69KB
auth (index.js)2.35KB1.07KB
auth (org-roles.js)6.66KB2.78KB
auth (phone-identifier.js)1.11KB0.66KB
auth (types.js)0.59KB0.35KB
auth (useAuth.js)4.91KB0.87KB
auth (useIsWorkspaceAdmin.js)1.61KB0.85KB
collaboration (CommentThread.js)26.07KB7.56KB
collaboration (LiveCursors.js)3.17KB1.27KB
collaboration (PresenceAvatars.js)6.49KB2.64KB
collaboration (PresenceProvider.js)2.79KB1.13KB
collaboration (index.js)1.65KB0.73KB
collaboration (useCollaborationTranslation.js)6.05KB2.52KB
collaboration (useCommentSearch.js)1.98KB0.88KB
collaboration (useConflictResolution.js)7.75KB1.86KB
collaboration (useMentionNotifications.js)1.81KB0.68KB
collaboration (usePresence.js)6.33KB1.84KB
collaboration (useRealtimeSubscription.js)7.91KB2.01KB
components (index.js)488.96KB108.42KB
core (index.js)3.04KB1.15KB
create-plugin (index.js)10.08KB3.26KB
data-objectstack (index.js)150.04KB39.79KB
fields (index.js)228.45KB56.62KB
i18n (LocalizationContext.js)1.76KB0.96KB
i18n (currency.js)1.22KB0.64KB
i18n (i18n.js)4.32KB1.77KB
i18n (index.js)2.65KB1.06KB
i18n (pickLocalized.js)1.70KB0.83KB
i18n (provider.js)16.38KB5.47KB
i18n (useObjectLabel.js)27.59KB6.63KB
i18n (useSafeTranslation.js)4.52KB1.96KB
layout (index.js)38.98KB10.85KB
mobile (MobileProvider.js)0.92KB0.49KB
mobile (ResponsiveContainer.js)0.94KB0.38KB
mobile (breakpoints.js)1.51KB0.70KB
mobile (createOfflineDataSource.js)5.61KB1.74KB
mobile (index.js)1.50KB0.62KB
mobile (offlineQueue.js)3.91KB1.35KB
mobile (pwa.js)0.97KB0.49KB
mobile (serviceWorker.js)1.48KB0.62KB
mobile (serviceWorkerSource.js)3.41KB1.48KB
mobile (useBreakpoint.js)1.54KB0.65KB
mobile (useGesture.js)6.96KB1.98KB
mobile (useOfflineSync.js)1.99KB0.72KB
mobile (usePullToRefresh.js)2.53KB0.85KB
mobile (useResponsive.js)0.71KB0.42KB
mobile (useResponsiveConfig.js)1.36KB0.63KB
mobile (useSpecGesture.js)4.32KB1.64KB
mobile (useTouchTarget.js)1.01KB0.54KB
permissions (MePermissionsProvider.js)8.75KB3.06KB
permissions (PermissionContext.js)0.31KB0.25KB
permissions (PermissionGuard.js)0.89KB0.45KB
permissions (PermissionProvider.js)3.67KB1.12KB
permissions (evaluator.js)4.41KB1.44KB
permissions (index.js)0.91KB0.41KB
permissions (store.js)0.91KB0.42KB
permissions (useFieldPermissions.js)1.28KB0.52KB
permissions (usePermissions.js)1.55KB0.71KB
plugin-ai (index.js)15.71KB3.79KB
plugin-calendar (index.js)45.23KB12.45KB
plugin-charts (index.js)61.73KB17.54KB
plugin-chatbot (index.js)180.33KB42.79KB
plugin-dashboard (index.js)121.07KB31.39KB
plugin-designer (index.js)210.91KB42.67KB
plugin-detail (index.js)238.98KB59.76KB
plugin-editor (index.js)2.46KB1.10KB
plugin-form (index.js)114.58KB27.68KB
plugin-gantt (index.js)164.14KB39.98KB
plugin-grid (index.js)187.97KB49.90KB
plugin-kanban (index.js)48.60KB13.41KB
plugin-list (index.js)109.93KB26.65KB
plugin-map (index.js)17.00KB5.32KB
plugin-markdown (index.js)13.72KB4.69KB
plugin-report (index.js)40.60KB10.58KB
plugin-timeline (index.js)26.21KB7.52KB
plugin-tree (index.js)8.50KB2.88KB
plugin-view (index.js)84.03KB20.55KB
providers (DataSourceProvider.js)0.75KB0.39KB
providers (MetadataProvider.js)1.37KB0.59KB
providers (ThemeProvider.js)1.90KB0.85KB
providers (UploadProvider.js)11.71KB3.53KB
providers (index.js)0.44KB0.22KB
providers (types.js)0.01KB0.04KB
react-runtime (index.js)5.67KB2.37KB
react (LazyPluginLoader.js)3.77KB1.33KB
react (SchemaRenderer.js)23.71KB7.96KB
react (data-invalidation.js)5.05KB2.08KB
react (index.js)1.23KB0.66KB
react (spec-input.js)0.20KB0.18KB
sdui-parser (codegen.js)4.09KB1.74KB
sdui-parser (index.js)4.47KB2.03KB
sdui-parser (parse.js)10.04KB2.82KB
sdui-parser (types.js)0.29KB0.24KB
sdui-parser (validate.js)4.69KB1.48KB
types (ai.js)0.20KB0.17KB
types (api-types.js)0.20KB0.18KB
types (app.js)2.87KB0.99KB
types (base.js)0.20KB0.18KB
types (blocks.js)0.20KB0.18KB
types (complex.js)0.20KB0.18KB
types (crud.js)0.20KB0.18KB
types (dashboard-filter-alias.js)6.23KB2.74KB
types (data-display.js)0.20KB0.18KB
types (data-protocol.js)0.20KB0.19KB
types (data.js)0.20KB0.18KB
types (designer.js)1.87KB0.85KB
types (disclosure.js)0.20KB0.18KB
types (error-code.js)1.54KB0.88KB
types (feedback.js)0.20KB0.18KB
types (field-types.js)0.20KB0.18KB
types (form.js)0.20KB0.18KB
types (http-retry.js)4.32KB2.02KB
types (index.js)3.05KB1.52KB
types (layout.js)0.20KB0.18KB
types (managed-by.js)0.19KB0.18KB
types (mobile.js)2.59KB1.31KB
types (navigation.js)0.20KB0.18KB
types (objectql.js)0.20KB0.18KB
types (overlay.js)0.20KB0.18KB
types (permissions.js)0.20KB0.18KB
types (plugin-scope.js)0.20KB0.18KB
types (record-components.js)0.20KB0.19KB
types (record-semantics.js)1.28KB0.67KB
types (registry.js)0.20KB0.18KB
types (reports.js)0.20KB0.18KB
types (spec-report.js)5.05KB1.93KB
types (system-fields.js)3.33KB1.54KB
types (theme.js)0.20KB0.18KB
types (ui-action.js)3.40KB1.71KB
types (views.js)0.20KB0.18KB
types (widget.js)0.20KB0.18KB

Size Limits

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

@yinlianghui
yinlianghui marked this pull request as ready for review August 11, 2026 14:00
@yinlianghui
yinlianghui added this pull request to the merge queueAug 11, 2026
Merged via the queue into main with commit e4d1c08Aug 11, 2026
21 checks passed
@yinlianghui
yinlianghui deleted the claude/issue-4280-resolver-root-export branch August 11, 2026 14:00
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@yinlianghui@claude