mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-06 07:11:59 +00:00
Review asked why this is a plugin and why it exports so much. The design note this branch shipped answered the second question itself — "a pure resolution function plus an installation function" — and the code drifted to seventeen exports and a Cordis plugin nobody approved or mounted. The plugin is gone. Transport policy has one answer per process: nothing to swap, and no scope narrower than the process to give one. Its `Config` was also the only supplier of a configuration branch, so resolution now reads the environment and nothing else — `mode`, the config-sourced fields, and the `config` policy source were unreachable the moment the plugin left. Four exports nothing outside the package used are internal again, and `currentProxyPolicy` answers with the direct policy instead of `undefined`, so `DIRECT_POLICY` no longer needs a public face. Nine functions remain, one per way a caller can need the policy; two is not reachable with six consumer seams. The package moves to `util/`. The note claimed a dependency on `undici` disqualified it from that group; the charter governs harness dependencies, not external ones, and the process note that says so predates this branch. The real blocker was the harness dependency: resolution needed one method of `LaunchEnvironmentSnapshot`, so it names a structural `EnvLookup` and the launcher passes its snapshot unchanged. `net/` is dissolved. Dropping the group's line from the repository layout also returns `AGENTS.md` to its original ceiling, so the raise the merge needed is reverted.
44 lines
2.1 KiB
TypeScript
44 lines
2.1 KiB
TypeScript
import { readFileSync } from 'node:fs'
|
|
import { describe, expect, it } from 'vitest'
|
|
import { PROXY_ENV_NAMES } from '../packages/util/http-proxy/src/policy.ts'
|
|
import { clearAmbientProxyEnv, TEST_PROXY_SETUP_FILE, vitestConfigFiles } from './test-proxy-environment.ts'
|
|
|
|
describe('ambient proxy environment', () => {
|
|
it('clears every name the policy resolver reads, in both casings', () => {
|
|
const env: NodeJS.ProcessEnv = {
|
|
HTTP_PROXY: 'http://p:1', http_proxy: 'http://p:1',
|
|
HTTPS_PROXY: 'http://p:1', https_proxy: 'http://p:1',
|
|
ALL_PROXY: 'http://p:1', all_proxy: 'http://p:1',
|
|
NO_PROXY: 'example.com', no_proxy: 'example.com',
|
|
NODE_USE_ENV_PROXY: '1',
|
|
PATH: '/usr/bin',
|
|
}
|
|
expect(clearAmbientProxyEnv(env)).toHaveLength(PROXY_ENV_NAMES.length + 1)
|
|
expect(env).toEqual({ PATH: '/usr/bin' })
|
|
})
|
|
|
|
it('reports only the names that were set, and touches nothing else', () => {
|
|
const env: NodeJS.ProcessEnv = { all_proxy: 'http://p:1', HOME: '/home/me' }
|
|
expect(clearAmbientProxyEnv(env)).toEqual(['all_proxy'])
|
|
expect(env).toEqual({ HOME: '/home/me' })
|
|
})
|
|
|
|
// A runtime assertion that this process is clear would pass either way: importing the module
|
|
// above already ran it. What can actually regress is the wiring — a new Vitest project, or a
|
|
// config that lists only the invariant host — so that is what this pins.
|
|
const declared = vitestConfigFiles()
|
|
.map(config => ({ config, slots: readFileSync(config, 'utf8').match(/setupFiles: \[[^\]]*\]/g) ?? [] }))
|
|
.filter(entry => entry.slots.length > 0)
|
|
|
|
it('finds the configurations that declare a setup at all', () => {
|
|
// Guards the discovery itself: a glob that stopped matching would make every case below vacuous.
|
|
expect(declared.map(entry => entry.config)).toEqual([
|
|
'vitest.config.ts', 'vitest.e2e.config.ts', 'vitest.expected.config.ts', 'vitest.snapshot.config.ts',
|
|
])
|
|
})
|
|
|
|
it.each(declared)('$config runs the setup in every setupFiles it declares', ({ slots }) => {
|
|
for (const slot of slots) expect(slot).toContain(TEST_PROXY_SETUP_FILE)
|
|
})
|
|
})
|