Fix e2e helpers: workspace IDs are strings, not numbers
After removing SQLite, workspace IDs are cwd path strings instead of numeric database IDs. Update type declarations in workspace-setup.ts and terminal-perf.ts, and remove the numeric parsing in fetchWorkspaceById that would reject path-based IDs.
This commit is contained in:
@@ -9,7 +9,7 @@ export type TerminalPerfDaemonClient = {
|
||||
connect(): Promise<void>;
|
||||
close(): Promise<void>;
|
||||
openProject(cwd: string): Promise<{
|
||||
workspace: { id: number; name: string; projectRootPath: string } | null;
|
||||
workspace: { id: string; name: string; projectRootPath: string } | null;
|
||||
error: string | null;
|
||||
}>;
|
||||
createTerminal(
|
||||
|
||||
@@ -13,7 +13,7 @@ type WorkspaceSetupDaemonClient = {
|
||||
close(): Promise<void>;
|
||||
openProject(cwd: string): Promise<{
|
||||
workspace: {
|
||||
id: number;
|
||||
id: string;
|
||||
name: string;
|
||||
workspaceDirectory: string;
|
||||
projectRootPath: string;
|
||||
@@ -22,7 +22,7 @@ type WorkspaceSetupDaemonClient = {
|
||||
}>;
|
||||
createPaseoWorktree(input: { cwd: string; worktreeSlug?: string }): Promise<{
|
||||
workspace: {
|
||||
id: number;
|
||||
id: string;
|
||||
name: string;
|
||||
workspaceDirectory: string;
|
||||
projectRootPath: string;
|
||||
@@ -31,7 +31,7 @@ type WorkspaceSetupDaemonClient = {
|
||||
}>;
|
||||
fetchWorkspaces(): Promise<{
|
||||
entries: Array<{
|
||||
id: number;
|
||||
id: string;
|
||||
name: string;
|
||||
workspaceDirectory: string;
|
||||
projectRootPath: string;
|
||||
@@ -302,18 +302,13 @@ export async function fetchWorkspaceById(
|
||||
client: WorkspaceSetupDaemonClient,
|
||||
workspaceId: string,
|
||||
): Promise<{
|
||||
id: number;
|
||||
id: string;
|
||||
name: string;
|
||||
workspaceDirectory: string;
|
||||
projectRootPath: string;
|
||||
}> {
|
||||
const parsedWorkspaceId = Number(workspaceId);
|
||||
if (!Number.isInteger(parsedWorkspaceId)) {
|
||||
throw new Error(`Workspace id is not numeric: ${workspaceId}`);
|
||||
}
|
||||
|
||||
const payload = await client.fetchWorkspaces();
|
||||
const workspace = payload.entries.find((entry) => entry.id === parsedWorkspaceId) ?? null;
|
||||
const workspace = payload.entries.find((entry) => String(entry.id) === workspaceId) ?? null;
|
||||
if (!workspace) {
|
||||
throw new Error(`Workspace not found: ${workspaceId}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user