Repository navigation
Description
What happened
After updating Maka to the build where SQLite became the sole operational
session store, every session created before the cutover disappeared from the
UI. The session list only shows sessions created after the update.
The old data is not deleted — the legacy transcript files are still on
disk, byte-for-byte intact. The new storage layer simply never reads them.
Evidence (data layer, from a real upgrade on macOS)
-
Legacy transcript file still exists, intact:
~/Library/Application Support/Maka/workspaces/default/sessions/b156d249-dbd1-4ddb-ae16-a801a9fe9526/session.jsonl
—schemaVersion: 1, opens with alegacy-headerrecord, then user/turn
message records. (In the affected install it contains a full turn: user
message,turn_state,token_usage,system_note.) -
But the session is absent from the new SQLite store:
runtime.sqlite→session_messagesreturns 0 rows for that
session_id; the id appears in neithersession_metadatanor
session_catalog_projection. The UI therefore has nothing to list. -
Schema migrations ran on first launch, but imported nothing:
operational_schema_migrations(runtime|9, session_metadata|21, …) all
applied at1785904471629, which is exactly the first launch after the
update. The migration machinery ran; no legacy-session import was part of
it.
Root cause (source layer)
- refactor(storage): make SQLite the sole operational authority #1994
refactor(storage): make SQLite the sole operational authority
made SQLite the only session store. Its README documents that several
legacy file stores are not imported (e.g. pre-existing Electron
safeStorage credential files "are not imported; affected users must
re-authenticate"), but for session transcripts it removes the JSONL path
without adding a one-time JSONL→SQLite importer. - fix(scripts): drop session-bundle imports deleted with the JSONL session tree #2029
fix(scripts): drop session-bundle imports deleted with the JSONL session treeexplicitly deletes the remaining JSONL-session import
code rather than replacing it with a migration. - In the shipped 0.1.5 bundle (
dist/main/), grepping forjsonlfinds no
session-transcript reading code at all — the new store only reads SQLite. - Startup (
app-lifecycle.ts) callsbackfillSessionProjects, but that only
backfills project grouping for sessions that already exist in SQLite; it
never scanssessions/b156d249-dbd1-4ddb-ae16-a801a9fe9526/session.jsonl. - The only remaining JSONL handling is
packages/core/src/foreign-session.ts
/packages/storage/src/foreign-session-store.ts(importing Claude Code
/ Codex external transcripts) — not Maka's own legacy transcripts.
So the upgrade path is: JSONL tree → (nothing) → SQLite. Silent invisibility
of intact user data.
Expected behavior
On upgrade, legacy schemaVersion: 1 JSONL sessions should be migrated into
SQLite (session_metadata + session_messages) so they stay visible — or at
minimum surfaced with an explicit import path / notice. Intact data must not
become silently invisible.
Suggested fix (any of)
- One-time importer at first launch after cutover: scan
sessions/*/session.jsonl, parselegacy-header+ message records,
insert intosession_metadata/session_messages, and mark the
migration done (schema-version bump or a durable one-time flag) so it runs
exactly once and is idempotent. - If full transcript import is too risky, import at least the session
metadata + last message so the session appears in the list and can be
opened/exported. - Add a "import legacy sessions" action / notice for installs that still
carry asessions/tree.
Repro / verification commands (maintainers)
# 1. Legacy transcript still on disk, intact
ls "~/Library/Application Support/Maka/workspaces/default/sessions/"
head -1 "~/Library/Application Support/Maka/workspaces/default/sessions/b156d249-dbd1-4ddb-ae16-a801a9fe9526/session.jsonl"
# 2. But the new store does not contain it
sqlite3 "~/Library/Application Support/Maka/workspaces/default/runtime.sqlite" \
"SELECT COUNT(*) FROM session_messages WHERE session_id='b156d249-dbd1-4ddb-ae16-a801a9fe9526';" # → 0
sqlite3 "~/Library/Application Support/Maka/workspaces/default/runtime.sqlite" \
"SELECT COUNT(*) FROM session_metadata WHERE session_id='b156d249-dbd1-4ddb-ae16-a801a9fe9526';" # → 0
# 3. Migrations ran on first launch, none imported the legacy tree
sqlite3 "~/Library/Application Support/Maka/workspaces/default/runtime.sqlite" \
"SELECT * FROM operational_schema_migrations;" # all applied_at ≈ first launch after updateEnvironment
- Maka version: 0.1.5 (desktop,
CFBundleShortVersionString = 0.1.5; also
reproduced from source atupstream/mainHEAD07c1e680) - OS: macOS, Apple Silicon (arm64)
- Updated via auto-updater from an earlier 0.1.x build
Related
- refactor(storage): make SQLite the sole operational authority #1994 — SQLite as sole operational authority (cutover)
- fix(scripts): drop session-bundle imports deleted with the JSONL session tree #2029 — dropped JSONL session-tree imports
- feat(storage): migrate all session metadata to SQLite #1370 / feat(storage): add SQLite session metadata foundation #1371 / feat(storage): make SQLite the default session metadata store #1372 / feat(storage): complete SQLite session metadata migration #1373 — earlier SQLite session-metadata migration
work (metadata only; message transcripts stayed in JSONL until refactor(storage): make SQLite the sole operational authority #1994)
Activity
fix(storage): address apache#2260 review — validate before write, pro…
fix(storage): import legacy JSONL session transcripts into SQLite (#2260