* Pull updates from evOo instead of the upstream Rakazo repository The in-app server updater, the image-based compose files and the desktop auto-updater still pointed at elie222/rakazo, so updating an evOo install would have pulled Rakazo. They now follow cynarAI/evOo-local, where the publish workflow already pushes the images. The disabled Rakazo production deploy job is gone from CI; evo deploys itself. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tgvrj34NMnaqvtgvruYQZZ * Call the product evOo everywhere people see its name The desktop setup window and menu, account emails, the iOS app name and permission prompts, sign-in headings, messages bots post into connected chat apps, the web fetch user agent, issue templates and the marketing site still said Rakazo, or EvOo. They now say evOo. The marketing site no longer calls evOo an alternative to itself. Internal identifiers (package scopes, env vars, bundle ids, the desktop productName that keys its data folder and keychain entry) stay as they are. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tgvrj34NMnaqvtgvruYQZZ * Open conversation actions by holding a row on a phone Pin, move to folder, mark unread, duplicate, archive and delete only opened on right-click, which iOS Safari never fires. Holding a conversation or a folder header now dispatches the same contextmenu event, so the existing menu opens under the finger; Android's own long-press event is not doubled and the lift does not also open the conversation. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tgvrj34NMnaqvtgvruYQZZ * Give small chrome icons a 44px touch area on phones The browser and computer toggles, the activity bell, the create button and the section plus buttons were 18 to 36 px targets. On touch screens each now gets an invisible 44px hit area without changing how it looks; the create button uses the same plus icon as the rest of the sidebar instead of a text glyph, and the computer toggle gets an accessible name. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tgvrj34NMnaqvtgvruYQZZ * Add German to the mobile app German speakers saw the phone app in English because the mobile UI only knew English, Simplified Chinese, and Russian. The app now ships a German catalog covering every mobile chrome string, follows a German device language (de, de-DE, de-AT, de-CH, ...), and offers Deutsch in the Account language picker. Strings that also exist in the web German catalog reuse its wording so web and phone say the same thing; the rest follow the same terms and the informal "du". Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tgvrj34NMnaqvtgvruYQZZ * Use the evOo sign-in strings in the German phone catalog Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tgvrj34NMnaqvtgvruYQZZ * Make account deletion work and give settings one section style Deleting an account posted to the auth endpoint without a JSON content type, so the server refused it and the button did nothing. The privacy page now deletes through the auth client and returns to sign-in. It also drops the claims it could not verify, the export button that only showed an alert, and its own padding, and shows where the data and the computer live. Notifications and media settings use the same SettingsSection. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tgvrj34NMnaqvtgvruYQZZ * Use status tokens, the shared switch and one German glossary Voice stage dots, the onboarding progress bar and the Voice First button used raw emerald, violet, cyan and rose; they now use foreground, success and destructive like the rest of the app. The routine editor's hand-built switch is the shared Switch. German says Unterhaltung for threads and Space consistently on web and phone. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tgvrj34NMnaqvtgvruYQZZ * Expect the evOo setup copy in the desktop e2e specs Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tgvrj34NMnaqvtgvruYQZZ * Translate the voice preview label in the German phone catalog Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tgvrj34NMnaqvtgvruYQZZ * Wait for the main thread URL without waiting for every resource openMainBotThread already navigated with domcontentloaded; its URL check then waited for the full load event, which can exceed 20 s on a busy runner. The composer check that follows covers readiness. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tgvrj34NMnaqvtgvruYQZZ --------- Co-authored-by: Claude <noreply@anthropic.com>
330 lines
12 KiB
TypeScript
330 lines
12 KiB
TypeScript
import { mkdir, mkdtemp, rm } from "node:fs/promises";
|
|
import { tmpdir } from "node:os";
|
|
import path from "node:path";
|
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
import {
|
|
applyServerUpdate,
|
|
assertNoGitApplyPath,
|
|
checkServerUpdate,
|
|
isUpdaterConfigured,
|
|
MAX_UPDATER_RESPONSE_BYTES,
|
|
readServerUpdateStatus,
|
|
type UpdaterProxyConfig,
|
|
UpdaterProxyError,
|
|
} from "./server-update.js";
|
|
|
|
const TOKEN = "fake-review-updater-token-000000000000";
|
|
const URL = "http://updater:7092";
|
|
const roots: string[] = [];
|
|
|
|
afterEach(async () => {
|
|
await Promise.all(roots.splice(0).map((root) => rm(root, { recursive: true, force: true })));
|
|
});
|
|
|
|
describe("server update install kind", () => {
|
|
async function tempRoot(withGit: boolean) {
|
|
const root = await mkdtemp(path.join(tmpdir(), "rakazo-update-"));
|
|
roots.push(root);
|
|
if (withGit) await mkdir(path.join(root, ".git"));
|
|
return root;
|
|
}
|
|
|
|
it("detects a source checkout when the sidecar is not wired", async () => {
|
|
const root = await tempRoot(true);
|
|
const status = await readServerUpdateStatus({
|
|
url: null,
|
|
token: null,
|
|
gitSha: "abc",
|
|
checkoutRoot: root,
|
|
fetch: vi.fn(),
|
|
});
|
|
expect(status.installKind).toBe("source");
|
|
expect(status.supported).toBe(false);
|
|
expect(status.manualCommands.some((line) => line.includes("git pull"))).toBe(true);
|
|
expect(status.manualCommands.some((line) => line.includes("migrate"))).toBe(true);
|
|
});
|
|
|
|
it("detects compose-without-sidecar when the updater URL is set but unreachable", async () => {
|
|
const root = await tempRoot(false);
|
|
const status = await readServerUpdateStatus({
|
|
url: URL,
|
|
token: TOKEN,
|
|
gitSha: "abc",
|
|
imageTag: "sha-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
checkoutRoot: root,
|
|
fetch: vi.fn(async () => {
|
|
throw new Error("ECONNREFUSED");
|
|
}),
|
|
});
|
|
expect(status.installKind).toBe("compose");
|
|
expect(status.supported).toBe(false);
|
|
expect(status.manualCommands[0]).toMatch(/docker compose .*pull api worker web/);
|
|
expect(status.manualCommands[1]).toMatch(/up -d --wait --pull never/);
|
|
});
|
|
|
|
it("shows rebuild commands for a compose install on the local image tag", async () => {
|
|
const root = await tempRoot(false);
|
|
const status = await readServerUpdateStatus({
|
|
url: URL,
|
|
token: TOKEN,
|
|
gitSha: "abc",
|
|
imageTag: "local",
|
|
checkoutRoot: root,
|
|
fetch: vi.fn(async () => {
|
|
throw new Error("ECONNREFUSED");
|
|
}),
|
|
});
|
|
expect(status.installKind).toBe("compose");
|
|
expect(status.manualCommands.some((line) => line.includes("--build"))).toBe(true);
|
|
expect(status.manualCommands.some((line) => line.includes("git pull"))).toBe(true);
|
|
expect(status.manualCommands.some((line) => /\bpull api worker web\b/.test(line))).toBe(false);
|
|
});
|
|
|
|
it("detects sidecar when health and authenticated state succeed", async () => {
|
|
const root = await tempRoot(false);
|
|
const fetchImpl = vi.fn(async (input: RequestInfo | URL) => {
|
|
const href = String(input);
|
|
if (href.endsWith("/health")) {
|
|
return new Response(JSON.stringify({ ok: true }), { status: 200 });
|
|
}
|
|
if (href.endsWith("/state")) {
|
|
return new Response(
|
|
JSON.stringify({
|
|
image: "ghcr.io/cynarai/evoo-local/app",
|
|
currentTag: "sha-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
previousTag: "sha-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
|
running: false,
|
|
checkout: {
|
|
present: true,
|
|
commit: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
branch: "main",
|
|
remoteUrl: "https://github.com/cynarAI/evOo-local",
|
|
dirty: false,
|
|
dirtyPaths: [],
|
|
},
|
|
}),
|
|
{ status: 200 },
|
|
);
|
|
}
|
|
return new Response("missing", { status: 404 });
|
|
});
|
|
const status = await readServerUpdateStatus({
|
|
url: URL,
|
|
token: TOKEN,
|
|
gitSha: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
checkoutRoot: root,
|
|
fetch: fetchImpl as unknown as typeof fetch,
|
|
});
|
|
expect(status.installKind).toBe("sidecar");
|
|
expect(status.supported).toBe(true);
|
|
expect(status.canRollback).toBe(true);
|
|
expect(status.manualCommands).toEqual([]);
|
|
expect(status.imageTag).toMatch(/^sha-/);
|
|
expect(status.lastRun).toBeNull();
|
|
});
|
|
|
|
it("surfaces a finished sidecar lastRun for recreate confirmation", async () => {
|
|
const root = await tempRoot(false);
|
|
const lastRun = {
|
|
startedAt: "2026-08-27T21:00:00.000Z",
|
|
finishedAt: "2026-08-27T21:01:00.000Z",
|
|
ok: false,
|
|
fromCommit: null,
|
|
toCommit: null,
|
|
fromTag: "sha-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
toTag: "sha-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
|
strategy: "pull",
|
|
repoUrl: "https://github.com/cynarAI/evOo-local",
|
|
branch: "main",
|
|
restart: "not-required",
|
|
restartAdvice: "Recreate failed; prior image restored, env pin not restored.",
|
|
error: "Recreate the stack failed.",
|
|
steps: [],
|
|
};
|
|
const fetchImpl = vi.fn(async (input: RequestInfo | URL) => {
|
|
const href = String(input);
|
|
if (href.endsWith("/health")) {
|
|
return new Response(JSON.stringify({ ok: true }), { status: 200 });
|
|
}
|
|
if (href.endsWith("/state")) {
|
|
return new Response(
|
|
JSON.stringify({
|
|
image: "ghcr.io/cynarai/evoo-local/app",
|
|
currentTag: "sha-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
|
previousTag: "sha-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
running: false,
|
|
lastRun,
|
|
checkout: {
|
|
present: true,
|
|
commit: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
branch: "main",
|
|
remoteUrl: "https://github.com/cynarAI/evOo-local",
|
|
dirty: false,
|
|
dirtyPaths: [],
|
|
},
|
|
}),
|
|
{ status: 200 },
|
|
);
|
|
}
|
|
return new Response("missing", { status: 404 });
|
|
});
|
|
const status = await readServerUpdateStatus({
|
|
url: URL,
|
|
token: TOKEN,
|
|
gitSha: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
checkoutRoot: root,
|
|
fetch: fetchImpl as unknown as typeof fetch,
|
|
});
|
|
expect(status.lastRun).toMatchObject({
|
|
ok: false,
|
|
fromTag: "sha-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
toTag: "sha-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
|
error: "Recreate the stack failed.",
|
|
});
|
|
});
|
|
});
|
|
|
|
describe("sidecar proxy auth and no-git-apply", () => {
|
|
it("requires both URL and token before claiming the sidecar is configured", () => {
|
|
expect(isUpdaterConfigured({ url: URL, token: null, gitSha: undefined })).toBe(false);
|
|
expect(isUpdaterConfigured({ url: null, token: TOKEN, gitSha: undefined })).toBe(false);
|
|
expect(isUpdaterConfigured({ url: URL, token: TOKEN, gitSha: undefined })).toBe(true);
|
|
});
|
|
|
|
it("sends the bearer token to the sidecar and never returns it", async () => {
|
|
const authHeaders: string[] = [];
|
|
const fetchImpl = vi.fn(async (input: RequestInfo | URL, init?: RequestInit) => {
|
|
const href = String(input);
|
|
const headers = new Headers(init?.headers);
|
|
const authorization = headers.get("authorization");
|
|
if (authorization) authHeaders.push(authorization);
|
|
if (href.endsWith("/health")) {
|
|
return new Response(JSON.stringify({ ok: true }), { status: 200 });
|
|
}
|
|
if (href.endsWith("/state")) {
|
|
return new Response(JSON.stringify({ running: false, currentTag: "local" }), {
|
|
status: 200,
|
|
});
|
|
}
|
|
if (href.endsWith("/plan")) {
|
|
return new Response(
|
|
JSON.stringify({
|
|
upToDate: false,
|
|
targetCommit: "cccccccccccccccccccccccccccccccccccccccc",
|
|
targetTag: "sha-cccccccccccccccccccccccccccccccccccccccc",
|
|
checkout: { commit: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", dirty: false },
|
|
}),
|
|
{ status: 200 },
|
|
);
|
|
}
|
|
return new Response(JSON.stringify({ error: "unexpected" }), { status: 500 });
|
|
});
|
|
const root = await mkdtemp(path.join(tmpdir(), "rakazo-proxy-"));
|
|
roots.push(root);
|
|
const config: UpdaterProxyConfig = {
|
|
url: URL,
|
|
token: TOKEN,
|
|
gitSha: undefined,
|
|
checkoutRoot: root,
|
|
fetch: fetchImpl as unknown as typeof fetch,
|
|
};
|
|
const check = await checkServerUpdate(config);
|
|
expect(check.status).toBe("available");
|
|
expect(authHeaders).toContain(`Bearer ${TOKEN}`);
|
|
expect(JSON.stringify(check)).not.toContain(TOKEN);
|
|
});
|
|
|
|
it("rejects check/apply when the sidecar is off (no git apply path)", async () => {
|
|
const config: UpdaterProxyConfig = {
|
|
url: null,
|
|
token: null,
|
|
gitSha: undefined,
|
|
fetch: vi.fn(),
|
|
};
|
|
await expect(checkServerUpdate(config)).rejects.toBeInstanceOf(UpdaterProxyError);
|
|
await expect(applyServerUpdate(config)).rejects.toMatchObject({
|
|
message: expect.stringMatching(/sidecar/i),
|
|
});
|
|
expect(assertNoGitApplyPath).toBeTypeOf("function");
|
|
expect(() => assertNoGitApplyPath("source")).toThrow(/cannot apply/);
|
|
expect(() => assertNoGitApplyPath("compose")).toThrow(/cannot apply/);
|
|
expect(() => assertNoGitApplyPath("sidecar")).not.toThrow();
|
|
});
|
|
|
|
it("maps a 401 from the sidecar without exposing the token", async () => {
|
|
const fetchImpl = vi.fn(async (input: RequestInfo | URL) => {
|
|
const href = String(input);
|
|
if (href.endsWith("/health")) {
|
|
return new Response(JSON.stringify({ ok: true }), { status: 200 });
|
|
}
|
|
return new Response(JSON.stringify({ error: "unauthorized" }), { status: 401 });
|
|
});
|
|
const config: UpdaterProxyConfig = {
|
|
url: URL,
|
|
token: TOKEN,
|
|
gitSha: undefined,
|
|
fetch: fetchImpl as unknown as typeof fetch,
|
|
};
|
|
await expect(applyServerUpdate(config)).rejects.toMatchObject({
|
|
message: expect.stringMatching(/credential|reachable|sidecar/i),
|
|
});
|
|
await expect(applyServerUpdate(config)).rejects.not.toMatchObject({
|
|
message: expect.stringContaining(TOKEN),
|
|
});
|
|
});
|
|
|
|
it("rejects an oversized declared sidecar response without waiting for cancellation", async () => {
|
|
const cancel = vi.fn();
|
|
const fetchImpl = vi.fn(async (input: RequestInfo | URL) => {
|
|
const href = String(input);
|
|
if (href.endsWith("/health")) return Response.json({ ok: true });
|
|
if (href.endsWith("/state")) return Response.json({ running: false });
|
|
return new Response(new ReadableStream({ cancel }), {
|
|
status: 200,
|
|
headers: { "content-length": String(MAX_UPDATER_RESPONSE_BYTES + 1) },
|
|
});
|
|
});
|
|
|
|
await expect(
|
|
applyServerUpdate({
|
|
url: URL,
|
|
token: TOKEN,
|
|
gitSha: undefined,
|
|
fetch: fetchImpl as unknown as typeof fetch,
|
|
}),
|
|
).rejects.toMatchObject({
|
|
message: "The updater sidecar response is too large.",
|
|
status: 502,
|
|
});
|
|
await vi.waitFor(() => expect(cancel).toHaveBeenCalledOnce());
|
|
});
|
|
|
|
it("rejects a streamed sidecar response once it crosses the byte limit", async () => {
|
|
const fetchImpl = vi.fn(async (input: RequestInfo | URL) => {
|
|
const href = String(input);
|
|
if (href.endsWith("/health")) return Response.json({ ok: true });
|
|
if (href.endsWith("/state")) return Response.json({ running: false });
|
|
return new Response(
|
|
new ReadableStream({
|
|
start(controller) {
|
|
controller.enqueue(new Uint8Array(MAX_UPDATER_RESPONSE_BYTES + 1));
|
|
},
|
|
}),
|
|
{ status: 200 },
|
|
);
|
|
});
|
|
|
|
await expect(
|
|
applyServerUpdate({
|
|
url: URL,
|
|
token: TOKEN,
|
|
gitSha: undefined,
|
|
fetch: fetchImpl as unknown as typeof fetch,
|
|
}),
|
|
).rejects.toMatchObject({
|
|
message: "The updater sidecar response is too large.",
|
|
status: 502,
|
|
});
|
|
});
|
|
});
|