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>;
|
connect(): Promise<void>;
|
||||||
close(): Promise<void>;
|
close(): Promise<void>;
|
||||||
openProject(cwd: string): Promise<{
|
openProject(cwd: string): Promise<{
|
||||||
workspace: { id: number; name: string; projectRootPath: string } | null;
|
workspace: { id: string; name: string; projectRootPath: string } | null;
|
||||||
error: string | null;
|
error: string | null;
|
||||||
}>;
|
}>;
|
||||||
createTerminal(
|
createTerminal(
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ type WorkspaceSetupDaemonClient = {
|
|||||||
close(): Promise<void>;
|
close(): Promise<void>;
|
||||||
openProject(cwd: string): Promise<{
|
openProject(cwd: string): Promise<{
|
||||||
workspace: {
|
workspace: {
|
||||||
id: number;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
workspaceDirectory: string;
|
workspaceDirectory: string;
|
||||||
projectRootPath: string;
|
projectRootPath: string;
|
||||||
@@ -22,7 +22,7 @@ type WorkspaceSetupDaemonClient = {
|
|||||||
}>;
|
}>;
|
||||||
createPaseoWorktree(input: { cwd: string; worktreeSlug?: string }): Promise<{
|
createPaseoWorktree(input: { cwd: string; worktreeSlug?: string }): Promise<{
|
||||||
workspace: {
|
workspace: {
|
||||||
id: number;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
workspaceDirectory: string;
|
workspaceDirectory: string;
|
||||||
projectRootPath: string;
|
projectRootPath: string;
|
||||||
@@ -31,7 +31,7 @@ type WorkspaceSetupDaemonClient = {
|
|||||||
}>;
|
}>;
|
||||||
fetchWorkspaces(): Promise<{
|
fetchWorkspaces(): Promise<{
|
||||||
entries: Array<{
|
entries: Array<{
|
||||||
id: number;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
workspaceDirectory: string;
|
workspaceDirectory: string;
|
||||||
projectRootPath: string;
|
projectRootPath: string;
|
||||||
@@ -302,18 +302,13 @@ export async function fetchWorkspaceById(
|
|||||||
client: WorkspaceSetupDaemonClient,
|
client: WorkspaceSetupDaemonClient,
|
||||||
workspaceId: string,
|
workspaceId: string,
|
||||||
): Promise<{
|
): Promise<{
|
||||||
id: number;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
workspaceDirectory: string;
|
workspaceDirectory: string;
|
||||||
projectRootPath: 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 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) {
|
if (!workspace) {
|
||||||
throw new Error(`Workspace not found: ${workspaceId}`);
|
throw new Error(`Workspace not found: ${workspaceId}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user