Skip to content

feat: migrate session storage from JSON to append-only JSONL#93

Merged
steve-calvert-glean merged 1 commit intomainfrom
jsonl-sessions
Apr 12, 2026
Merged

feat: migrate session storage from JSON to append-only JSONL#93
steve-calvert-glean merged 1 commit intomainfrom
jsonl-sessions

Conversation

@steve-calvert-glean
Copy link
Copy Markdown
Collaborator

Summary

  • Sessions now stored as latest.jsonl — one JSON object per line, appended per turn
  • AppendTurn writes a single line (O(1)) instead of rewriting the entire file (O(n))
  • Corrupt lines are skipped on load — a crash only loses the last partial line
  • Existing latest.json files are automatically migrated to JSONL format and removed

Test plan

  • Unit test: append 3 turns, reload, verify all present
  • Unit test: corrupt line in middle is skipped, other turns load
  • Unit test: legacy JSON file migrated to JSONL, original removed
  • Unit test: non-existent file returns false
  • mise run test:all passes (485 tests, lint clean, binary builds)

Sessions are now stored as latest.jsonl with one JSON object per line.
AppendTurn writes a single line instead of rewriting the entire file,
making it O(1) per turn. Corrupt lines are skipped on load. Existing
latest.json files are automatically migrated to JSONL format.
@steve-calvert-glean steve-calvert-glean requested a review from a team as a code owner April 12, 2026 18:49
@steve-calvert-glean steve-calvert-glean added the enhancement New feature or request label Apr 12, 2026
Copy link
Copy Markdown
Member

@rwjblue-glean rwjblue-glean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@steve-calvert-glean steve-calvert-glean merged commit a2fae7e into main Apr 12, 2026
7 checks passed
@steve-calvert-glean steve-calvert-glean deleted the jsonl-sessions branch April 12, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants