From 7b9763951cbbaa366b506d1628414c6a883b7d0b Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Wed, 12 Aug 2026 22:21:23 +0900 Subject: fix(models): verify persisted-state migration write-back + numbered probe fixtures - app/store.test: the persisted-tab migration test now also asserts the migrated opencode-1/ value was ACTUALLY written back to the storage adapter (dispatch.tabs), not merely changed in memory, and that no legacy opencode/ value remains (idempotent; issue 7). - scripts/live-probe + live-probe-provider-retry: default PROBE_MODEL and usage examples updated from the obsolete 'opencode/' namespace to numbered 'opencode-1/' so generic fixtures no longer normalize the old namespace as ordinary valid data (issue 8). Verification: bun run typecheck (0 errors), bun run test (1179 passed), bun run check (clean, exit 0), bun run build (vite OK). --- scripts/live-probe-provider-retry.ts | 4 ++-- scripts/live-probe.ts | 4 ++-- src/app/store.test.ts | 8 ++++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/live-probe-provider-retry.ts b/scripts/live-probe-provider-retry.ts index 952163c..d7b8c6b 100644 --- a/scripts/live-probe-provider-retry.ts +++ b/scripts/live-probe-provider-retry.ts @@ -19,7 +19,7 @@ * the JSON-parse boundary the unit tests skip (they pass constructed events). * * bun scripts/live-probe-provider-retry.ts - * PROBE_MODEL=opencode/glm-5.2 bun scripts/live-probe-provider-retry.ts + * PROBE_MODEL=opencode-1/glm-5.2 bun scripts/live-probe-provider-retry.ts */ import type { ChatDeltaMessage, ChatErrorMessage } from "@dispatch/transport-contract"; import type { SurfaceServerMessage } from "@dispatch/ui-contract"; @@ -33,7 +33,7 @@ import { } from "../src/core/chunks/index.ts"; const WS_URL = process.env.PROBE_WS ?? "ws://localhost:24205"; -const MODEL = process.env.PROBE_MODEL ?? "opencode/deepseek-v4-flash"; +const MODEL = process.env.PROBE_MODEL ?? "opencode-1/deepseek-v4-flash"; const PROMPT = process.env.PROBE_PROMPT ?? "Reply with exactly: ok"; type ChatMsg = ChatDeltaMessage | ChatErrorMessage; diff --git a/scripts/live-probe.ts b/scripts/live-probe.ts index 6121eac..ad00179 100644 --- a/scripts/live-probe.ts +++ b/scripts/live-probe.ts @@ -4,7 +4,7 @@ * `bun run test`. Run with the backend up: * * bun scripts/live-probe.ts # default model - * PROBE_MODEL=opencode/glm-5 bun scripts/live-probe.ts + * PROBE_MODEL=opencode-1/glm-5 bun scripts/live-probe.ts * PROBE_TOOL_PROMPT="..." bun scripts/live-probe.ts # override the tool turn * * Drives the FE's REAL network-facing modules (the thin live integration test the @@ -55,7 +55,7 @@ import { createConversationCache } from "../src/features/conversation-cache/inde const WS_URL = process.env.PROBE_WS ?? "ws://localhost:24205"; const HTTP_BASE = process.env.PROBE_HTTP ?? "http://localhost:24203"; -const MODEL = process.env.PROBE_MODEL ?? "opencode/deepseek-v4-flash"; +const MODEL = process.env.PROBE_MODEL ?? "opencode-1/deepseek-v4-flash"; const TEXT_PROMPT = process.env.PROBE_PROMPT ?? "Reply with exactly: hello from dispatch"; const TOOL_PROMPT = process.env.PROBE_TOOL_PROMPT ?? diff --git a/src/app/store.test.ts b/src/app/store.test.ts index 16d1760..e172c8f 100644 --- a/src/app/store.test.ts +++ b/src/app/store.test.ts @@ -652,6 +652,14 @@ describe("createAppStore", () => { const restored = store.tabs.find((t) => t.conversationId === "c-legacy"); expect(restored?.model).toBe("opencode-1/deepseek-v4-flash"); expect(store.activeModel).toBe("opencode-1/deepseek-v4-flash"); + // Issue 7: the migrated tab state is ACTUALLY written back to the storage + // adapter immediately (not merely kept in memory) — a re-load is now a no-op. + const persisted = JSON.parse(storage.getItem("dispatch.tabs") ?? "") as { + tabs: Array<{ conversationId: string; model: string }>; + }; + const persistedModel = persisted.tabs.find((t) => t.conversationId === "c-legacy")?.model; + expect(persistedModel).toBe("opencode-1/deepseek-v4-flash"); + expect(persisted.tabs.some((t) => t.model.startsWith("opencode/"))).toBe(false); store.dispose(); }); -- cgit v1.2.3