Files
feedBack/tests/test_env_compat.py
T
byrongamatosandClaude Opus 4.8 932c0b28ac rename: implement advertised backward-compat + prune dead community plugins
Address gaps where PR #537's "Backward compatibility" section was advertised
but not implemented, and clean up the community plugin list.

Env vars (FEEDBACK_* canonical, legacy SLOPSMITH_* honoured):
- New lib/env_compat.py (getenv_compat / env_flag_compat) + tests. server.py
  (_env_flag + all FEEDBACK_* reads), diagnostics_hardware, gp2midi and
  tailwind_rebuild now resolve the legacy alias, so existing SLOPSMITH_UI /
  SLOPSMITH_PLUGINS_DIR / etc. deployments keep working.
- Fix the rename collapsing plugins/__init__.py and minigames/routes.py from
  `FEEDBACK_PLUGINS_DIR or SLOPSMITH_PLUGINS_DIR` into a redundant
  `FEEDBACK_ or FEEDBACK_` (the fallback was silently lost).

Storage (app.js update-channel):
- Read feedBack-update-channel, fall back to legacy slopsmith-update-channel,
  and clear the legacy key on write — so a user's update-channel preference
  survives the rename instead of resetting to "stable".

Community plugin list (README): the rename rewrote third-party repo URLs we
don't own. Probed every one; their owners never renamed, so:
- Restore the 13 live community plugins to their real slopsmith-* names.
- Prune 6 that are 404 to the public (topkoa splitscreen/stems, OmikronApex
  tuner, Jafz2001 nam-rig-builder, DeathlySin song-preview, Erikcb91 shuffle).
- Fix a pre-existing Guitar Theory clone-command typo (nam-tone -> guitar-theory).

Verified: env_compat 7/7, JS 819/819, pytest 1690 collected / 0 import errors,
rename-sensitive + startup suites green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 10:43:48 +02:00

51 lines
1.9 KiB
Python

"""Coverage for the slopsmith -> feedBack env backward-compat shim."""
from env_compat import getenv_compat, env_flag_compat
def test_canonical_wins_over_legacy(monkeypatch):
monkeypatch.setenv("FEEDBACK_UI", "v3")
monkeypatch.setenv("SLOPSMITH_UI", "v2")
assert getenv_compat("FEEDBACK_UI") == "v3"
def test_legacy_fallback_when_canonical_unset(monkeypatch):
monkeypatch.delenv("FEEDBACK_UI", raising=False)
monkeypatch.setenv("SLOPSMITH_UI", "v2")
assert getenv_compat("FEEDBACK_UI") == "v2"
def test_default_when_neither_set(monkeypatch):
monkeypatch.delenv("FEEDBACK_UI", raising=False)
monkeypatch.delenv("SLOPSMITH_UI", raising=False)
assert getenv_compat("FEEDBACK_UI", "default") == "default"
assert getenv_compat("FEEDBACK_UI") is None
def test_non_feedback_names_have_no_fallback(monkeypatch):
monkeypatch.delenv("CONFIG_DIR", raising=False)
monkeypatch.setenv("SLOPSMITH_CONFIG_DIR", "/tmp/x")
# A non-FEEDBACK_ name must behave like os.environ.get (no aliasing).
assert getenv_compat("CONFIG_DIR") is None
def test_empty_canonical_is_respected_not_overridden(monkeypatch):
# An explicitly-empty canonical value is still "set" and wins.
monkeypatch.setenv("FEEDBACK_UI", "")
monkeypatch.setenv("SLOPSMITH_UI", "v2")
assert getenv_compat("FEEDBACK_UI") == ""
def test_flag_parses_true_values(monkeypatch):
for raw in ("1", "true", "YES", " On "):
monkeypatch.setenv("FEEDBACK_SYNC_STARTUP", raw)
assert env_flag_compat("FEEDBACK_SYNC_STARTUP") is True
def test_flag_false_and_legacy(monkeypatch):
monkeypatch.delenv("FEEDBACK_SYNC_STARTUP", raising=False)
monkeypatch.setenv("SLOPSMITH_SYNC_STARTUP", "1")
assert env_flag_compat("FEEDBACK_SYNC_STARTUP") is True
monkeypatch.setenv("FEEDBACK_SYNC_STARTUP", "0")
assert env_flag_compat("FEEDBACK_SYNC_STARTUP") is False