Skip to content

fix(editor): a failed secret save no longer duplicates the new object - #613

Merged
kipavy merged 1 commit into
devfrom
fix/new-object-secret-failure
Oct 11, 2026
Merged

kipavy merged 1 commit into
devfrom
fix/new-object-secret-failure

Conversation

@kipavy

@kipavy kipavy commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Found while working on #608 / #611.

Problem

Creating a host, key or identity stores the object first and its secrets second. When a secret failed to store — a refused or unreachable team vault upload, or a local store error — the save threw before the editor learned the new object's id. The editor stayed in "create" mode, so every later autosave created the same object again.

The #608 case reaches it directly: a new team host with a knock sequence on a server too old for it is created, the sequence is refused, and the next keystroke creates a second host.

Change

saveHostFromForm, saveKeyFromForm and saveIdentityFromForm take a required onCreated callback and call it as soon as the object exists, before storing its secrets. All six callers (desktop and mobile) switch to editing from that callback instead of from the return value, which is gone. The next autosave then updates the same object and retries the secrets that are still dirty.

The create-then-store step the three saves shared is now createWithSecrets in vaultObjectSecrets.ts.

Tests

New cases in hostForm.test.ts and keychainForm.test.ts: a new host, key and identity whose secret store rejects are still announced; an edit announces nothing. Watched them fail before the change. tsc and the services, stores, hosts, keychain, mobile and connections suites pass locally. No live run.

Not changed

Mobile edit screens still show no error when a save fails; the object is no longer duplicated, but the failure is silent there.

Creating a host, key or identity stores the object first and its secrets
second. When a secret failed to store, the save threw before the editor learned
the new object's id, so it stayed in "create" mode and every later autosave
created the object again.

The three form saves now announce the created object before storing its
secrets, through a required callback. The editor switches to editing on that
call, so the next autosave updates the same object and retries its secrets.
The shared create-then-store step lives in createWithSecrets.

Refs #608
@kipavy
kipavy merged commit ed8c7fa into dev Oct 11, 2026
5 checks passed
@kipavy
kipavy deleted the fix/new-object-secret-failure branch October 11, 2026 09:42
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