Repository navigation
test: the suite does not start real @opencode-ai/plugin installs
#1872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0e8e862
65ccba1
2229e0e
33cb412
e1ea0f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1063,6 +1063,18 @@ const loadConfigDirWithDependencies = ( | |
| describe("config dir plugin dependency install", () => { | ||
| const npmIt = testEffect(Layer.mergeAll(infra, FSUtil.defaultLayer)) | ||
|
|
||
| // The suite's preload switches the background install off. These cases check when the app | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. MINOR: no layer-level test shows that the switch actually stops the install. // The suite's preload switches the background install off. These cases check when the app
// asks for one, through a recording installer that never reaches the network.The new test calls
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added in 33cb412. One Config case sets the switch to |
||
| // asks for one, through a recording installer that never reaches the network. | ||
| let installOff: string | undefined | ||
| beforeEach(() => { | ||
| installOff = process.env["ALTIMATE_DISABLE_DEPENDENCY_INSTALL"] | ||
| delete process.env["ALTIMATE_DISABLE_DEPENDENCY_INSTALL"] | ||
| }) | ||
| afterEach(() => { | ||
| if (installOff === undefined) delete process.env["ALTIMATE_DISABLE_DEPENDENCY_INSTALL"] | ||
| else process.env["ALTIMATE_DISABLE_DEPENDENCY_INSTALL"] = installOff | ||
| }) | ||
|
|
||
| npmIt.effect("skips the install in a bare writable config dir but still writes .gitignore", () => | ||
| Effect.gen(function* () { | ||
| const npm = recordingNpm() | ||
|
|
@@ -1086,6 +1098,18 @@ describe("config dir plugin dependency install", () => { | |
| }).pipe(Effect.provide(testInstanceStoreLayer), Effect.provide(CrossSpawnSpawner.defaultLayer)), | ||
| ) | ||
|
|
||
| npmIt.effect("ALTIMATE_DISABLE_DEPENDENCY_INSTALL=1 asks for no install even with a local tool source", () => | ||
| Effect.gen(function* () { | ||
| process.env["ALTIMATE_DISABLE_DEPENDENCY_INSTALL"] = "1" | ||
| const npm = recordingNpm() | ||
| const dir = yield* tmpdirScoped() | ||
| const configDir = path.join(dir, "configdir") | ||
| yield* FSUtil.use.writeWithDirs(path.join(configDir, "tools", "hello.ts"), "export default {}\n") | ||
| yield* loadConfigDirWithDependencies(dir, configDir, npm) | ||
| expect(npm.dirs).toEqual([]) | ||
| }).pipe(Effect.provide(testInstanceStoreLayer), Effect.provide(CrossSpawnSpawner.defaultLayer)), | ||
| ) | ||
|
|
||
| npmIt.effect("installs when the config dir has a local plugin source", () => | ||
| Effect.gen(function* () { | ||
| const npm = recordingNpm() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,6 +50,12 @@ process.env["ALTIMATE_DISABLE_WORKSPACE"] = "1" | |
| // keychain); tests must never write there. Credential-store tests inject a backend instead. | ||
| process.env["ALTIMATE_CODE_DISABLE_OS_CREDENTIAL_STORE"] = "1" | ||
| // altimate_change end | ||
| // altimate_change start — a test that writes a tool or plugin file into a config dir makes the | ||
| // app start a real `npm install` of `@opencode-ai/plugin` there, in this process and not awaited. | ||
| // It outlives the test: several pile up, starve the event loop, and the tests that run next time | ||
| // out. Tests that check the install itself clear this and inject an installer. | ||
| process.env["ALTIMATE_DISABLE_DEPENDENCY_INSTALL"] = "1" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. MAJOR — this hides the cold-start subprocess regression test. process.env["ALTIMATE_DISABLE_DEPENDENCY_INSTALL"] = "1"The CLI test helpers pass the runner's environment to every child: Fix: opt that test back in, the same way it already does for PURE: env: {
OPENCODE_PURE: "0",
ALTIMATE_DISABLE_DEPENDENCY_INSTALL: "0",
...Its fake registry returns 503, and
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 33cb412. |
||
| // altimate_change end | ||
|
|
||
| // Set test home directory to isolate tests from user's actual home directory | ||
| // This prevents tests from picking up real user configs/skills from ~/.claude/skills | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MINOR · documentation — the flag covers less than this row suggests
The flag only gates the config-dir
@opencode-ai/plugininstall (ConfigPlugin.shouldInstallDependencies). Other installs still run with it set:BunProc.installinsrc/plugin/index.ts:141andNpm.addinsrc/plugin/shared.ts:213BunProc.installinsrc/provider/provider.ts:2272So an operator who sets it because the registry is unreachable, with
"plugin": ["some-plugin@1.0.0"]in their config, still gets a registry install attempt at startup.Suggested: state in this row that npm plugin and provider SDK installs are not affected. Or rename the flag to match its scope, e.g.
ALTIMATE_DISABLE_PLUGIN_SDK_INSTALL.