Skip to content

fix(presets): drop whitespace-only dropdown values + strip surrounding spaces#119

Merged
trudenboy merged 1 commit intodevfrom
fix/preset-whitespace-value
Apr 23, 2026
Merged

fix(presets): drop whitespace-only dropdown values + strip surrounding spaces#119
trudenboy merged 1 commit intodevfrom
fix/preset-whitespace-value

Conversation

@trudenboy
Copy link
Copy Markdown
Owner

Summary

Addresses Copilot review comment on music-assistant/server#3606 against the upstream sync of v3.4.0.

parse_stored_presets validated optional dropdown fields with isinstance(val, str) and val, so a hand-edited JSON with a whitespace-only value (e.g. " ") passed validation and propagated into the rotor seed — Yandex then rejects settingDiversity: with a 4xx, silently losing the preset.

Change

Strip whitespace before the empty-check, keep the stripped form when the value is valid. Whitespace-only → treated as empty → skipped. Leading/trailing spaces on a valid value → normalised to canonical.

Test plan

  • pytest — 255/255 (+1 new test in test_my_wave.py::test_get_user_wave_presets_drops_whitespace_only_values exercising both the whitespace-only drop and the leading/trailing strip)
  • ruff check / mypy — clean

🤖 Generated with Claude Code

…g spaces

Copilot review on music-assistant/server#3606 (upstream sync of v3.4.0)
flagged that parse_stored_presets only checked `isinstance(val, str) and val`,
so a hand-edited JSON with " " as a value would propagate whitespace into
the rotor seed (settingDiversity: ) and the server would 4xx.

Treat whitespace-only strings as empty (and therefore skipped), and store
the stripped form when the value is valid — keeps the seed builder on
canonical values regardless of whether the user typed trailing spaces.

Covered by a new parser test exercising both the whitespace-only drop
and the leading/trailing strip.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@trudenboy trudenboy merged commit d375a0d into dev Apr 23, 2026
5 checks passed
@trudenboy trudenboy deleted the fix/preset-whitespace-value branch April 23, 2026 14:15
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