Archived
test(sessions): resolve POSIX fixture paths that are drive-relative on Windows
Five tests failed only on the Windows runner. Their fixtures used bare
POSIX-absolute paths such as /srv/other-worktree and /old-project, which
win32 treats as absolute but drive-relative: resolve() maps them onto the
runner's current drive (D:\...). The code under test canonicalizes stored
cwds by contract, so assertions comparing against the raw fixture string
never matched on Windows:
- parentSessionLocator and crossWorkspace listings annotate
parentSessionCwd with canonicalizeStoredCwd(header.cwd);
- cleanup forgets unread via canonicalizeStoredCwd(record.cwd), which
missed the marker the test seeded with the raw path.
Resolve the fixture paths once at declaration, matching the existing
WORKSPACE_CWD = resolve("/workspace") convention, so fixtures model what
a real Windows Pi would record. Linux behavior is unchanged.
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { join, resolve } from "node:path";
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
import { PiSessionService, type PiSessionListEntry } from "./piSessionService.js";
|
||||
import { CapturingSessionEventHub, emptyArchiveStore, fakeSessionManager, sessionRecord, testModelRuntime, type SessionGateway } from "./piSessionService.testSupport.js";
|
||||
|
||||
const TEST_AGENT_DIR = "/tmp/pi-web-test-agent";
|
||||
const CHILD_CWD = "/srv/dev/pi-web";
|
||||
const PARENT_CWD = "/srv/dev/pi-web-feature";
|
||||
// Resolved because the service canonicalizes header cwds before annotating: a
|
||||
// bare "/srv/..." is drive-relative on Windows and would land on the runner's
|
||||
// current drive.
|
||||
const PARENT_CWD = resolve("/srv/dev/pi-web-feature");
|
||||
|
||||
let tempDir: string;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user