You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bc7da10
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: packages/app/src/session/question-switch.stories.tsx
+158Lines changed: 158 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -167,3 +167,161 @@ export const LongList = {
167
167
/>
168
168
),
169
169
}
170
+
171
+
constlongMobileOptions=[
172
+
{
173
+
value: "opt-1",
174
+
label: "1. Incremental schema migration with dual-read verification (Recommended)",
175
+
description:
176
+
"Backfill every existing session row in bounded batches while reading from both tables and logging any mismatch before cutover.",
177
+
},
178
+
{
179
+
value: "opt-2",
180
+
label: "2. Blue-green SQLite snapshot swap on daemon restart",
181
+
description:
182
+
"Build a fresh projected database beside the live file during idle windows and atomically swap file descriptors once parity holds.",
183
+
},
184
+
{
185
+
value: "opt-3",
186
+
label: "3. Lazy per-session hydration on first transcript open",
187
+
description:
188
+
"Leave historical sessions untouched at startup and upgrade each transcript inside a single write transaction when opened.",
189
+
},
190
+
{
191
+
value: "opt-4",
192
+
label: "4. Shadow journal replay from durable event log",
193
+
description:
194
+
"Replay ordered session aggregate events into a new read-model table in the background without blocking active prompt drains.",
195
+
},
196
+
{
197
+
value: "opt-5",
198
+
label: "5. Read-only archive boundary for legacy schema versions",
199
+
description:
200
+
"Keep older transcripts viewable through a frozen decoder while writing all newly admitted prompts exclusively to the v4 tables.",
201
+
},
202
+
{
203
+
value: "opt-6",
204
+
label: "6. Checkpoint compaction before running structural DDL",
205
+
description:
206
+
"Truncate the write-ahead log, vacuum dead pages, and verify foreign-key integrity prior to adding the new composite indexes.",
207
+
},
208
+
{
209
+
value: "opt-7",
210
+
label: "7. Partitioned attachment metadata with external blob refs",
211
+
description:
212
+
"Move inline base64 tool outputs into content-addressed files on disk so mobile queries never scan oversized row payloads.",
213
+
},
214
+
{
215
+
value: "opt-8",
216
+
label: "8. Staged rollout gated by workspace recovery marker",
217
+
description:
218
+
"Enable the new projection only after all claimed top-level sessions finish draining cleanly without pending inbox items.",
219
+
},
220
+
{
221
+
value: "opt-9",
222
+
label: "9. Deterministic fixture verification before live migration",
223
+
description:
224
+
"Clone the workspace header and sample fifty recent conversations into a temporary file to benchmark query plans first.",
225
+
},
226
+
{
227
+
value: "opt-10",
228
+
label: "10. Reversible trigger mirror between v3 and v4 columns",
229
+
description:
230
+
"Install temporary SQLite triggers that keep old and new columns synchronized so an older binary can still open the workspace.",
231
+
},
232
+
{
233
+
value: "opt-11",
234
+
label: "11. Offline CLI migration subcommand with progress bar",
235
+
description:
236
+
"Require explicit operator confirmation via opencode db migrate and refuse automatic background writes on startup.",
237
+
},
238
+
{
239
+
value: "opt-12",
240
+
label: "12. Clean slate rebuild of derived read projections only",
241
+
description:
242
+
"Drop disposable summary caches and rebuild every read projection directly from the canonical event history on boot.",
243
+
},
244
+
]
245
+
246
+
consttallMobilePrompt=[
247
+
"Before I run the workspace storage migration on this repository, please review the full rollout plan and confirm how failure recovery should behave if the connection drops mid-run.",
248
+
"Step 1 inspects the active SQLite write-ahead log, verifies that no other local coordinator currently holds a busy execution claim, and records the starting event sequence number in a durable checkpoint row.",
249
+
"Step 2 scans session_inbox for any unconsumed user or synthetic items so steered prompts admitted right before shutdown remain preserved in exact enqueue order without duplicate delivery.",
250
+
"Step 3 creates the new normalized message part tables beside the existing transcript projection, keeping every original row intact until row counts, byte checksums, and foreign-key constraints match across all sessions.",
251
+
"Step 4 streams large diff and terminal output blobs out of inline JSON columns into content-addressed storage files, preventing multi-megabyte rows from stalling mobile timeline queries over remote tunnels.",
252
+
"Step 5 rebuilds the full-text search index and session summary projections in slices of twenty-five conversations per transaction, yielding between slices so interactive HTTP requests and live SSE updates stay responsive.",
253
+
"Step 6 validates cursor pagination from both ends of the longest session timeline, checking that sticky tool headers, collapsed reasoning blocks, and pending permission or question docks restore to identical state.",
254
+
"Step 7 writes a reversible compatibility view so older CLI processes inspecting the same directory fail gracefully with a clear upgrade message rather than corrupting partially migrated state.",
255
+
"Step 8 runs PRAGMA integrity_check and compares aggregate token, cost, and tool-call totals before and after the projection swap to catch any silent truncation in historical metadata.",
256
+
"Step 9 retains the pre-migration backup snapshot in the cache directory for seven days so you can roll back with a single command if any downstream script or plugin depends on the legacy layout.",
257
+
"Step 10 revalidates workspace permissions, active MCP server tool bindings, and pending form or elicitation state so an in-flight agent session resumes cleanly without re-prompting for completed answers.",
258
+
"Step 11 checks disk free space on both the database volume and temporary directory before committing the final rename, ensuring low-storage mobile hosts and containers never wedge mid-checkpoint.",
259
+
"Step 12 emits a structured migration summary event with elapsed wall time, migrated row counts, reclaimed page bytes, and fallback instructions for operators monitoring remote headless servers.",
260
+
"If a power loss, SIGKILL, or mobile network timeout interrupts any of these steps before the final checkpoint commits, how should the server handle the unfinished migration when it starts back up?",
261
+
].join(" ")
262
+
263
+
// Twelve verbose options followed by a question prompt taller than a phone viewport.
264
+
exportconstLongPrompt={
265
+
render: ()=>(
266
+
<SessionPreview
267
+
title="Plan the storage migration"
268
+
description="opencode · storage-rollout"
269
+
document={questionPendingDocument}
270
+
request={{
271
+
type: "question",
272
+
value: {
273
+
...activeQuestionRequest,
274
+
fields: [
275
+
{
276
+
key: "strategy",
277
+
type: "string",
278
+
title: "Strategy",
279
+
description: "Which migration strategy should I use for existing workspace sessions?",
280
+
options: longMobileOptions,
281
+
custom: true,
282
+
},
283
+
{
284
+
key: "recovery",
285
+
type: "string",
286
+
title: "Recovery",
287
+
description: tallMobilePrompt,
288
+
options: [
289
+
{
290
+
value: "resume",
291
+
label: "Resume from the last committed slice (Recommended)",
292
+
description: "Continue from the recorded checkpoint sequence without repeating verified batches.",
293
+
},
294
+
{
295
+
value: "rollback",
296
+
label: "Roll back to the pre-migration snapshot automatically",
297
+
description: "Restore the original file immediately and surface a diagnostic toast in the session.",
298
+
},
299
+
{
300
+
value: "pause",
301
+
label: "Pause startup recovery and ask before retrying",
302
+
description: "Keep the workspace read-only until an explicit retry or rollback choice is confirmed.",
303
+
},
304
+
{
305
+
value: "rebuild",
306
+
label: "Discard partial projections and replay from scratch",
307
+
description: "Drop the incomplete target tables and restart a fresh pass from event sequence zero.",
308
+
},
309
+
{
310
+
value: "readonly",
311
+
label: "Serve existing sessions read-only while retrying in background",
312
+
description: "Allow browsing transcripts immediately and unlock new prompts once parity finishes.",
313
+
},
314
+
{
315
+
value: "export",
316
+
label: "Export a diagnostic bundle and halt migration",
317
+
description: "Write schema stats and mismatch logs to disk without touching the live workspace.",
0 commit comments