feat(app-shell): ADR-0048 Phase 2 — prefer-local metadata resolution#1688
Merged
Conversation
Two installed packages may legitimately ship the same bare name (e.g. a `page` named `home`); the install-time namespace gate keeps their namespaces distinct and resolution disambiguates by container. Add `preferLocal(list, name, ownerPackageId)`: prefer the item whose `_packageId` matches the active app's package, falling back to the first name match (preserving prior behaviour when the owner is unknown — runtime/DB apps with no `_packageId`). Wire it at the bare-name resolution sites: PageView, DashboardView, ReportView (rendered defs) and AppHeader (breadcrumb labels). The active app is read from `useExpressionContext().app` / AppHeader's `currentApp`. v1 = namespace as the route key (`/apps/crm`), so URLs are unchanged. Test: utils/__tests__/preferLocal.test.ts (6). app-shell views/utils/layout suites green (308). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Frontend prefer-local resolution for ADR-0048. Pairs with framework PR objectstack-ai/objectstack#1810 (namespace install gate + package-scoped
getItem, ADR pivoted to option A = package id as canonical route key).What
Two installed packages may ship the same bare name (a
pagenamedhome). The frontend mirrored the backend's first-match-wins bug:pages.find(p => p.name === pageName)over the merged list returns whichever package loaded first.Adds
preferLocal(list, name, ownerPackageId)— prefers the item whose_packageIdmatches the active app's package, falling back to the first name match when the owner is unknown (runtime/DB apps with no_packageId). Wired at the bare-name resolution sites:PageView,DashboardView,ReportView(rendered defs) andAppHeader(breadcrumb labels). The active app comes fromuseExpressionContext().app/currentApp.This scopes by
_packageId— i.e. it is already aligned with option A (package id is the identity/scope key), independent of what the URL segment looks like.Scope
This PR is the prefer-local half — it disambiguates page/dashboard/report within the active app. The complementary route-key migration (
/apps/:appName→ package id, and selecting the active app by_packageIdinstead ofname) is a larger ~20-site navigation change requiring live verification, tracked as ADR-0048 "Phase 2 frontend (remaining)" and handled separately.Tests
utils/__tests__/preferLocal.test.ts(6): prefer-by-owner, fallbacks, missing inputs, single-item.🤖 Generated with Claude Code