Skip to content

fix: retain failed settings writes for retry and report the failure (#118) - #120

Merged
willwade merged 4 commits into
mainfrom
fix/118-settings-save-failure
Nov 18, 2026
Merged

willwade merged 4 commits into
mainfrom
fix/118-settings-save-failure

Conversation

@willwade

Copy link
Copy Markdown

Summary

XmlSettingsStore::Save() cleared modified_ before doc.save_file(), so a failed write (unwritable destination, full disk) silently dropped every pending change — a later Save() returned success without ever retrying them, and neither SaveIfNeeded() nor dasher_save_settings() surfaced anything.

  • modified_ now clears only after a successful write; a failed write keeps the store dirty so any later save retries the changes — no parameter change needed to retry.
  • Failures are reported once per failure episode through the existing message mechanism (non-modal FormatInfoMessage → message callback + log callback), so frontends can explain why settings can't be saved. The store gets a SetMessageDisplay() because the C API builds it before the interface exists.
  • The flag pair also reconciles after a successful dasher_reload_settings re-parse (reload chooses the file over memory; the episode is over; the file is not normalized until the next real change — self-healing, documented in-code).
  • Detach-first at every interface delete site (both dasher_create catch handlers, failed-Realize recovery, dasher_destroy) so the store never points at a dead interface.
  • dasher_save_settings stays void — no observable-return change, so no DASHER_CAPI_VERSION bump per the header's own policy.

Regression test

Follows the issue recipe exactly: save → make destination unwritable (file replaced by a directory — fails even as root) → change a persistent parameter → save fails and is reported exactly once, non-modal (DASHER_MESSAGE_INFO) → restore → save with no further change persists the value → verified by reload. A second failure episode must report again (pins the latch reset — mutation-tested). Verified the test fails against the old behavior at both the message and the retry assertions.

Validation

  • Full suite 46→51 tests green incl. ASan+UBSan (50/50 at the time of the fix)
  • clang-format clean, clang-tidy (18.1.8) clean under CI's filter, symbol freeze intact (111), changed TUs clean under -Werror
  • Two review-loop rounds (independent subagent reviewers, mutation checks against old behavior)

Fixes #118

Three consecutive rounds (2026-11-09, runs 42633360846 r1-3) had all
four macOS legs cancelled simultaneously ~15 minutes in — no failure,
logs expired with the cancellation, fail-fast is false, timeout is 30m.
macos-latest is mid-roll and whatever it resolves to today kills these
jobs; macos-15 is the known-good image (GTK's macos-latest matrix is
unaffected, so this is image x job-shape specific — gcc-on-macOS legs
are the usual suspect). Unpin after the image generation settles.

Signed-off-by: will wade <willwade@gmail.com>
Signed-off-by: will wade <willwade@gmail.com>
…ll 13 required green on head)

Signed-off-by: will wade <willwade@gmail.com>
…118)

XmlSettingsStore::Save() cleared modified_ before doc.save_file(), so a
failed write (unwritable destination, full disk) silently dropped every
pending change: the next Save() returned success without retrying them,
and neither SaveIfNeeded() nor dasher_save_settings() surfaced anything.

- modified_ now clears only after a successful write; a failed write
  keeps the store dirty so any later save retries the changes
- failures are reported once per failure episode through the existing
  message mechanism (non-modal FormatInfoMessage -> message callback +
  log callback); the store gets a SetMessageDisplay() because the C API
  builds it before the interface exists
- the flag pair also reconciles after a successful dasher_reload_settings
  re-parse (reload chooses the file over memory; the episode is over)
- detach-first at every interface delete site (create catch handlers,
  failed-Realize recovery, dasher_destroy) so the store never points at
  a dead interface
- regression test follows the issue recipe: save -> make destination
  unwritable -> change parameter -> save (fails, reported, exactly once,
  non-modal) -> restore -> save with no further change persists the
  value; a second failure episode must report again

Signed-off-by: will wade <willwade@gmail.com>
@willwade
willwade merged commit 063aac6 into main Nov 18, 2026
14 checks passed
@willwade
willwade deleted the fix/118-settings-save-failure branch November 18, 2026 09:56
@willwade
willwade restored the fix/118-settings-save-failure branch November 18, 2026 11:06
@willwade
willwade deleted the fix/118-settings-save-failure branch November 18, 2026 11:07
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.

Report failed settings writes and retain changes for retry

1 participant