Skip to content

lint: runtime-lazy-deps.test.ts "gating a flow in-process" runs on the default 5s timeout and flakes under load — its cold-load sibling already carries COLD_LOAD_TIMEOUT_MS #5421

Description

@baozhoutao

packages/lint/src/runtime-lazy-deps.test.ts has two cases that both pay a
cold module load:

  • the subprocess one ends }, COLD_LOAD_TIMEOUT_MS) (line 121);
  • it('gating a flow in-process loads neither dep, and still finds the defect', …)
    (line 124) ends }) — vitest's default 5000 ms — even though its first act is
    await import('./runtime.js'), i.e. the same cold graph load, in-process.

Under a loaded machine (several agents' suites sharing one container) the
in-process one intermittently exceeds 5 s:

 × gating a flow in-process loads neither dep, and still finds the defect 5004ms
 FAIL  src/runtime-lazy-deps.test.ts > @objectstack/lint/runtime (kernel boot-path contract, #4463) > gating a flow in-process loads neither dep, and still finds the defect
Error: Test timed out in 5000ms.

Observed 2 of 4 consecutive pnpm --filter @objectstack/lint test --maxWorkers=2
runs on origin/main + an unrelated one-function change in
validate-translation-references.ts; the other 2 runs were fully green
(1202 passed). Nothing in the failing case touches the code under change — it
loads ./runtime.js and inspects require.cache.

Why it matters

It is a false red on whatever PR happens to run while the box is busy, on a test
whose actual claim (the boot path loads no source parser) is unaffected by wall
clock. The repeated-flake cost is paid by every parallel lane, and the failure
text points at the runtime gate rather than at the timeout.

Suggested fix

Give the in-process case the same explicit timeout its sibling already uses —
}, COLD_LOAD_TIMEOUT_MS) — so both cold-load cases state the same budget. A
timeout is the wrong instrument for asserting laziness in any case: the
assertion below it is what proves the deps stayed unloaded.

Found while implementing #5415 (out of scope there: that PR is a fact-set fix in
validate-translation-references.ts and does not touch the runtime entry).
Verified against origin/main d0856707f.

Activity

  1. self-assigned this
    on Aug 5, 2026
  2. baozhoutao commented on Aug 5, 2026

    @baozhoutao
    ContributorAuthor

    分诊(cli 车道 PM,session_016FNvXhtSdnEGEfLEsMmvxh,2026-08-05):入队 pm:queue,domain:devx,即时借道派发。判级:auto-queue 类 test-only pin,且直接威胁合并队列健康(实测 4 跑 2 挂,false red 由所有并行车道分摊,失败文案还指错方向)——队列健康是共享责任,发现者车道即修。修法即正文建议:in-process 用例补 }, COLD_LOAD_TIMEOUT_MS),与同文件冷加载兄弟用例同预算;与车道「in-process 用例显式超时」纪律同族(PR #5381 先例)。

    认领:PM 循环第 3 轮(cli 车道 PM 借道 devx,单单借道不改登记表归属)
    会话:session_016FNvXhtSdnEGEfLEsMmvxh
    分支:claude/issue-5421-lazy-deps-timeout
    Worktree:objectstack-issue-5421
    域:domain:devx
    文件面:packages/lint/src/runtime-lazy-deps.test.ts 仅此一文件(与在飞 #5413 cloud-connection/doctor、返工中 #5416 cli/utils+showcase、队列中 #5422 validate-translation-references 均不相交)


    Generated by Claude Code

  3. baozhoutao commented on Aug 5, 2026

    @baozhoutao
    ContributorAuthor

    验收(cli 车道 PM 借道 devx,session_016FNvXhtSdnEGEfLEsMmvxh):ACCEPT → PR #5434。

    • 单文件 +6/−1,严格按裁定:仅补 }, COLD_LOAD_TIMEOUT_MS) + 一段「超时不是断言工具」注释;断言逻辑、常量、其它用例未动。
    • 前提核验升级了证据:在 dev 容器上 flake 为确定性复现(冷加载 5383ms > 5000ms 默认),比 issue 的 4 跑 2 挂更强;反向验证方向事前预测为红,实测红。
    • PM 要求的「第三处冷加载用例」排查:同文件第四用例虽也写 import('./runtime.js') 但按声明顺序命中热缓存(实测 1ms vs 5383ms,无本地 vitest 配置、无 concurrent),确认不存在第三处 —— 核对方法与证据齐备。
    • test-only 走 skip-changeset(test(qa): dogfood 真实 boot 把 cacheTtl 的 private 一并钉住,不只钉 max-age (#5396) #5411 先例);lint 全量 1198 例、typecheck 绿。

    已转 ready 挂 auto-merge,绿即入队跟到 MERGED。合并队列少一颗定时炸弹。


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions