Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

chore: auto-save WIP via Claude stop-hook safety net (2026-07-03 11:56)

Ruben Lütke4df7b9a61f65
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingFlow.test.tsx b/jarvis/ui/web/frontend/src/components/onboarding/OnboardingFlow.test.tsx
index b170fce025..852320d4ff 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingFlow.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/onboarding/OnboardingFlow.test.tsx
@@ -15,7 +15,6 @@ const { dbl } = vi.hoisted(() => {
return { dbl };
});
vi.mock("./steps/WelcomeStep", () => ({ WelcomeStep: dbl("step-welcome") }));
-vi.mock("./steps/TermsStep", () => ({ TermsStep: dbl("step-terms") }));
vi.mock("./steps/LanguageStep", () => ({ LanguageStep: dbl("step-language") }));
vi.mock("./steps/WakeWordStep", () => ({ WakeWordStep: dbl("step-wake-word") }));
vi.mock("./steps/ApiKeysStep", () => ({ ApiKeysStep: dbl("step-api-keys") }));
@@ -34,7 +33,7 @@ function makeOnb(stateOverrides: Record<string, unknown> = {}) {
terms: { accepted: false, accepted_version: null, current_version: "1.0" },
wake_word_acknowledged: false,
legal_references: [],
- steps: ["welcome", "terms", "finish"],
+ steps: ["welcome", "language", "finish"],
...stateOverrides,
},
loading: false,
@@ -58,8 +57,8 @@ it("advancing persists the next step and shows it", () => {
render(<OnboardingFlow onb={onb} />);
fireEvent.click(within(screen.getByTestId("step-welcome")).getByText("next"));
expect((onb as never as { saveStep: ReturnType<typeof vi.fn> }).saveStep)
- .toHaveBeenCalledWith("terms", []);
- expect(screen.getByTestId("step-terms")).toBeDefined();
+ .toHaveBeenCalledWith("language", []);
+ expect(screen.getByTestId("step-language")).toBeDefined();
});
it("always starts at the first step, ignoring a saved current_step", () => {
@@ -69,23 +68,18 @@ it("always starts at the first step, ignoring a saved current_step", () => {
expect(screen.getByTestId("step-welcome")).toBeDefined();
});
-it("honors an explicit initialStep (the terms-version-bump re-open)", () => {
- render(<OnboardingFlow onb={makeOnb({ current_step: "finish" })} initialStep="terms" />);
- expect(screen.getByTestId("step-terms")).toBeDefined();
-});
-
it("skip accumulates the skipped step", () => {
const onb = makeOnb();
render(<OnboardingFlow onb={onb} />);
fireEvent.click(within(screen.getByTestId("step-welcome")).getByText("skip"));
expect((onb as never as { saveStep: ReturnType<typeof vi.fn> }).saveStep)
- .toHaveBeenCalledWith("terms", ["welcome"]);
+ .toHaveBeenCalledWith("language", ["welcome"]);
});
it("REGISTRY covers exactly the canonical backend steps", () => {
expect(new Set(STEP_KEYS)).toEqual(
new Set([
- "welcome", "terms", "language", "wake-word",
+ "welcome", "language", "wake-word",
"api-keys", "finish",
]),
);
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.test.tsx b/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.test.tsx
index 33b52fc6ca..aa2dc1f3a0 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.test.tsx
@@ -39,16 +39,6 @@ it("renders nothing when completed", async () => {
await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());
});
-it("re-shows for a terms version bump even when completed", async () => {
- stub({
- ...base,
- completed: true,
- terms: { accepted: true, accepted_version: "1.0", current_version: "1.1" },
- });
- render(<OnboardingGate />);
- await waitFor(() => expect(screen.getByRole("dialog")).toBeDefined());
-});
-
it("fails open (renders nothing) on a fetch error", async () => {
stub("error");
render(<OnboardingGate />);
@@ -64,7 +54,9 @@ it("shows the tutorial video after the risk gate, then the step flow", async ()
fireEvent.click(screen.getByRole("checkbox"));
fireEvent.click(screen.getByRole("button", { name: /continue/i }));
- // Second screen: the YouTube tutorial embed.
+ // Second screen: the tutorial video. It uses a click-to-play thumbnail
+ // facade, so the YouTube embed only mounts once the user presses play.
+ fireEvent.click(screen.getByRole("button", { name: /play the tutorial video/i }));
const frame = screen.getByTitle(/tour/i) as HTMLIFrameElement;
expect(frame.src).toContain("youtube-nocookie.com");
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.tsx b/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.tsx
index 42ff29d901..364610c081 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.tsx
+++ b/jarvis/ui/web/frontend/src/components/onboarding/OnboardingGate.tsx
@@ -7,9 +7,8 @@ import { IntroVideoScreen } from "./IntroVideoScreen";
/**
* Blocking overlay that shows the onboarding flow until it is completed.
* Fails open (renders nothing) while loading or on a fetch error so a broken
- * guide never traps the user. Re-shows once when the accepted Terms version is
- * older than the shipped version (opening at the terms step). `?onboarding=force`
- * forces the flow for non-destructive dev replay.
+ * guide never traps the user. `?onboarding=force` forces the flow for
+ * non-destructive dev replay.
*/
export function OnboardingGate() {
const onb = useOnboarding();
@@ -46,18 +45,10 @@ export function OnboardingGate() {
if (onb.error) return null; // fail open — never trap the user
if (!onb.state) return null;
- const termsOutdated =
- onb.state.terms.accepted &&
- onb.state.terms.accepted_version !== onb.state.terms.current_version;
- const show = (forced || !onb.state.completed || termsOutdated) && !dismissed;
+ const show = (forced || !onb.state.completed) && !dismissed;
if (!show) return null;
- // On a terms version bump for an already-completed install, re-open at terms.
- const isTermsBumpReopen = Boolean(onb.state.completed && termsOutdated);
- const initialStep = isTermsBumpReopen ? "terms" : undefined;
- // Skip the tutorial on a pure terms-bump re-open: that user has already seen
- // it and is only re-accepting a new Terms version.
- const showVideo = !videoSeen && !isTermsBumpReopen;
+ const showVideo = !videoSeen;
return (
<div
@@ -70,7 +61,7 @@ export function OnboardingGate() {
) : showVideo ? (
<IntroVideoScreen onContinue={() => setVideoSeen(true)} />
) : (
- <OnboardingFlow onb={onb} initialStep={initialStep} />
+ <OnboardingFlow onb={onb} />
)}
</div>
);
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/TermsStep.test.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/TermsStep.test.tsx
deleted file mode 100644
index 304a2b4ca8..0000000000
--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/TermsStep.test.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
-import { afterEach, expect, it, vi } from "vitest";
-vi.mock("@/i18n", () => ({ useT: () => (k: string) => k }));
-import { TermsStep } from "./TermsStep";
-afterEach(() => { cleanup(); vi.restoreAllMocks(); });
-
-function stubTerms() {
- vi.stubGlobal(
- "fetch",
- vi.fn().mockResolvedValue({
- ok: true,
- json: () => Promise.resolve({ version: "1.0", text: "THE TERMS BODY" }),
- }),
- );
-}
-
-it("renders the fetched terms body", async () => {
- stubTerms();
- render(<TermsStep onb={{ acceptTerms: vi.fn() } as never} goNext={vi.fn()} goBack={vi.fn()} skip={vi.fn()} isFirst={false} isLast={false} />);
- await waitFor(() => expect(screen.getByText("THE TERMS BODY")).toBeDefined());
-});
-
-it("blocks continue until accepted, then accepts + advances", async () => {
- stubTerms();
- const goNext = vi.fn();
- const acceptTerms = vi.fn().mockResolvedValue(undefined);
- render(<TermsStep onb={{ acceptTerms } as never} goNext={goNext} goBack={vi.fn()} skip={vi.fn()} isFirst={false} isLast={false} />);
- const cta = screen.getByRole("button", { name: "onboarding.terms.continue" });
- expect((cta as HTMLButtonElement).disabled).toBe(true);
- fireEvent.click(screen.getByRole("checkbox"));
- expect((cta as HTMLButtonElement).disabled).toBe(false);
- fireEvent.click(cta);
- await waitFor(() => expect(acceptTerms).toHaveBeenCalled());
- expect(goNext).toHaveBeenCalled();
-});
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/TermsStep.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/TermsStep.tsx
deleted file mode 100644
index a4b947412a..0000000000
--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/TermsStep.tsx
+++ /dev/null
@@ -1,59 +0,0 @@
-import { useEffect, useState } from "react";
-import { Button } from "@/components/ui/button";
-import { useT } from "@/i18n";
-import type { StepProps } from "../OnboardingFlow";
-
-export function TermsStep({ onb, goNext }: StepProps) {
- const t = useT();
- const [accepted, setAccepted] = useState(false);
- const [busy, setBusy] = useState(false);
- const [body, setBody] = useState("");
- const [err, setErr] = useState<string | null>(null);
-
- useEffect(() => {
- let cancelled = false;
- fetch("/api/onboarding/terms")
- .then((r) => (r.ok ? r.json() : Promise.reject(new Error(`HTTP ${r.status}`))))
- .then((d: { text?: string }) => {
- if (!cancelled) setBody(d.text ?? "");
- })
- .catch(() => {
- if (!cancelled) setBody("");
- });
- return () => {
- cancelled = true;
- };
- }, []);
-
- async function onContinue() {
- if (!accepted || busy) return;
- setBusy(true);
- setErr(null);
- try {
- await onb.acceptTerms();
- goNext();
- } catch (e) {
- setErr((e as Error).message);
- } finally {
- setBusy(false);
- }
- }
-
- return (
- <div className="flex flex-col gap-4">
- <h2 className="font-display text-lg font-semibold">{t("onboarding.terms.title")}</h2>
- <p className="text-sm text-muted-foreground">{t("onboarding.terms.intro")}</p>
- <div className="max-h-56 min-h-0 overflow-y-auto scrollbar-jarvis whitespace-pre-line rounded-md border border-border bg-background p-3 text-xs text-muted-foreground">
- {body}
- </div>
- <label className="flex items-center gap-2 text-sm">
- <input type="checkbox" checked={accepted} onChange={(e) => setAccepted(e.target.checked)} />
- {t("onboarding.terms.accept_label")}
- </label>
- {err && <p className="text-xs text-amber-500">{err}</p>}
- <Button className="w-full" disabled={!accepted || busy} onClick={onContinue}>
- {t("onboarding.terms.continue")}
- </Button>
- </div>
- );
-}
diff --git a/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.test.tsx b/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.test.tsx
index 7a3d2e21a1..d61c86452d 100644
--- a/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/onboarding/steps/WakeWordStep.test.tsx
@@ -24,6 +24,9 @@ it("requires word + acknowledgment, then saves 'Hey <word>' and advances", async
const goNext = vi.fn();
render(<WakeWordStep onb={onb} goNext={goNext} goBack={vi.fn()} skip={vi.fn()} isFirst={false} isLast={false} />);
+ // The trademark references are tucked behind a "How to check" toggle now —
+ // reveal them before asserting the register link is present.
+ fireEvent.click(screen.getByRole("button", { name: "onboarding.wake_word.learn_more" }));
expect(screen.getByRole("link", { name: "EUIPO" })).toBeDefined();
const cta = screen.getByRole("button", { name: "onboarding.wake_word.cta" });