fix(nodes): pre-validate storage_dir + unwrap daemon error envelope#96
Open
Nic-dorman wants to merge 2 commits into
Open
fix(nodes): pre-validate storage_dir + unwrap daemon error envelope#96Nic-dorman wants to merge 2 commits into
Nic-dorman wants to merge 2 commits into
Conversation
Two related fixes for the customer-reported Windows toast:
Failed to add nodes: {"error":"I/O error: Access is denied. (os error 5)"}
The PR #34 release (v0.6.7) was the first build where storage_dir is
actually honored at node-add time — any path that's writable in
Explorer but not to the daemon process (USB read-only volume, OneDrive
placeholder, second-drive default ACL, network share) now produces this
error. The toast also shows the daemon's raw JSON envelope verbatim,
which looks broken even when the underlying error is real.
Three defences:
1. probe_writable Tauri command — writes a tiny sentinel, fsyncs,
deletes. Surfaces the raw OS message + path on failure.
2. Settings → Storage Directory picker calls probe_writable before
persisting. On failure, the path is not saved and the error is
surfaced both inline under the card and as a global banner in the
default layout. Toast on success is "Storage directory verified"
instead of the previous unconditional "Storage directory updated".
3. Startup re-probe — app.vue calls settingsStore.revalidateStorageDir()
after loadConfig so a previously-working path that's gone offline
(USB unplugged, OneDrive offline, perms changed) is caught before
the user reaches Add Node. Non-blocking; does not clear the saved
path.
4. daemon-api request() unwraps the {"error": "..."} envelope from
4xx/5xx bodies, falling back to the raw body when it isn't JSON or
doesn't have the expected shape. Covers every daemon error toast in
the app, not just addNodes.
Tests: 5 cases for the envelope unwrap (JSON envelope, plain string,
unrelated JSON shape, malformed JSON, Error instance with .message).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…level Blue 'info' was matching the previous "updated" toast, but the new flow performs a real verification before persisting — green 'success' is the honest signal that we did work and it succeeded. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Customer reports of `Failed to add nodes: {"error":"I/O error: Access is denied. (os error 5)"}` on Windows after v0.6.7 (the first build where the user-chosen `storage_dir` is actually honored at node-add time). Two problems in one report: the path is unwritable to the daemon, and the toast surfaces the raw JSON envelope verbatim.
Three defences:
Common failure categories this catches: volume read-only flag (USB / VHDX / BitLocker To Go), second internal drive with default ACL, OneDrive Files-On-Demand placeholders, restrictive network-share ACL.
Test plan
🤖 Generated with Claude Code