Skip to content

feat(core): store models, change journal and store generation - #4560

Merged
datlechin merged 9 commits into
mainfrom
feat/core-store-journal
Nov 25, 2026
Merged

datlechin merged 9 commits into
mainfrom
feat/core-store-journal

Conversation

@datlechin

@datlechin datlechin commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Summary

  • SavedConnection gains details (startup SQL, AI rules and allowed tools, SSH profile id and route, credential profile link, credential_reference, Redis database, plugin additional_fields) and device (Local only, sample, origin, password file or command, Cloudflare, Cloud SQL proxy, SOCKS and tunnel command settings), flat in the entry. Additive, so connections.json stays version 1.
  • A connection keeps the keys it does not know and writes them back. A connection or profile this build cannot read, such as one with a value a newer build wrote or without tls, is held: left out of the list and written back unchanged. An import, a form save or a profile save never takes its id, a delete or a pulled deletion removes it, and a pull keeps its favourite. The rest of the file stays usable. ConnectionList::unreadable and unreadable_profiles name them.
  • field_trust ports the macOS ConnectionFieldTrust table and the MongoDB secret options. check-connection-field-trust.py fails when the Swift and Rust tables differ.
  • Export writes SavedConnection::portable: no device-only setting, no unknown key, nothing that runs, sends or signs in without the import showing it, portable plugin fields only. Import takes the same projection and keeps an updated entry's own fields. The Linux connection form keeps the fields it does not show.
  • New stores: SSH and credential profiles in connections.json; table folders and their items in history.db (new migration, no foreign keys, millisecond times); TeamLibraryStore, one file per (origin, account) at state/team-library/<digest>.json, refusing a file bound to another owner.
  • Store identity (core ADR 0054, The engine): StoreIdentity (generation, sequence) in each store. JSON stores stamp it on every write; history.db keeps one row that triggers raise on every write to a synced table. compared_with says whether a store continues, is another generation or went back. start_new_generation is for a host's restore path.
  • Change journal: ChangeJournal gets the RecordKinds each write changed, after the write and outside the store's locks. ConnectionStore, QueryHistory (every handle it gives out) and TeamLibraryStore take one with set_journal. Deleting a connection's data takes its table folders too and names every kind it removed. Deleting a table folder or unfiling a table trims the upgrade copies.
  • FFI: ConnectionLibrary reads and sets connection details and device settings, and saves, lists and deletes SSH and credential profiles; QueryHistoryStore::table_folders gives a TableFolderStore. A form save keeps details and device settings. Windows bindings regenerated.
  • Tests that pinned "an unreadable entry makes the whole file unavailable" now pin the held entry: unknown_auth_mode_is_held_not_dropped, an_entry_without_a_level_a_policy_or_an_access_level_is_held_not_guessed, an_entry_without_tls_is_held_not_guessed. fresh_database_applies_every_migration and migrator_embeds_every_migration count 5 migrations.
  • Docs: linux/docs/storage.md, core/ARCHITECTURE.md.

Test plan

  • cargo test -p tablepro-storage: every field round-trips, unknown keys survive a rewrite, held entries, an import or save never takes a held id, the export and import projection, a journal call from every ConnectionStore, QueryHistory, saved query, favourite, table folder and Team Library write, a new generation on a restore and a copied-in file, the sequence going back on an older file, the triggers on every synced table, Team Library isolation per (origin, account), the migration fixture.
  • cargo test -p tablepro-ffi --test library_details --test library --test cloud_library --test saved_queries --test library_copies --test history.
  • python3 -m unittest apple/scripts/ci/test_check_connection_field_trust.py.
  • Linux dev container: verify.sh --platform linux test tablepro-storage (400 passed), test tablepro connect_dialog (126 passed, with the test that a form save keeps details, device settings and unknown keys), lint.
  • Windows: verify.sh --platform windows bindings (no diff after the regeneration), build, test Interop.Tests ConnectionLibrary (12 passed).
  • 16 history.db upgrade copy tests (14 of them on main) fail on this Mac's system SQLite 3.54 (macOS 27): VACUUM INTO refuses the empty .partial file the copy pre-creates. They pass on Linux.

@datlechin
datlechin enabled auto-merge (squash) November 25, 2026 18:09
# Conflicts:
#	windows/src/TablePro.Interop/Generated/tablepro_ffi.cs
@datlechin
datlechin disabled auto-merge November 25, 2026 18:43
# Conflicts:
#	Cargo.lock
#	core/ARCHITECTURE.md
#	core/crates/storage/src/connections/cloud.rs
#	core/crates/storage/src/connections/mod.rs
@datlechin
datlechin enabled auto-merge (squash) November 25, 2026 19:05
@datlechin
datlechin disabled auto-merge November 25, 2026 19:09
@datlechin
datlechin merged commit 3dfce83 into main Nov 25, 2026
1 check passed
@datlechin
datlechin deleted the feat/core-store-journal branch November 25, 2026 19:09
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.

1 participant