mirror of
https://github.com/got-feedBack/feedBack.git
synced 2026-08-10 18:59:56 +00:00
fix(settings): don't let a stale DLC path block saving the Demucs server address (#795)
ship-ci / ci (push) Waiting to run
ship-ci / ci (push) Waiting to run
The v3 Settings "Save" button posts dlc_dir together with demucs_server_url, default_arrangement and av_offset_ms in one request. POST /api/settings validated dlc_dir first and early-returned "DLC directory not found" before it ever processed demucs_server_url, so on a machine whose DLC path doesn't resolve (fresh install, unplugged/network drive, a path carried over from another machine) setting the Demucs server address silently failed — reported in got-feedBack/feedBack-demucs-server#3 (macOS 07-05 nightly). - server: a non-resolving dlc_dir is now recorded as a warning and skipped rather than aborting the whole POST, so the co-submitted keys still persist. The bad path is surfaced via a new additive `warnings` field and folded into `message` so the settings status line still shows it. - client (v3): the Demucs input now autosaves on blur/enter via a single-key persistSetting POST, like every other v3 setting, so it never depends on the coupled Save button. - tests: cover the decoupling and the unchanged happy path. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
a20dca21bb
commit
69c8ad4e0c
@@ -10765,6 +10765,9 @@ def save_settings(data: dict):
|
||||
config_file = CONFIG_DIR / "config.json"
|
||||
updates: dict = {}
|
||||
messages: list[str] = []
|
||||
# Named dlc_warnings (not `warnings`) so it can't shadow the module-level
|
||||
# `import warnings` used elsewhere in this file.
|
||||
dlc_warnings: list[str] = []
|
||||
|
||||
if "dlc_dir" in data:
|
||||
dlc_path = data["dlc_dir"]
|
||||
@@ -10784,7 +10787,16 @@ def save_settings(data: dict):
|
||||
if f.suffix.lower() in sloppak_mod.SONG_EXTS)
|
||||
messages.append(f"DLC folder: {count} song files found")
|
||||
else:
|
||||
return {"error": f"DLC directory not found: {dlc_path}"}
|
||||
# A non-resolving DLC path (a stale value, an unplugged
|
||||
# external/network drive, or a path carried over from another
|
||||
# machine) must NOT abort the whole POST. saveSettings() bundles
|
||||
# dlc_dir together with demucs_server_url / default_arrangement /
|
||||
# av_offset_ms in a single request, so an early `return` here
|
||||
# silently dropped every co-submitted key — this is the "can't
|
||||
# set the Demucs server address" report (feedBack-demucs-server
|
||||
# #3). Record it as a warning, skip persisting dlc_dir, and keep
|
||||
# validating the rest so the other settings still save.
|
||||
dlc_warnings.append(f"DLC directory not found: {dlc_path}")
|
||||
|
||||
# Both of these are consumed downstream as strings (e.g.
|
||||
# demucs_server_url.rstrip('/')), so reject non-string shapes
|
||||
@@ -11041,7 +11053,15 @@ def save_settings(data: dict):
|
||||
return {"error": str(exc)}
|
||||
cfg = settings_with_instrument_profiles(cfg)
|
||||
_atomic_write_file(config_file, json.dumps(cfg, indent=2).encode("utf-8"))
|
||||
return {"message": ". ".join(messages) if messages else "Settings saved"}
|
||||
resp = {"message": ". ".join(messages) if messages else "Settings saved"}
|
||||
if dlc_warnings:
|
||||
# `warnings` is an additive response field (existing clients read
|
||||
# `message || error`); fold the text into `message` too so the current
|
||||
# settings status line still surfaces the bad DLC path even though the
|
||||
# rest of the save succeeded.
|
||||
resp["warnings"] = dlc_warnings
|
||||
resp["message"] = resp["message"] + " — " + "; ".join(dlc_warnings)
|
||||
return resp
|
||||
|
||||
|
||||
# Keys a client "Reset {category}" action may clear. Resetting removes the key
|
||||
|
||||
Reference in New Issue
Block a user