Archived
Merge pull request #108 from jmfederico/fix/windows-session-test-paths
test(sessions): fix Windows-only failures from drive-relative fixture paths
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
import { resolve } from "node:path";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { countOutOfListingChildren, locateOutOfListingParents } from "./parentSessionLocator.js";
|
||||
import type { SessionHeaderSummary } from "./sessionFileHeader.js";
|
||||
|
||||
const PARENT_PATH = "/sessions/--srv-other--/parent.jsonl";
|
||||
const LISTING_CWD = "/srv/dev/pi-web";
|
||||
const PARENT_CWD = "/srv/other-worktree";
|
||||
// Resolved because the locator canonicalizes header cwds: a bare "/srv/..." is
|
||||
// drive-relative on Windows and would land on the runner's current drive.
|
||||
const PARENT_CWD = resolve("/srv/other-worktree");
|
||||
|
||||
describe("locateOutOfListingParents", () => {
|
||||
it("reports the cwd and id of a parent that is not in the listing", async () => {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -694,9 +694,13 @@ describe("PiSessionService daemon-owned unread state", () => {
|
||||
|
||||
it("clears unread for sessions archived and deleted by cleanup", async () => {
|
||||
const unreadStore = new SessionUnreadStore({ createCatalogId: () => "catalog-test" });
|
||||
completeStoreWork(unreadStore, "cleanup-archive", "/old-project");
|
||||
completeStoreWork(unreadStore, "cleanup-delete", "/old-project");
|
||||
const archivedRecord = { sessionId: "cleanup-delete", cwd: "/old-project", archivedAt: "2026-04-01T00:00:00.000Z", archivePath: "/archive/cleanup-delete.jsonl" };
|
||||
// Resolved because the service canonicalizes cwds before forgetting unread:
|
||||
// a bare "/old-project" is drive-relative on Windows and would land on the
|
||||
// runner's current drive, so the seeded marker would never match.
|
||||
const oldProjectCwd = resolve("/old-project");
|
||||
completeStoreWork(unreadStore, "cleanup-archive", oldProjectCwd);
|
||||
completeStoreWork(unreadStore, "cleanup-delete", oldProjectCwd);
|
||||
const archivedRecord = { sessionId: "cleanup-delete", cwd: oldProjectCwd, archivedAt: "2026-04-01T00:00:00.000Z", archivePath: "/archive/cleanup-delete.jsonl" };
|
||||
const service = new PiSessionService(new CapturingSessionEventHub(), {
|
||||
agentDir: TEST_AGENT_DIR,
|
||||
modelRuntime: testModelRuntime,
|
||||
@@ -705,7 +709,7 @@ describe("PiSessionService daemon-owned unread state", () => {
|
||||
sessionManager: {
|
||||
create: () => fakeSessionManager(),
|
||||
list: () => Promise.resolve([]),
|
||||
listAll: () => Promise.resolve([sessionRecord("cleanup-archive", "/old-project")]),
|
||||
listAll: () => Promise.resolve([sessionRecord("cleanup-archive", oldProjectCwd)]),
|
||||
open: () => fakeSessionManager(),
|
||||
},
|
||||
archiveStore: {
|
||||
|
||||
Reference in New Issue
Block a user