From c47d2c772ed5c49e511475a36901c4cc08b07854 Mon Sep 17 00:00:00 2001 From: ehonis Date: Sun, 8 Nov 2026 12:55:04 -0500 Subject: [PATCH] Code health and the last visual gaps: splits, lint, one check, dates, titles, 44px measured (#98) Published from the private repository by oss-sync. - Code health and the last visual gaps: splits, lint, one check, dates, titles, 44px measured (#98) 115 files changed, 5417 insertions(+), 3205 deletions(-) --- .github/workflows/ci.yml | 2 + AGENTS.md | 344 ++-------- app/eslint.config.js | 46 ++ app/gear.test.js | 4 +- app/merge.test.js | 92 +++ app/native.test.js | 21 + app/package-lock.json | 1000 +++++++++++++++++++++++++++++ app/package.json | 8 +- app/runner.dom.test.jsx | 87 +++ app/smoke/editor.jsx | 2 +- app/smoke/log.jsx | 6 +- app/smoke/misc.jsx | 2 +- app/smoke/profile.jsx | 25 +- app/smoke/progress.jsx | 31 +- app/smoke/sheet.jsx | 6 +- app/smoke/system.jsx | 96 +++ app/smoke/today.jsx | 8 +- app/smoke/workout.jsx | 28 + app/src/App.jsx | 440 +------------ app/src/appdata.jsx | 227 +++++++ app/src/blurb.jsx | 12 + app/src/css/feed.css | 14 + app/src/css/frame.css | 17 + app/src/css/runner.css | 15 +- app/src/css/sheet.css | 19 +- app/src/css/workout.css | 2 +- app/src/daylist.jsx | 474 ++++++++++++++ app/src/dayswitcher.jsx | 59 ++ app/src/exercises.jsx | 13 +- app/src/filters.jsx | 29 + app/src/gear.jsx | 5 +- app/src/gearpicker.jsx | 2 +- app/src/howto.jsx | 19 +- app/src/lazy.jsx | 61 ++ app/src/lib/dates.js | 29 +- app/src/lib/grades.js | 16 + app/src/lib/lifts.js | 9 + app/src/lib/planflow.js | 2 +- app/src/lib/prefs.jsx | 4 +- app/src/lib/profile.js | 9 +- app/src/lib/store.js | 10 +- app/src/lib/timer.js | 2 + app/src/lib/viz.jsx | 4 +- app/src/lib/vizscale.js | 9 +- app/src/log.jsx | 33 +- app/src/main.jsx | 1 + app/src/notifications.jsx | 6 +- app/src/planner.jsx | 240 +------ app/src/plantalk.jsx | 233 +++++++ app/src/profile.jsx | 24 +- app/src/progress.jsx | 11 +- app/src/runner.jsx | 23 +- app/src/screeninfo.jsx | 3 +- app/src/session.jsx | 11 +- app/src/sessionlog.jsx | 1 + app/src/setlog.jsx | 9 +- app/src/sharedwith.jsx | 6 +- app/src/sheet.jsx | 6 +- app/src/shell.jsx | 214 ++++++ app/src/styles.css | 12 +- app/src/tabs.jsx | 571 +--------------- app/src/testing.jsx | 12 +- app/src/timer.jsx | 433 +------------ app/src/timerbus.js | 29 + app/src/timerhost.jsx | 49 ++ app/src/timerrun.jsx | 273 ++++++++ app/src/trainer.jsx | 19 +- app/src/unlogged.jsx | 5 +- app/src/whoop.jsx | 451 +------------ app/src/whoopday.jsx | 454 +++++++++++++ app/src/workchrome.jsx | 103 +++ app/src/workout.jsx | 22 +- app/targets.dom.test.jsx | 177 +++++ docs/DESIGN.md | 4 +- docs/people.md | 288 +++++++++ mobile/AGENTS.md | 13 +- mobile/src/features/blurb.tsx | 12 + mobile/src/features/daylist.tsx | 497 ++++++++++++++ mobile/src/features/editor.tsx | 56 +- mobile/src/features/exercises.tsx | 75 +-- mobile/src/features/filters.tsx | 56 ++ mobile/src/features/gear.tsx | 8 +- mobile/src/features/log.tsx | 48 +- mobile/src/features/planner.tsx | 7 +- mobile/src/features/profile.tsx | 23 +- mobile/src/features/progress.tsx | 29 +- mobile/src/features/runner.tsx | 22 +- mobile/src/features/session.tsx | 11 +- mobile/src/features/setlog.tsx | 9 +- mobile/src/features/sheet.tsx | 18 +- mobile/src/features/tabs.tsx | 493 +------------- mobile/src/features/testing.tsx | 12 +- mobile/src/features/timer.tsx | 3 +- mobile/src/features/trainer.tsx | 9 +- mobile/src/features/whoop.tsx | 10 +- mobile/src/features/workout.tsx | 21 +- mobile/src/lib/dates.js | 29 +- mobile/src/lib/foreground.ts | 2 +- mobile/src/lib/grades.js | 16 + mobile/src/lib/lifts.js | 9 + mobile/src/lib/planflow.js | 2 +- mobile/src/lib/prefs.jsx | 4 +- mobile/src/lib/profile.js | 9 +- mobile/src/lib/store.js | 10 +- mobile/src/lib/timer.js | 2 + mobile/src/lib/viz.tsx | 4 +- mobile/src/lib/vizscale.js | 9 +- mobile/src/shell/AppData.tsx | 4 +- mobile/src/shell/TabBar.tsx | 2 +- mobile/src/ui/DayStepper.tsx | 4 +- mobile/src/ui/Sheet.tsx | 11 +- mobile/src/ui/kit.tsx | 3 +- package.json | 4 +- scripts/check.mjs | 31 + scripts/test.mjs | 2 +- 115 files changed, 5417 insertions(+), 3205 deletions(-) create mode 100644 app/eslint.config.js create mode 100644 app/merge.test.js create mode 100644 app/src/appdata.jsx create mode 100644 app/src/css/frame.css create mode 100644 app/src/daylist.jsx create mode 100644 app/src/dayswitcher.jsx create mode 100644 app/src/filters.jsx create mode 100644 app/src/lazy.jsx create mode 100644 app/src/plantalk.jsx create mode 100644 app/src/shell.jsx create mode 100644 app/src/timerbus.js create mode 100644 app/src/timerhost.jsx create mode 100644 app/src/timerrun.jsx create mode 100644 app/src/whoopday.jsx create mode 100644 app/src/workchrome.jsx create mode 100644 app/targets.dom.test.jsx create mode 100644 docs/people.md create mode 100644 mobile/src/features/daylist.tsx create mode 100644 mobile/src/features/filters.tsx create mode 100644 scripts/check.mjs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4dd4458..f4934cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,6 +30,8 @@ jobs: - name: tests working-directory: . run: npm test + # ESLint: undefined names, the rules of hooks, and every suppression says why. + - run: npm run lint - run: npm run build # The iPhone app: strict TypeScript over mobile/src, including the lib copies. diff --git a/AGENTS.md b/AGENTS.md index ba69131..43d169a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -106,9 +106,10 @@ reasons behind the design, and the things that have been removed on purpose. | Unlogged workouts | `app/src/lib/unlogged.js`, `app/src/unlogged.jsx` | What WHOOP/Strava saw that the log lacks; `pairUp`, `mergeTargets`, `outWith()`. | | Session sheet / edit panel | `app/src/sessionlog.jsx` | `SessionLog`, `SessionDetails`, `DetailsSheet`, `NameField`. | | Writing a logged workout | `app/src/lib/sessionops.js` | `sessionOps({ plan, entries, upsertEntry, deleteEntry, toast })`: save (`applyOut` + the test result), remove (+ result, Undo), "just miles", done, run, plan. Today and the Log both write through it, on both platforms (#76); a sheet never builds its own entry write. | -| The session sheet | `app/src/sheet.jsx`, `app/src/sheetparts.jsx` | `SessionSheet` (header, body, footer) and `runnable`; Today (`tabs.jsx`) opens it. `sheetparts.jsx` is what every sheet of a workout shares (#80): `DoneChip`, `useDoneFlip` (the flip and its Undo toast) and `SheetStart` (the one footer action), used by the owner's sheet and `PersonEntrySheet`. The row meta line both use is `app/src/metaline.jsx`. Twins: `mobile/src/features/sheet.tsx`, `sheetparts.tsx`. | +| The session sheet | `app/src/sheet.jsx`, `app/src/sheetparts.jsx` | `SessionSheet` (header, body, footer) and `runnable`; Today's rows (`daylist.jsx`, `DaySessions`) open it. `sheetparts.jsx` is what every sheet of a workout shares (#80): `DoneChip`, `useDoneFlip` (the flip and its Undo toast) and `SheetStart` (the one footer action), used by the owner's sheet and `PersonEntrySheet`. The row meta line both use is `app/src/metaline.jsx`. Twins: `mobile/src/features/sheet.tsx`, `sheetparts.tsx`. | | Prescription editor | `app/src/editor.jsx` | `PrescriptionEditor` (`doing` on the sheet, #79), its blocks and items, `BlockMenu` (a block's ⋯), `blockTag`, `PieceAdder`, `BlockQuota`: the one editor Plan a workout and the sheet share. Block operations are `addBlock`, `renameBlock`, `noteBlock`, `removeBlock`, `moveBlock` in `lib/prescription.js`. Twin: `mobile/src/features/editor.tsx` (the ⋯ is the system action sheet). | -| Day switcher | `app/src/tabs.jsx` (`DaySwitcher`; `dayWords`, `isoShift` in `lib/dates.js`) | ‹ day › in words; Today's title and the rest day's date (§10.9). The phone's is `mobile/src/ui/DayStepper.tsx`. | +| The app's frame | `app/src/App.jsx`, `app/src/shell.jsx`, `app/src/appdata.jsx`, `app/src/tabs.jsx`, `app/src/daylist.jsx` | `App` renders the header, tabs, + and what it opens; `useAppData` (appdata.jsx) is its state and every write path from outside a sheet (`placeAll`, `keepPlan`, `takeRest`, `logCircuit`…); shell.jsx is `tabsFor`, `FabMenu`, `RestPrompt`, `ActingBanner`. Today is `TodayTab` (tabs.jsx); its rows, the empty day and `DaySessions` (which opens sheets, the runner and workout mode) are daylist.jsx (#98). Twins: `shell/AppData.tsx`, `features/app.tsx`, `features/tabs.tsx`, `features/daylist.tsx`. | +| Day switcher | `app/src/dayswitcher.jsx` (`DaySwitcher`; `dayWords`, `isoShift` in `lib/dates.js`) | ‹ day › in words; Today's title and the rest day's date (§10.9). The phone's is `mobile/src/ui/DayStepper.tsx`. | | Session history | `app/src/lib/history.js` | `priorSessions`: which earlier entries are THIS workout ("The last 5 times you did this"), before the one shown in the day list's order (#96: an earlier day, or an earlier session of the same day). A card by its ids (`aka`, `priorIds`); a planned workout by its title or mostly the same exercises; a free-form one by its activity (#74). | | Toasts | `app/src/toast.jsx`, `app/src/lib/toast.js` | Mobile's API (`pushToast`, `pushError`) on the web: a removal's Undo, a failed save's Retry. | | Log feed | `app/src/log.jsx` | Newest first; the open sheet is keyed by ID and is `LogSheet`: Today's `SessionSheet`, with no Start (#79). | @@ -118,7 +119,7 @@ reasons behind the design, and the things that have been removed on purpose. | Number inputs | `app/src/numinput.jsx`, `app/src/lib/numtext.js` | Text inputs that own their text (§6.4). | | Body diagram | `app/src/lib/bodymap.jsx`, `app/muscles.build.mjs` | `react-body-highlighter` + `free-exercise-db`; nothing hand-drawn. | | How-to figures | `app/src/howto.jsx`, `app/src/lib/figures.jsx` | Registry of SVG figures named by content. | -| Palette | `app/src/styles.css` `:root`, `app/validate_palette.js` | `npm run palette`; a real gate (§6.10). The rest of the token contract is pinned by `app/smoke/system.jsx` (§10.12). | +| Palette | `app/src/styles.css` `:root`, `app/validate_palette.js` | `npm run palette`; a real gate (§6.10). The rest of the token contract is pinned by `app/smoke/system.jsx` (§10.13). | | Styles | `app/src/styles.css` (tokens, base components, shell), `app/src/css/.css` (each screen area's rules, one owner each), `app/src/timer.css` | A new rule goes in its area's file (`sheet.css`, `today.css`, `planner.css`, `editor.css`, `runner.css`, `workout.css`, …); `main.jsx` imports them in cascade order. See `docs/DESIGN.md`, "Visual system". | | Notifications client | `app/src/lib/push.js`, `app/src/notifications.jsx` | | | Device screen probe | `app/src/screeninfo.jsx` | Measures the iOS safe-area bug on the device (§10.5). | @@ -306,284 +307,25 @@ section keeps only the keys `blank()` names, so a removed setting is dropped on is for, never the owner's. - **Only the owner is an admin**: Settings, People and acting-as are refused to anyone else. The `bushido_as` cookie is honoured only when the real requester is the owner. -- **Shared workouts** (`lib/shared.js`, `sharedwith.jsx`, `server/sharedsync.js`, - `peopleRoute` in `server.js`): the owner adds someone to one workout from the sheet - (the sharing chip under the title, #80) without acting as them. Their copy is an ordinary entry in THEIR log (same - derivable id unless they logged something of their own there, then an `extraEntryId` - extra), `done: false` (done by §4 once they do something on it or its day has passed, - never their own tick, which is what `hasOwnMarks` reads, along with any set they typed - into), carrying the workout's shared facts (`SHARED_OUT_KEYS`: what kind of workout it - is, `activity` and `category`, since #74, then its name, time and distance) and the - owner's EXERCISES, never the owner's numbers: reps, weights, effort, feel, notes, gear and - WHOOP/Strava show only as placeholders on their side. The owner's entry names them in - `data.sharedWith: [{ id, entryId, sync }]`; the copy carries `data.sharedFrom: { id, name, sync }`, - stamped by the server. `sync` (#80) is the server's word on whether the copy is in step, - because the link that says so is on the owner's entry, which the other person cannot read: - set from the owner's log on every write to a copy (whatever the device sent, `name` - included: it is pinned to the owner in users.json as the people route stamps it), on a carry - into it, and on the copy whose link the owner switches, adds or takes off - (`flagged`, `flagChanges`, `flagCopy` in `server/sharedsync.js`; `flagWritten` in - `server.js`). A copy written before #80 has no flag and reads as in step if the sync ever - stamped it (`inStep` in `lib/shared.js`). Their own sheet says it under "with Alex": - "Exercises stay in step with Alex's" (`inStepLine`). - - **Sync** ("Keep exercises in step", one switch per person in the sharing panel, - `sync: true` on the link, on when someone is added). While on, the workout's STRUCTURE is one thing seen from two - logs: exercises and blocks added, removed, renamed or reordered, and set counts, on - EITHER side reach the other. Numbers never cross: reps, weights, times, the run - (`data.run`), `out`, `done`/`undone`/`doneAt` (§4) and WHOOP/Strava stay in the log - they were written in; the sync only ever writes `plan`, `out.lifts`, the run's set keys - and `syncBase` on the receiving entry, and with a carry that changes something, the - workout's kind (`out.activity`/`out.category`) on a side that names neither - (`withKind`; a copy from before they were shared facts). A set - or exercise that arrives is blank (an interval keeps its own last set's shape); the - implement is each person's own. A removal never takes an exercise (or a set) the other - side has logged on (next bullet). **Whether a hold is counted in seconds or reps is each person's - own** (#63): an exercise arrives counted the way the sender has it, and after that the - "sec ⇆" / "reps ⇆" switch on either side changes that side only, like the implement. A - writer that sends no `measure` key (an app from before holds) keeps the stored one. - Off, each side stays as it is, and **Copy my exercises to …** in the sharing panel - (`copyExercises`, add-only; it opens their side and copies through that side's one - queue) is the way to bring the owner's over; it is hidden while sync is on. A link without the flag (shared before sync existed) is off; turning sync - on aligns the two by name once and adds what their side lacks. - - **Numbers typed on the sheet are the log too.** Sets are mostly filled in straight on the - sheet, never through the runner, so for a change arriving from the OTHER side "logged on" - also means a lift's set someone typed a number into: the editor marks it `typed: true` - (`patchSet` in `lib/prescription.js`) and the carry keeps it and its exercise (`typedOn`, - `loggedOf(…, typed)` in `server/sharedsync.js`). A target the plan arrived with is not - typed: keeping a plan from the planner clears the mark (`dropEmptyBlocks`), and a share - never copies it (`theirSet` in `lib/shared.js`), so an untouched set still follows a - removal. Only a change marks a set: a patch to the number it already had does not, and - a set ADDED as a copy of the last (`addSet`, `addSetLike`, a share's extra sets, the - sync's interval sets) carries its numbers but not the mark (#74). A model revision on the entry keeps the mark on every set it left as it was - (`keepTyped`, through `reviseWeightModes`). Two carve-outs: inside a circuit (one there or one the exercise moved into) an - exercise has one set, its timing, whatever was typed; and a device's OWN write keeps the - narrower rule (marked in its run), so an exercise the same person removed on another - device stays removed. Kept sets leave one side above the other, so when both sides ADDED, - `wantSets` takes the larger, not the sum; any other mix is the difference, so a removal - is never undone by an add on the other side. Numbers typed before the mark existed - carry none, so **on a shared copy (`sharedFrom`) a weight counts as logged, mark or - not** (#80, `ownWeight`): a share nulls the owner's weights and anything that arrives - over the sync is blank, so nothing but its own person ever puts a weight there. - (Without it the owner's removal took Sam's 50 lb Hip thrust, and Undo brought the sets - back empty.) Reps and a hold's seconds alone are not enough: the share copies those as - targets. And on EITHER side, **what the app reads as lifted on the receiving entry is - logged** (#80, `liftedOf` in `server/sharedsync.js`, held equal to `liftsDone` in - lib/lifts.js by `sharedsync.test.js`): on a done workout dated before today every set - with a number (done as written), on its own day the typed sets, or the logged row that - stands for the item. The owner's sets on a done day carry no mark, and Sam's phone - removing Hip adduction took the owner's 85, 85, 100. A plan for today nobody touched, - or for a later day, reads as nothing lifted and still follows every removal. In a - circuit (here, or the one it moves into over there) it keeps the exercise, one set. - `hasOwnMarks` counts a weight on a copy too. - - **The merge runs on the server**, because only it sees every write (the owner's - devices, the other person's own phone, and the owner writing their side through - `/api/people/:id/entry`) and only it can write both logs (`commitSynced` in - `server.js`). Identity is a `uid` on every block and plan item, minted by the server - the first time it sees one and never changed; plan ids (`b0i1`) are positional and are - never matched on. A model revision is asked for each uid back (the planner's reply - schema allows it, the revise prompt says to copy it) and `normalizePrescription` keeps - it, so a renamed exercise stays the same one. An item that still arrives without a uid - takes the uid of the same-named item it replaced, in its own block only, never one in - another block (#105: a plan can have Back squat in its main block and in a circuit, or - three rounds with the same names). An entry shared before uids existed (no uid, no - `syncBase`) is stamped by its own items on its first write, the stored entry before the - write is laid onto it, with uids derived from where each row is, so both sides get the - same ones whichever is written first. That write is numbers only (the rule below): its - numbers land on the exercise they were written on, and it adds nothing the stored entry - lacks but an exercise its own device logged on, like any numbers-only write. - - **The rule** (`intentOf`, stated at the top of `server/sharedsync.js`). Each synced - entry carries `data.syncBase` (`{ of: , rev, plan | lifts }`, its structure as - the server last wrote it, a new `rev` on every change), and a device sends back the base - it was given. A **matching or older base of this entry** is structural intent, applied - as a three-way change: (that base → what it sent) onto what is stored, so whatever - reached the entry since stays, and only that change is carried. **No base, a foreign - one or a future one** (another entry's, not a base, a rev this entry never had, a - different structure under the same rev, or a stored entry not stamped yet) is numbers - only: its numbers, run, notes and done land on the stored structure; it never removes, - reorders or adds structure, and nothing it does is carried. A list of exercises that - merely arrived is not a decision to delete what it lacks. **Logged data is never removed - by anyone else's write**: a carry keeps what the receiving side has logged on, and a - write keeps an exercise its own device logged on even when the merge lacks it (on that - side, uncarried), whatever base it sent. So a stale device, a pre-sync copy and an old - app can neither resurrect an unlogged exercise nor delete a logged one. The cost: a - write with no base (in practice only a copy pulled before sync existed) silently drops - the structural edits it made to exercises it has not logged on. Last-write-wins still - holds per entry for everything else. - - **Every synced write gets a receipt** (`acks` on `PUT /api/state` and `POST /api/entry`, - `ack` on `POST /api/people/:id/entry`; `ackFor` in `server/sharedsync.js`): the base for - exactly what that write sent. A device that kept editing while the write was out keeps its - newer copy, and takes the receipt as that copy's base (`withAck`/`adoptAcks` in - `lib/store.js`, both stores); without it the next write carried the earlier change a - second time (one set added became two, one taken off came back). A reply lost on the way - is no receipt, and the next write then reads the change again as before. The owner's - sheet writes someone's copy one request at a time (`lib/copyqueue.js`, in - `usePersonCopy`): edits made while one is out go as one write of the copy as it stands - then, a write still waiting takes each receipt even after the sheet switched sides, a - copy reopened while its edit is unanswered shows that edit, and one reopened while a save - landed shows the save, never an older read (`newest`, `openedCopy`), and an answer never - replaces edits made since it was sent. That covers the sheet's edits; a - circuit done together writes through its own path (§3, the together rule). An older app - that ignores receipts behaves as before. - - A write the sync makes is stamped one millisecond past the RECEIVING entry's own - `updatedAt`, never the sender's time or the server's clock: a later or skewed sender - stamp would beat the receiver's own write saved earlier but arriving later (offline - sets) and LWW would drop their numbers, while the structure survives that write - through its base. The first version (`server/mirror.js`, removed in #15) followed the - owner one way and matched exercises by NAME, and was dropped because the owner had no - say over when their side changed; the switch and uids are what answer that. Do not - move the merge into a client. - - **The sheet** (#80): under the title, the done chip and then ONE sharing chip ("with Sam - · in sync ›", "Add someone"), which opens the sharing panel (per person: the sync - switch, Copy my exercises while sync is off, Take Sam off; then Add Jo). Nothing about - who is on it sits between the title and the workout. The header's title, time and - counts follow the side on screen, never the owner's over Sam's exercises. - - **Their side** of the sheet: the You / Sam bar (each person's initial and name in their - colour, and a tick on each side that is done) is pinned to the top while the sheet - scrolls (`position: sticky` on the web, the sheet header on the phone), and the sheet - reopens on the side last viewed on this device (`bushido:shared-side`, per entry id; - also set from a running workout). Every - exercise's "last time" and the session history come from THEIR log - (`/api/people/:id/state`), labelled with their name. Their copy is re-read every few - seconds while open, so the other phone's changes appear. Their side of a planned - session shows their plan in the same editor, and "Start workout" opens the sides - runner on their side. - - The owner's sheet reads and writes the copy through `/api/people/:id/entry`, never - through the owner's store or cache, so logs still never mix on a device. The server - refuses non-owners, acting-as, the owner's own log, and any live entry without - `sharedFrom` (`not-shared`); a sync never writes into an entry they logged themselves. - Those writes fire no habit sync and no push. **Taking someone off never deletes what - they logged** (#96): a copy they have marked (`hasOwnMarks`; copied lifts with nothing - marked on them are not marks) stays in their log as their own workout, unlinked (the - server flags it not in step); one they never touched is tombstoned. No question either - way: a toast says which, with Undo (`removePerson`, `takeOffWords`, `undoTakeOff`). It - used to tombstone a logged copy after a bare browser confirm, with no Undo. A kept copy - is then theirs: the server stamps it `sharedFrom.off` when the link goes (`flagCopy`, - `withOff`; cleared when a link is back) and refuses the owner's writes to it through the - people route (409 `not-linked`). A copy never linked yet is not refused, because adding - someone writes the copy first and links it second. WHOOP/Strava stay off on their side. - - **A copy shows its person nothing the planner wrote for the owner** (#96): the plan's - `why`, `notes`, `thread`, `ask` and `changed`, and the note on each exercise and set - ("3x10 at 95 was RPE 6 last time"), are the owner's (the owner's recovery and weights, - in the owner's words). A share leaves them out (`theirPlan`), and the sheet and the - runner read a plan through `planShown(entry)`, which hides them on any entry with - `sharedFrom`, so copies shared before the share stripped them are covered without - rewriting them. A block's note stays: it is the workout's prose and shared structure. - **Display only**: every write from those screens (the editor on either side, the - runner's added set) goes through `withStoredWords`, which puts each hidden word back - byte for byte, so an edit lands on the stored plan and erases nothing (review 2: the - first version saved the filtered plan and lost the notes for good). What the person - asks the model on their own copy is theirs: - the sheet stamps it `ownWords` (`ownWordsOn`) and such a plan is shown whole. - An older copy's form also reads the activity its plan files it under (`formOut` in - lib/category.js, the form's twin of `filedOut`), so it no longer asks "What kind of - workout was this?" with nothing picked. A removal on the other person's own copy says - the synced line about the owner (`syncedSides`), because it reaches the owner's log too. - - Pinned by `server/sharedsync.test.js`, the `shared workouts:` and `sync:` steps in - `server/http.test.js`, `app/shared.test.js`, and the `SessionSheet(… sharing chip …)`, - `SharePanel(…)`, person bar, `PersonSwitch(…)` and `TheirSide` smoke cases. -- **The owner as trainer** (`lib/trainer.js`, `trainer.jsx`, the same `peopleRoute`): - without acting as anyone, the owner plans for someone else, sees their week and runs a - workout from their side. All of it is owner-only, needs someone else on the install and - is hidden while acting (`planPeople(me)`, the same rule as `sharePeople`). - - **Planning for someone** is a "For: You / Sam" choice at the top of Plan a workout (both - routes). Since #59 it is several at once (`who = { me, others }`, `toggleFor`; You on - by default, never nobody); the four cases are below. For ONE other person the model runs with `for: ` on the request (`aiSpaceFor`), so its log, - plan and About you are theirs; the client context (`plannerContext`) is built from their - log too, and WHOOP readiness is left out. Nothing is written until the tap (§0.4). Keeping it writes into - THEIR log through `/api/people/:id/entry`: their day is read first and `placeEntries` - mints the ids their own + would have, one entry per part (`plannedEntriesFor`), each - `done: false` (done on its day once touched, then from the next day on, §4) with `data.plannedBy: { id, name }` stamped by the server. The server - accepts only `daily-…` entries carrying `sharedFrom` or `plannedBy`, and refuses any - live entry without one of them. (Planning someone's WEEK went with the quotas; a - `quota-` entry is refused with a 400.) - They see a quiet "planned by " (`plannedLine`) on the row, the sheet and the - feed, and the entry is theirs to edit, log or delete. They cannot plan for anyone. - - **Several people at once** (#59; `forOf`, `forWords`, `shareKept` in lib/trainer.js, - `aiTargetFor` in server.js). `for` is then a LIST of ids (the owner's own among them - when the owner is doing it too), and the run is the OWNER's: the owner's space and - flags, no `--add-dir` for anyone else, each person's name and About you put in the - prompt by the server, and each one's last week built by the app from their own log - (`groupContext`) and sent as context. The prompt asks for one structure and no loads, - and the server strips any `weight` the model wrote anyway (`noLoads`, planner.js). - **You and others**: keeping it places it in the owner's log as always, then shares - each entry with each of them, sync on, through `addPerson` (exactly the sharing chip on the - sheet; no second sharing path). **Others only**: `keepPlanFor` once per person, - independent copies. The last screen is worded from who it actually landed for; a - person it missed is named, with "Try again for " (others only, `keepForEach`) - or the sharing chip on the sheet (you and others). The retry is safe to repeat: each part is - stamped `data.keepKey` (`:`) and `keepPlanFor` skips a part their - day already has, so a keep that failed part-way, or whose answer was lost, is never - written twice. It lives on that last screen only: the server retires the draft once its - id is in any one log (`isKept`), which is what stops a second device keeping it again. - A plan for several people carries no loads by either route: the model's are stripped - on the server (`noLoads`), a hand-built one's on the way in (`withoutLoads`). - A draft stores `people: [{ id, name, owner? }]`; a draft with a single `for` (every - draft before #59) still reopens and runs as it did (`whoOfDraft`). - - **Sides of a workout.** A shared entry opens the runner or workout mode through - `SidesWorkout`: a You / switcher under the header, the name in a pill and a rule - in that person's colour (`[data-tone]`: the accent for the owner, the series colours for - everyone else, so the palette check has nothing new), and a haptic on switch (native). - Every side stays mounted with its own runner over that person's own entry and its own - writer (the owner's `saveRun`/`saveOutputs`; anyone else's `usePersonCopy`), so each - has its own sets, weights, rest clock and done state, and the runner still has ONE - writer per entry (§6.2). Only the side on screen makes a sound. Finishing a side hands - over to the next one not done. `applyOut`/`applyRun`/`applyDone` are the owner's write - paths as pure functions, so both sides write the same shape. A workout nobody shares, - and everyone but the owner, get the single screen they always had. - - **A circuit can be done together** (#68): on a shared workout whose link has sync on, a - circuit waits on its start screen with **Together with Sam** (on by default, remembered - per device under `bushido:circuit-together`). On, one clock runs on the side it was - started from, and at its end its result is offered to every other side - (`shareCircuit` → `togetherWrite`; the owner's through `onOwnerRun`, anyone else's - through `/api/people/:id/entry`). Off, each side starts its own clock (§6.5). **THE - TOGETHER RULE** (stated in full above `togetherWrite` in `lib/trainer.js`; written after - two review rounds in which each fix opened a new way to lose data): - 1. **It fills, it never overwrites.** Seconds, reps and weight land only in blanks, - per exercise and per set (`endCircuit` `fill`, `fillOut`). A side whose circuit is - already ended or whose own clock is running is not written at all, and is reported - as "Sam already logged it" / "Sam is running it": not a miss, no Retry. Totals are - read off what is there (`run.circuitTimes`, set per block), never added to. The - shared-sync rule again: logged data is never removed by anyone else's write. - A blank is filled in the shape the CLOCK ran it (#96): the result names how each - exercise was timed (`togetherItems`, `by`), and one counted in reps on the side that - ran it is a count where this side's own timing is blank (`endCircuit` `counted`), - never a hold of the seconds spent on its reps. A side that says reps or seconds - keeps its own shape. - 2. **It decides from fresh data.** Someone else's side is re-read from the server right - before it is written and rule 1 applied to THAT, never to a copy on screen that may - hold a write that never landed. This run's key (the clock's `startedAt`, - `run.circuitKeys`) with its result already there is done: success, nothing sent; the - key without the result is written. Retry is the same path, so a lost reply or a - second owner device ending the same run sends nothing. - 3. **It is offered only where it can help** (`togetherSides`): sides ended or running - their own clock are left out, judged on what the SERVER last said (`usePersonCopy`'s - `server`, which the switcher's "done" reads too); nobody left, no switch. "Running" - means a LIVE clock: paused, or moved within `STALE_CLOCK_MS` (10 minutes); one that - ran out, or sat on a count-up, longer ago than that does not block anyone. Who was - offered it is kept on the run (`run.circuit.with`, the result's `with`), and only - they are written at its end. - 4. **A miss survives Close**: kept on the device (`bushido:together-pending`, by run and - person) and tried again, re-read then fill, when the workout or its sheet next opens - (`retryPending`, `TogetherPending` on the sheet with Try again). A miss is kept only - while the owner's LIVE entry still carries that run (`circuitKeys` holds its key) - and the person is still in `sharedWith`, and for at most `PENDING_DAYS` (7); - otherwise it is dropped from the device, so a workout deleted and planned again - under the same derivable id never gets another run's numbers. - 5. **Honest words** (`togetherSaid`): "Logged for you", then "and Sam", "Sam already - logged it", "Sam is running it" or "Not on Sam's log yet" with Try again; never - "for you and Sam" over a miss. - One write per side at most, so the owner's push fires once and nobody else's at all. - - **"Sam's day"** (`PeopleDays` under the day list on Today, `PersonDay`) is a read-only - week of their log from `/api/people/:id/state`; Today's row lists each session with its - done state. A session opens in `PersonEntrySheet` (their form without WHOOP/Strava, and - the owner's sheet parts, #80: the done chip with Undo, and Start, which runs it from - their side, as the one footer action). It - never touches the owner's store or cache. Act-as stays exactly as it was. - - Pinned by the `trainer:`/`ai for everyone:` steps in `server/http.test.js`, - `server/agentflags.test.js`, `server/prompts.test.js`, `app/trainer.test.js`, and the - `PlanFlow("For: …")`, `SidesWorkout(…)`, `TodayTab("Sam's - day" …)` and "planned by" smoke cases, including every absence (one person, acting, - not the owner). +- **Shared workouts and the owner as trainer are in [docs/people.md](docs/people.md)** + (moved there in #98, word for word; read it before changing `lib/shared.js`, + `lib/trainer.js`, `lib/copyqueue.js`, `server/sharedsync.js`, `peopleRoute`, + `sharedwith.jsx` or `trainer.jsx`). What must never break: + - **A copy is an ordinary entry in THEIR log**, written through the people endpoints, + never through the owner's store or cache. It carries the workout's shared facts and + the owner's exercises, never the owner's numbers (`SHARED_OUT_KEYS`), and is shown + without the owner's words (`planShown`), which every write puts back (`withStoredWords`). + - **Sync is on the server** (`commitSynced`, `intentOf` in `server/sharedsync.js`): + structure crosses, numbers never do; identity is a `uid` minted once; a write with a + matching base is structural intent, anything else is numbers only; **logged data is + never removed by anyone else's write**; every synced write gets a receipt. + - **Together** (a circuit done on one clock, #68) fills blanks only, decides from a fresh + read, is offered only where it can help, keeps a miss across Close, and says honestly + who it missed (THE TOGETHER RULE above `togetherWrite` in `lib/trainer.js`). + - **Planning for someone** writes only into their log, `done: false`, stamped + `plannedBy`; a plan for several people carries no loads (`noLoads`, `withoutLoads`); + a draft is kept once (`keepKey`, `isKept`). + - Owner-only, hidden while acting (`planPeople(me)`, `sharePeople`). - Pinned by `server/users.test.js`, the people cases in `server/http.test.js`, `app/whoami.test.js` and the `tabsFor`/`PlanFlow(no AI…)`/`ActingBanner`/`PeopleCard` smoke cases. @@ -1092,7 +834,7 @@ no rebuild. An older plan file may also carry `recommender`, `checkin`, `journal (`TimerRun`) shows the exercise to do now big, with its gist and ⓘ (the exercise sheet, over the run, clock still going), and what is up next during a rest. - **A circuit logs itself, once, when it ends**, finished or stopped, and nothing when - nothing was done. From the + timer (no entry): App.jsx `logCircuit` places one planned + nothing was done. From the + timer (no entry): appdata.jsx `logCircuit` places one planned workout on the day the run STARTED (`loggedCircuit` → `circuitPlan`, `placeEntries`, `applyRun` with `done: true`), filed by `circuitFiling` (a category named for the exercises' commonest group, else the content's lifting activity: the one whose shape @@ -1559,7 +1301,7 @@ Removed, each pinned absent: `FullScreenSession` (a third way to read a session) "log another" link (the + is the door; the day list's own dashed "Log another" button went too in #41, §10.9), the footer "remove" link (a header bin with a confirmation, then since #94 a worded Remove workout at the foot -of Edit this workout, §10.13), the name box in the form (now behind the +of Edit this workout, §10.14), the name box in the form (now behind the pencil), boilerplate protocols on the two container cards (now a plain notes box), lift rest intervals, and the runner for lift-only sessions. @@ -1594,7 +1336,7 @@ phone, suspect the inset before the stacking order. ### 10.6 Rest days have their own door **Rest day** is a quiet button on Today's empty day (any day up to today), and **Log a -rest day** is in the + menu, both opening `RestPrompt` in `App.jsx`. It asks why (chips +rest day** is in the + menu, both opening `RestPrompt` in `shell.jsx`. It asks why (chips from the rest card's own `why` output, plus "Notes"; both optional), has the day switcher for a forgotten rest day, and edits an existing rest entry rather than adding a second. `restStats` in `lib/stats.js` @@ -1761,7 +1503,7 @@ footer. Web and native, pinned in `app/smoke/people.jsx`: - **Data safety, first**: a weight on a shared copy is that person's log, typed mark or not (§3, `ownWeight`). -### 10.12 One feel (#82, 2026-11-08) +### 10.13 One feel (#82, 2026-11-08) The last fix of overhaul 2: the G-visual-ia token contract on both platforms at once. Look only; behaviour did not change. Pinned by `app/smoke/system.jsx` (and the cases named): @@ -1785,7 +1527,7 @@ only; behaviour did not change. Pinned by `app/smoke/system.jsx` (and the cases - `scripts/test.mjs` refuses a test file or a test-running script that no listed suite runs, whatever its name (it saw only `test:*` names). -### 10.13 The sheet, regrade 1 (#94, 2026-11-08) +### 10.14 The sheet, regrade 1 (#94, 2026-11-08) The regrade's sheet findings, web and native, each pinned in `app/smoke/` (sheet, today, editor, timer, planner, people): @@ -1814,10 +1556,36 @@ editor, timer, planner, people): the owner's own sheet on Sam's side (`ownerEntryFor`); anything else of theirs opens `PersonEntrySheet`, which is their side's body (the doing editor, their history). +### 10.15 Code health (#98, 2026-11-08) + +The regrade's code findings, behaviour unchanged except where a test names a bug: + +- **The runner has one controller**, `lib/runflow.js` (`useRunner` and the `*Tap` writes), + shared with the phone. Characterisation tests drove the old runner tap by tap in a real + DOM before anything moved (`app/runner.dom.test.jsx`), and passed unchanged after. +- **The phone's typing rules are data** (`ui/sheetPolicy.ts`), run in node by + `app/native.test.js`, which also ratchets the `as any` count in `mobile/src`. +- **Files say what is in them**: `tabs.jsx` is Today, `daylist.jsx` its rows, + `dayswitcher.jsx` the switcher; `App.jsx` renders, `appdata.jsx` decides, `shell.jsx` + is the frame's pieces. The phone's `tabs.tsx` split the same way (`daylist.tsx`). +- **ESLint** (`npm run lint`): undefined names, hooks, and a reason after `--` on every + suppression. **`npm run check`** is tests, lint, build and the mobile typecheck. +- **Lazy parts** (`lazy.jsx`): Plan a workout (`planner.jsx`), the interval timer's screen + (`timer.jsx`; its host, `timerhost.jsx`, is static) and WHOOP on Today (`whoopday.jsx`). + **Nothing a sheet or a workout in progress draws is lazy**: `PlanTalk` is `plantalk.jsx`, + WHOOP's workouts stay in `whoop.jsx`, the timer's running face is `timerrun.jsx`, and + the bundle pin walks the sheet's, runner's and workout mode's imports for any lazy part. + Each part is fetched ahead so the service worker has it offline. **A failed load never + covers anything**: what is always mounted (WHOOP on Today, a resumed timer) draws + nothing; a screen the user opened says so inside itself (`LoadFailed`, in the flow) with + Try again and its own way out. +- The sharing detail moved to `docs/people.md`; §3 keeps what must never break. + ## 11. Before you finish -- `npm test` at the repo root passes. -- If you touched `app/src`, you ran `npm run build`. +- `npm run check` at the repo root passes: every suite, `npm run lint` (ESLint over + `app/src`: undefined names, the rules of hooks, and a reason after `--` on every + suppression), the build and the mobile typecheck. - If you touched shared content in `test/fixtures/plan.json`, you ran `node app/starter.build.mjs` and the generated files are in the diff. - If you removed or moved a control, there is a smoke case asserting the absence at the diff --git a/app/eslint.config.js b/app/eslint.config.js new file mode 100644 index 0000000..ce8ada8 --- /dev/null +++ b/app/eslint.config.js @@ -0,0 +1,46 @@ +// ESLint for the web app (#98). Two jobs, both cheap and both real failures this +// codebase has had: a name that is not defined (an import lost in a move renders +// nothing until the line runs), and the rules of hooks. `exhaustive-deps` is on, +// and a suppression must say why after `--` (`local/disable-says-why`): ten of +// them sat unexplained, and nothing checked them, before this file existed. +import globals from 'globals' +import reactHooks from 'eslint-plugin-react-hooks' + +/** An `eslint-disable…` comment with no ` -- reason` after its rule. */ +const disableSaysWhy = { + meta: { type: 'problem', messages: { why: 'Say why after `--`: {{text}}' } }, + create(context) { + return { + Program() { + for (const c of context.sourceCode.getAllComments()) { + const text = c.value.trim() + if (/^eslint-disable/.test(text) && !/\s--\s+\S/.test(text)) context.report({ loc: c.loc, messageId: 'why', data: { text } }) + } + }, + } + }, +} + +export default [ + { ignores: ['node_modules/**', 'dist/**', '**/.*.mjs', '../dist/**'] }, + { + files: ['src/**/*.{js,jsx}'], + languageOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + parserOptions: { ecmaFeatures: { jsx: true } }, + globals: { ...globals.browser }, + }, + linterOptions: { reportUnusedDisableDirectives: 'error' }, + plugins: { 'react-hooks': reactHooks, local: { rules: { 'disable-says-why': disableSaysWhy } } }, + rules: { + 'no-undef': 'error', + 'no-unused-vars': ['error', { args: 'none', varsIgnorePattern: '^_', caughtErrors: 'none', ignoreRestSiblings: true }], + 'no-dupe-keys': 'error', + 'no-unreachable': 'error', + 'react-hooks/rules-of-hooks': 'error', + 'react-hooks/exhaustive-deps': 'error', + 'local/disable-says-why': 'error', + }, + }, +] diff --git a/app/gear.test.js b/app/gear.test.js index 926253f..84ea124 100644 --- a/app/gear.test.js +++ b/app/gear.test.js @@ -290,7 +290,9 @@ check('every profile field is renderable', () => { ok(g.key && g.name && g.icon, `group ${g.key} is missing something`) for (const f of g.fields) { ok(f.key && f.label && f.type, `${g.key}.${f.key} is missing something`) - ok(['number', 'text'].includes(f.type), `${f.key}: unknown type ${f.type}`) + ok(['number', 'text', 'grade'].includes(f.type), `${f.key}: unknown type ${f.type}`) + // A grade says which ladder it is picked off (#98): the field decides, never the number. + if (f.type === 'grade') ok(['yds', 'v'].includes(f.scale), `${f.key}: a grade with no scale`) } } }) diff --git a/app/merge.test.js b/app/merge.test.js new file mode 100644 index 0000000..c48990b --- /dev/null +++ b/app/merge.test.js @@ -0,0 +1,92 @@ +// The client's and the server's last-write-wins merge (#98, H F6), fed the same +// inputs. They share the rule (per entry, on its own updatedAt, a tie to the +// incoming copy, tombstones as entries, settings by settingsUpdatedAt) and the +// comment above lib/store.js `mergeState` used to claim they were identical. +// They are not: the server also stamps an entry that arrives with no updatedAt +// and keeps an old client's bare untick (`keepUntick`). The shared cases are +// held equal here; the two differences are pinned as differences, so neither +// side is "fixed" to match the other by someone trusting a comment. +import assert from 'node:assert/strict' +import { readFileSync } from 'node:fs' +import { createRequire } from 'node:module' +import { mergeState as clientMerge } from './src/lib/store.js' + +const require = createRequire(import.meta.url) +const { mergeState: serverMerge } = require('../server/server.js') + +const tests = [] +const test = (name, fn) => tests.push([name, fn]) + +const e = (id, updatedAt, data = {}, more = {}) => ({ id, kind: 'daily', date: '2026-11-08', updatedAt, data, ...more }) +const base = () => ({ + entries: { + a: e('a', '2026-11-08T10:00:00.000Z', { name: 'Old' }), + b: e('b', '2026-11-08T12:00:00.000Z', { name: 'Kept' }), + c: e('c', '2026-11-08T09:00:00.000Z', { name: 'Going' }), + }, + settings: { units: 'lb' }, + settingsUpdatedAt: '2026-11-08T08:00:00.000Z', +}) + +const SHARED = [ + ['a newer entry wins', { entries: { a: e('a', '2026-11-08T11:00:00.000Z', { name: 'New' }) } }], + ['an older entry loses', { entries: { b: e('b', '2026-11-08T11:00:00.000Z', { name: 'Stale' }) } }], + ['a tie goes to the incoming copy', { entries: { a: e('a', '2026-11-08T10:00:00.000Z', { name: 'Same time' }) } }], + ['a newer tombstone deletes', { entries: { c: e('c', '2026-11-08T10:00:00.000Z', {}, { deleted: true }) } }], + ['an older tombstone does not', { entries: { b: e('b', '2026-11-08T01:00:00.000Z', {}, { deleted: true }) } }], + ['a new entry is added under its key', { entries: { z: e('elsewhere', '2026-11-08T13:00:00.000Z', { name: 'New one' }) } }], + ['what is not an entry is skipped', { entries: { x: null, y: 'nope', a: e('a', '2026-11-08T11:00:00.000Z') } }], + ['newer settings win', { entries: {}, settings: { units: 'kg' }, settingsUpdatedAt: '2026-11-08T09:00:00.000Z' }], + ['older settings lose', { entries: {}, settings: { units: 'kg' }, settingsUpdatedAt: '2026-11-08T07:00:00.000Z' }], + ['a done entry ticked done again is just newer', { entries: { a: e('a', '2026-11-08T11:00:00.000Z', { done: true }) } }], +] + +for (const [name, incoming] of SHARED) { + test(`same answer: ${name}`, () => { + const b1 = base(), b2 = base() + const c = clientMerge(b1, structuredClone(incoming)) + const s = serverMerge(b2, structuredClone(incoming)) + assert.deepEqual(c, s, 'the client and the server merge disagree') + assert.deepEqual(b1, base(), 'the merge changed what it was given') + }) +} + +test('the cases say what they claim', () => { + const m = clientMerge(base(), SHARED[0][1]) + assert.equal(m.entries.a.data.name, 'New') + assert.equal(clientMerge(base(), SHARED[1][1]).entries.b.data.name, 'Kept') + assert.equal(clientMerge(base(), SHARED[2][1]).entries.a.data.name, 'Same time') + assert.equal(clientMerge(base(), SHARED[3][1]).entries.c.deleted, true) + assert.equal(clientMerge(base(), SHARED[5][1]).entries.z.id, 'z', 'the key, not the body, is the id') + assert.equal(clientMerge(base(), SHARED[7][1]).settings.units, 'kg') + assert.equal(clientMerge(base(), SHARED[8][1]).settings.units, 'lb') +}) + +test('a difference, on purpose: only the server stamps an entry that arrives with no updatedAt', () => { + const incoming = { entries: { n: { id: 'n', kind: 'daily', date: '2026-11-08', data: {} } } } + assert.equal(clientMerge(base(), incoming).entries.n.updatedAt, undefined) + assert.ok(serverMerge(base(), incoming).entries.n.updatedAt, 'the server kept an unstamped entry unstamped') +}) + +test("a difference, on purpose: only the server keeps an old client's bare untick as one (keepUntick)", () => { + const b = base() + b.entries.a.data = { done: true } + const incoming = { entries: { a: e('a', '2026-11-08T11:00:00.000Z', { done: false }) } } + assert.equal(clientMerge(structuredClone(b), incoming).entries.a.data.undone, undefined) + assert.equal(serverMerge(structuredClone(b), incoming).entries.a.data.undone, true) +}) + +test('the comment on the client merge says what it shares and what it does not', () => { + for (const f of ['./src/lib/store.js', '../mobile/src/lib/store.js']) { + const src = readFileSync(new URL(f, import.meta.url), 'utf8') + if (/Identical to the server's/.test(src)) throw new Error(`${f} claims the merges are identical again`) + if (!/keepUntick/.test(src) || !/app\/merge\.test\.js/.test(src)) throw new Error(`${f} no longer names the difference and this test`) + } +}) + +let failed = 0 +for (const [name, fn] of tests) { + try { await fn(); console.log(` ok ${name}`) } catch (err) { failed += 1; console.log(` FAIL ${name}\n ${err.message}`) } +} +console.log(failed ? `${failed} of ${tests.length} merge cases failed` : `${tests.length} merge cases`) +process.exit(failed ? 1 : 0) diff --git a/app/native.test.js b/app/native.test.js index 6d6e589..7c7e16e 100644 --- a/app/native.test.js +++ b/app/native.test.js @@ -83,6 +83,27 @@ test('every Input carries the keyboard bar, and no sheet footer is a Close', () assert.deepEqual(bad, [], 'a Close is back in a sheet footer') }) +test('the coach is gone from the dock too (#31, F F8)', () => { + if (/coach/.test(read('shell/TabBar.tsx'))) throw new Error('the tab bar still checks for a coach tab') + if (/coach/i.test(read('lib/foreground.ts'))) throw new Error('foreground.ts still names a coach provider') +}) + +/* + * The typecheck means something only where nothing is cast away (#98, H F4): + * a lib function TypeScript reads too narrowly gets a JSDoc type in the lib + * (both copies), never an `as any` at the call. A ratchet: these numbers only + * go down. Lower them when you remove casts. + */ +const AS_ANY = { total: 217, hot: { 'features/sheet.tsx': 0, 'features/editor.tsx': 1, 'features/exercises.tsx': 3, 'features/runner.tsx': 2 } } +test(`no more \`as any\` than the ratchet (${AS_ANY.total} in mobile/src)`, () => { + const count = (f) => (read(f).match(/\bas any\b/g) || []).length + const total = walk('.').reduce((n, f) => n + count(f), 0) + if (total > AS_ANY.total) throw new Error(`${total} \`as any\` in mobile/src, up from ${AS_ANY.total}: type the lib function with JSDoc instead`) + for (const [f, n] of Object.entries(AS_ANY.hot)) { + if (count(f) > n) throw new Error(`${f}: ${count(f)} \`as any\`, up from ${n}`) + } +}) + let failed = 0 for (const [name, fn] of tests) { try { await fn(); console.log(` ok ${name}`) } catch (e) { failed += 1; console.log(` FAIL ${name}\n ${e.message}`) } diff --git a/app/package-lock.json b/app/package-lock.json index 055f0b3..687b8da 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -14,6 +14,9 @@ }, "devDependencies": { "@vitejs/plugin-react": "^5.1.0", + "eslint": "^10.14.0", + "eslint-plugin-react-hooks": "^7.1.1", + "globals": "^17.14.0", "happy-dom": "^15.11.7", "vite": "^7.1.5" } @@ -300,6 +303,30 @@ "node": ">=6.9.0" } }, + "node_modules/@cacheable/memory": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@cacheable/memory/-/memory-2.2.0.tgz", + "integrity": "sha512-CTLKqLItRCEixEAewD3/j9DB3/o96gpTPD4eJ1v+DGOlxZRZncRQkGYqqnAGCscYd6RNeXfGeiuCphsPtqyIfQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cacheable/utils": "^2.5.0", + "@keyv/bigmap": "^1.3.1", + "hookified": "^1.15.1", + "keyv": "^5.6.0" + } + }, + "node_modules/@cacheable/utils": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@cacheable/utils/-/utils-2.5.0.tgz", + "integrity": "sha512-buipgOVDkkPXNR5+xBpDw7Zk2n1EvU7qBJCNUcL7rhQ//kfpOXPAvQ511Os0vpLYJ1pZnvudNytkQt2hst3wqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hashery": "^1.5.1", + "keyv": "^5.6.0" + } + }, "node_modules/@esbuild/aix-ppc64": { "version": "0.28.1", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.1.tgz", @@ -742,6 +769,179 @@ "node": ">=18" } }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.10.1.tgz", + "integrity": "sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.3", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.3.tgz", + "integrity": "sha512-R76UKbvsqI68DJJVTVyqFKqU98CN4+B+acxNfEA2IFarSzP0SjtKf/3+fFiXzTyv5Fj3PxLkGHe2wnVWWMxobQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.23.5", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.5.tgz", + "integrity": "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^3.0.5", + "debug": "^4.3.1", + "minimatch": "^10.2.4" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.7.0.tgz", + "integrity": "sha512-DObd/KKUsU+FaFv4PLxSRenpXfQWmPXXP3pPZ6/K1PCrMu2vQpMDMuQe/BqYeoLcz8ro0bVDF1RxOJgfVEdhUw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/core": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz", + "integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/object-schema": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.5.tgz", + "integrity": "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.3.tgz", + "integrity": "sha512-IkO+/KEUvwbVpiURZg+P7zF74z5Jxe0UgJxVni+RtoHQ6IZieXaO02kmadomap/q+l6bc/jdPGGqTjhuZnuz1Q==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1", + "levn": "^0.4.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz", + "integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/types": "^0.15.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.8", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz", + "integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.2", + "@humanfs/types": "^0.15.0", + "@humanwhocodes/retry": "^0.4.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/types": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz", + "integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.13", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", @@ -792,6 +992,30 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@keyv/bigmap": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@keyv/bigmap/-/bigmap-1.3.1.tgz", + "integrity": "sha512-WbzE9sdmQtKy8vrNPa9BRnwZh5UF4s1KTmSK0KUVLo3eff5BlQNNWDnFOouNpKfPKDnms9xynJjsMYjMaT/aFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "hashery": "^1.4.0", + "hookified": "^1.15.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "keyv": "^5.6.0" + } + }, + "node_modules/@keyv/serialize": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@keyv/serialize/-/serialize-1.1.1.tgz", + "integrity": "sha512-dXn3FZhPv0US+7dtJsIi2R+c7qWYiReoEh5zUntWCf4oSpMNib8FDhSoed6m3QyZdx5hK7iLFkYk3rNxwt8vTA==", + "dev": true, + "license": "MIT" + }, "node_modules/@napi-rs/lzma-linux-x64-gnu": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz", @@ -1211,6 +1435,13 @@ "@babel/types": "^7.28.2" } }, + "node_modules/@types/esrecurse": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", + "integrity": "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/estree": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", @@ -1218,6 +1449,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, "node_modules/@vitejs/plugin-react": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-5.2.0.tgz", @@ -1239,6 +1477,56 @@ "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/acorn": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.19.0.tgz", + "integrity": "sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", + "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, "node_modules/baseline-browser-mapping": { "version": "2.11.10", "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.10.tgz", @@ -1252,6 +1540,19 @@ "node": ">=6.0.0" } }, + "node_modules/brace-expansion": { + "version": "5.0.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz", + "integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "20 || >=22" + } + }, "node_modules/browserslist": { "version": "4.28.7", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.7.tgz", @@ -1286,6 +1587,20 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, + "node_modules/cacheable": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/cacheable/-/cacheable-2.5.0.tgz", + "integrity": "sha512-60cyAOytib/OzBw1JNSoSV/boK1AtHryDIjvVBk7XbN4ugfkM3+Sry7fEjNgPMGgOjuaZPAp8ruZ0Cxafwyq9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cacheable/memory": "^2.2.0", + "@cacheable/utils": "^2.5.0", + "hookified": "^1.15.0", + "keyv": "^5.6.0", + "qified": "^0.10.1" + } + }, "node_modules/caniuse-lite": { "version": "1.0.30001806", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001806.tgz", @@ -1314,6 +1629,21 @@ "dev": true, "license": "MIT" }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/debug": { "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", @@ -1332,6 +1662,13 @@ } } }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, "node_modules/electron-to-chromium": { "version": "1.5.399", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.399.tgz", @@ -1404,6 +1741,215 @@ "node": ">=6" } }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "10.14.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.14.0.tgz", + "integrity": "sha512-T0pNsxkb9IKmtQjhpK3d7nWOpFv+YHuMbTJnSVMoQblF0onvXfErrtp4V1jHtsQPan7dKaGVD0q1WCXnzMF31A==", + "dev": true, + "license": "MIT", + "workspaces": [ + "packages/*" + ], + "dependencies": { + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.2", + "@eslint/config-array": "^0.23.5", + "@eslint/config-helpers": "^0.7.0", + "@eslint/core": "^1.2.1", + "@eslint/plugin-kit": "^0.7.3", + "@humanfs/node": "^0.16.8", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.14.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^9.1.2", + "eslint-visitor-keys": "^5.0.1", + "espree": "^11.2.0", + "esquery": "^1.7.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "11.1.5 || >11.1.6 <12", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "minimatch": "^10.2.6", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-plugin-react-hooks": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-7.1.1.tgz", + "integrity": "sha512-f2I7Gw6JbvCexzIInuSbZpfdQ44D7iqdWX01FKLvrPgqxoE7oMj8clOfto8U6vYiz4yd5oKu39rRSVOe1zRu0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.24.4", + "@babel/parser": "^7.24.4", + "hermes-parser": "^0.25.1", + "zod": "^3.25.0 || ^4.0.0", + "zod-validation-error": "^3.5.0 || ^4.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 || ^10.0.0" + } + }, + "node_modules/eslint-scope": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-9.1.2.tgz", + "integrity": "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@types/esrecurse": "^4.3.1", + "@types/estree": "^1.0.8", + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-11.2.0.tgz", + "integrity": "sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.16.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^5.0.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz", + "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, "node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", @@ -1422,6 +1968,52 @@ } } }, + "node_modules/file-entry-cache": { + "version": "11.1.5", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-11.1.5.tgz", + "integrity": "sha512-+PFTHITI08JIGhnNpGNI8T8inUpgZfk3GNEqfT9R2zZV2iFXg3CvqzSl/uEhs7TSGujYRELEANyDvS8Fj7+S7Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^6.1.23" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "6.1.23", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-6.1.23.tgz", + "integrity": "sha512-f++BY9pTk+983xK1FLzlLpmM0i0z+jHmx3QESGkURMXujQZz1k5wzwX6hjnQ8goaD0B+sYnDK1yZ6MTyZfUaqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "cacheable": "^2.5.0", + "flatted": "^3.4.2", + "hookified": "^1.15.0" + } + }, + "node_modules/flatted": { + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.4.tgz", + "integrity": "sha512-5+ybhBZANEJxaH3X5evAFatUxLfEHSr7n6kYJ+1Qd0mUqr4eu9gIf6GDbWHf8RJijHrjjO8G+la14SlL2SeS1Q==", + "dev": true, + "license": "ISC" + }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", @@ -1447,6 +2039,32 @@ "node": ">=6.9.0" } }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "17.14.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-17.14.0.tgz", + "integrity": "sha512-UtdkTVyAJePQv0J2M9Xe4L0ruNSDV314XiIJsADI2Zf40bcdAonE/D/OhAU8AT99oij9mhLByb+NvA3QWZYgCg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/happy-dom": { "version": "15.11.7", "resolved": "https://registry.npmjs.org/happy-dom/-/happy-dom-15.11.7.tgz", @@ -1462,6 +2080,93 @@ "node": ">=18.0.0" } }, + "node_modules/hashery": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/hashery/-/hashery-1.5.1.tgz", + "integrity": "sha512-iZyKG96/JwPz1N55vj2Ie2vXbhu440zfUfJvSwEqEbeLluk7NnapfGqa7LH0mOsnDxTF85Mx8/dyR6HfqcbmbQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "hookified": "^1.15.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/hermes-estree": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/hermes-estree/-/hermes-estree-0.25.1.tgz", + "integrity": "sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw==", + "dev": true, + "license": "MIT" + }, + "node_modules/hermes-parser": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/hermes-parser/-/hermes-parser-0.25.1.tgz", + "integrity": "sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hermes-estree": "0.25.1" + } + }, + "node_modules/hookified": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/hookified/-/hookified-1.15.1.tgz", + "integrity": "sha512-MvG/clsADq1GPM2KGo2nyfaWVyn9naPiXrqIe4jYjXNZQt238kWyOGrsyc/DmRAQ+Re6yeo6yX/yoNCG5KAEVg==", + "dev": true, + "license": "MIT" + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -1482,6 +2187,20 @@ "node": ">=6" } }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", @@ -1495,6 +2214,46 @@ "node": ">=6" } }, + "node_modules/keyv": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-5.6.0.tgz", + "integrity": "sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@keyv/serialize": "^1.1.1" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", @@ -1514,6 +2273,22 @@ "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, + "node_modules/minimatch": { + "version": "10.2.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.8" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -1540,6 +2315,13 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, "node_modules/node-releases": { "version": "2.0.51", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.51.tgz", @@ -1550,6 +2332,76 @@ "node": ">=18" } }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -1599,6 +2451,46 @@ "node": "^10 || ^12 || >=14" } }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/qified": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/qified/-/qified-0.10.1.tgz", + "integrity": "sha512-+Owyggi9IxT1ePKGafcI87ubSmxol6smwJ+RAHDQlx9+9cPwFWDiKFFCPuWhr9ignlGpZ9vDQLw67N4dcTVFEA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hookified": "^2.1.1" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/qified/node_modules/hookified": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/hookified/-/hookified-2.2.0.tgz", + "integrity": "sha512-p/LgFzRN5FeoD3DLS6bkUapeye6E4SI6yJs6KetENd18S+FBthqYq2amJUWpt5z0EQwwHemidjY5OqJGEKm5uA==", + "dev": true, + "license": "MIT" + }, "node_modules/react": { "version": "19.2.8", "resolved": "https://registry.npmjs.org/react/-/react-19.2.8.tgz", @@ -1704,6 +2596,29 @@ "semver": "bin/semver.js" } }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/source-map-js": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", @@ -1731,6 +2646,19 @@ "url": "https://github.com/sponsors/SuperchupuDev" } }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/update-browserslist-db": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", @@ -1762,6 +2690,16 @@ "browserslist": ">= 4.21.0" } }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, "node_modules/vite": { "version": "7.3.6", "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.6.tgz", @@ -1857,12 +2795,74 @@ "node": ">=12" } }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", "dev": true, "license": "ISC" + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/zod": { + "version": "4.6.7", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz", + "integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "node_modules/zod-validation-error": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-4.0.2.tgz", + "integrity": "sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.0.0" + }, + "peerDependencies": { + "zod": "^3.25.0 || ^4.0.0" + } } } } diff --git a/app/package.json b/app/package.json index 46409c5..da6fadd 100644 --- a/app/package.json +++ b/app/package.json @@ -37,6 +37,8 @@ "test:runner": "esbuild runner.dom.test.jsx --bundle --platform=node --format=esm --jsx=automatic --packages=external --outfile=.runnerdomtest.mjs --log-level=error && node .runnerdomtest.mjs", "test:runflow": "node runflow.test.js", "test:native": "esbuild native.test.js --bundle --platform=node --format=esm --packages=external --outfile=.nativetest.mjs --log-level=error && node .nativetest.mjs", + "test:merge": "node merge.test.js", + "test:targets": "esbuild targets.dom.test.jsx --bundle --platform=node --format=esm --jsx=automatic --packages=external --outfile=smoke/.targetsdomtest.mjs --log-level=error && node smoke/.targetsdomtest.mjs", "test:done": "node done.test.js", "test:history": "node history.test.js", "test:fingers": "node fingers.test.js", @@ -44,7 +46,8 @@ "test:handoff": "node handoff.test.js", "test:libsync": "node libsync.test.js", "test:cycles": "node cycles.test.js", - "test:sessionops": "node sessionops.test.js" + "test:sessionops": "node sessionops.test.js", + "lint": "eslint src" }, "dependencies": { "lucide-react": "^1.28.0", @@ -54,6 +57,9 @@ }, "devDependencies": { "@vitejs/plugin-react": "^5.1.0", + "eslint": "^10.14.0", + "eslint-plugin-react-hooks": "^7.1.1", + "globals": "^17.14.0", "happy-dom": "^15.11.7", "vite": "^7.1.5" } diff --git a/app/runner.dom.test.jsx b/app/runner.dom.test.jsx index b844ffc..0fa4b54 100644 --- a/app/runner.dom.test.jsx +++ b/app/runner.dom.test.jsx @@ -27,6 +27,8 @@ Date.now = () => realNow() + skew const { act, useState } = await import('react') const { createRoot } = await import('react-dom/client') const { WorkoutRunner } = await import('./src/runner.jsx') +const { HowSheet } = await import('./src/howto.jsx') +const { lazyPart, WARM_MS, LoadFailed } = await import('./src/lazy.jsx') const { PlanProvider } = await import('./src/lib/planctx.jsx') const { CUES } = await import('./src/lib/cues.js') const { normalizePrescription, prescriptionSteps } = await import('./src/lib/prescription.js') @@ -308,6 +310,8 @@ test('The rest: it starts off an interval set; +10 moves it, Pause holds it, Bac await click(document.querySelectorAll('.setlist-go')[1]) await tapText(/^Done set$/) assert.ok(r.last().run.restUntil > Date.now()) + // The rest after the LAST set names no next set (it used to name the set just done). + assert.equal(document.querySelector('.rest-next').textContent, 'That was the last set.') await tapLabel(/^Skip the rest$/) assert.equal(r.last().run.restUntil || 0, 0) assert.equal(r.last().opts.out, null) @@ -429,6 +433,89 @@ test('Sound: muted, a set marks in silence; a side not on screen never sounds', await hidden.done() }) +test("All sets is the shell's Popover: the scrim and Escape close it, and only it", async () => { + const r = await mount(entryOf(LEGS)) + await tapText(/^All sets$/) + const dialog = () => document.querySelector('[role=dialog][aria-label="All sets"]') + assert.ok(dialog(), 'All sets did not open') + assert.equal(document.querySelector('.setlist-scrim'), null, 'its own scrim is back') + const scrim = dialog().closest('.pop-scrim') + assert.ok(scrim, 'All sets is not in the shell\'s Popover') + await click(scrim) + assert.equal(dialog(), null, 'a tap on the scrim did not close it') + assert.match(where(), /Warm-up · Set 1 of 1/, 'the runner went with it') + await tapText(/^All sets$/) + await act(() => { document.dispatchEvent(new win.KeyboardEvent('keydown', { key: 'Escape', bubbles: true })) }) + assert.equal(dialog(), null, 'Escape did not close it') + assert.equal(document.querySelector('[role=dialog][aria-label="Leave the workout?"]'), null) + assert.equal(r.writes.length, 0, 'opening and closing the list wrote something') + await r.done() +}) + +test("The how-to is the shell's Popover too: the scrim, Escape and Got it close it", async () => { + if (unmountLast) await unmountLast() + document.body.innerHTML = '' + const host = document.createElement('div') + document.body.appendChild(host) + const root = createRoot(host) + let closed = 0 + await act(async () => root.render( { closed += 1 }} />)) + const dialog = document.querySelector('[role=dialog][aria-label="How to do Max hang"]') + assert.ok(dialog, 'the how-to did not open') + assert.equal(document.querySelector('.how-scrim'), null, 'its own scrim is back') + await click(dialog.closest('.pop-scrim')) + assert.equal(closed, 1, 'a tap on the scrim did not close it') + await act(() => { document.dispatchEvent(new win.KeyboardEvent('keydown', { key: 'Escape', bubbles: true })) }) + assert.equal(closed, 2, 'Escape did not close it') + await click(document.querySelector('.how-got')) + assert.equal(closed, 3, 'Got it did not close it') + await act(() => root.unmount()) +}) + +test('A lazy part is fetched ahead; failing to load, an always-mounted one draws NOTHING, an opened screen says so in itself and Try again draws it', async () => { + if (unmountLast) await unmountLast() + document.body.innerHTML = '' + let calls = 0, fail = true + const load = () => { calls += 1; return fail ? Promise.reject(new Error('offline')) : Promise.resolve({ Hello: ({ who }) =>

Hello {who}

}) } + // Always mounted (WHOOP on Today, a timer resumed in the background): no `failed`. + const Quiet = lazyPart(load, 'Hello') + // A screen the user opened: its own frame, the words, Try again, its way out. + const Screen = lazyPart(load, 'Hello', { + failed: (props, retry) => ( +
+ + +
+ ), + }) + await wait(WARM_MS + 100) + assert.equal(calls, 2, 'the parts were not fetched ahead of being drawn') + const host = document.createElement('div') + document.body.appendChild(host) + const root = createRoot(host) + const quiet = console.error + console.error = () => {} + let closed = 0 + try { + await act(async () => root.render(<>)) + await wait(50) + assert.equal(host.querySelector('.lazy-failed'), null, 'an always-mounted part that failed to load put a card over the app') + assert.equal(host.innerHTML, '', 'an always-mounted part that failed to load drew something') + await act(async () => root.render( { closed += 1 }} />)) + await wait(50) + const card = host.querySelector('.opened .lazy-failed') + assert.ok(card, 'an opened screen that failed to load said nothing, or said it outside itself') + assert.match(card.textContent, /Plan a workout did not load/) + await click([...host.querySelectorAll('button')].find(b => b.textContent === 'Back')) + assert.equal(closed, 1, 'no way out of a screen that did not load') + fail = false + await click([...host.querySelectorAll('button')].find(b => /Try again/.test(b.textContent))) + await wait(50) + assert.equal(host.querySelector('.hello')?.textContent, 'Hello Sam', 'Try again did not load it') + } finally { console.error = quiet } + await act(() => root.unmount()) +}) + let failed = 0 for (const [name, fn] of tests) { try { await fn(); console.log(` ok ${name}`) } catch (e) { failed += 1; console.log(` FAIL ${name}\n ${e.stack?.split('\n').slice(0, 3).join('\n ')}`) } diff --git a/app/smoke/editor.jsx b/app/smoke/editor.jsx index e1ad7a4..6d55979 100644 --- a/app/smoke/editor.jsx +++ b/app/smoke/editor.jsx @@ -52,7 +52,7 @@ export default [ throw new Error('the web card does not fold and bring the next into view') } const phone = readFileSync(new URL('../../mobile/src/features/exercises.tsx', import.meta.url), 'utf8') - if (!/doingMove as any\)\(was\.current, \{ finished, focus \}\)/.test(phone) || !/if \(move\.fold\) setOpen\(false\)/.test(phone) || !/scrollTo\(root\.current\)/.test(phone)) { + if (!/doingMove\(was\.current, \{ finished, focus \}\)/.test(phone) || !/if \(move\.fold\) setOpen\(false\)/.test(phone) || !/scrollTo\(root\.current\)/.test(phone)) { throw new Error('the phone card does not fold and scroll to the next') } const css = readFileSync(new URL('../src/css/sheet.css', import.meta.url), 'utf8') diff --git a/app/smoke/log.jsx b/app/smoke/log.jsx index 59a4a77..abb509c 100644 --- a/app/smoke/log.jsx +++ b/app/smoke/log.jsx @@ -36,7 +36,7 @@ export default [ * capitalised date with "N workouts", and a down chevron as if the row opened * in place) is gone. */ - ['LogTab(one card per day, workouts as rows, a header like "Fri 23 Oct")',

([^<]*)<\/h3>/g)].map(m => m[1]) if (heads.length !== 2) throw new Error(`expected two day heads, got ${heads}`) for (const h of heads) { - if (!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) \d{1,2} (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)( \d{4})?$/.test(h)) { - throw new Error(`a day head read "${h}", not like "Fri 23 Oct"`) + if (!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{1,2}(, \d{4})?$/.test(h)) { + throw new Error(`a day head read "${h}", not like "Fri, Oct 23"`) } } if ((t.match(/class="card list logday-list"/g) || []).length !== 2) throw new Error('not one card per day') diff --git a/app/smoke/misc.jsx b/app/smoke/misc.jsx index 9e5eb61..7d4fd09 100644 --- a/app/smoke/misc.jsx +++ b/app/smoke/misc.jsx @@ -6,7 +6,7 @@ import { renderToString } from 'react-dom/server' import { ToastList } from '../src/toast.jsx' import { pushToast, dismissToast, useToasts } from '../src/lib/toast.js' import { Undo2 } from 'lucide-react' -import { FabMenu, ActingBanner, tabsFor } from '../src/App.jsx' +import { FabMenu, ActingBanner, tabsFor } from '../src/shell.jsx' import { QuickLog } from '../src/quicklog.jsx' import { ActivityPicker } from '../src/activitypicker.jsx' import { recentActivities, quickEntry } from '../src/lib/quicklog.js' diff --git a/app/smoke/profile.jsx b/app/smoke/profile.jsx index 088c6a6..dbeede6 100644 --- a/app/smoke/profile.jsx +++ b/app/smoke/profile.jsx @@ -12,7 +12,8 @@ import { ProfileMenu, ProfilePanel, PeopleCard, homePages } from '../src/profile import { PrefsProvider } from '../src/lib/prefs.jsx' import { SessionLog } from '../src/sessionlog.jsx' import { WhoopProvider } from '../src/lib/whoop.jsx' -import { WhoopWorkouts, WhoopReadiness, WhoopSleep, sleepSeries, sleepStats } from '../src/whoop.jsx' +import { WhoopWorkouts } from '../src/whoop.jsx' +import { WhoopReadiness, WhoopSleep, sleepSeries, sleepStats } from '../src/whoopday.jsx' import { StravaProvider } from '../src/lib/strava.jsx' import { StravaActivities } from '../src/strava.jsx' import { UnloggedWorkouts } from '../src/unlogged.jsx' @@ -113,6 +114,28 @@ export default [ who={owner} onClose={noop} {...props} />) const rowTitles = (html) => [...html.matchAll(/class="list-row-title">([^<]+) m[1]) return [ + /* Grades are picked off the ladder, never typed (§6.4, #98, G r1 F9); one typed + before shows on its rung, or is said when it is none, and is not rewritten (§4). Both platforms. */ + ['ProfilePanel(Climbing: your grades off the ladder; a grade typed before is kept and said)', null, () => { + const typed = { id: 'profile', kind: 'profile', updatedAt: 'z', data: { facts: { redpoint: '5.11b', flash: 'mid 5.10s', boulder: 5 } } } + const html = renderToString( e.id !== 'profile'), typed]} upsertEntry={noop} deleteEntry={noop} + status="synced" who={owner} onClose={noop} initialPage="climbing" />) + for (const label of ['Redpoint grade', 'Flash / onsight', 'Boulder grade']) { + if (!new RegExp(`([^]*?)<\/select>/)?.[1] || '' + if (!/