feat: per-host notes, synced with host data (#25)#27
Closed
ezhkov-ph wants to merge 4 commits into
Closed
Conversation
Adds a free-form notes field to connections: editable in the host form (desktop + mobile), persisted in connections.json, CRDT-clock-tracked so it merges per-field across devices, carried through import/export bundles, and preserved across plugin-driven updates. Also hardens export: when the bundle contains plaintext secrets (passwords, keys, or host notes), encryption now defaults to on and a warning is shown if the user opts out.
ezhkov-ph
force-pushed
the
feat/host-notes
branch
from
July 14, 2026 20:02
ba0e599 to
3ae9f6c
Compare
…hrough - Add ru locale keys for the new Notes section (sectionNotes, notesPlaceholder) and the export plaintext-secrets warning, now that the ru locale has landed on main (VoltiusApp#26). - SerialConnectionForm: pass through initial.notes on save. The serial form has no notes UI, so it was sending notes=undefined and would wipe a note that had synced onto a serial-typed host from another device.
Contributor
|
Thanks for this, Alex — really thorough work, and the write-up made review easy. Merged into I added two small follow-ups on top of your branch before merging:
Verified on the merged tree: tsc clean, full vitest suite (318) green, i18n key-parity passing. Also confirmed the field renders on the mobile host-edit screen (shared Closing this PR since the commits are now on |
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 #25.
What this adds
Every host (
Connection) gets a free-form notes field: multiline text, editable from the host form, persisted with the rest of the host's data and synced across devices the same way name/tags/etc. already are. No markdown rendering — plain text only, per the issue's "not now" on that.How it's wired (for review)
Rust (
src-tauri/)notes: Option<String>added toConnectionandConnectionFormDatainstorage/config.rs, both#[serde(default, ...)]so existingconnections.jsonfiles on disk deserialize unchanged — no migration needed.commands/connections.rs: threadednotesthroughmerge_form_into_connection,connection_save, andconnection_update.notesto theconnection_clocks!macro'ssimple:list. This repo tracks a per-field CRDT clock per connection (clocks: HashMap<String, String>) so two devices editing different fields of the same host merge without clobbering each other — notes gets the same treatment as every other synced field, for free. This macro also seedsinitial_clocksand is asserted against in two "golden field list" tests (bump_covers_the_expected_field_set,initial_clocks_match_bumpable_field_set) — both updated to expectnotes.TypeScript
notes?: stringadded toConnection/ConnectionFormDatainsrc/types/index.ts.src/stores/connectionStore.ts: added to all three places aConnectionobject gets assembled (local create/update, team-vault create/update), and toconnectionToFormData— this last one matters because partial updates (pin, ping-toggle, tag rename, etc.) rebuild the form payload via{ ...connectionToFormData(c), someField: x }, so omittingnotesthere would have silently wiped it on any unrelated edit.src/plugins/runtime.ts: the pluginconnections.updateAPI (used by the SSH-config-import plugin, for one) now explicitly passes through the existingnotes— plugins have no way to set notes themselves, so this just guarantees they can't accidentally erase a user's note on their next sync pass.src/components/connections/ConnectionForm.tsx: a "Notes"FormSectionwith a plain<textarea>(4 rows, no resize handle — matches the existing private-key textarea's styling), wired into the existing autosave debounce. Used by both the desktop and mobile host-edit screens since they share this component.enandfrkeys added (connections.form.sectionNotes/notesPlaceholder). Not added toru— the Russian locale doesn't exist onmainyet (open in i18n: add Russian (ru) locale #26), so I kept this PR independent of it; happy to add therustrings here once i18n: add Russian (ru) locale #26 lands, or you can layer them in.Import/export + encryption
ConnectionExportby passthrough-spreading mostConnectionfields (src/services/import-export/handlers/connections.ts), sonotesrides along into JSON export bundles with no code change there.src/components/import-export/ExportTab.tsxnow checks whether the export bundle contains any plaintext secret (password / private key / passphrase / notes) and defaults the "Encrypt backup" toggle to on in that case, with a warning shown if the user switches it off anyway. This was already a pre-existing feature (XChaCha20-Poly1305 + PBKDF2,services/import-export/formats.ts) — this just changes the default and adds a nudge, doesn't touch the crypto.What I deliberately left out
src/services/crdt.ts's per-field LWW merge) and the Gist-sync plugin (src/plugins/runtime.ts'simportStates, which uses the same genericmergeEntities) both carrynoteswith no extra code.Testing
cargo test(full--lib) — 119 passed, including the two updated golden-field-list tests.vitest run(full suite) — 318 passed, incl. i18n key-parity tests.