test(ai): require explicit opt-in for Ollama live tests - #559
Merged
code-yeongyu merged 5 commits intoAug 3, 2026
Merged
Conversation
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.
Why
A normal
npm testrun treated the presence of theollamaexecutable as permission to enter the live Ollama suite. That path can pullgpt-oss:20b, start a local server, and load a large model without explicit consent.What changed
PI_ENABLE_LOCAL_LLM=1orPI_ENABLE_LIVE_API_TESTS=1.which ollamacommand inside the shared gate and mock that command boundary in regression tests.test.shto clear the opt-in flags instead of exporting the retiredPI_NO_LOCAL_LLMopt-out flag.packages/ai/changes.md.Validation
npx vitest run packages/ai/test/live-api-gates.test.ts packages/ai/test/stream.test.tsnpx biome check --error-on-warnings packages/ai/test/live-api-gates.ts packages/ai/test/live-api-gates.test.ts packages/ai/test/stream.test.tsnpx tsgo --noEmitbash -n test.shnpm run buildnpm testThe default-env runs did not start an Ollama process, open TCP 11434, or modify the Ollama server log. The positive live Ollama suite was intentionally not executed; its opt-in boundary is covered with a mocked command.
Summary by cubic
Require explicit opt-in to run Ollama live tests so
npm testno longer probes or starts local models by default. The probe is now portable across Unix and Windows.Bug Fixes
whichon Unix andwhereon Windows.child_process.execSyncand updatetest.shto unset the new opt-in flags.stream.test.tsto use the shared availability check and skip by default.Migration
Written for commit 6393b5b. Summary will update on new commits.