@@ -6,6 +6,7 @@ import {
|
6 | 6 | listKnownSecretEnvVarNames, |
7 | 7 | PROVIDER_AUTH_ENV_VAR_CANDIDATES, |
8 | 8 | PROVIDER_ENV_VARS, |
| 9 | +resolveProviderAuthEnvVarCandidates, |
9 | 10 | resolveProviderAuthEvidence, |
10 | 11 | } from "./provider-env-vars.js"; |
11 | 12 | |
@@ -233,6 +234,48 @@ describe("provider env vars dynamic manifest metadata", () => {
|
233 | 234 | expect(pluginRegistryMocks.loadPluginMetadataSnapshot).not.toHaveBeenCalled(); |
234 | 235 | }); |
235 | 236 | |
| 237 | +it("does not reuse a load-path current snapshot for default provider env lookups", async () => { |
| 238 | +const staleSnapshot = { |
| 239 | +index: { |
| 240 | +plugins: [ |
| 241 | +{ |
| 242 | +pluginId: "load-path-provider", |
| 243 | +origin: "global", |
| 244 | +enabled: true, |
| 245 | +enabledByDefault: true, |
| 246 | +}, |
| 247 | +], |
| 248 | +}, |
| 249 | +plugins: [ |
| 250 | +{ |
| 251 | +id: "load-path-provider", |
| 252 | +origin: "global", |
| 253 | +providerAuthEnvVars: { |
| 254 | +"load-path-provider": ["LOAD_PATH_PROVIDER_API_KEY"], |
| 255 | +}, |
| 256 | +}, |
| 257 | +], |
| 258 | +}; |
| 259 | +pluginRegistryMocks.getCurrentPluginMetadataSnapshot.mockImplementation( |
| 260 | +(params: { config?: unknown; requireDefaultDiscoveryContext?: boolean }) => { |
| 261 | +if (params.config || params.requireDefaultDiscoveryContext) { |
| 262 | +return undefined; |
| 263 | +} |
| 264 | +return staleSnapshot; |
| 265 | +}, |
| 266 | +); |
| 267 | + |
| 268 | +expect( |
| 269 | +resolveProviderAuthEnvVarCandidates({ config: {} })["load-path-provider"], |
| 270 | +).toBeUndefined(); |
| 271 | +expect(pluginRegistryMocks.getCurrentPluginMetadataSnapshot).toHaveBeenCalledWith({ |
| 272 | +env: process.env, |
| 273 | +allowWorkspaceScopedSnapshot: true, |
| 274 | +requireDefaultDiscoveryContext: true, |
| 275 | +}); |
| 276 | +expect(pluginRegistryMocks.loadPluginMetadataSnapshot).toHaveBeenCalled(); |
| 277 | +}); |
| 278 | + |
236 | 279 | it("excludes untrusted workspace plugin auth evidence by default", async () => { |
237 | 280 | pluginRegistryMocks.loadPluginManifestRegistryForPluginRegistry.mockReturnValue({ |
238 | 281 | plugins: [ |
|