Uh oh!
There was an error while loading. Please reload this page.
fix(nav): 导航侧最后 4 处生产端直发规范 metadata 路由,不再绕已废弃的 component/metadata 别名 (#3660) - #3668
Merged
Conversation
… the deprecated alias (#3660) The System hub's "Metadata" and "Datasources" cards, and the `sys-datasources` entry in both AppSidebar and UnifiedSidebar, aimed at `component/metadata/{directory,resource?type=datasource}`. app-shell declares those spellings as legacy aliases whose route element is `LegacyMetadataRedirect` — a bare Navigate onto `metadata` and `metadata/datasource`. Each click paid a redundant hop plus a re-render. All four now name the destination directly. Endpoints are byte-identical to what the alias hop computed; only the intermediate hop is gone. The alias routes are untouched and stay reachable for bookmarks and external links. Completes #3639, which fixed the console host's two redirects and enumerated these four as the remainder. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
The two sidebars' `sys-datasources` entry now names the canonical `…/metadata/datasource` route, so three comments claiming the setup left-nav points at the legacy alias became false as of the previous commit. Rewritten as positive statements of what is true now. Per #3656, none of them re-plants the alias URL in a denial sentence — a comment that says "no longer points at X" keeps a grep for X returning the very hit the rewrite was meant to clear. `console/AppContent.tsx` is a comment-only change: the two alias route declarations, and every other line of code, are untouched. Its #3610 history is preserved and extended rather than replaced — #3610 declined to re-point the navigation because a zero-app-only spelling would have given the alias a second canonical destination, and #3660 re-pointed it at the shared route, so that reasoning still holds. Fixes#3666 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
yinlianghui
marked this pull request as ready for review
August 7, 2026 18:30
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Aug 7, 2026
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 freeto 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.
Fixes#3660
Fixes#3666
前置复核(先证实,再动手)
派发单要求实测 PR #3658(修 #3639)已落 main —— 本 PR 的"单跳"断言依赖它的落地形态。已证实:
issue 正文的 4 个行号在
origin/main(dae1ac41e)上逐条命中,前提成立。规范落点按LegacyMetadataRedirect(packages/app-shell/src/console/AppContent.tsx:963-982)的翻译逻辑推出,并实测确认两条规范路由在两个分支都已声明:零应用分支:639/:641,有应用分支:752-758(嵌套metadata+index/:type)。改了什么(4 处前后对照)
apps/console/.../SystemHubPage.tsx"Metadata" 卡片${basePath}/component/metadata/directory→metadata${basePath}/metadataapps/console/.../SystemHubPage.tsx"Datasources" 卡片${basePath}/component/metadata/resource?type=datasource→metadata/datasource${basePath}/metadata/datasourcepackages/app-shell/src/layout/AppSidebar.tsxsys-datasources/apps/setup/component/metadata/resource?type=datasource→ 同上/apps/setup/metadata/datasourcepackages/app-shell/src/layout/UnifiedSidebar.tsxsys-datasources落点与旧的两跳逐字节等价,这是对齐
LegacyMetadataRedirect得到的,不是巧合:${appBase}/metadata+ search + hash;resource 臂构造${appBase}/metadata/${encodeURIComponent(type)}+ path 尾巴 + hash。?type=),且datasource的encodeURIComponent是自身,所以旧链路落的就是现在这两个 URL。别名路由声明(
console/AppContent.tsx两个分支各 2 条)⛔ 一行未动 —— 书签/外链仍需要它(与 #3639 裁决第 3 条一致)。钉翻转(派发单第 2 条)
packages/app-shell/src/layout/__tests__/systemNavSettingsTarget.test.tsx的ADMINISTRATION_ENTRIES钉住了Datasources的旧形态。照 #3609 的纪律替换而非并存:该行改写为新的DATASOURCES_TARGET常量,旧拼法不保留,文件头补了一节说明为什么翻转。仓库钉的是修复,不是同时钉 bug 和修复。顺带补上一个此前无人钉的半边:
AppSidebar与UnifiedSidebar各持一份sys-datasources字面量,而只有UnifiedSidebar的进了ADMINISTRATION_ENTRIES。AppSidebar那份可以退回别名而全仓测试仍绿。现已在同文件的AppSidebar用例里补断言。生产端枚举(派发单第 5 条)
全仓 grep
component/metadata后按类别分:console/AppContent.tsx:659-660、:788-789AppContent.noAppComponentRoutes/pseudoRouteSegments/legacyRedirects/ 本 PR 新增componentRegistry.ts:28、ResourceRouter.tsx:63.changeset/*.md三份packages/app-shell/dist/本 PR 之后,仓内已无任何生产端生成
component/metadataURL。#3666 并入说明(PM 裁决 A,范围扩至三处)
第二个提交
bd04651ee修掉本分支第一个提交自己制造的三段失效 docblock —— 它们都以现在时断言"setup 左导航 Datasources 指向别名",而第一个提交刚把两个 sidebar 改成直指规范拼法。views/metadata-admin/datasource/register.ts:11-14…/component/metadata/resource?type=datasourcespelling. That is a legacy alias…」AppContentstill declares are redirects onto it rather than routes of their own — kept so bookmarks and external links keep resolving — but no navigation in this repo is routed through them any more.」views/metadata-admin/datasource/DatasourceResourcePage.tsx:8-12…/component/metadata/resource?type=datasource…,and the console host forwards…/system/metadata/datasource」…/system/metadata/datasource…,and the older aliasesAppContentdeclares for bookmarks and external links are rewritten byLegacyMetadataRedirect.」console/AppContent.tsx:649-658sys-datasourcespoints straight at…/component/metadata/resource?type=datasource…。Kept as a mirror rather than re-pointed navigation because…」sys-datasourcesat an alias…。#3610 mirrored the routes rather than re-point that navigation, because inventing a zero-app-only spelling would have given the alias a second canonical destination. #3660 re-pointed it anyway — at the sharedmetadata/:typeroutes above, so no second spelling was created — which leaves these two serving bookmarks and external links, the arrivals that can never be re-pointed.」三点交代:
…/component/metadata/resource?type=datasource」这种把失真特征词原样种回注释的正面否认句 —— 那会让 grep 停在原来的命中数上,正是改写要清掉的东西。全部改成正面陈述。可证伪的测量:该字面量在这三个文件中的出现数 3 → 0(git grep对6ca05d476计 3,现 0 hits)。console/AppContent.tsx是纯注释改动 —— PM 解除的 ⛔ 仅限注释,故两条别名路由声明及该文件其余每一行代码一字未动(见该文件 diff:改动全部落在{/* ... */}块内)。metadata/:type,没有造出第二个拼法 —— 所以那条理由今天依然成立,注释如实保留了它。测试
新增两个文件,都用 PR #3658 的
ChainRecorder手法 —— 记录路由每一次停靠位置,断言针对整条链而非只有终点。只看终点无法区分一跳与两跳(都以metadata/datasource收尾),而一跳与否恰是本单的全部内容。apps/console/src/pages/system/__tests__/SystemHubPage.metadataCards.test.tsx(4 例)—— 挂载真实的SystemHubPage,真点卡片,不转抄 href 列表(转抄正是别名拼法能活这么久的原因)。packages/app-shell/src/layout/__tests__/systemNavDatasourcesHop.test.tsx(3 例)—— 从真实 sidebar 渲染里读出 href,再喂进同时声明规范路由与别名路由的探针表。两个 sidebar 各驱动一次。一处方法论交代:别名镜像的承重范围
systemNavDatasourcesHop.test.tsx里的AliasResourceRedirect是LegacyMetadataRedirectresource 臂的镜像。该文件断言的绿,不依赖这个镜像是否忠实 —— 绿的判据是chain等于[规范 URL],当且仅当 sidebar 的 URL 直接命中规范路由时成立。镜像只决定失败长什么样:有它,回退任一字面量会得到"两条目、第一条是别名"的链,即那一跳被直接打印出来而非仅被暗示。真别名路由自身的行为另有真路由表的钉(AppContent.noAppComponentRoutes.test.tsx)。这一点写进了文件头,没有含糊过去。逆向验证(先预测,后运行)
预测:只回退 4 处生产端字面量(注释与测试不动),读取生产端 URL 的断言转红且 diff 打印别名;但三条刻意设置的 CONTROL 必须保持绿 —— 它们都不读被改的生产端。预测具体分布:hub 套件 3/4 红、hop 套件 2/3 红、钉套件 2/3 红,合计 7 红 3 绿。
实跑结果与预测完全一致:
每条 diff 都直接打印别名:
保持绿的 3 条正是三条 CONTROL:
Applications卡片(未改的兄弟项)、"别名仍可解析且仍要付那一跳"、非管理员看不到 Administration 集群。方向无反转。其余门禁
首个提交(4 处生产端 + 测试 + changeset):
第二个提交(
bd04651ee,纯注释)复跑:两个 lint 的 warning 数与 PR #3658 报告的基线逐字相同,本 PR 未新增。新 worktree 已先跑依赖构建(
pnpm --filter '@object-ui/app-shell^...' build等)再跑测试,避免 AGENTS.md §9 陈旧产物陷阱的镜像。changeset
写了,
patch。@object-ui/console与@object-ui/app-shell都在 39 包fixed组内,ignore只有@object-ui/example-*与@object-ui/site,故需要。用户可见变化:导航直达,少一跳。第二个提交纯注释,不另加 changeset。🤖 Generated with Claude Code
https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt