refactor(app): split persistence helpers - #694
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Suggested priority: P2 (includes user-path files (packages/app/src/utils/persist-local-storage.ts, packages/app/src/utils/persist-read.ts, packages/app/src/utils/persist.test.ts, packages/app/src/utils/persist.ts)).
P1/P0 are reserved for maintainer confirmation. Please relabel manually if this is a release blocker, security issue, data-loss risk, or updater/runtime failure.
There was a problem hiding this comment.
Code Review
This pull request refactors the persistence logic by extracting local storage implementation and reading/migration utilities into dedicated files, persist-local-storage.ts and persist-read.ts. The changes introduce a caching layer with an eviction mechanism to manage storage quotas and include new tests for async data reading. Feedback was provided to optimize the key iteration in the eviction logic by replacing an unnecessary intermediate array with a standard for loop.
Perf delta summaryComparator: pass
|
Prepare PawWork v2026.5.18 for the stable desktop release. - Bump the desktop package version to 2026.5.18. - Scope the diagnostics unreadable-file retention test to POSIX permission semantics so Windows advisory does not fail on chmod behavior that Windows does not enforce the same way. Verification: - Focused desktop diagnostics test passed locally: 11 pass / 0 fail. - Release typecheck passed locally for packages/desktop-electron. - PR #706 CI passed, including ci, desktop-smoke, e2e-artifacts, CodeQL, dependency-review, label-policy, commit-lint, and title lint. Release notes: - Drafted against the merged range since v2026.5.17: #691, #692, #693, #694, #702, and #703. - Cold-read review completed before merge; wording was tightened to avoid overclaiming diagnostics impact and to keep verification short.
Summary
Split persistence helper logic out of
packages/app/src/utils/persist.tsinto focused read/migration and localStorage resilience modules.Why
#687 identifies
persist.tsas a first-batch frontend infrastructure debt file because it mixed storage targets, cache/quota eviction, legacy migration, and the Solid persisted wrapper in one>500LOC utility. This PR keeps the public facade in place while moving the easiest independent helper responsibilities behind clearer file boundaries.Related Issue
Refs #687.
Human Review Status
Pending. A human should make the final merge decision after reviewing the final diff and verification evidence.
Review Focus
Persist,persisted,removePersisted,PersistTesting, andshouldDebugPersistedTerminalReadremain available from@/utils/persist.persist-local-storage.ts, not changed.persist-read.ts, not changed.serialize.tsor active UI rewrite lanes.Risk Notes
Behavior risk is low but broad: persistence is shared by layout, terminal, settings, language, server, model, prompt, and other app state. The change is intended to be behavior-preserving. No persistence keys, namespaces, data migrations, UI behavior, or desktop storage APIs changed.
Remaining #687 scope intentionally deferred:
serialize.tsremains the next independent first-batch file. #601/#602/#604/#605/#606/#595/#615 lanes are not touched.How To Verify
Screenshots or Recordings
Not required. This is a non-visual persistence helper extraction.
Checklist
bug,enhancement,task, ordocumentation), at least one primary routing label (app,ui,platform,harness, orci), and exactly one priority label (P0toP3), or I requested maintainer labelingdev, and my PR title and commit messages use Conventional Commits in English