This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
test(app-shell): 把 MetadataRedirectStub 同步回宿主实现,并用整链断言钉住转录真实性 (#3661) - #3671
Merged
Merged
Conversation
PR #3658 把 apps/console 的 MetadataRedirect 改成直发规范拼法 (7883c02),但 app-shell 这份自称「逐字转录」的 stub 没跟着改。 于是 sys-objects 用例测的是一条生产中已不存在的两跳链 —— 它仍绿, 是因为 stub 自己还在往别名跳,不是因为生产代码这么做。 - stub 的 target 构造同步为 #3658 后的宿主实现(可执行代码逐字节一致), docblock 注明转录对象、出处 commit,以及「逐字」这个声明需要持续兑现。 - LocationProbe 升级为整链记录器,renderConsoleAt 返回链;四条重定向 用例改为 toEqual 整个数组 —— 只断终点分辨不出一跳与两跳,而这正是 本单的全部内容。 - 补一条直接进入 component/metadata/directory 的用例:该别名在零应用 分支原本只有 stub 的 typeless 臂在跑,stub 同步后会失去全部覆盖。 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
|
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 #3661
前提复核(先证实,再动手)
issue 正文的行号与断言在最新
origin/main(fe4d4da37,含7883c0250)上逐条命中,前提成立:packages/app-shell/src/console/__tests__/AppContent.noAppComponentRoutes.test.tsx:159-176的MetadataRedirectStubdocblock 自称 "VERBATIM transcription … Keep the regex and the target construction identical to the original",而 target 构造仍是别名拼法;apps/console/src/AppContent.tsx的MetadataRedirect自7883c0250起已改为直接构造…/metadata/:type[/:name];失真是实测出来的,不是从 diff 推出来的
动手前先给
LocationProbe加了链记录,原样跑了一遍旧 stub,把三条链打了出来:sys-datasources[component/metadata/resource?type=datasource, metadata/datasource]sys-objects[system/metadata/object, **component/metadata/resource?type=object**, metadata/object][system/metadata, **component/metadata/directory**, metadata]两点比 issue 正文多出来的事实:
sys-objects一条 —— typeless directory 那条同样在测一条生产中已不存在的两跳链。issue 只点名了前者。改了什么
1. stub 同步(逐字转录恢复为真)
机器比对过:同步后 stub 函数体与宿主
MetadataRedirect函数体可执行代码逐字节一致,唯一差异是宿主多带的三行注释(那三行 stub 改前也没有)。docblock 改为注明转录对象路径、出处 commit(
7883c0250/ #3658),并明说「逐字」是一句需要持续兑现的声明 —— 它在7883c0250到 #3661 之间就是假的。2. 整链断言(本单的防复发部分)
LocationProbe升级为链记录器,renderConsoleAt返回整条链,四条重定向用例改为toEqual整个数组。这是必要的:旧断言只钉最终 pathname,而一跳与两跳的终点逐字节相同,所以 stub 失真时没有任何断言会红。整链断言是这个文件里唯一能发现这件事的机制。
3. 补一条用例,接住会被本 PR 删掉的覆盖
零应用分支的
component/metadata/directory(app-shellAppContent.tsx:659,#3610 加的)在改前的唯一运行者就是 stub 的 typeless 臂 —— 顺路经过。stub 改直达后,该路由在全仓将失去所有覆盖:pseudoRouteSegments.test.tsx:299虽然直接进入该别名,但走的是/apps/ghost/…,会回退到默认 app,跑的是带 app 分支那份声明,不是零应用分支这份。所以补了一条直接进入的用例(手法与既有的
sys-datasources一致 —— 别名作为入口而非中间站)。SystemHubPage的 "Metadata" 卡片与书签今天仍在产出这个 URL,它是活输入。推断兑现(issue 里那条未实测的推断)
#3639 的记录者标注了「方向 1 改完后该用例大概率仍绿,但这一条我没有跑过」。实测结论:推断成立,仍绿。
理由与记录者写的一致:零应用分支本来就声明了
metadata与metadata/:type,断言的落点/apps/setup/metadata/object逐字未变,变的只有到达它的路径(两跳变一跳)。逆向验证(先预测,后运行)
预测:只把 stub 的 target 构造回退成别名(docblock 与断言保持不动),应当恰好两条用例转红 ——
sys-objects与 typeless host arm;sys-datasources与新补的 directory 用例应当保持绿,因为它们自己就以别名为入口,stub 不在它们的路径上。红的形态应为链多出一个中间条目。实跑:
两条,且 diff 各只多出一行:
方向与预测一致,无反转。
顺带,这两张 diff 本身就是本单为什么会静默发生的直接证据:两条链的首尾条目完全没动,只有中间多了一站。旧的「只断终点」断言在结构上就不可能红。
门禁
type-check前先跑了pnpm --workspace-concurrency=2 --filter '@object-ui/app-shell^...' build(新 worktree 未构建依赖会报一片Cannot find module '@object-ui/*',AGENTS.md §9 陈旧产物陷阱的镜像)。changeset
不写,判断依据:本 PR 只改一个测试文件,零生产代码改动,对包的发布物与运行时行为没有任何影响,不属于用户可见变更。
越界发现(只报不改)
AppContent.pseudoRouteSegments.test.tsx:218-233有第二份MetadataRedirectStub,同样自称逐字转录、同样在 fix(console): 宿主重定向直发规范 metadata 路由,不再绕已废弃的 component/metadata 别名 (#3639) #3658 后仍走别名,同样有两条用例在测已不存在的两跳链。同机制同来源,但不同文件,而本单的文件面被明确限定为单文件,故立单未改。已打finding、未打pm:queue(测试是绿的,无用户可撞),未认领。🤖 Generated with Claude Code
https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt
Generated by Claude Code