Skip to content

test(cli): warm plugin import pipeline and share plugin fixture#9569

Open
kilo-code-bot[bot] wants to merge 1 commit intomainfrom
fix/provider-plugin-tests-warmup
Open

test(cli): warm plugin import pipeline and share plugin fixture#9569
kilo-code-bot[bot] wants to merge 1 commit intomainfrom
fix/provider-plugin-tests-warmup

Conversation

@kilo-code-bot
Copy link
Copy Markdown
Contributor

@kilo-code-bot kilo-code-bot Bot commented Apr 27, 2026

Summary

Alternative fix for the spurious Windows failures in packages/opencode/test/provider/provider.test.ts (see #9566 for the root-cause fix in Provider.layer).

The two failing tests each wrote a unique .opencode/plugin/*.ts file into a fresh tmp dir and triggered a cold Bun TS import(). On Windows that cold transpile exceeded the 30 s per-test ceiling.

  • Add a shared plugin fixture at test/fixture/plugins/config-mutator.ts that accepts tuple options to mutate provider, enabled_providers, and disabled_providers. The two tests now reference this single file via config.plugin, so Bun's module cache short-circuits after the first import.
  • Warm Bun's TS import pipeline by import()ing the fixture once during test/preload.ts so the first plugin-loading test does not pay the full cold-start cost.

Why not the other approach

This is a pure test-infrastructure change -- it does not touch src/ and does not alter runtime behavior. #9566 changes Provider.layer ordering; this PR is the safer alternative when the ordering fix is not desirable.

How to test

cd packages/opencode && bun run test test/provider/provider.test.ts

Provider test file drops from ~88 s to ~46 s locally and both plugin tests complete inside the 30 s per-test ceiling.

The two plugin tests in provider.test.ts that were spuriously failing on
Windows CI each wrote a unique .opencode/plugin/*.ts file into a fresh tmp
dir and then triggered a cold Bun TS import. Cold .ts imports on Windows can
exceed 30 s which caused the test timeout.

- Add a shared plugin fixture (test/fixture/plugins/config-mutator.ts) that
  accepts tuple options to mutate provider, enabled_providers, and
  disabled_providers. The two tests now reference this single file so
  Bun's module cache short-circuits after the first import.
- Warm Bun's TS import pipeline by importing the fixture once during
  test/preload.ts so the first test to hit the plugin loader does not pay
  the full cold-start cost.

Provider test suite drops from ~88 s to ~46 s locally and both plugin tests
now complete well inside the 30 s per-test ceiling.
@kilo-code-bot
Copy link
Copy Markdown
Contributor Author

kilo-code-bot Bot commented Apr 27, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (3 files)
  • packages/opencode/test/fixture/plugins/config-mutator.ts
  • packages/opencode/test/preload.ts
  • packages/opencode/test/provider/provider.test.ts

Reviewed by gpt-5.4-2026-03-05 · 404,915 tokens

@markijbema markijbema self-assigned this Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant