fix: Windows-native CI findings on latest master

Local run of check:ci:windows-complete (the windows-native gate) on
latest master surfaced five Windows-only failures, all unreachable by
current CI because the native windows job is disabled and the wine gate
only covers build+site.

- install-lefthook/translation-pairing-merge specs junctioned the real
  scripts/ and tsx package into fixtures; Windows recursive deletion
  (Node rmSync and git worktree remove) follows MOUNT_POINT junctions and
  deleted the repository's own directories mid-run. Fixtures now unlink
  their reparse points before any recursive removal (shared helper in
  scripts/test-fixture-cleanup.ts).
- workflow-workerthread spawned its worker with an empty env; on Windows
  os.tmpdir() then degrades to the literal relative path undefined\temp,
  so tsx wrote its transform cache into a cwd-relative undefined/
  directory inside the repo. The worker env now injects the host temp
  path on win32 (workerSpawnEnv, platform-parameterized and unit-tested
  on both arms).
- workspace-context spec did not stub USERPROFILE (win32 homedir) or a
  set DSH_HOME, leaking the developer machine's real ~/.dsh/AGENTS.md
  into discovery.
- ui-trajectory client-bundle spec mounted the built artifact without the
  remote/settingsScope provides the locale plugin needs, so the plugin
  never activated and no view registered.
- subagent temp-fixture cleanup lacked the maxRetries Windows handle
  release needs under load (EPERM); added retries to the three affected
  specs and the fixture-cleanup helper.
This commit is contained in:
Huanqi Cao
2026-08-12 01:11:46 +08:00
committed by Chinesezjc
parent 54cc6033a6
commit 4ed036da1c
9 changed files with 137 additions and 18 deletions

View File

@@ -578,10 +578,12 @@ describe('workspace context instruction discovery', () => {
const root = await tempRepo()
const emptyHome = await tempRepo()
// Isolate the default-home fallback: blank DSH_HOME is treated as unset, and
// HOME points at an empty dir so the default ~/.dsh holds no global scope.
// Symlinks are followed, so a real ~/.dsh/AGENTS.md would otherwise leak in.
// the home dirs point at an empty dir so the default ~/.dsh holds no global
// scope. Windows homedir() reads USERPROFILE (not HOME), so both must be
// stubbed or a real ~/.dsh/AGENTS.md would otherwise leak in.
vi.stubEnv('DSH_HOME', '')
vi.stubEnv('HOME', emptyHome)
if (process.platform === 'win32') vi.stubEnv('USERPROFILE', emptyHome)
try {
const cwd = join(root, 'child')
await mkdir(cwd, { recursive: true })
@@ -622,6 +624,8 @@ describe('workspace context instruction discovery', () => {
try {
await write(join(home, '.dsh/AGENTS.md'), 'global default rule')
// A set DSH_HOME would override the homedir default and relabel the home.
vi.stubEnv('DSH_HOME', '')
vi.resetModules()
vi.doMock('node:os', () => ({ homedir: () => home }))
const isolated = await import('@deepseek-ai/dsh-agent-instructions')
@@ -629,6 +633,7 @@ describe('workspace context instruction discovery', () => {
expect(files.map(file => file.displayPath)).toEqual(['~/.dsh/AGENTS.md'])
} finally {
vi.unstubAllEnvs()
vi.doUnmock('node:os')
vi.resetModules()
await rm(root, { recursive: true, force: true })