fix(app): retain workspace pull request status across reloads
This commit is contained in:
@@ -490,6 +490,63 @@ describe("ReplicaCache", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("restores workspace change request checks beside the directory cursor", async () => {
|
||||||
|
const githubRuntime = {
|
||||||
|
featuresEnabled: true,
|
||||||
|
pullRequest: {
|
||||||
|
number: 824,
|
||||||
|
url: "https://github.com/blank-dot-page/editor/pull/824",
|
||||||
|
title: "Cut realistic editor typing latency by two thirds",
|
||||||
|
state: "OPEN",
|
||||||
|
baseRefName: "main",
|
||||||
|
headRefName: "perf-editor-typing-latency",
|
||||||
|
isMerged: false,
|
||||||
|
checksStatus: "success" as const,
|
||||||
|
checks: [
|
||||||
|
{
|
||||||
|
name: "Check",
|
||||||
|
status: "success" as const,
|
||||||
|
url: "https://github.com/blank-dot-page/editor/actions/runs/824",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
error: null,
|
||||||
|
};
|
||||||
|
const storage = new MemoryStorage();
|
||||||
|
const writer = new ReplicaCache(storage);
|
||||||
|
writer.setHosts([SERVER_ID]);
|
||||||
|
seedSession();
|
||||||
|
useSessionStore.getState().setWorkspaces(
|
||||||
|
SERVER_ID,
|
||||||
|
new Map([
|
||||||
|
[
|
||||||
|
"workspace-1",
|
||||||
|
normalizeWorkspaceDescriptor({
|
||||||
|
...workspace(),
|
||||||
|
forge: "github",
|
||||||
|
githubRuntime,
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
writer.writeDirectoryCheckpoint(SERVER_ID, {
|
||||||
|
workspaces: { generation: "daemon-generation", afterSeq: 9 },
|
||||||
|
});
|
||||||
|
await writer.flush();
|
||||||
|
|
||||||
|
useSessionStore.getState().clearSession(SERVER_ID);
|
||||||
|
const reader = new ReplicaCache(storage);
|
||||||
|
reader.setHosts([SERVER_ID]);
|
||||||
|
await reader.restore();
|
||||||
|
|
||||||
|
expect(
|
||||||
|
useSessionStore.getState().sessions[SERVER_ID]?.workspaces.get("workspace-1")?.githubRuntime,
|
||||||
|
).toEqual(githubRuntime);
|
||||||
|
expect(reader.readDirectoryCheckpoint(SERVER_ID)).toEqual({
|
||||||
|
workspaces: { generation: "daemon-generation", afterSeq: 9 },
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it("restores every registered host directory before any host reconnects", async () => {
|
it("restores every registered host directory before any host reconnects", async () => {
|
||||||
const storage = new MemoryStorage();
|
const storage = new MemoryStorage();
|
||||||
const writer = new ReplicaCache(storage);
|
const writer = new ReplicaCache(storage);
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
import { Buffer } from "buffer";
|
import { Buffer } from "buffer";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { AgentStatusSchema, AgentTimelineItemPayloadSchema } from "@getpaseo/protocol/messages";
|
import {
|
||||||
|
AgentStatusSchema,
|
||||||
|
AgentTimelineItemPayloadSchema,
|
||||||
|
WorkspaceGitHubRuntimePayloadSchema,
|
||||||
|
} from "@getpaseo/protocol/messages";
|
||||||
import { AgentProviderSchema } from "@getpaseo/protocol/provider-manifest";
|
import { AgentProviderSchema } from "@getpaseo/protocol/provider-manifest";
|
||||||
import {
|
import {
|
||||||
normalizeProjectDescriptor,
|
normalizeProjectDescriptor,
|
||||||
@@ -238,6 +242,7 @@ const StoredWorkspaceSchema = z.strictObject({
|
|||||||
diffStat: z.strictObject({ additions: z.number(), deletions: z.number() }).nullable(),
|
diffStat: z.strictObject({ additions: z.number(), deletions: z.number() }).nullable(),
|
||||||
scripts: z.array(WorkspaceScriptSchema),
|
scripts: z.array(WorkspaceScriptSchema),
|
||||||
gitRuntime: WorkspaceGitRuntimeSchema,
|
gitRuntime: WorkspaceGitRuntimeSchema,
|
||||||
|
githubRuntime: WorkspaceGitHubRuntimePayloadSchema,
|
||||||
forge: z.string().optional(),
|
forge: z.string().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -573,6 +578,7 @@ function serializeWorkspace(workspace: WorkspaceDescriptor): StoredWorkspace {
|
|||||||
terminalId: script.terminalId,
|
terminalId: script.terminalId,
|
||||||
})),
|
})),
|
||||||
gitRuntime: workspace.gitRuntime,
|
gitRuntime: workspace.gitRuntime,
|
||||||
|
githubRuntime: workspace.githubRuntime,
|
||||||
forge: workspace.forge,
|
forge: workspace.forge,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3514,7 +3514,7 @@ const WorkspaceGitRuntimePayloadSchema = z
|
|||||||
.optional()
|
.optional()
|
||||||
.nullable();
|
.nullable();
|
||||||
|
|
||||||
const WorkspaceGitHubRuntimePayloadSchema = z
|
export const WorkspaceGitHubRuntimePayloadSchema = z
|
||||||
.object({
|
.object({
|
||||||
featuresEnabled: z.boolean().optional(),
|
featuresEnabled: z.boolean().optional(),
|
||||||
pullRequest: z
|
pullRequest: z
|
||||||
|
|||||||
Reference in New Issue
Block a user