Repository navigation
feat(history): move query history into SQLite - #597
Merged
Merged
Conversation
This was referenced Sep 9, 2026
History lived in localStorage under one key, rewritten in full on every query. That medium shares a five-to-ten megabyte origin quota with settings and favorites; swallows a quota failure silently, so recording simply stopped and nothing said so; and is wiped when the user clears site data. A single entry was unbounded, so one pasted migration script could consume the quota by itself (#585). It now lives in history.db beside connections.db, with the same PRAGMA user_version migration machinery. Its own file rather than a table in connections.db: history is append-only and much larger, and a corrupt or oversized history should not be able to take the connection profiles with it. The frontend store is a view over the database rather than the thing that holds it. Search is a LIKE with an explicit ESCAPE — without one, searching for "100%" matches every row containing 100, and searching for "_" matches everything. A statement over 256 KB is stored cut and marked, with the walk back to a character boundary that stops a non-ASCII query panicking on the slice. On first run the old localStorage key is imported and then removed. Ids carry across, so an app killed midway resumes rather than duplicating, and the key is removed only after the import succeeds — deleting someone's only copy of their history because we could not read it is the one outcome worth designing against. A parse failure leaves it alone. A failed history write no longer fails the query that produced it; it surfaces in the panel instead. Deletes and clears are optimistic and roll back if the write fails. This supersedes #331: the full-array synchronous rewrite was a property of the medium, not something to debounce around. Closes #585 Closes #331 Co-Authored-By: Claude Opus 5 <[email protected]>
EVWorth
force-pushed
the
feat/history-sqlite-store
branch
from
September 10, 2026 00:01
45b27cd to
5d22f5d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #585, closes #331.
Why the medium was the bug
History lived in
localStorageunder one key, rewritten in full on every query:persistswallows a quota failure — recording just stopped and nothing said so.Where it lives now
history.db, besideconnections.db, with the samePRAGMA user_versionmigration machinery (mas_core::history). Its own file, not a table inconnections.db— history is append-only and much larger, and a corrupt or oversized history should not be able to take the connection profiles with it.The frontend store is now a view over the database rather than the thing holding it.
Details worth a look in review
LIKEneeds an explicitESCAPE. Without one, searching100%matches every row containing 100, and searching_matches everything. Both are tested."é".repeat(MAX_SQL_BYTES).i64doesn't cross specta, so counts use the existing#[specta(type = Number)]idiom fromQueryResultrather than inventing a new convention.Verification
21 Rust store tests + 2 migration tests, 26 frontend store tests, 20 panel tests. Full suites green (1842 frontend, all Rust crates), clippy clean, 0 lint errors. ARCHITECTURE §9.4, the data-dir tree and the localStorage key table all updated.
The old store tests asserted
localStoragebehaviour that no longer exists, so they were rewritten against the new contract rather than patched.