Q186: data that can no longer be updated says how old it is and why

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-09 07:55:58 -04:00
1 parent f5526b075c
commit 6f6ed48549
5 files changed
+71 -3

No files matched your search

+36
View File
@@ -4,6 +4,8 @@ import { tmpdir } from "node:os";
import { join, resolve } from "node:path";
import { randomUUID } from "node:crypto";
import { DatabaseSync } from "node:sqlite";
import { seedBuiltinSkillsFixture } from "./builtin-skills-fixture";
import { closeApp, onboard } from "./onboard";
test("a first load that fails says why, keeps retrying, and recovers", async () => {
const profileDir = join(tmpdir(), `agentcompany-new-e2e-startup-${randomUUID()}`);
@@ -37,3 +39,37 @@ test("a first load that fails says why, keeps retrying, and recovers", async ()
await expect(page.getByRole("heading", { name: "Welcome" })).toBeVisible();
await app.close();
});
test("data that can no longer be updated says so, from when it is, and recovers", async () => {
const profileDir = join(tmpdir(), `agentcompany-new-e2e-stale-${randomUUID()}`);
mkdirSync(profileDir, { recursive: true });
const builtinDir = seedBuiltinSkillsFixture(join(tmpdir(), `agentcompany-new-e2e-stale-builtin-${randomUUID()}`));
const app = await electron.launch({
args: [resolve("out/main/index.js")],
env: { ...process.env, AGENTCOMPANY_NEW_PROFILE_DIR: profileDir, AGENTCOMPANY_NEW_AUTORUN: "0", AGENTCOMPANY_NEW_BUILTIN_SKILLS_DIR: builtinDir },
});
const setDraft = (json: string | null) => {
const db = new DatabaseSync(join(profileDir, "agentcompany.db"));
db.prepare("update app_state set onboarding_draft_json = ? where id = 1").run(json);
db.close();
};
const announceChange = () => app.evaluate(({ BrowserWindow }) => {
BrowserWindow.getAllWindows()[0]!.webContents.send("agentcompany:renderer-event", { type: "snapshot-changed" });
});
try {
const page = await app.firstWindow();
await onboard(page, "Stale Co");
setDraft("{");
await announceChange();
const banner = page.getByRole("alert").filter({ hasText: "Not up to date." });
await expect(banner).toContainText("Showing data from");
await expect(banner).toContainText("JSON");
// The rest of the app stays usable with the old data on screen.
await page.getByRole("button", { name: "Work" }).click();
setDraft(null);
await banner.getByRole("button", { name: "Retry now" }).click();
await expect(banner).toHaveCount(0);
} finally {
await closeApp(app);
}
});