test(lint): give the in-process cold-load case the same COLD_LOAD_TIMEOUT_MS its siblings carry (#5421) - #5434
Merged
Conversation
…EOUT_MS its siblings carry (#5421) `runtime-lazy-deps.test.ts` has three cases that pay a cold load of the gate graph; two of them (the spawned CJS/ESM entries) already end with `COLD_LOAD_TIMEOUT_MS`, while the in-process one ran on vitest's 5 s default even though its first act is the same `import('./runtime.js')`. On a loaded box that case takes longer than 5 s and goes red on a claim the wall clock has nothing to do with — the boot path loading no source parser is proved by the require-cache assertions below it, never by how long the transform took. Measured on this container: 5383 ms with the budget, and a deterministic `Test timed out in 5000ms` without it. No assertion, constant or sibling case is touched. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016FNvXhtSdnEGEfLEsMmvxh
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckNo hand-written docs reference the 0 changed package(s). ✅ |
baozhoutao
marked this pull request as ready for review
August 5, 2026 11:16
baozhoutao
enabled auto-merge
August 5, 2026 11:16
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 #5421
问题
packages/lint/src/runtime-lazy-deps.test.ts里有三处用例都要付一次「冷加载整张 gate 模块图」的代价:}, COLD_LOAD_TIMEOUT_MS)收尾;gating a flow in-process loads neither dep, and still finds the defect以})收尾,吃 vitest 默认的 5000 ms —— 尽管它的第一个动作就是await import('./runtime.js'),即同一张冷图,只是在进程内加载。结果是:机器一忙(多个 agent 的测试套件共用一个容器),这一处就超时,变成任何一条并行车道上的 false red,而且失败文案指向 runtime gate,而不是指向超时预算。
改法
只给该 in-process 用例补上兄弟用例已有的
}, COLD_LOAD_TIMEOUT_MS),让三处冷加载用例声明同一个预算;另加一段注释说明为什么超时不是这里的断言工具。⛔ 断言逻辑、其它用例、
LAZY_DEPS、COLD_LOAD_TIMEOUT_MS常量本身一律未动。该用例真正要钉的事实(boot path 不加载任何源码解析器)由它下面那圈 require-cache 断言证明,和挂钟无关 —— 超时只该宽到不会误伤。同文件第三处冷加载用例:核对过,不存在
本文件第四个用例
the runtime entry re-exports the gate and nothing that carries a parser同样写了await import('./runtime.js'),但它在声明顺序上排在 in-process 用例之后,而本包没有本地 vitest 配置、全文件也没有任何concurrent,所以它命中的是已经热起来的模块缓存,并不付冷加载。verbose 输出直接量到了这个差:同一次运行里冷的那次 5383 ms,热的这次 1 ms。因此按「付冷加载却吃默认超时」的口径,同文件没有第三处需要同样修法的用例。验证
反向验证方向在跑之前就定好了,预期 红(本机冷加载耗时已经越过 5000 ms),实际也确实是红:
改前(
git stash掉本改动后跑同一文件):值得记一笔:在这个容器上它不是「间歇」复现,而是确定性复现——比 issue 里报的 4 跑 2 挂更强的证据。
改后(同一文件,verbose):
全包套件与类型检查:
node scripts/check-nul-bytes.mjsOK;另对改动文件做了控制字符自查(grep -naP覆盖 gate 扫不到的那段范围),干净。changeset
test-only,不面向用户,按 #5411 先例走
skip-changeset豁免路径,未添加 changeset。🤖 Generated with Claude Code
https://claude.ai/code/session_016FNvXhtSdnEGEfLEsMmvxh
Generated by Claude Code