552 lines
28 KiB
Markdown
552 lines
28 KiB
Markdown
# wodify — agent notes
|
|
|
|
Read-only client for the **Wodify athlete app** (`claycrossfit.wodify.com`), built so an
|
|
agent can answer "what's the workout / what did I book / who's coaching / who else is going"
|
|
**without driving a browser at query time**.
|
|
|
|
Replaces browser automation, which was slow and burned a lot of tokens rendering a SPA just to
|
|
read text back out of the DOM.
|
|
|
|
## Hard rule: read-only
|
|
|
|
This client must never reserve, cancel, check in, log results, accept terms, change settings,
|
|
or buy anything. The credential it uses is a *full-session* login — Wodify issues no read-only
|
|
token — so nothing at the credential layer enforces this. Enforcement lives in two places, and
|
|
both must stay:
|
|
|
|
1. `actions.py::ACTIONS` — an explicit allowlist. Nothing not registered can be called.
|
|
2. `actions.py::assert_read_only` — rejects any path containing a write marker
|
|
(`Create`, `Save`, `Reserve`, `Cancel`, `SignIn`, …), applied *even to* allowlisted entries.
|
|
|
|
`tests/test_actions.py` asserts both, including that known write endpoints are refused. If you
|
|
add an action, add a test.
|
|
|
|
## How it works
|
|
|
|
Wodify's athlete app is OutSystems Reactive. Its data actions are plain JSON POSTs:
|
|
|
|
```
|
|
POST https://<host>/WodifyClient/screenservices/<Module>/<Screen>/<Action>
|
|
X-CSRFToken: <28 chars>
|
|
Cookie: nr1W_Theme_UI=…; nr2W_Theme_UI=…; AuthenticationToken=…
|
|
{"versionInfo": {"moduleVersion": …, "apiVersion": …},
|
|
"viewName": …, "inputParameters": {…}}
|
|
```
|
|
|
|
Two phases:
|
|
|
|
| Phase | Cost | Needs a browser? |
|
|
|-------|------|------------------|
|
|
| **prime** | rare — once, then on Wodify redeploys | yes, via CDP |
|
|
| **query** | one HTTP POST per question | no |
|
|
|
|
`prime` attaches to a logged-in Chrome over CDP, captures the cookies, the CSRF token, and each
|
|
action's `versionInfo` + `inputParameters` shape, and writes them to a cache. `query` then does
|
|
pure stdlib HTTP.
|
|
|
|
### Why prime needs a browser
|
|
|
|
- The session bearer `nr1W_Theme_UI` is **HttpOnly** (184 chars). `document.cookie` cannot read
|
|
it, so it cannot be exported by hand — this is why an earlier cookie-paste approach was
|
|
impossible, not merely inconvenient.
|
|
- `X-CSRFToken` is not in `localStorage`, cookies, or any JS global. It only appears on outbound
|
|
requests, so it has to be sniffed.
|
|
- `apiVersion` is **per-action**, not global (two actions returned
|
|
`w5JqiO_2RpM6VdmR6V470Q` and `hBUtX6paK6XbMlXso4zBcw`). Each endpoint needs its own.
|
|
|
|
### Self-healing
|
|
|
|
Every response carries `versionInfo: {hasModuleVersionChanged, hasApiVersionChanged}`. When
|
|
either flips true — or a call returns 401/403 — the cache is stale and `prime` must re-run.
|
|
`client.py` raises `VersionStale` / `SessionExpired` rather than returning wrong data.
|
|
|
|
## Dependencies
|
|
|
|
The **query path is stdlib-only** (`urllib`, `json`, `gzip`) — deliberate, so the hot path has
|
|
no install step. `prime` needs `websockets` (declared as the `prime` extra) because CDP is a
|
|
WebSocket protocol.
|
|
|
|
## Layout
|
|
|
|
```
|
|
src/wodify/
|
|
config.py host, CDP URL, cache path, all env-overridable
|
|
actions.py read-only allowlist + write guard
|
|
cdp.py minimal CDP client (prime only)
|
|
prime.py capture cookies / CSRF / versionInfo -> cache
|
|
client.py HTTP query path (stdlib)
|
|
store.py SQLite cache (sqlite3, stdlib)
|
|
service.py cache-through data access -- all fetches go through here
|
|
render.py compact text output (token-efficient, not a DOM dump)
|
|
listcmd.py the `list date` / `list workout` / `list mine` commands
|
|
mcpserver.py `wodify mcp` -- the same commands as an MCP server, stdio or HTTP (stdlib)
|
|
accessjwt.py verifies Cloudflare Access assertions for the HTTP server (stdlib)
|
|
cli.py python -m wodify <cmd>
|
|
```
|
|
|
|
## The `list` interface
|
|
|
|
```
|
|
wodify list date 2026-07-25 # classes: time, coach, booked/max, title, duration, ID
|
|
wodify list workout 190917816 # attendee names + the workout for that class
|
|
wodify list mine [2026-07-25] # the account's own classes that day, each with
|
|
# roster + workout; "No class reserved on …" if none
|
|
```
|
|
|
|
`list mine` takes `--days N` (1-14) to look ahead. "Mine" is any class whose schedule
|
|
`Status` is non-empty: reserved, waitlist (printed as NOT a confirmed spot) or signed in.
|
|
No class is a normal answer and exits 0.
|
|
|
|
`list date` prints IDs; `list workout <id>` consumes one. Both accept `--refresh`
|
|
(bypass cache), `--json`, and `list workout` also takes `--notes` for the coach's brief.
|
|
|
|
A class ID resolves to nothing on its own — it is per-occurrence, and carries neither date
|
|
nor program. `list date` indexes the day's classes into SQLite, and `list workout` looks the
|
|
ID up there. Querying an ID for a day never listed returns a message saying exactly that.
|
|
|
|
## MCP server
|
|
|
|
`wodify mcp` serves the CLI over MCP's stdio transport (newline-delimited JSON-RPC).
|
|
It is **stdlib-only** -- no `mcp` SDK -- so it needs no install step, like the query path.
|
|
|
|
Each tool builds an argv and calls `cli.main` in-process with stdout captured. That is
|
|
the whole design: there is no second code path, so the allowlist, the write guard, the
|
|
SQLite cache and the output wording are the CLI's by construction. Do not add a tool that
|
|
fetches on its own; add a CLI command and wrap it.
|
|
|
|
| Tool | Runs |
|
|
|------|------|
|
|
| `my_classes` | `list mine` -- reserved class material in one call, incl. "none reserved" |
|
|
| `list_date`, `list_workout` | the `list` commands (cached) |
|
|
| one per `actions.keys()` | the generic action commands (live, as in the CLI) |
|
|
| `doctor`, `prime` | same |
|
|
|
|
- Single-user: it answers as whoever `prime` captured. No account parameter exists.
|
|
- A non-zero CLI exit becomes `isError: true` with `[wodify exit N]` appended; the code is
|
|
from whichever exit table that command uses (see "Exit codes").
|
|
- Every argument is validated (date regex, digits, real booleans) before it reaches an
|
|
argv, so a string can never be read as a flag. Unknown arguments are refused.
|
|
- `prime` is the one tool not annotated `readOnlyHint`: it rewrites the local session
|
|
cache. It still changes nothing in Wodify. It is exposed so an agent can heal STALE.
|
|
- While serving, `sys.stdout` is pointed at stderr -- stdout is the protocol channel and a
|
|
stray `print` would corrupt it.
|
|
|
|
### HTTP transport (public: `https://wodify.luci.ooo/mcp`)
|
|
|
|
`wodify mcp --http HOST:PORT` serves the same handler over MCP streamable HTTP at `/mcp`:
|
|
stateless, JSON responses only (GET/DELETE answer 405 -- there is no SSE stream and no
|
|
session). Still stdlib (`http.server`).
|
|
|
|
This is the one part of the project reachable from the internet, fronting a full Wodify
|
|
session and other members' names. Rules that must stay:
|
|
|
|
- **A bearer token is mandatory.** `$WODIFY_MCP_TOKEN`, else `--token-file`, else
|
|
`~/.config/wodify/mcp-token`. No token, or one under 32 chars, and it refuses to start.
|
|
There is no flag to disable auth; do not add one.
|
|
- **Auth is checked before the path**, for every method, with `hmac.compare_digest`. An
|
|
unauthenticated caller gets 401 everywhere and cannot tell `/mcp` from `/`.
|
|
- **`prime` is not offered over HTTP** (it drives the host's browser) unless
|
|
`--allow-prime`. The stdio server keeps it.
|
|
- Tool calls run under a lock: `run_cli` redirects the process-wide stdout, so two
|
|
overlapping calls would swap output.
|
|
- Bodies over 1 MB are refused on the declared length, before reading. Logs carry the
|
|
request line and status only -- never headers, so never the token.
|
|
|
|
#### OAuth: Cloudflare Access does it, the origin verifies it
|
|
|
|
The server implements no OAuth. `wodify.luci.ooo` is a Cloudflare Access self-hosted
|
|
application ("Wodify MCP") with **Managed OAuth** on: Access answers an unauthenticated
|
|
MCP client with a 401 pointing at its discovery metadata, runs registration, login
|
|
(passkey) and token exchange itself, and forwards allowed requests to the origin with a
|
|
signed `Cf-Access-Jwt-Assertion` header. The client's own `Authorization` header is an
|
|
opaque `oauth:…` token that means nothing to the origin.
|
|
|
|
`accessjwt.py` verifies that assertion, and it must: the origin is reachable without
|
|
Cloudflare (home IP + the right SNI), so anything that trusts the edge alone, or a plain
|
|
header like `Cf-Access-Authenticated-User-Email`, is an open door. Checked on every
|
|
request: RS256 signature against the team's published keys, issuer, the application's
|
|
AUD tag, expiry, and (with `--access-email`) the identity.
|
|
|
|
- RS256 is verified in stdlib: one `pow()` with the public key, then the expected
|
|
PKCS#1 v1.5 block is **constructed and compared whole**, never parsed. Cross-checked
|
|
against an OpenSSL signature when written. The algorithm is pinned, not read from
|
|
the token.
|
|
- Keys are cached; an unknown `kid` triggers at most one refetch a minute. A failed
|
|
fetch refuses the request.
|
|
- The bearer token still works beside it -- but only on the LAN address, since Access
|
|
now intercepts everything arriving through Cloudflare.
|
|
- Who may log in is decided by the Access policy on the application (the account's
|
|
reusable "Allow emails" policy). `--access-email` is not set on the deployed unit, so
|
|
loosening that policy loosens this endpoint.
|
|
- The service's AUD tag and team domain are flags on `wodify-mcp.service`. If the Access
|
|
application is ever deleted and recreated, its AUD changes and the unit must follow.
|
|
- Dynamic client registration only accepts redirect URIs on `chatgpt.com`, `claude.ai`,
|
|
`claude.com`, localhost, and one exact Gemini web callback
|
|
(`https://oauth-redirect.googleusercontent.com/r/user_bound_custom-mcp-…` -- exact,
|
|
not a wildcard: that host is shared by every Google user). Gemini's own automatic
|
|
registration fails against Access even with that URI allowed -- why was not
|
|
established, the same request succeeds from curl -- so its client was registered by
|
|
hand (POST to the `registration_endpoint`, `token_endpoint_auth_method:
|
|
client_secret_post`) and the client ID and secret typed into Gemini's connector
|
|
dialog. If Google issues a new redirect URI, allow it and register again. Another client needs its callback added to the Access
|
|
application's Managed OAuth settings.
|
|
|
|
Path on the wire: Cloudflare (proxied A record `wodify.luci.ooo`, kept current by
|
|
`home-ddns` on luhpe, which follows every A record holding the home IP -- no per-record
|
|
config) -> home router :443 -> Caddy on the NAS (`wodify.luci.ooo` block, `/mcp` only)
|
|
-> `10.233.33.15:8765` on luhpe (`wodify-mcp.service`, a systemd user unit; ufw admits
|
|
only the NAS, 10.233.33.13). The hop from Caddy to luhpe is plain HTTP on the LAN.
|
|
|
|
To rotate the token: write a new one to `~/.config/wodify/mcp-token` (mode 600) and
|
|
`systemctl --user restart wodify-mcp`.
|
|
|
|
Registered with hermes on luhpe as the `wodify` server (`command:
|
|
/home/lucio/.local/bin/wodify`, `args: [mcp]`). From another machine:
|
|
`ssh luhpe .local/bin/wodify mcp` is a working stdio command.
|
|
|
|
## SQLite cache
|
|
|
|
`~/.cache/wodify/wodify.db` (override with `WODIFY_DB`), created mode 600 — it holds other
|
|
members' names.
|
|
|
|
| Table | Holds |
|
|
|-------|-------|
|
|
| `payloads` | raw action responses, keyed e.g. `schedule:2026-07-25`, stamped with the local date |
|
|
| `classes` | one row per class occurrence, so an ID resolves to date + program + limit |
|
|
|
|
Schedules and attendee rosters have a **one-hour TTL**; workout content remains cached
|
|
for the local calendar day. All payloads expire at midnight. The class-ID index is not
|
|
subject to the hourly TTL. `bookings` queries bypass the payload cache entirely.
|
|
Use `--refresh` before attendance decisions: even an hourly cache can predate a recent
|
|
sign-in. Every command prints whether the answer came from cache or the wire.
|
|
|
|
Only `service.py` fetches, so caching cannot be forgotten at a call site.
|
|
|
|
## Environment
|
|
|
|
| Var | Default | Meaning |
|
|
|-----|---------|---------|
|
|
| `WODIFY_HOST` | `claycrossfit.wodify.com` | tenant host |
|
|
| `WODIFY_CDP_URL` | `http://127.0.0.1:9222` | Chrome CDP root for `prime` |
|
|
| `WODIFY_CACHE` | `~/.cache/wodify/session.json` | cached headers, mode 600 |
|
|
|
|
The cache holds live session credentials. Mode 600, never committed (`.gitignore`), never
|
|
logged. Anything that prints it is a bug.
|
|
|
|
### Priming from this machine
|
|
|
|
The logged-in Chrome profile lives on the CDP host, not here. Tunnel first:
|
|
|
|
```
|
|
ssh -L 9222:127.0.0.1:9222 <cdp-host>
|
|
```
|
|
|
|
Then `python -m wodify prime` works locally against the remote profile.
|
|
|
|
## Status
|
|
|
|
### Working, verified live (2026-07-25)
|
|
|
|
`prime` and `bookings` run end-to-end against the real service with **no browser at query
|
|
time**:
|
|
|
|
```
|
|
$ python -m wodify bookings
|
|
- 2026-07-20 17:30:00 CrossFit: 5:30 PM [Attended]
|
|
- 2026-07-22 17:30:00 CrossFit: 5:30 PM [Attended]
|
|
- 2026-07-24 17:30:00 CrossFit: 5:30 PM [Attended]
|
|
```
|
|
|
|
- `prime` over an SSH tunnel to the CDP host's Chrome: 338-char cookie, 28-char CSRF,
|
|
`moduleVersion=4qHsLi2Es1qvgd2NhStmPw`
|
|
- Auth accepted: responses carry `hasApiVersionChanged: false`, so cookie + CSRF + both
|
|
versions are all valid
|
|
- 60 tests pass, no network needed (161 as of 2026-11-10)
|
|
|
|
### The body contract (learned the hard way)
|
|
|
|
The `tamird/wodify-race-repro` example uses `inputParameters`. That is right for
|
|
`ServiceAPI*` actions but **wrong for screen data actions**, which send:
|
|
|
|
```json
|
|
{"versionInfo": {…}, "viewName": "MainScreens.Home",
|
|
"screenData": {"variables": {…entire screen state, incl. ClientVariables…}}}
|
|
```
|
|
|
|
Sending `inputParameters` — or adding any key not in the captured body — returns
|
|
`400 Failed to parse JSON request content`. So `prime` stores the **whole body** and `client`
|
|
patches individual leaves via `set_field`, which only writes keys that already exist.
|
|
|
|
Levers that live in `screenData.variables.ClientVariables`: `SelectedDate`, `GymProgramId`,
|
|
`ActiveLocationId`, `CustomerId`, `UserId`.
|
|
|
|
`SelectedDate` must be a **bare `YYYY-MM-DD`**. Every datetime form probed
|
|
(`…T00:00:00`, `…T00:00:00Z`, `…T07:00:00.000Z`) returns 400 — note the browser's
|
|
*localStorage* holds `2026-07-24T07:00:00.000Z`, which is not the wire format.
|
|
|
|
### WOD content — solved
|
|
|
|
The content action is **`WOD_Flow/GetAllWorkoutData_WB/DataActionGetAllWorkoutData`**,
|
|
`viewName: MainScreens.Exercise`. Content at `Response.ResponseWOD.ResponseWorkout`:
|
|
`Name`, `Notes` (coach's brief), and `WorkoutComponents.List[].{Name, Comment, IsSection}`.
|
|
|
|
Why it took a while to find, recorded so nobody repeats it:
|
|
|
|
- `GetWorkoutData_HasWodLeaderboardComponents` **sounds** like the content action but returns
|
|
a bare `{"Response": true}`. It is registered as `wodflags`, never `workout`.
|
|
- The content action **does not fire on a cold load of `/WodifyClient/Exercise`** — that
|
|
screen shows "No workout posted" and issues no content request at all. Enumerating requests
|
|
on a direct load therefore "proves" the action does not exist. It only fires when the screen
|
|
is reached properly: class detail → **Go to workout**.
|
|
- OutSystems also **caches** the data action, so revisiting the same date issues no request.
|
|
Capturing it requires navigating to a date whose WOD is not already cached.
|
|
- `ProgramWODList` on `GetClasses` was a red herring — it stays a placeholder record.
|
|
|
|
Body contract: `SelectedDate` and `GymProgramId` appear in **two** sibling objects
|
|
(`RequestCache` *and* `In_Request`). `client.set_field` writes every occurrence, which is why
|
|
overriding the date works; writing only the first would silently query the wrong day.
|
|
|
|
`prime` reproduces the walk via `WORKOUT_WALK_JS` (Schedule → date → class → Go to workout),
|
|
which also captures the class-detail actions as a side effect. Pass `--workout-date` for a day
|
|
that actually has a posted WOD; a day with nothing published cannot capture it.
|
|
|
|
### Both target workflows work (verified live 2026-07-25)
|
|
|
|
```
|
|
$ python -m wodify bookings --since 2026-07-18 --until 2026-07-25 --attended
|
|
- 2026-07-20 17:30:00 CrossFit: 5:30 PM [Attended] class_id=190917816
|
|
- 2026-07-22 17:30:00 CrossFit: 5:30 PM [Attended] class_id=190917818
|
|
- 2026-07-24 17:30:00 CrossFit: 5:30 PM [Attended] class_id=190917820
|
|
|
|
$ python -m wodify workout --date 2026-07-22
|
|
# CrossFit - Wed, Jul 22
|
|
## WARM-UP
|
|
General Warm-Up
|
|
1:30 Cardio Choice
|
|
...
|
|
```
|
|
|
|
`bookings` emits `class_id` so the two chain together. Range filtering is client-side: the
|
|
action returns the whole history in one call, so filtering here is cheaper than negotiating a
|
|
range with the server.
|
|
|
|
The coach's brief (`Notes`) is **excluded unless `--notes`** is passed — it runs to several
|
|
thousand characters, and small output is the entire reason this client exists.
|
|
|
|
### Field-name traps (each one produced confident wrong output)
|
|
|
|
These all failed *silently* — plausible output, no error. Worth reading before adding a
|
|
renderer.
|
|
|
|
| Field | Trap |
|
|
|-------|------|
|
|
| `PersonName` | attendee name is **not** `Name`. Looking for `Name` returns an empty list on a full class, reading as "nobody came" |
|
|
| `Description` | the metcon's movements. Reading only `Name`/`Comment` yields goals and RPE with no workout |
|
|
| `MeasureRepScheme` | strength set scheme, plain text with real newlines (not HTML) |
|
|
| `FromDate` | the scheduler's date key. It is **not** `SelectedDate` (that is the workout screen), so `--date` was ignored and every query returned today |
|
|
| `Id` on a class row | **not** `ClassId`. A class row nests `GroupMemberReservationStatus.ClassId == "0"`, so flattening nested dicts up clobbers the real id and collapses every class into one |
|
|
| `Id == "0"` | OutSystems' empty-record placeholder. Reads exactly like real data; `render._real_records` filters it |
|
|
|
|
A related lesson worth keeping: when the attendee list came back empty, the code printed an
|
|
invented explanation ("Wodify hides names for anonymous members"). That was a fabricated cause
|
|
for a bug in the same function. Empty results now say only what is true — "None returned" —
|
|
and speculate about nothing.
|
|
|
|
### Known quirks
|
|
|
|
- Attendee lists omit **the requesting account**, so a class you attended shows one fewer
|
|
person than it has reservations. `render.attendee_block` flags the gap rather than letting
|
|
it look like a miscount.
|
|
- `schedule` only returns programs the account can see: the request carries
|
|
`CustomerHasShowAllClassesEnabled: false` and `IncludeDropInsAndFreeTrials: false`. Programs
|
|
like Open Gym or Personal Training will not appear even if they ran.
|
|
- `ReservationCount` is reservations, not attendance. For a past class, the attendee list's
|
|
`HasSignedIn` / `HasNoShow` flags are the real signal.
|
|
|
|
### Deployment
|
|
|
|
Deployed to the hermes host at `~/repo/wodify`, with a wrapper at `~/.local/bin/wodify`.
|
|
The wrapper puts `src/` on `PYTHONPATH` rather than pip-installing: the query path is
|
|
stdlib-only, and staying out of the hermes venv means `hermes update` cannot clobber or drop
|
|
it. It uses the hermes venv's interpreter because `prime` needs `websockets` from there.
|
|
|
|
Chrome runs on that host, so `prime` works locally with no tunnel. The `wodify-viewer`
|
|
hermes skill (v5.1.0) tells the agent to prefer the `mcp_wodify_*` tools (hermes prefixes
|
|
MCP tools `mcp_<server>_`), fall back to the CLI, and treat the browser as last resort.
|
|
|
|
Verified live on the host: `list date`, `list workout` (12 attendees + the WOD), and a full
|
|
`prime` whose walk log reads
|
|
`{"log":["schedule=true","date=true","classes=4","class=true","hasGoToWorkout=true","goto=true"],"ok":true}`.
|
|
|
|
### Self-healing, confirmed in the wild
|
|
|
|
Wodify redeployed mid-session (`moduleVersion` went `4qHsLi2Es1qvgd2NhStmPw` →
|
|
`Lr5GpsYppagRVIiIPnDo2g`). The stale cache did **not** return wrong data — it raised:
|
|
|
|
```
|
|
STALE: schedule: Wodify redeployed (module changed=True, api changed=False). Re-prime.
|
|
```
|
|
|
|
Exit 3, no fallback, no guess. Intended behaviour, fired unprompted.
|
|
|
|
### The 2026-08 redesign: attendees moved, paths re-prefixed
|
|
|
|
Wodify redeployed around 2026-08-22 and broke `attendees` in two independent
|
|
ways. Both are fixed; recorded so the next redesign is faster to diagnose.
|
|
|
|
1. **Every data action gained a `WodifyClient_DataFetch_WB/` prefix** (e.g.
|
|
`Schedule_OS/GetClassList_ForClient_WithReservationCounts_WB/...` now lives
|
|
under `WodifyClient_DataFetch_WB/Schedule_OS/...`). Symptom was subtle:
|
|
cached apiVersions kept working, so everything *except* never-captured
|
|
actions kept answering — and re-prime could not recapture anything new,
|
|
because `_observe` matches captured paths exactly against the allowlist.
|
|
2. **`GetClassAttendees` is gone entirely.** No request by that name fires
|
|
anywhere in the app now, on any screen, including scroll. The class screen
|
|
sources its roster from a different endpoint:
|
|
`WodifyClient_Class/Classes/Class/ActionGetClassAttendees` (note: no
|
|
`_WB`, no `DataAction` infix — ServiceAPI style). It only fires when a
|
|
class is opened from the Scheduler UI, which the existing workout walk
|
|
already does.
|
|
|
|
Diagnosis recipe that found both: attach CDP with a request observer, click
|
|
through Home → Schedule → a class, and dump every `/screenservices/` path
|
|
(probe script pattern in git history, `probe4.py`). Grepping the dump for
|
|
the missing action's name fragments (`Attendee`) reveals its new home.
|
|
|
|
The response shape also changed: attendees now arrive as
|
|
`Response.ClassDetailAttendee.List[].{PersonName, StatusInClass, ...}` —
|
|
which `render.attendee_rows` already handled, but the CLI's `attendees`
|
|
command had its own older inline renderer that only knew `Name`/
|
|
`FirstName+LastName` and silently printed "No attendees listed." for every
|
|
class. Rule reinforced: **there must be exactly one attendee-shape parser**;
|
|
`render.attendees()` now delegates to `attendee_rows()`.
|
|
|
|
### 2026-11: "the interface changed" -- it was a stale service worker, not the API
|
|
|
|
Wodify redeployed on 2026-11-10 (`moduleVersion` -> `+_VG7Ud3pDy9uLRnDiVCAg`). `prime`
|
|
then captured **zero** actions, wrote a cache with an empty action table, and every query
|
|
reported `NOT PRIMED ... missing 'actions'`. It looked exactly like the 2026-08 endpoint
|
|
move. It was not: **every allowlisted path and every response shape is unchanged**, and
|
|
the prime walk passes as written on the current Schedule screen (Classes / Appointments
|
|
tabs, an "All classes" filter, a week strip, then the class rows).
|
|
|
|
What actually happened: the app's **service worker** kept serving the old OutSystems
|
|
runtime script to pages whose screen code was already the new build. In that mixed state
|
|
every data action throws client-side, before any request leaves the browser:
|
|
|
|
```
|
|
TypeError: s is not a function
|
|
at Controller.callServerDataSource (.../scripts/OutSystems__....js)
|
|
```
|
|
|
|
So screens render blank (Schedule shows only its title bar), the only requests on the wire
|
|
are the bootstrap ones (`ActionShowFeaturesAvailable`, `ActionSync*`, `Firebase_CW/*`), and
|
|
there is nothing for `_observe` to match. The session was valid the whole time -- cookie and
|
|
CSRF were captured fine.
|
|
|
|
Which layer, measured rather than assumed (Home, 18 s, errors counted per mode):
|
|
|
|
| Tab setting | Runtime script loaded | Data requests | Page errors |
|
|
|-------------|-----------------------|---------------|-------------|
|
|
| default | `OutSystems__F9kv…` (old) | 14 | `s is not a function` |
|
|
| HTTP cache disabled only | `OutSystems__F9kv…` (old) | 14 | `s is not a function` |
|
|
| service worker bypassed only | `OutSystems__fKIr…` (new) | 34 | none |
|
|
| both | `OutSystems__fKIr…` (new) | 34 | none |
|
|
|
|
The HTTP cache is not involved. The worker reported `active`, with nothing `waiting`, so
|
|
this is not an upgrade blocked on open tabs either -- it is simply serving stale files.
|
|
Why it does not refresh itself was not established; do not write a cause into this file
|
|
without measuring it.
|
|
|
|
The fix, in `cdp.open_page`: `Network.setBypassServiceWorker` on the prime tab, so the app
|
|
loads from the network. Per-tab; nothing in the profile is unregistered or cleared, which
|
|
also means **the profile itself is still stale** -- anything else driving that Chrome (the
|
|
hermes browser fallback) still gets the broken app until the worker is refreshed.
|
|
|
|
Two other defects surfaced, both fixed:
|
|
|
|
1. **`prime` saved the empty capture**, replacing the previous cache with one that could
|
|
answer nothing. It now raises instead, leaves the existing cache alone, and names the
|
|
cause.
|
|
2. **`prime` leaked a tab on every run** (`open_page` never closed its target); six stale
|
|
Wodify tabs had piled up in the profile. `CDPSession.close()` now closes the tab it
|
|
opened. No evidence the leak caused the stale worker -- it is fixed because it is a leak.
|
|
|
|
How to tell the two failure modes apart next time -- `prime` now does it for you:
|
|
|
|
| `prime` says | Meaning |
|
|
|--------------|---------|
|
|
| `captured none ... The page itself reported errors ... callServerDataSource` | the *browser's copy of the app* is broken. Endpoints are fine. |
|
|
| `captured none ... none matched actions.ACTIONS -- Wodify has probably moved its endpoints` | a real endpoint move, as in 2026-08. Run the path-dump recipe. |
|
|
| `page_errors: [...]` on an otherwise successful prime | informational; the app logged errors but data actions still fired. |
|
|
|
|
Diagnosis recipe that found it: enable `Runtime` + `Log` on the tab and read the console,
|
|
and look at the bodies the app POSTs to `/WodifyClient/moduleservices/log` -- it reports its
|
|
own exceptions there, stack included. Six of those posts on a page load is the tell.
|
|
|
|
Red herrings from this investigation, so nobody chases them again:
|
|
|
|
- The app talks to **Firebase**: `Firebase_CW/ServiceAPIGet_FirebaseCustomToken`,
|
|
`identitytoolkit.googleapis.com/...signInWithCustomToken`, and Firestore `Listen` channels
|
|
on `firestore-prd-dfda5`. With the data actions dead, that was the *only* traffic, so it
|
|
looked like the schedule had moved to Firestore. It has not. Firestore carries the inbox
|
|
(`communication-service` database), a per-user notification feed
|
|
(`GeneralListenerRequests/<customer>/Client/<user>/Requests`) and performance-result
|
|
counts. Classes, rosters and workouts still come from the OutSystems data actions.
|
|
- A direct load of `/WodifyClient/Scheduler` was seen to bounce back to Home after ~20 s
|
|
with the app in this state. That is the crash, not a route change.
|
|
- `WodifyClient_Class/Classes/Attendance/DataActionGetClasses` still fires on Home. It is
|
|
still the dead placeholder action (see below). Do not re-add it.
|
|
|
|
Also noticed while verifying: the schedule's `Status` (the `YOU` column) can be
|
|
`Waitlist`, alongside `Reserved` and `Signed In`. A waitlisted class is marked `»` like any
|
|
other of the account's classes, but it is not a confirmed spot -- the `Skill/` prompts now
|
|
say so.
|
|
|
|
### Exit codes: `list` differs from the generic commands
|
|
|
|
This bit the cron prompts: they applied the generic table to `list` commands, so "session
|
|
expired" handling fired on bad arguments and `NOT PRIMED` (exit 5) was not handled at all.
|
|
|
|
| | `list date` / `list workout` | `bookings`, `schedule`, other action commands |
|
|
|---|---|---|
|
|
| bad argument | 2 | (argparse) 2 |
|
|
| session expired | **3** | **2** |
|
|
| stale (redeploy) | **4** | **3** |
|
|
| not primed | **5** | **4** |
|
|
| write refused | -- | 5 |
|
|
| class id not indexed | 6 | -- |
|
|
|
|
`prime` exits 1 on any failure. Changing either column would break the deployed hermes
|
|
skill, which documents both -- keep them as they are and keep prompts explicit about which
|
|
table applies.
|
|
|
|
### Publishing
|
|
|
|
Test fixtures use **fictional** names. Real gym members' names were scrubbed and the git
|
|
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.
|
|
|
|
### 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
|
|
|
|
- `/WodifyClient/Exercise` (the workout screen) renders **"No workout posted"** even when a
|
|
workout exists, unless reached via a class. Irrelevant to this client — we call the data
|
|
action directly — but do not "verify" against that screen and conclude the data is missing.
|
|
- A stale `ClassId` **redirects to Home** instead of erroring. `ClassId` is per-occurrence and
|
|
changes daily.
|
|
- Capacity is `reserved | limit` and can exceed the limit when the gym overbooks. Report it
|
|
verbatim.
|