Skip to content

Centralize persisted state - #98

Merged
ctoth merged 1 commit into
masterfrom
agent/issue-76-persistence
Jul 30, 2026
Merged

Centralize persisted state#98
ctoth merged 1 commit into
masterfrom
agent/issue-76-persistence

Conversation

@ctoth

@ctoth ctoth commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add one shared persistence owner for versioned local storage, migration, quota/error handling, and IndexedDB opening/upgrades
  • migrate preferences, channel history, command history, output history, auth tokens, checkpoints, session logs, file transfers, and autolog storage to that owner
  • preserve legacy raw and versioned data through schema migration, including the existing raw auth token and output-log shapes

Root cause

Persisted state was owned independently by each feature. The stores used incompatible payload shapes, version handling, error behavior, and IndexedDB upgrade paths, so blocked storage or future schema changes had to be solved repeatedly in each caller.

Impact

All current durable client state now goes through the same versioned contract. Blocked or full local storage is handled without crashing consumers, legacy values migrate into the shared envelope, and IndexedDB creation/upgrades use one entry point.

TDD and validation

  • observed the new persistence suite fail before src/persistence.ts existed
  • observed the legacy raw-token regression fail before raw-string migration was added
  • npm test — 107 files, 1,063 tests passed
  • npm run typecheck
  • npm run lint:staged
  • git diff --cached --check

Closes #76

@ctoth
ctoth merged commit b3ee544 into master Jul 30, 2026
1 check passed
github-actions Bot pushed a commit that referenced this pull request Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[epic] Persistence is scattered, unversioned, and unguarded

1 participant