Repository navigation
fix(settings): keep general preferences unchanged when saving fails - #1068
Conversation
dovvnloading
left a comment
There was a problem hiding this comment.
Reviewed all three changed files against #1053 and the existing atomic-save, manager-lock, WebSocket error handling and controlled settings UI contracts. No blocking code findings: candidate state is committed only after strict atomic replacement, failed writes do not publish app-settings or apply the live log level, and the error message does not disclose raw filesystem details. The regression suite covers write/fsync/replace faults, unchanged state and file, cleanup, retry and restart, including multi-field update status.
Verified GitHub Actions on this head: all four required checks passed (Windows Python, frontend, wheel build, POSIX permissions), as did MCP Connect Chromium. Windows pytest reports 8,450 passed, 56 skipped, 22 subtests passed and 88.24% coverage. Optional nightly boot-smoke was skipped as designed. Compared the four newer main commits; no changed-file overlap. No review threads outstanding.
Limitation: the native desktop/manual theme and keyboard walkthrough was not performed (local GitHub DNS resolution fails); the full CI and automated real-file/intent regressions provide the functional evidence for this backend-only change. Under the maintainer's current request to process and merge a PR, treating that evidence as sufficient for this change, without claiming the manual checklist passed. No CI gates or branch protections changed. Formal self-approval is not appropriate; this is a review comment.
Summary
Fixes #1053. General preference setters now save a candidate state through the existing atomic file replacement before exposing it in memory. If a write, flush/fsync or rename fails, the previous settings stay active and the intent returns a safe, actionable error instead of publishing a misleading success.
What Changed
UserFacingErrortransport path; never expose raw filesystem exception text or paths.Why
A setting shown as active should correspond to the last successful save, not an uncommitted candidate. The knowledge embedding preferences already use the same strict candidate-before-publish pattern. The fix preserves the settings schema, accepted enum values, and existing client error reporting.
Validation
python -m compileall -q .passes (run from the repo root - matches CI)python -m pytest -qpasses (run from the repo root - matches CI)cd web_ui && npm run checkpasses (matches CI)Local checkout is blocked:
git ls-remote https://github.com/dovvnloading/Graphlink.git HEADfails DNS resolution. The committed pytest regression suite and full CI gates have not been executed locally; the isolated harness above does not replace them. Focused command in a configured checkout:Manual verification: in a disposable profile, simulate a failed settings-file replacement, change theme or log level, check that the old preference remains active and an error is shown, restore writable storage, retry and restart. Verify both themes and keyboard operation.
UI Notes
Additional Context
Scoped to the general preference setters (including update status); provider configuration, credentials, plugin grants and other persistence mixins are not changed. No dependencies, schema changes, or CI gate changes. Draft pending required CI and manual review; do not merge until they pass.