* fix(server): deduplicate workspaces by resolving to git worktree root Agents running in subdirectories of the same git repo were creating separate workspace entries in the sidebar. Now workspace IDs resolve to the git worktree root (via the already-computed `worktreeRoot` from `inspectCheckoutContext`), so all agents in the same checkout share a single workspace. Stale subdirectory workspace records are archived during reconciliation. * fix(server): fix 3 broken test files in server unit suite - relay-reconnect: move speech mock to correct constructor position and rename getSpeechReadiness→getReadiness after SpeechService refactor - commands-poc: add credential/CLI availability guards matching claude-agent.integration.test.ts pattern - claude-sdk-behavior: pass pathToClaudeCodeExecutable via findExecutable and add credential guards matching real provider configuration * fix(server): fix race condition in loop-service test mock Replace setTimeout(..., 0) with queueMicrotask() in ScriptedAgentSession so turn_completed events fire before the verify check runs. Fixes flaky CI failure where the file write hadn't completed before verification. * fix(server): use /bin/sh for loop verify checks instead of /bin/zsh More portable across CI environments. Also use queueMicrotask in test mock to fix race condition between event emission and waiter setup. * fix(server): correct import paths for isCommandAvailable and findExecutable Import from utils/executable.js (where they're exported) instead of provider-launch-config.js (which only imports them internally).
45 lines
1.5 KiB
TypeScript
45 lines
1.5 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { deriveProjectPlacementFromCwd, resolveProjectPlacement } from "./project-placement";
|
|
|
|
describe("project-placement", () => {
|
|
it("derives fallback placement from cwd", () => {
|
|
const placement = deriveProjectPlacementFromCwd("/Users/test/repo");
|
|
|
|
expect(placement.projectKey).toBe("/Users/test/repo");
|
|
expect(placement.projectName).toBe("repo");
|
|
expect(placement.checkout.cwd).toBe("/Users/test/repo");
|
|
expect(placement.checkout.isGit).toBe(false);
|
|
});
|
|
|
|
it("normalizes paseo worktree paths into the parent repo key", () => {
|
|
const placement = deriveProjectPlacementFromCwd("/Users/test/repo/.paseo/worktrees/feature-x");
|
|
|
|
expect(placement.projectKey).toBe("/Users/test/repo");
|
|
expect(placement.projectName).toBe("repo");
|
|
expect(placement.checkout.cwd).toBe("/Users/test/repo/.paseo/worktrees/feature-x");
|
|
});
|
|
|
|
it("prefers an existing placement when present", () => {
|
|
const existing = {
|
|
projectKey: "remote:github.com/acme/repo",
|
|
projectName: "acme/repo",
|
|
checkout: {
|
|
cwd: "/Users/test/repo",
|
|
isGit: true as const,
|
|
currentBranch: "main",
|
|
remoteUrl: "https://github.com/acme/repo.git",
|
|
worktreeRoot: "/Users/test/repo",
|
|
isPaseoOwnedWorktree: false as const,
|
|
mainRepoRoot: null,
|
|
},
|
|
};
|
|
|
|
const resolved = resolveProjectPlacement({
|
|
projectPlacement: existing,
|
|
cwd: "/Users/test/repo",
|
|
});
|
|
|
|
expect(resolved).toBe(existing);
|
|
});
|
|
});
|