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 <[email protected]>
This commit is contained in:
1 parent
1d0fd9c8ca
commit
8ab4ad4b17
5 files changed
+77
-19
No files matched your search
@@ -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
|
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.
|
fixtures or docs, even in examples. The gym host and location id are not secrets and stay.
|
||||||
|
|
||||||
### Not yet done
|
### The Home-variant GetClasses is dead — closed, do not reopen
|
||||||
- `classes` (the Home variant of `GetClasses`) still returns placeholders only; superseded by
|
|
||||||
`schedule` and kept solely as a labelled trap
|
`WodifyClient_Class/Classes/Attendance/DataActionGetClasses` returns placeholder records
|
||||||
- Not pushed to the remote: the git server exposes no SSH port, and HTTPS needs a password
|
(`Id "0"`, empty `ScheduleList`, zero WODs) **even when the real client calls it**. Confirmed
|
||||||
that has to be entered by a human
|
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
|
## Gotchas found the hard way
|
||||||
|
|
||||||
|
|||||||
+7
-10
@@ -107,8 +107,13 @@ ACTIONS: dict[str, Action] = {
|
|||||||
inputs=("Request",),
|
inputs=("Request",),
|
||||||
),
|
),
|
||||||
# The schedule screen's class list, with reservation counts. This is the
|
# The schedule screen's class list, with reservation counts. This is the
|
||||||
# one that actually populates; `classes` below (the Home variant) returns
|
# only class-list action that returns data.
|
||||||
# placeholder records only.
|
#
|
||||||
|
# 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(
|
Action(
|
||||||
key="schedule",
|
key="schedule",
|
||||||
path=f"{_FETCH}/Schedule_OS/GetClassList_ForClient_WithReservationCounts_WB"
|
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",
|
summary="All classes on a given day, with reservation counts",
|
||||||
inputs=("In_Request",),
|
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(
|
Action(
|
||||||
key="waitlist",
|
key="waitlist",
|
||||||
path=f"{_FETCH}/Schedule_OS/GetClassWaitList_WB/DataActionGetClassWaitList",
|
path=f"{_FETCH}/Schedule_OS/GetClassWaitList_WB/DataActionGetClassWaitList",
|
||||||
|
|||||||
+7
-2
@@ -147,7 +147,10 @@ def build_parser() -> argparse.ArgumentParser:
|
|||||||
|
|
||||||
for key in actions.keys():
|
for key in actions.keys():
|
||||||
action = actions.ACTIONS[key]
|
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("--json", action="store_true", help="raw JSON instead of text")
|
||||||
p.add_argument("--date", default=None, metavar="YYYY-MM-DD",
|
p.add_argument("--date", default=None, metavar="YYYY-MM-DD",
|
||||||
help="target date (default: today for date-scoped actions)")
|
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:
|
def main(argv: list[str] | None = None) -> int:
|
||||||
args = build_parser().parse_args(argv)
|
args = build_parser().parse_args(argv)
|
||||||
|
if args.command == "classes": # alias for the action that actually works
|
||||||
|
args.command = "schedule"
|
||||||
if args.command == "list":
|
if args.command == "list":
|
||||||
from . import listcmd
|
from . import listcmd
|
||||||
return listcmd.dispatch(args)
|
return listcmd.dispatch(args)
|
||||||
@@ -176,7 +181,7 @@ def main(argv: list[str] | None = None) -> int:
|
|||||||
return cmd_doctor(args)
|
return cmd_doctor(args)
|
||||||
if args.command == "prime":
|
if args.command == "prime":
|
||||||
return cmd_prime(args)
|
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()
|
args.date = _today()
|
||||||
return cmd_query(args)
|
return cmd_query(args)
|
||||||
|
|
||||||
|
|||||||
+11
-2
@@ -66,11 +66,20 @@ def test_guard_does_not_block_legitimate_read_paths():
|
|||||||
|
|
||||||
|
|
||||||
def test_all_expected_actions_registered():
|
def test_all_expected_actions_registered():
|
||||||
expected = {"bookings", "wodflags", "attendees", "classdetail",
|
expected = {"bookings", "workout", "wodflags", "attendees", "classdetail",
|
||||||
"coach", "classes", "waitlist"}
|
"coach", "schedule", "waitlist"}
|
||||||
assert expected <= set(actions.keys())
|
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():
|
def test_get_returns_action_for_workout_probe():
|
||||||
"""wodflags is deliberately not called 'workout': it returns a boolean, and
|
"""wodflags is deliberately not called 'workout': it returns a boolean, and
|
||||||
naming it 'workout' invited reporting 'no workout' from a probe response."""
|
naming it 'workout' invited reporting 'no workout' from a probe response."""
|
||||||
|
|||||||
@@ -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"
|
||||||
Reference in new issue
Block a user