Skip to content

[Bug][CI]: cold-spawn warm-up coverage accepts an unused import or comment as execution proof #5060

Closed

Description

@Ingwannu

Client or integration

CI/test infrastructure.

Area

Cold spawned-child warm-up coverage.

Summary

The coverage guard merged in #5038 records files as warmed when their source merely contains the substring helpers/cold-spawn-warmup:

.filter(([path]) => !readFileSync(repoPath(path), "utf8").includes("helpers/cold-spawn-warmup"))

An unused import, comment or string literal therefore satisfies the guard after the real beforeAll call is removed. The measured child then pays the cold module-graph cost again while the coverage test remains green.

Expected behaviour

Verify an actual top-level warm-up registration/invocation for every warmed: true disposition. Use the existing Bun syntax scanner or another structured check to require a call to warmColdSpawn or warmModuleGraph; string presence is not execution evidence.

Required regressions

  • unused import only fails;
  • comment/string literal only fails;
  • imported helper with no call fails;
  • a valid beforeAll registration with a warm-up call passes; and
  • an unwarmed disposition still requires its documented reason and forbids an active call.

Scope clarification

The separate automated suggestion that Bun.Transpiler.scanImports misses re-export edges does not reproduce on the bundled runtime: named, star and namespace re-exports all appear as import-statement entries. This issue tracks only the verified invocation-oracle gap.

Activity

  1. added
    bugSomething isn't working
    platformOS/service/tray/ACL (Windows-heavy, not Windows-only)
    on Sep 18, 2026
  2. lidge-jun commented on Sep 19, 2026

    @lidge-jun
    Owner

    Fixed on dev by #5080, merged as the commit above.

    The guard no longer asks whether a file's text contains the warm-up module path. It recognises a small set of exact shapes and refuses everything else by line number:

    hook-statement    describe(...)* > beforeAll(async () => { ... await W(...); ... })
    hook-return       describe(...)* > beforeAll(() => { return W(...); })
    hook-expression   describe(...)* > beforeAll(() => W(...)) and its awaited form
    module-top-level  await W(...); as a whole statement at the top level
    

    W has to come from a direct named import of the helper, aliases followed, and describe and beforeAll have to be direct named imports of bun:test that are not rebound anywhere in the file. A hook inside describe.skip or a conditional describe is a registration in shape only and is refused, because that suite never runs.

    The first draft went the other way and tried to model the grammar generally. Review found it accepted register(() => beforeAll(async () => { await W(options); })), where the hook is never registered, and accepted a locally shadowed const beforeAll = () => {}. Both are false passes, which is the exact failure this guard exists to remove, so the accept-set was narrowed instead. TypeScript 7.0.2 publishes no in-process parser, so the alternative was reconstructing scoping from tokens where every wrong guess is a false pass.

    Shapes that do warm at run time are refused too — a namespace import, a barrel re-export, an alias through a variable, a call in a scope the judge does not model. That is deliberate rather than a backlog: a refusal is loud, located, and a legitimate file needing one records it in its disposition, which keeps the refusal itself under test.

    What this does not claim: a structural check does not prove execution. The helper still prints one completion line per warmed graph on every hosted run, and that remains the separate execution oracle.

    CI at the exact head 151e52ac3c was green on every leg. No local suite was run.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingplatformOS/service/tray/ACL (Windows-heavy, not Windows-only)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions