Skip to content

main 红:wildcard fall-through 守卫声明了一个已被删除的挂载(#4116 与 #4112 的竞态) #4140

Description

@os-zhuang

main(当前 4f30943)上 pnpm check:wildcard-fallthrough 失败,因此每个 PR 的 Lint & Type Check job 都是红的——GitHub Actions 在 pull_request 事件下检出的是「PR 与 base 的合并树」,所以哪怕 PR 本身没碰相关文件也会中招。

复现

在纯净的 origin/main 上(不带任何 PR 改动):

$ node scripts/check-wildcard-fallthrough.mjs
✗ wildcard fall-through guard (#4116)

  packages/adapters/hono/src/index.ts:all `${prefix}/storage/*`
    DECLARED but not found by the scan. Moved, renamed or deleted? Update MOUNTS.

1 problem(s).

成因:两个 PR 的竞态

PR 做了什么
#41124be9d99 删除了 hono adapter 的 app.all(prefix + '/storage/*')——「retire the /storage dispatcher bridge — it never spoke the storage contract」
#41163df8819 scripts/check-wildcard-fallthrough.mjsMOUNTS 账本里声明了这同一个挂载,ratchet 记为 #4117 — terminal, same shape as #4088

两者各自基于删除/声明尚未发生的 main 开发,先后合入后没有互相 rebase,于是账本里留下了一条指向已不存在的挂载的声明。守卫对「DECLARED but not found」是严格失败的——这个设计本身是对的(否则账本会悄悄腐烂),只是这次它逮到的是账本自己过期。

packages/adapters/hono/src/index.ts:351 现在只剩下解释这段历史的注释,挂载确实已经没了。

建议的修法

删掉 MOUNTS 里那条 'packages/adapters/hono/src/index.ts:all ${prefix}/storage/*'(约 scripts/check-wildcard-fallthrough.mjs:158-160)。#4112 的退休正是这条 ratchet 想要的终局,所以是「已解决,销账」而不是「放宽守卫」。

同一账本里的 ${prefix}/auth/* 那条仍然有效(该挂载在 hono adapter 里还在),不要一起删。

影响面

main 保持红态期间,所有 PR 的 Lint & Type Check 都无法转绿,合并流程被阻塞。发现于 #4109 的 CI(该 PR 未触及 hono adapter,在纯净 main 上复现了同样的失败)。

关联

#4116(守卫)、#4112(删除挂载)、#4117(ratchet 追踪项)、#4088(原始形态)。

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions