fix: prime bypasses the stale service worker; never saves an empty capture

After the 2026-11-10 Wodify redeploy, prime captured zero actions and every
query reported NOT PRIMED. It looked like another endpoint move. It was not:
every allowlisted path and response shape is unchanged.

The app's service worker was serving the old OutSystems runtime to pages
running the new screen code. That mixed app throws in
Controller.callServerDataSource before any data action is sent, so there was
nothing to observe. Measured per tab setting: bypassing the service worker
alone fixes it; disabling the HTTP cache alone does not.

- cdp.open_page: Network.setBypassServiceWorker on the prime tab. Per-tab,
  nothing in the profile is unregistered or cleared.
- cdp.close: close the tab the session opened. Every prime leaked one.
- prime: refuse to save a capture with no actions, leave the existing cache
  alone, and say why. Page errors are collected and reported, which is what
  separates "the browser's copy of the app is broken" from "Wodify moved its
  endpoints".
- Skill/: the cron prompts applied the generic exit-code table to `list`
  commands. For `list`, 3 is session expired, 4/5 are stale / not primed,
  6 is an unindexed class id. Exit 5 was not handled at all. Also document
  the `waitlist` value of the YOU column.
- CLAUDE.md / README: record the diagnosis, the measurements, the Firebase
  red herring, and both exit-code tables.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
lucioandClaude Fable 5.2 committed 2026-11-10 21:18:08 -08:00
1 parent cd7924d890
commit a15efa0874
9 files changed
+498 -16

No files matched your search

+101 -1
View File
@@ -153,7 +153,7 @@ $ python -m wodify bookings
`moduleVersion=4qHsLi2Es1qvgd2NhStmPw`
- Auth accepted: responses carry `hasApiVersionChanged: false`, so cookie + CSRF + both
versions are all valid
- 60 tests pass, no network needed
- 60 tests pass, no network needed (161 as of 2026-11-10)
### The body contract (learned the hard way)
@@ -312,6 +312,106 @@ command had its own older inline renderer that only knew `Name`/
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