Skip to content

fix(settings): refresh saved values after validation - #1092

Merged
kapok-4o merged 4 commits into
LargeModGames:mainfrom
PiyushChoudhary-Git:fix/settings-saved-values-1063
Nov 21, 2026
Merged

kapok-4o merged 4 commits into
LargeModGames:mainfrom
PiyushChoudhary-Git:fix/settings-saved-values-1063

Conversation

@PiyushChoudhary-Git

@PiyushChoudhary-Git PiyushChoudhary-Git commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #1063.

Saving Settings could clamp a number or reject an icon while leaving the typed value on screen. For example, Volume Increment displayed 500 even though the saved value was 100.

Refresh row values from the accepted configuration after a successful save and before taking the saved snapshot. Rows are matched by ID, preserving their order, labels, cursor, scroll position, and dialog state. Rows outside the current category are left alone, and failed writes keep the typed values.

Testing

Run locally on Windows with the slim feature set:

  • cargo fmt --all -- --check — exit 0.
  • cargo clippy --locked --no-default-features --features telemetry,tui -- -D warnings — exit 0.
  • cargo test --locked --no-default-features --features telemetry,tui — 1,934 passed, 0 failed.
  • cargo test --locked --no-default-features --features telemetry,tui settings_rows_show — 3 passed, 0 failed.

The new regression tests cover clamped numbers, rejected icons, unmatched rows, and preservation of row metadata and navigation state. Tests do not write the real configuration file.

Additional notes

  • Cargo.lock and tools/gates.count are unchanged.
  • Cargo reported an existing manifest warning about the unused vergen build dependency.

Summary by CodeRabbit

  • Bug Fixes
    • Settings rows now immediately display the value accepted after saving, without requiring you to close and reopen Settings. This includes values adjusted to a permitted range and cases where an unsupported icon is rejected. The displayed value reflects what was actually saved, even when it differs from what you entered. Other row details, including labels and selection state, remain unchanged.

Refresh displayed setting values from the accepted configuration after a successful save, preserving row identity and navigation state. Add regression coverage for clamped numbers, rejected icons, and unmatched rows.

Fixes LargeModGames#1063
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 673255c and ca2f2a3.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

After a successful settings save, matching staged row values are refreshed from the accepted configuration before the saved-row snapshot is recorded. Category row construction now uses a non-mutating helper. Tests cover clamped values, refused icons, and unmatched rows.

Changes: Settings Save Refresh

Layer / File(s) Summary
Build rows for the selected category
src/core/app/settings_schema.rs
A new helper returns rows for the selected category. The category loader assigns those rows and retains its existing screen-state updates.
Refresh staged rows after saving
src/core/app/settings_apply.rs, CHANGELOG.md
After a successful configuration write, matching staged row values are refreshed before the saved-row snapshot is recorded. Tests cover clamped values, refused icons, and unmatched rows. The changelog notes the updated Settings display.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · previous review 67325

After a successful save, Settings rows now show the value actually kept, such as a clamped number or the previous icon. The change is small, limited to the TUI, and has regression tests. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title uses the conventional-commit prefix "fix" with the scope "settings", which matches the required format. It is concise and imperative. It describes the main change: after a save, the settings…
Linked Issues check Passed [#1063] Requirement: after a successful save, each TUI Settings row shows the value now in the config. This includes a clamped number and the kept icon after a rejected wide icon. At head 673255c, `sa…
Out of Scope Changes check Passed The whole-PR diff against the merge base touches three files. src/core/app/settings_apply.rs adds the refresh helper, its single call site in the save path, and three tests. `src/core/app/settings_s…
Full details: Title check

Explanation

The title uses the conventional-commit prefix "fix" with the scope "settings", which matches the required format. It is concise and imperative. It describes the main change: after a save, the settings rows refresh their values from the accepted configuration, which is what the code and linked issue #1063 cover. The title is specific to the changeset and is not misleading.

Full details: Linked Issues check

Explanation

[#1063] Requirement: after a successful save, each TUI Settings row shows the value now in the config. This includes a clamped number and the kept icon after a rejected wide icon. At head 673255c, save_settings_from_items calls refresh_settings_items_from_config() after the save-error check and before settings_saved_items is set. That helper builds fresh rows with settings_items_for_category() and copies only value into each staged row whose id matches. Rows without a match are not changed. Because the snapshot follows the refresh, the screen does not report unsaved changes after a save. The helper does not change settings_selected_index, scroll offset, or prompt state. load_settings_for_category still performs the cursor reset and prompt-state updates, and the refresh does not call it. Failed writes return before the refresh, so typed values stay. The row-building match moved unchanged into settings_items_for_category(&self) in settings_schema.rs. The GUI path (set_setting) uses the same save function and matches its one-row list by ID, so other rows are unchanged. Three tests in mod tests cover the clamped number, the kept icon after >> is rejected, and rows without a match. They call apply_settings_changes() and the refresh helper directly and do not call save_settings_from_items(), so they do not write config.yml. The test names start with settings_rows_show, as the issue requires. The PR reports fmt, clippy, and test results as passing. I did not run these commands, so those results are reported, not verified. The non-coding items (changelog line and tools/gates.count) are not coding requirements.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against the merge base touches three files. src/core/app/settings_apply.rs adds the refresh helper, its single call site in the save path, and three tests. src/core/app/settings_schema.rs extracts the category row builder into settings_items_for_category, which the issue's solution section describes as the needed helper. The extraction keeps the match body unchanged, so the diff is small (+9/-4). CHANGELOG.md adds one line under Unreleased that cites #1063. The issue lists this line as a completion item. No unrelated behavior change appears in the diff. Because the head changed since the previous review, I re-read the whole-PR diffs for the Rust files and the changelog rather than relying on the earlier incremental result.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Simplify code

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between d85317e and 673255c.

Files selected for processing: 2

  • CHANGELOG.md
  • src/core/app/settings_apply.rs
Files skipped from review as they are similar to previous changes: 1

  • CHANGELOG.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@codecov

codecov Bot commented Nov 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@PiyushChoudhary-Git

Copy link
Copy Markdown
Contributor Author

Please merge this.

@kapok-4o kapok-4o left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reproduced both stale-row cases on main and verified that this fixes them through the real save path. Failed writes keep the typed values, and successful saves leave the rows and saved snapshot in sync. Local fmt, slim/default clippy, and the settings tests pass. The GUI feature build and generated bindings also check out.

One optional test improvement: extend the existing temporary-file SaveSettings test with a clamped row and assert that the saved snapshot is clean. Moving the refresh below the snapshot still leaves all three new tests green, but brings back the unsaved-changes prompt. The ordering in this PR is correct.

@kapok-4o
kapok-4o merged commit 4d449bc into LargeModGames:main Nov 21, 2026
35 checks passed
LargeModGames added a commit that referenced this pull request Nov 21, 2026
# Summary

Adds seven authors of recently merged PRs to `.all-contributorsrc` and
the README contributor table, one commit each in the all-contributors
bot format:

- polete-bermejo: code (#1116)
- Seyamalam: code (#1115)
- akshit-bansal11: code, doc (#1102, #1111)
- D0ktay: code (#1099)
- zuhairkhalid229: code (#1098)
- ViktorBystrov72: code (#1096)
- PiyushChoudhary-Git: code (#1092)

# Testing

- `jq` reads `.all-contributorsrc`: 91 contributors (84 before).
- The README table fills the last row to 7 cells and starts a new row
with the other 6.

# Additional notes

Names, avatars and profile links come from each user's public GitHub
profile, the same fields the bot uses.

---
<sub>💬 Questions or want to chat with other contributors? Join the
[spotatui Discord](https://spotatui.com/discord).</sub>

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Documentation**
* Updated contributor acknowledgements in the project records and
README, adding seven contributor records and six README entries.
* The README entries include code contributions and a documentation
credit.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
LargeModGames added a commit that referenced this pull request Nov 25, 2026
# Summary

Version bump and changelog for v0.49.0. No application code changes.

- `Cargo.toml`, `Cargo.lock`, `desktop/Cargo.toml` and
`desktop/Cargo.lock` go to 0.49.0. The desktop lock also picks up
`mdns-sd` 0.22.0 (#1145) and drops symphonia 0.6.1 (#1161). The
librespot fork stays at `=0.8.7`.
- `CHANGELOG.md`: `tools/assemble_changelog.sh v0.49.0` moved the `##
[Unreleased]` entries and the `changelog.d/` fragments into `##
[v0.49.0] 2026-11-25`. I checked every PR merged since v0.48.0 against
it and added entries for the iTerm2 Retina cover size (#999), the
Chinese visualizer labels (#1009), the Settings values after a save
(#1092) and the folder names (#1094).
- The translated READMEs from #1097 now name kapok-4o instead of
2570165831, as #1156 did for `README.md`.

# Testing

- cargo fmt --all -- --check: ok
- cargo clippy --no-default-features --features telemetry,tui -- -D
warnings: ok
- cargo test --no-default-features --features telemetry,tui: 2041 passed
- cargo clippy --manifest-path desktop/Cargo.toml -- -D warnings: ok
- cargo test --manifest-path desktop/Cargo.toml: 7 passed

---
<sub>💬 Questions or want to chat with other contributors? Join the
[spotatui Discord](https://spotatui.com/discord).</sub>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Release**
  * Updated the application to version 0.49.0.
* **Bug Fixes**
* This release includes fixes covering plugin updates, input handling,
command validation, playback, visual rendering, and Subsonic downloads.
* **Documentation**
* Added the 0.49.0 release notes, including feature and fix highlights.
Removed several standalone change entries; consult the consolidated
release notes for the current summary.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.

Settings keeps showing the typed value after a save clamped or rejected it

2 participants