Repository navigation
fix(console): 宿主重定向直发规范 metadata 路由,不再绕已废弃的 component/metadata 别名 (#3639) - #3658
Merged
Merged
Conversation
…the deprecated alias (#3639) `ObjectRedirect` and `MetadataRedirect` rewrote `system/objects[/:name]` and `system/metadata[/:type[/:name]]` onto `component/metadata/resource[/:name]?type=`. app-shell declares that spelling as a legacy alias whose element is `LegacyMetadataRedirect` — a second `<Navigate>` onto `metadata/:type[/:name]`. Both host redirects now build that canonical target directly, so the chain is one hop instead of two. Endpoints are unchanged byte for byte, including the alias hop's own percent-encoding of `:type` and its verbatim pass-through of `:name`. The alias routes are untouched and still forward bookmarks/external links. Also corrects four docblocks that called the alias "the engine route" — the wording that led the #3610 dispatch to conclude `component/metadata/resource` was canonical, which is the opposite of what the route table says. 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. |
This was referenced Aug 7, 2026
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
yinlianghui
marked this pull request as ready for review
August 7, 2026 17:44
This was referenced Aug 7, 2026
Closed
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Aug 8, 2026
* docs(app-shell): 两个 AppContent 路由测试的生产端叙述改写为「历史 + 现状」两段 (#3749) 三处注释以现在时枚举「侧边栏 / QuickActions 现在发哪些 URL」,而这些 URL 已被 #3660(`sys-datasources`)与 #3739(`sys-objects` + 首页 Manage Objects 卡片)改指 metadata-admin 引擎的规范路由。断言全部正确且全绿 —— 陈旧的只有叙述,以及两个以 生产端命名的 `it` 标题:它们实际量的是别名路由仍能解析且只跳一次。 手法照 #3666:每处拆成「#3610 当时如此」(过去时)与「#3660/#3739 之后如此」 (现在时)两段,现状段正面陈述两条别名今天的身份 —— 不再是任何导航的目标,而是 书签与外部链接的到达路径,这正是重定向必须继续工作的理由。按 #3656,现状段不靠 「不再指向 X」的否认句复述别名 URL。 - `AppContent.noAppComponentRoutes.test.tsx`:头注拆段;两个 `it` 标题从 `sys-datasources:` / `sys-objects:` 改为 `shell alias:` / `host alias:`,即两条 别名各自的改写者(shell 自己的 `LegacyMetadataRedirect` vs 宿主的 `MetadataRedirect`)—— 文件正文本来就画了这条区分。用例体内两处重申同一陈旧 断言的行内注释同步(`sys-datasources` item still points straight at this spelling / this case now measures what production actually does),否则改完标题 的文件会自相矛盾。顺带把同一段落里 `isMetadataRoute` 的现在时「substring test」 收敛为过去时 —— #3638 起它是 `pathSegments.includes('metadata')` 段测试。 - `AppContent.pseudoRouteSegments.test.tsx`:生产端表格按实读重写(逐条读自 `AppSidebar` / `UnifiedSidebar` / `QuickActions` / `HomePage` / `InboxPopover`), 并补一段说明两条旧拼写并未消失,只是从 `navigation` 行移到了上面两行的到达面。 `metadata` 两种拼写下都是完整路径段,所以本文件要证伪的论断不受影响。 - `AppContent.tsx`(#3610 那段):收尾句补上 #3739 也已重指,并注明 `sys-objects` 的链路早在 #3658 就离开了这两条路由。该段前半的过去时叙述保留。 零行为改动:两个测试文件跑前跑后同为 43 passed,断言与用例数未动。 无 changeset —— 注释-only,照 #3666(bd04651)与 #3785(f9d70a7)先例。 Fixes #3749 * chore(changeset): 为 #3749 注释改写声明「不发布任何东西」(空 frontmatter) CI 的 Changeset Declaration 门(scripts/check-changeset-presence.mjs)守的是 「fixed 组内任一包的 `<pkg>/src/**` 被改动 -> 必须有 `.changeset/*.md` 声明」, 本次三个改动文件全部落在 packages/app-shell/src 下,所以门要求声明。 先前照 #3666(bd04651)与 #3785(f9d70a7)判断「注释-only 不带 changeset」是 读错了先例:那两个 PR 早于这道门(#3387 引入),且 #3785 只动 content/docs/**, 根本不在守护面内。门自己写明了正确出口 —— 「If this change really should release nothing, say so — that is a pass, not a workaround」,即空 frontmatter,照 .changeset/registry-inputs-spec-parity-gate-3797.md 的先例写法。 空 frontmatter 而非 patch:AppContent.tsx 只改 JSX 注释,两条 LegacyMetadataRedirect 路由声明与其余每一行代码未动;两个测试文件断言与用例数 逐字节未变(前后同为 43 passed)。确无可发布的行为改动。 本地验证: node scripts/check-changeset-presence.mjs -> exit 0(识别为空 frontmatter 豁免) node scripts/check-changeset-no-major.mjs -> exit 0 --------- Co-authored-by: Claude <noreply@anthropic.com>
akarma-synetal
pushed a commit
to akarma-synetal/objectui
that referenced
this pull request
Aug 10, 2026
…stack-ai#3661) (objectstack-ai#3671) PR objectstack-ai#3658 把 apps/console 的 MetadataRedirect 改成直发规范拼法 (7883c02),但 app-shell 这份自称「逐字转录」的 stub 没跟着改。 于是 sys-objects 用例测的是一条生产中已不存在的两跳链 —— 它仍绿, 是因为 stub 自己还在往别名跳,不是因为生产代码这么做。 - stub 的 target 构造同步为 objectstack-ai#3658 后的宿主实现(可执行代码逐字节一致), docblock 注明转录对象、出处 commit,以及「逐字」这个声明需要持续兑现。 - LocationProbe 升级为整链记录器,renderConsoleAt 返回链;四条重定向 用例改为 toEqual 整个数组 —— 只断终点分辨不出一跳与两跳,而这正是 本单的全部内容。 - 补一条直接进入 component/metadata/directory 的用例:该别名在零应用 分支原本只有 stub 的 typeless 臂在跑,stub 同步后会失去全部覆盖。 Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt Co-authored-by: Claude <noreply@anthropic.com>
akarma-synetal
pushed a commit
to akarma-synetal/objectui
that referenced
this pull request
Aug 10, 2026
…整链断言钉住 (objectstack-ai#3669) (objectstack-ai#3691) 第二份 MetadataRedirectStub 自称逐字转录宿主 MetadataRedirect,但 objectstack-ai#3658 把宿主 改为直接构造 canonical `…/metadata/:type` 后未同步,仍构造已废弃的 `component/metadata/resource?type=` 别名。被它喂的两条 `system/metadata/*` 用例 因此在测一条生产中已不存在的两跳链,却始终是绿的 —— 断言只钉终点,而终点在 一跳与两跳下逐字节相同。 - stub 按 7883c02 后的宿主实现逐字同步(可执行代码经机器比对逐字节一致); - LocationProbe 升级为链记录器,renderConsoleAt 返回整条重定向链; - 两条受影响用例从 it.each 表中提出为独立 it,改断整条链(原有断言全部保留)。 objectstack-ai#3638 落的输入面回归断言与近似段族断言一行未动。测试-only,无 changeset。 Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt Co-authored-by: Claude <noreply@anthropic.com>
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.
Fixes #3639
前提复核(先证实,再动手)
issue 正文的行号在最新
origin/main(54dd7ec1)上逐条命中,前提成立:apps/console/src/AppContent.tsx的ObjectRedirect(:47-51 docblock / :52-60 实现)与MetadataRedirect(:62-67 / :68-82)确实仍在改写到component/metadata/resource,而packages/app-shell/src/console/AppContent.tsx把这个拼法声明为LegacyMetadataRedirect(:775-776 有应用分支、:646-647 零应用分支),规范落点是metadata/:type[/:name]。改了什么
两个宿主重定向直接构造规范目标,不再喂别名:
system/objectscomponent/metadata/resource?type=object→metadata/objectmetadata/objectsystem/objects/:objectNamecomponent/metadata/resource/:name?type=object→metadata/object/:namemetadata/object/:namesystem/metadatacomponent/metadata/directory→metadatametadatasystem/metadata/:typecomponent/metadata/resource?type=:type→metadata/:typemetadata/:typesystem/metadata/:type/:namecomponent/metadata/resource/:name?type=:type→metadata/:type/:namemetadata/:type/:name落点与旧的两跳逐字节等价,这是刻意对齐
LegacyMetadataRedirect的翻译逻辑得到的,不是巧合::type做encodeURIComponent—— 别名跳自己就是这么做的(它从?type=读出再编码进 path)。旧写法把metadataType裸拼进 query,遇到含&的类型名会被URLSearchParams截断;现写法不会。对现实中的类型名(object/datasource…)两者恒等。:name/:objectName原样透传 —— 别名跳把 path 尾巴原样接上,没有编码。保持一致,不顺手"修"。location.search,宿主也从不转发入参 query,所以旧链路同样是光秃秃的 path 落地。保留这个行为并专门写了一条测量用例钉住,免得下一个读者以为是漏掉的。另外订正四段把别名说成 "the engine route" 的 docblock:
apps/console两处 +datasource/register.ts:9+DatasourceResourcePage.tsx:6(裁决第 5 条)。这不是文字洁癖 —— #3610 的派发单正是顺着这句话推出"component/...才是规范拼法"的,与路由表恰好相反。生产端枚举(issue 的⚠️ 要求)
全仓 grep
component/metadata,按生成 / 声明接收 / 测试钉形态 / 注释分类:apps/console/src/AppContent.tsx:57-58(ObjectRedirect)apps/console/src/AppContent.tsx:75-80(MetadataRedirect)apps/console/src/pages/system/SystemHubPage.tsx:118("Metadata" 卡片 →directory)apps/console/src/pages/system/SystemHubPage.tsx:126("Datasources" 卡片 →resource?type=datasource)packages/app-shell/src/layout/AppSidebar.tsx:330(sys-datasources)packages/app-shell/src/layout/UnifiedSidebar.tsx:336(sys-datasources)packages/app-shell/src/console/AppContent.tsx:646-647 / 775-776packages/app-shell/src/console/AppContent.tsx:951-952(LegacyMetadataRedirectdocblock)packages/app-shell/src/layout/__tests__/systemNavSettingsTarget.test.tsx:162packages/app-shell/src/console/__tests__/AppContent.noAppComponentRoutes.test.tsx:169-171MetadataRedirect逐字转录副本packages/app-shell/src/services/componentRegistry.ts:28packages/app-shell/src/views/metadata-admin/ResourceRouter.tsx:63datasource/register.ts:9、DatasourceResourcePage.tsx:6一共 6 处生产端,本 PR 修其中 2 处(围栏内),另 4 处按"越界即停"立单。它们与本 PR 的两处是同一机制(导航直接指向别名 → 多一跳),但分布在
apps/console的 SystemHub 卡片与packages/app-shell的两个 sidebar,修法应当一次性统一决定,而不是拆成两半。测试
新增
apps/console/src/__tests__/AppContent.legacyRedirects.test.tsx(7 例)。关键点是它导入生产代码的systemRoutesfragment(为此把它export出来),而不是把路由抄一遍 —— 抄一份正是component/metadata/resource这个拼法能在此处存活这么久的原因。ChainRecorder记录路由每一次停靠的位置,所以断言针对的是整条链而非只有终点:只看终点无法区分一跳与两跳(都是metadata/object收尾),而一跳与否恰恰就是本单的全部内容。路由表里同时声明了规范路由与别名路由(都作为终端探针),这让方向可证伪。逆向验证(先预测,后运行)
预测的方向:红,且失败现场应指认"中间/落点仍是别名"。 只回退两处 target 构造(docblock 与测试保持不动)后实跑:
七条全红,且每条 diff 都直接打印出别名:
方向与预测一致,无反转。
别名仍可达(裁决第 3 条的回归证据)
别名路由一行未动,证据是
packages/app-shell/src/console/__tests__/AppContent.noAppComponentRoutes.test.tsx全绿 —— 它直接以/apps/setup/component/metadata/resource?type=datasource起步并断言落到/apps/setup/metadata/datasource:顺带一提:该文件里那份
MetadataRedirectStub是apps/consoleMetadataRedirect的逐字转录(注释明写 "keep identical to the original")。本 PR 之后它不再逐字,而且它的sys-objects用例现在测的是一条生产中已不存在的链路 —— 绿是因为 stub 自己仍走别名,不是因为生产代码走。属于"该整例替换而非重拼"的那一类,已立单,未在此 PR 内改(围栏外,且 #3638 在途于同一组件的测试面)。其余门禁
type-check首跑报了一片Cannot find module '@object-ui/*'—— 是新 worktree 未构建依赖所致(AGENTS.md §9 陈旧产物陷阱的镜像),pnpm --filter '@object-ui/app-shell^...' build之后即全绿,与本改动无关。遮蔽关系测量(裁决第 6 条:只测量不动)
react-router 打分(静态段 10 / 动态段 3 / splat -2,
initialScore = 段数 + splat 罚分):component/metadata/resource/*4 - 2 + 10 + 10 + 10component/:ns/:name/*4 - 2 + 10 + 3 + 3修前 = 修后,完全没变。 本 PR 的 diff 里
packages/app-shell/src/console/AppContent.tsx零改动(改的只有datasource/下两个注释),路由声明、顺序、打分一行未动;打分是同一个Routes内的静态属性,与谁往这些 URL 发流量无关。所以注册表组件metadata:resource依旧被恒压,MetadataResourceRouter依旧休眠。本 PR 唯一改变的是流量:
apps/console不再把system/metadata/*与system/objects/*送进别名。别名仍由 sidebar 的sys-datasources、SystemHub 两张卡片以及书签/外链喂着(见上面的枚举表),所以别名远未变成死路 —— 这也是保留它的理由本身。一并确认 issue 评论区那条"不要以为 datasource 定制页也死了":
ResourceListPage.tsx:98-104的规范列表页自己查注册表(getMetadataResource(type)?.ListPage),所以metadata/datasource渲染的仍是DatasourceResourcePage。休眠的只有MetadataResourceRouter这一层分发器。其处置(删除 vs 保留)按裁决另行分诊,本 PR 不碰。changeset
写了。判断依据:
.changeset/config.json的ignore只有@object-ui/example-*与@object-ui/site,@object-ui/console(即apps/console,private未设、version 17.3.0)与@object-ui/app-shell都在 39 包fixed组内,会随组发布,因此需要 changeset。按仓规标patch,绝不标major。🤖 Generated with Claude Code
https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
Generated by Claude Code