Skip to content

AppContent.pseudoRouteSegments.test.tsx 里还有第二份 MetadataRedirectStub,同样在 #3658 后失真(自称逐字转录,仍走废弃别名) #3669

Description

@yinlianghui

越界发现,记录于 #3661 / PR 修 stub 失真期间。#3661 的文件面被明确限定为 AppContent.noAppComponentRoutes.test.tsx 单文件,本文件在围栏外,按纪律只报不改未认领

观察类:测试是绿的,CI 不会报,没有任何用户会撞上。故打 finding、不打 pm:queue

事实

packages/app-shell/src/console/__tests__/AppContent.pseudoRouteSegments.test.tsx:218-233第二份 MetadataRedirectStub,docblock 与 #3661 修掉的那份措辞几乎一致:

> VERBATIM transcription of apps/console/src/AppContent.tsx's MetadataRedirect — the system/metadata/* legs of systemRoutes. Keep the regex and the target construction identical to the original.

而它的 target 构造仍是 #3658 之前的别名拼法:

  const base = `${prefix}/component/metadata/resource`;
  const target = !metadataType
    ? `${prefix}/component/metadata/directory`
    : itemName
      ? `${base}/${itemName}?type=${metadataType}`
      : `${base}?type=${metadataType}`;

宿主自 7883c0250(PR #3658)起已改为直接构造 …/metadata/:type[/:name],所以这份转录同样不再逐字,而 docblock 仍在指示后来者「keep identical to the original」。

受影响的用例

这三行是被这份 stub 喂的,现在走的是生产中已不存在的两跳链:

  • :300 ['/apps/ghost/system/metadata/object', 'metadata-resource-list-page', '/apps/ghost/metadata/object'] —— 注释还明写 "Two-hop: host rewrite (system/metadata/:type) -> shell alias -> canonical",该注释现已是事实错误;
  • :321 ['/apps/setup/system/metadata/object', 'metadata-resource-list-page'](setup family 块)。

它们仍绿,理由与 #3661 完全相同:断言只钉最终落点(或只钉 testid),而落点在一跳与两跳下逐字节相同。绿的理由已与被测对象脱钩。

#3661 的关系

同一机制、同一来源改动(#3658)、同一处置形态,但不同文件,且 #3661 的派发单把文件面收得很紧,所以没有一并修。#3661 的 PR 里已经把可复用的手法落地了:LocationProbe 收集整条重定向链,断言 toEqual 整个数组而非只断终点 —— 逆向验证实测为「回退 stub → 恰好两条用例转红,diff 各多出一行别名,首尾条目不变」。这份 stub 照抄该手法即可,不需要重新设计。

⚠️ 一处需要接手者注意的连带项:本文件 :299['/apps/ghost/component/metadata/directory', …]直接进入别名,不经 stub,所以同步 stub 不会让它失去覆盖(与 #3661 那边不同 —— 那边零应用分支的 component/metadata/directory 只有 stub 的 typeless 臂在跑,PR 已补了一条直接进入的用例把覆盖接住)。同步前请确认本文件对应分支的别名覆盖同样有着落。

关联

已就关键词(MetadataRedirectStub / pseudoRouteSegments / verbatim transcription / component/metadata)搜过本仓开放 issue 与 PR,无同源单(#3660 / #3666生产端导航与 docblock,不含本文件)。


Generated by Claude Code

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions