From 8ab4ad4b17e493f8f61556ab33acce657a0d8dff Mon Sep 17 00:00:00 2001 From: Lucio Chen Date: Sat, 25 Jul 2026 15:44:41 -0700 Subject: [PATCH] fix: remove dead Home-variant GetClasses; `classes` now aliases `schedule` The remaining open item. Probing settled it: the Home-variant GetClasses returns placeholder records even when the real client calls it -- confirmed by capturing the app's own request/response pair during a live walk (200, ~10 KB, zero real records, empty ScheduleList). Every screen-variable override (WBDataFetchIsComplete, IsLoading, ProgramsWithHistory, all date/program combos) changes nothing. It is not parameter-gated; it is empty by design. So the fix is honesty, not persistence: the action is removed from the allowlist (a test pins it out so it cannot quietly return), and `wodify classes` becomes an argparse alias of `schedule`, the class-list action that actually returns data. `schedule` also gains the default-to-today behaviour the old command had. 134 tests, no network required. Co-Authored-By: Claude Opus 5 --- CLAUDE.md | 17 ++++++++++++----- src/wodify/actions.py | 17 +++++++---------- src/wodify/cli.py | 9 +++++++-- tests/test_actions.py | 13 +++++++++++-- tests/test_cli.py | 40 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 77 insertions(+), 19 deletions(-) create mode 100644 tests/test_cli.py diff --git a/CLAUDE.md b/CLAUDE.md index e263818..34651db 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -285,11 +285,18 @@ Test fixtures use **fictional** names. Real gym members' names were scrubbed and history squashed before first publication — do not reintroduce live attendee names into fixtures or docs, even in examples. The gym host and location id are not secrets and stay. -### Not yet done -- `classes` (the Home variant of `GetClasses`) still returns placeholders only; superseded by - `schedule` and kept solely as a labelled trap -- Not pushed to the remote: the git server exposes no SSH port, and HTTPS needs a password - that has to be entered by a human +### The Home-variant GetClasses is dead — closed, do not reopen + +`WodifyClient_Class/Classes/Attendance/DataActionGetClasses` returns placeholder records +(`Id "0"`, empty `ScheduleList`, zero WODs) **even when the real client calls it**. Confirmed +by capturing the app's own request/response pair during a live walk to the workout screen: +200, ~10 KB of empty-record scaffolding, `real_wods=0`. Screen-variable overrides +(`WBDataFetchIsComplete`, `IsLoading`, `ProgramsWithHistory`, every date/program combination) +were all probed and change nothing. It is not parameter-gated; it is empty by design — the +Home screen sources its data from other actions. + +The action is removed from the allowlist (a test pins that), and `wodify classes` is now a +CLI alias for `schedule`, which is the class-list action that actually returns data. ## Gotchas found the hard way diff --git a/src/wodify/actions.py b/src/wodify/actions.py index 3227a64..c7b1582 100644 --- a/src/wodify/actions.py +++ b/src/wodify/actions.py @@ -107,8 +107,13 @@ ACTIONS: dict[str, Action] = { inputs=("Request",), ), # The schedule screen's class list, with reservation counts. This is the - # one that actually populates; `classes` below (the Home variant) returns - # placeholder records only. + # only class-list action that returns data. + # + # Do NOT re-add WodifyClient_Class/Classes/Attendance/DataActionGetClasses: + # it returns placeholder records (Id "0", empty ScheduleList) even when the + # real client itself calls it -- confirmed by capturing the app's own + # request/response pair during a live walk (200, ~10 KB, zero real + # records). It is not parameter-gated; it is empty by design. Action( key="schedule", path=f"{_FETCH}/Schedule_OS/GetClassList_ForClient_WithReservationCounts_WB" @@ -117,14 +122,6 @@ ACTIONS: dict[str, Action] = { summary="All classes on a given day, with reservation counts", inputs=("In_Request",), ), - Action( - key="classes", - path="WodifyClient_Class/Classes/Attendance/DataActionGetClasses", - view_name="Classes.Attendance", - summary="Classes via the Home screen variant (returns placeholders; " - "prefer 'schedule')", - inputs=("Request",), - ), Action( key="waitlist", path=f"{_FETCH}/Schedule_OS/GetClassWaitList_WB/DataActionGetClassWaitList", diff --git a/src/wodify/cli.py b/src/wodify/cli.py index d78737b..ff3ff19 100644 --- a/src/wodify/cli.py +++ b/src/wodify/cli.py @@ -147,7 +147,10 @@ def build_parser() -> argparse.ArgumentParser: for key in actions.keys(): action = actions.ACTIONS[key] - p = sub.add_parser(key, help=action.summary) + # `classes` survives as an alias: the action it used to name returns + # placeholders even when the real client calls it, so it was removed. + aliases = ["classes"] if key == "schedule" else [] + p = sub.add_parser(key, help=action.summary, aliases=aliases) p.add_argument("--json", action="store_true", help="raw JSON instead of text") p.add_argument("--date", default=None, metavar="YYYY-MM-DD", help="target date (default: today for date-scoped actions)") @@ -169,6 +172,8 @@ def build_parser() -> argparse.ArgumentParser: def main(argv: list[str] | None = None) -> int: args = build_parser().parse_args(argv) + if args.command == "classes": # alias for the action that actually works + args.command = "schedule" if args.command == "list": from . import listcmd return listcmd.dispatch(args) @@ -176,7 +181,7 @@ def main(argv: list[str] | None = None) -> int: return cmd_doctor(args) if args.command == "prime": return cmd_prime(args) - if getattr(args, "date", None) is None and args.command in ("workout", "classes"): + if getattr(args, "date", None) is None and args.command in ("workout", "schedule"): args.date = _today() return cmd_query(args) diff --git a/tests/test_actions.py b/tests/test_actions.py index f04af83..e07dd02 100644 --- a/tests/test_actions.py +++ b/tests/test_actions.py @@ -66,11 +66,20 @@ def test_guard_does_not_block_legitimate_read_paths(): def test_all_expected_actions_registered(): - expected = {"bookings", "wodflags", "attendees", "classdetail", - "coach", "classes", "waitlist"} + expected = {"bookings", "workout", "wodflags", "attendees", "classdetail", + "coach", "schedule", "waitlist"} assert expected <= set(actions.keys()) +def test_dead_home_getclasses_is_not_registered(): + """The Home-variant GetClasses returns placeholders even when the real + client calls it (confirmed live). It must stay out of the allowlist so + nothing reports its empty response as a real answer.""" + assert "classes" not in actions.ACTIONS + for action in actions.ACTIONS.values(): + assert "Classes/Attendance/DataActionGetClasses" not in action.path + + def test_get_returns_action_for_workout_probe(): """wodflags is deliberately not called 'workout': it returns a boolean, and naming it 'workout' invited reporting 'no workout' from a probe response.""" diff --git a/tests/test_cli.py b/tests/test_cli.py new file mode 100644 index 0000000..b4402f7 --- /dev/null +++ b/tests/test_cli.py @@ -0,0 +1,40 @@ +"""CLI wiring: the `classes` alias and command normalization.""" +from __future__ import annotations + +from wodify import cli + + +def test_classes_parses_as_alias_of_schedule(): + args = cli.build_parser().parse_args(["classes", "--date", "2026-07-24"]) + assert args.command == "classes" + assert args.date == "2026-07-24" + + +def test_main_normalizes_classes_to_schedule(monkeypatch): + seen = {} + + def fake_query(args): + seen["command"] = args.command + seen["date"] = args.date + return 0 + + monkeypatch.setattr(cli, "cmd_query", fake_query) + assert cli.main(["classes"]) == 0 + assert seen["command"] == "schedule" + assert seen["date"], "schedule should default to today" + + +def test_schedule_defaults_date_to_today(monkeypatch): + seen = {} + monkeypatch.setattr(cli, "cmd_query", + lambda a: seen.update(date=a.date) or 0) + cli.main(["schedule"]) + assert seen["date"] == cli._today() + + +def test_explicit_date_not_overridden(monkeypatch): + seen = {} + monkeypatch.setattr(cli, "cmd_query", + lambda a: seen.update(date=a.date) or 0) + cli.main(["schedule", "--date", "2026-07-20"]) + assert seen["date"] == "2026-07-20"