Commit Graph
529 Commits
Author SHA1 Message Date
Duarte Santos 1e86d6ace2 Config sheet: a stepper is not a list-row accessory
Added weight sat inside a list row next to its label, which is fine for a switch
and wrong for a stepper: the control took the width it needed and left the text
column wrapping one word per line. It now gets the same full-width treatment as
sets and reps, with the explanation underneath, and reuses the "Added (kg)" label
the set table already uses.

Also stops a long value overlapping its own title in a list row — flex:none meant
"Follow the routine (Linear progression)" ran straight through "Rule", since the
title's column was already free to shrink to nothing. The value shrinks and
ellipsises instead. Pre-existing, visible in every settings row with a long value.
2026-08-01 17:00:30 +02:00
Duarte Santos a5e360cde5 Settings can register on an invite-only instance too
The sign-in screen asks for an invite code when the server says it needs one. The
same registration reached from Settings never did: it collected a name, called
passkeyRegister without the second argument, and the server refused it. On an
invite-only instance that path could not succeed at all, with nothing on screen to
explain why.

It now reads /api/config and shows the code field on the same terms, reusing the
sign-in screen's own strings so nothing new needs translating.
2026-08-01 16:52:30 +02:00
Duarte Santos 00b4f543a3 Per side stays on reps work, where reps exist
Switching a per-side exercise to Time carried `side` onto the hold: the config
sheet hides the toggle in that mode but still saved the flag, and the workout
badge then halved a rep count a timed set does not have, reading "0 per side".

Dropped at all three points it could get through — the config sheet no longer
writes it outside reps mode, the badge no longer renders outside it, and the plan
serialiser refuses it on a hold so an older file cannot bring it back.
2026-08-01 16:48:57 +02:00
Duarte Santos 4afffcb248 Per side: log the total, show the split
Feedback on #31: a rep count that sometimes means one side and sometimes both is
the ambiguity, not the fix for it. So the logged number is the total — 16 — the
same as every other set in the app, and the split is derived for planning: "8 per
side" on the exercise, "3 × 16 · 8/side" on the plan line and the printed sheet.

Unilateral targets step in twos. 16 → 18 → 20, in the config stepper, the set-row
stepper and the bodyweight rep progression, because half of an odd total is a rep
one side never gets. Turning the flag on rounds an existing target up to even, and
a saved target is stored even for the same reason. An odd total that arrives some
other way still displays honestly, as 8.5 per side, since that is what it means.

Volume loses its per-side case: both sides are already in the number logged.
2026-08-01 16:47:44 +02:00
Duarte Santos c33ff15d9d Bodyweight work, logged the way it is done
A push-up has no weight to type and the app asked for one anyway, on a quarter of
the catalogue. Issues #31, #32 and #33 are the same gap seen from three sides: the
app assumed progress lived in the load.

Two flags on the exercise config rather than two new modes, because "bodyweight"
and "per side" are equally true of a rep set and a timed hold:

  bodyweight — seeded from the equipment the dataset already records. The weight
               column is gone, the set row is one stepper, and the working-weight
               prompt stops asking about a weight that was never there. A belt
               weight reads as an addition and hands progression back to the
               normal policies, because now there is something to add.
  side       — 8 logged is 8 per side. The total is spelled out where there is
               width for it, and volume counts both sides so a routine that moved
               to single-arm work no longer halves itself on the chart.

Bodyweight progression grows reps, and now sets: a rep ceiling sends the reps back
to the bottom and adds a set instead of climbing forever, stopping at six with the
advice it should have given all along. No ceiling keeps the old behaviour exactly.

Both flags are written to a plan only when they disagree with the catalogue, and
absent reads as false, so every existing plan, workout and backup is read
unchanged.
2026-08-01 16:37:52 +02:00
Duarte Santos 8de55ce0d9 Merge pull request #29 from DuarteSantos8/dependabot/npm_and_yarn/frontend/frontend-120fce7b1d
Bump react-router-dom from 7.18.1 to 7.18.2 in /frontend in the frontend group
2026-08-01 14:49:40 +01:00
Duarte Santos aefb13b544 Merge pull request #30 from DuarteSantos8/dependabot/github_actions/actions-6382876e44
Bump docker/login-action from 4.5.2 to 4.6.0 in the actions group
2026-08-01 14:49:21 +01:00
dependabot[bot] 7354b1ca0c Bump docker/login-action from 4.5.2 to 4.6.0 in the actions group
Bumps the actions group with 1 update: [docker/login-action](https://github.com/docker/login-action).


Updates `docker/login-action` from 4.5.2 to 4.6.0
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v4.5.2...v4.6.0)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-version: 4.6.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-01 00:45:03 +00:00
dependabot[bot] f5562febca Bump react-router-dom in /frontend in the frontend group
Bumps the frontend group in /frontend with 1 update: [react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom).


Updates `react-router-dom` from 7.18.1 to 7.18.2
- [Release notes](https://github.com/remix-run/react-router/releases)
- [Changelog](https://github.com/remix-run/react-router/blob/react-router-dom@7.18.2/packages/react-router-dom/CHANGELOG.md)
- [Commits](https://github.com/remix-run/react-router/commits/react-router-dom@7.18.2/packages/react-router-dom)

---
updated-dependencies:
- dependency-name: react-router-dom
  dependency-version: 7.18.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: frontend
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-01 00:44:33 +00:00
Duarte Santos 1f40230727 Dependabot: majors arrive on their own, and Capacitor waits
Grouping by ecosystem cut the noise, which was the point, but it also let a
Capacitor 7 → 8 migration turn up as "the frontend group, 7 updates" — six
routine siblings and one native-platform migration, indistinguishable in the
list. CI would have gone green on it too: the test workflow builds the web app
and never touches the mobile flavour, so the check would have been reassuring
about something it had not looked at.

Minor and patch stay grouped and quiet. Majors get their own PR per ecosystem,
where being alone is the signal.

Capacitor majors are ignored outright for now: Capacitor 8 declares Node >= 22
and the build host runs 20, and frontend/android and frontend/ios are committed,
so the upgrade also means migrating Gradle/AGP and the Podfile. That is a piece
of work to schedule, not a PR to merge. The comment says to drop the ignore once
the build host moves to Node 22.
2026-07-31 20:35:12 +02:00
Duarte Santos de65e1099a Merge pull request #28 from DuarteSantos8/dependabot/github_actions/actions-d8aa18c958 2026-07-31 19:30:56 +01:00
dependabot[bot] be2fb2dd1d Bump the actions group across 1 directory with 10 updates
Bumps the actions group with 10 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [actions/checkout](https://github.com/actions/checkout) | `4` | `7` |
| [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) | `3` | `4` |
| [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) | `3` | `4` |
| [docker/login-action](https://github.com/docker/login-action) | `3` | `4.5.2` |
| [docker/metadata-action](https://github.com/docker/metadata-action) | `5` | `6` |
| [docker/build-push-action](https://github.com/docker/build-push-action) | `6` | `7` |
| [actions/setup-node](https://github.com/actions/setup-node) | `4` | `7` |
| [actions/configure-pages](https://github.com/actions/configure-pages) | `5` | `6` |
| [actions/upload-pages-artifact](https://github.com/actions/upload-pages-artifact) | `3` | `5` |
| [actions/deploy-pages](https://github.com/actions/deploy-pages) | `4` | `5` |



Updates `actions/checkout` from 4 to 7
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v7)

Updates `docker/setup-qemu-action` from 3 to 4
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](https://github.com/docker/setup-qemu-action/compare/v3...v4)

Updates `docker/setup-buildx-action` from 3 to 4
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v3...v4)

Updates `docker/login-action` from 3 to 4.5.2
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v3...v4.5.2)

Updates `docker/metadata-action` from 5 to 6
- [Release notes](https://github.com/docker/metadata-action/releases)
- [Commits](https://github.com/docker/metadata-action/compare/v5...v6)

Updates `docker/build-push-action` from 6 to 7
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v6...v7)

Updates `actions/setup-node` from 4 to 7
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v4...v7)

Updates `actions/configure-pages` from 5 to 6
- [Release notes](https://github.com/actions/configure-pages/releases)
- [Commits](https://github.com/actions/configure-pages/compare/v5...v6)

Updates `actions/upload-pages-artifact` from 3 to 5
- [Release notes](https://github.com/actions/upload-pages-artifact/releases)
- [Commits](https://github.com/actions/upload-pages-artifact/compare/v3...v5)

Updates `actions/deploy-pages` from 4 to 5
- [Release notes](https://github.com/actions/deploy-pages/releases)
- [Commits](https://github.com/actions/deploy-pages/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/configure-pages
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/deploy-pages
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/setup-node
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/upload-pages-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: docker/build-push-action
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: docker/login-action
  dependency-version: 4.5.2
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: docker/metadata-action
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: docker/setup-buildx-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: docker/setup-qemu-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-31 17:34:50 +00:00
Duarte Santos 611987545a Dependabot: don't chase Node majors that were never LTS
The first run offered node:22-alpine → 25-alpine in both Dockerfiles. Odd
majors are Current, not LTS, and stop getting fixes about six months in — for
an image other people self-host that trades stability for nothing. Even majors
are still proposed, so 22 → 24 will show up as a PR, which is the move actually
worth reviewing.
2026-07-31 19:32:57 +02:00
Duarte Santos accc3c1038 Sessions you can actually end, and invite codes worth guessing at
SECURITY.md documented three weaknesses two hours ago. Documented is better than
hidden; fixed is better than documented.

Sessions were a signed cookie the server trusted for a year, and /api/logout
only cleared it in the browser you clicked it in — a copy left on a shared
machine stayed good until it expired, and the only way to end it was deleting
./data/secret and signing out the entire instance. The cookie payload now
carries the user's session version, and POST /api/logout/all bumps it, which
kills every cookie that account ever had. Settings grows a "Sign out
everywhere" row for it.

Cookies already in the wild have no version field. They read as version 0 and
match a user who has never bumped, so nobody is signed out by this deploy and
db.json needs no migration — sv appears lazily on the first bump. Verified
against a server running the new code with a db.json shaped like the live one.

Session default drops from 365 days to 90, overridable with SESSION_DAYS. The
expiry is baked into each cookie when issued, so lowering it never cuts an
existing session short.

Invite codes go from 32 to 64 bits. The app has no rate limiting by design and
/api/register/options answers whether a code is valid, so the code itself has to
be the part not worth guessing. Existing codes still work — validation is an
exact string compare. Unused old ones are worth revoking and reissuing.

What did not change: no rate limiting, still the reverse proxy's job, still the
first caveat in SECURITY.md. requireUserVerification stays false — raising it
could refuse passkeys that already exist, which is a lockout, not a fix.
2026-07-31 19:32:57 +02:00
Duarte Santos 1574811af0 Wake-lock test: stop assigning to a global Node now owns
The first CI run found this, which is the point of having one. Node 21+ defines
globalThis.navigator itself as a getter with no setter, so `globalThis.navigator
= {...}` throws under ESM strict mode. This box runs Node 20, where the global
does not exist and the assignment is fine — the test has never failed locally
and never would.

Only the first test failed: its afterEach deletes the built-in accessor, so
every later test assigned cleanly against the hole it left. defineProperty works
on both runtimes.

Production images are node:22-alpine (web/Dockerfile, api/Dockerfile), so the
version CI runs is the right one and the test was what needed fixing.
2026-07-31 19:21:03 +02:00
Duarte Santos b45dbca2a6 Demo: rate the sets, so the demo shows the effort stats
The live demo is the shop window, and it was the one place the new Effort card
could not appear — demoSeed fabricated twelve weeks of training with no ratings
at all, so every chart that reads effort rendered empty or absent.

The seed now rates about 82% of finished sets, deterministically as before:
effort tracks position in the session and the block's progression, one deload
week sits well away from failure, the first three weeks are written in RPE as if
imported from another app, and one exercise stays unrated throughout so the
partial-coverage case is visible rather than theoretical. Only reps-mode sets
are rated — a reps-in-reserve number on a cardio set would be nonsense.
2026-07-31 19:12:18 +02:00
Duarte Santos 3a120df205 A security policy, and dependency updates that stay quiet
openGym ships passkeys, a signed session cookie and an admin dashboard, and
people run it on the open internet. Until now someone finding a hole had no
option but a public issue.

SECURITY.md documents the model as it actually is, verified against server.js
rather than described from memory: what the session cookie is and how long it
lasts, that it cannot be revoked individually, that ./data is unencrypted and
its holder can mint a session for any account, that there is no rate limiting,
and what changing RP_ID costs. A self-hoster deciding whether to run this for
other people deserves that list up front.

Dependabot is monthly and grouped one PR per ecosystem — a default setup on a
solo project produces noise that stops being read, which is the opposite of the
point. Android/iOS are left out on purpose: Capacitor pins those to the npm
packages, so bumping them separately breaks the mobile build.

Also: api/ has had two dependencies since notifications landed. CONTRIBUTING
still claimed one.
2026-07-31 19:12:18 +02:00
Duarte Santos 051a37abbf CI: actually run the tests, and hold the locales to one key set
There are 159 unit tests and nothing ran them. Both existing workflows fire on
push to main only, so the two outside pull requests merged so far were reviewed
by eye alone. This runs the suite, the build and a locale check on every pull
request.

The locale check exists because of a bug that shipped last week: a feature added
17 strings to de.js only, and the other ten languages fell back to English
mid-sentence with nothing failing anywhere. The checker compares every locale
against the union of all keys, so a string added to one file flags the other ten
instead of passing unnoticed.
2026-07-31 19:12:18 +02:00
Duarte Santos 8440cf3546 Changelog: the effort stats, under Unreleased
v1.2.3 is published, so this is the start of the next version rather than an
amendment to that one — it stays under Unreleased until there is a release to
fold it into.
2026-07-31 19:00:42 +02:00
Duarte Santos b0d176aba3 Merge branch 'effort-stats': the effort ratings, read back as statistics
Sets have carried an RIR/RPE rating since v1.2.3, but nothing ever read it
back — the number lived in the set label and nowhere else. This is the other
half: a trend per week, the spread across the scale, the share of sets taken
near failure, a hard-sets mode on the muscle map, and the rating riding along
on each exercise's own curve.
2026-07-31 18:49:41 +02:00
Duarte Santos 42ac8c8513 Send questions to Discussions, and put a Sponsor button on the repo
Discussions has been enabled since the start and empty since the start, so
every question arrives as an issue — the tracker is carrying design debates and
"how do I" alongside actual bugs, and the answers end up buried in closed
issues where the next person searching won't find them.

The "New issue" screen now offers Q&A, Ideas and Show-and-tell before the
templates, which is where that traffic gets intercepted; README and CONTRIBUTING
say the same thing in a table.

FUNDING.yml does nothing until the account is enrolled in GitHub Sponsors —
GitHub simply doesn't render the button. Stated plainly next to it: openGym is
AGPL, there is no paid tier and nothing is held back for sponsors. A project
that starts selling access to its maintainer stops being the thing people
starred.
2026-07-31 18:43:15 +02:00
Duarte Santos f232b5ba7e Effort stats: the other ten languages, and drop what nothing calls
The card shipped translated into German only, so every other UI language fell
back to the English source strings mid-sentence — the locale files have been
key-for-key identical until now, and they are again (607 each).

exerciseEffort() had no caller: Stats builds its per-exercise curve from the
points it already has, which are filtered by training mode, so the library
version would have drawn a different set of sessions. Removed with its tests
rather than left as a second answer to the same question.
2026-07-31 16:55:21 +02:00
Duarte Santos caaf61d91e Stats: read the effort back — trend, distribution, hard sets, per exercise
Rating a set only paid off inside the set label until now: Stats never looked at
rir/rpe at all. It reads them now, in four places.

lib/effort.js aggregates everything in RIR and converts back to whichever scale the
profile reads. A history that mixes the two — own logs in RIR, an imported file in
RPE — has to average as one series or every chart draws half the data, and RIR is the
internal unit because its zero is real where RPE's floor of 6 is a convention.

- an Effort card: average and share of sets taken near failure, the week-by-week curve
  with the week's volume in the tooltip, and where the sets land on the scale
- the muscle map gains a hard-sets mode: a muscle can lead on volume and still never
  be trained near failure
- Exercise progress carries effort on the top-set dots and as a curve of its own — the
  same weight with more left in the tank is progress a weight-only line draws flat
- LineChart learns an inverted axis (RIR counts down as it gets harder) and per-point marks

Every number carries how much of the training it speaks for: rating is optional and off
by default, so an unrated set is left out rather than read as failure, and an average
waits for five rated sets before it claims to be one.
2026-07-31 16:17:08 +02:00
Duarte Santos 4c829b6d1f Release v1.2.3: fold in the screen lock, the rest timer and the settings grouping
v1.2.3 was tagged but never published, so everything since v1.2.2 -- the last
published release -- belongs in this one version rather than a new number.

CHANGELOG gets the three new sections, README a feature bullet, SELF_HOSTING a note
that the Wake Lock API wants HTTPS (or localhost) like passkeys do and that iOS
refuses it in Low Power Mode. Website: the APK line said v1.2.2 while the download is
1.2.3, and the feature grid gained the screen-awake card.
v1.2.3
2026-07-31 15:35:36 +02:00
Duarte Santos c5e131f81c Rest timer: take 15 seconds off, not only add them
addRest now accepts a negative step, and taking off more than is left finishes the
rest instead of counting into the negative -- which also kept a negative duration out
of the progress bar and out of the server-side push schedule.

Three controls and the clock do not fit one line on a phone: at 360px the bar was
left with about 30px and stopped saying anything. The rest variant stacks -- clock and
bar on top, controls beneath, -15 and +15 together in number-line order, Skip pushed
to the far edge so the button that ends the rest is not next to the one you tap to buy
more time. Scoped to #timer.rest, so the work timer keeps its single row. Back to one
line at >=1000px, and the card is nearly opaque now -- the set rows underneath were
reading through it.
2026-07-31 15:35:27 +02:00
Duarte Santos 248da53dca Keep the screen awake while a workout is running
Locking and unlocking the phone between every set was the worst part of logging on
one. Settings -> During a workout -> Keep screen awake, on by default; the lock is
held only while S.active exists, so it follows the workout rather than the route and
lets go when you finish.

The browser drops the lock whenever the document stops being visible, which is what
happens the moment you glance at a message, so wakelock.js keeps its own 'wanted'
intent and re-acquires on every visibilitychange. It also releases a sentinel that
arrives after a release landed mid-request, and swallows the rejection iOS gives in
Low Power Mode. Where the API is missing the row shows disabled instead of offering
a switch that does nothing.

Settings is regrouped by what each thing affects while the row needed a home:
General (language, units), During a workout (rest timer, keep awake, sounds, effort),
Notifications, Appearance, Data. Nothing removed, no setting changed meaning.
2026-07-31 15:35:18 +02:00
Duarte Santos 42d3659615 Release v1.2.3: effort per set, and the RPE your old app already had
Everything published since v1.2.2 is one number: the RIR column from #21 and
the RIR/RPE scale choice built on top of it, plus the importer reading the
RPE that Hevy and Strong export.

Changelog, README, roadmap and the website all describe the feature as it
actually shipped — a rating that is optional, keeps its scale per set, and
is deliberately not an input to progression or the 1RM estimate.

Android versionCode 4: it has to increase strictly or the APK will not
install over the v1.2.2 build already out there.
2026-07-31 00:16:43 +02:00
Duarte Santos ca917f0320 Merge branch 'effort-metric': effort per set (RIR / RPE)
Adds an optional per-set effort rating on either of the two scales people
actually use, generalising the RIR column from #21 rather than bolting a
second one next to it, and teaches the importer to read the RPE that Hevy
and Strong already export.
2026-07-31 00:14:51 +02:00
Duarte Santos 54fb14be13 Import: bring the RPE other apps already recorded
Hevy and Strong both write an RPE next to every set and the importer was
dropping the column, so a history imported from either arrived flatter than
the file it came from. It is read now, along with an RIR column if a file
happens to have one.

A blank cell stays unrated rather than becoming 0, and a written-out 0 is
only a rating on the RIR scale — RIR 0 is a set taken to failure, while RPE
runs 1-10, so an app writing 0 there means "nothing here" and reading it as
an effort would stamp one on every unrated set in the file. Ratings above
the scale are capped rather than thrown away, junk is ignored, and effort
only rides along on weighted rep sets — a treadmill row has nowhere to show
it. A file carrying both columns is read as RIR, the precedence setLabel
already reads them back with.

The import summary reports how many sets brought a rating, and says where
to switch the column on when the profile is not logging effort yet —
otherwise the ratings arrive invisibly and look like they were lost.

Export needed no change: the backup is the whole state serialised, so both
fields and the setting travel with it. There is a test pinning that now,
along with 11 for the import paths.
2026-07-30 23:59:01 +02:00
Duarte Santos 6905117352 Effort stepper: count up from the bottom of the scale
The first + on an empty cell jumped straight to a "typical working set"
(RIR 2 / RPE 8), skipping 0 and 1 with no way to see why. A stepper that
lands somewhere other than where counting would take you is just puzzling,
so it now starts at the bottom of the scale and walks up in even steps like
every other stepper in the app: RIR from 0, RPE from 6 — the scale is only
meaningful for working sets and anything lighter is a warm-up nobody rates.

Stepping back off the floor clears the cell again, so a mistap is undoable
instead of sticking at 0 — which on the RIR scale claims the set went to
failure. − on a cell that was never filled in still leaves it empty.

The stepping moved out of the view into stepEffort/capEffort in history.js,
where it can be tested: 16 new cases covering the scale walk, the floor and
ceiling, the clear-on-undershoot, half-step rounding, junk settings values,
the showRir overlay every load path performs, and a session's worth of
logging end to end.

A typed value is still only capped, never floored — clamping up would turn
the "1" of "10" into the floor and fight the input.

The help sheet no longer claims the highlighted row is where + starts; it is
where working sets usually land. Reworded in all 11 language packs.
2026-07-30 23:52:57 +02:00
Duarte Santos 0c6c22c04b Effort help: show the two scales as one table, (i) before the control
The sheet explained RIR and RPE in three paragraphs, which is a bad way to
say "these are the same judgement counted from opposite ends" — you had to
hold both sentences in your head to see the correspondence. A conversion
table shows it in one look: RIR and RPE in fixed tabular columns you can
read straight down, the feel in words next to them, and the row a working
set usually lands on highlighted in the accent.

The table is built from the same parts as the app's grouped lists (surface
fill, inset hairlines) instead of a real <table>, so it inherits the card
look and wraps on a narrow phone.

The (i) moves ahead of the segmented control: you reach the explanation on
the way to the choice rather than past it.

The three paragraph strings are replaced by the table's strings in all 11
language packs.
2026-07-30 23:42:21 +02:00
Duarte Santos 4e27461b7e Effort per set: RIR or RPE, whichever scale you think in
The RIR column becomes a three-way setting (Off / RIR / RPE). Both scales
measure the same judgement from opposite ends — RPE 8 is RIR 2 — so they
share one column and one stepper, but keep their own field on the set.

A set is never silently rewritten into the other scale: switching the
setting changes what new sets ask for, and old sets still read back with
the scale they were logged with.

Profiles carrying the old showRir boolean keep their column (effortOf
falls back to it until the new setting is chosen), so a backup or another
device that still has the flag does not lose the column.

The steppers now know the scale: the first + lands on a typical working
set (RIR 2 / RPE 8) instead of the end of the scale, and typed values are
capped at 10 — there is no RPE 12.
2026-07-30 23:35:47 +02:00
Duarte Santos fa978a1bb4 Merge PR #21: optional RIR column on reps-mode sets
octaviodimarco's RIR (reps in reserve) stepper for reps-mode sets, opt-in under
Settings → Units & timer, plus a fixup for the leftover RIR-0 stamp and the
header alignment.
2026-07-30 19:53:21 +02:00
Duarte Santos c08381e558 RIR: an unlogged RIR stays unlogged, and the header lines up
A set that never had an RIR could still end up carrying one: NumberField mapped an
empty field to 0 and the − button clamped to 0, so one stray tap stamped '(RIR 0)' —
went to failure — on the set for good, in history and in backups, with no way back.
An optional field now clears to null (the key is dropped), and stepping down from
empty leaves it empty. A typed 0 still logs a real 0.

The row's three-stepper sizing also has to reach the header, or the labels sit up
to 5px off the columns they name.
2026-07-30 19:53:14 +02:00
Octavio Di Marco c5172d0633 i18n: add RIR strings to all 11 language packs
t('RIR') and the new Settings toggle label had no entries in
src/locales/ — RIR itself is kept as the acronym across languages
(same treatment as 1RM), only the surrounding label text is translated.
2026-07-30 19:20:00 +02:00
Octavio Di Marco c3929b0a70 Remove RIR auto-check; gate the column behind a setting
Two blockers from review:

- NumberField.commit() fires onChange on every keystroke, so typing
  a decimal RIR (e.g. 1.5) committed the auto-check after the first
  character, before the value was finished — and the same auto-check
  turned a stray tap on an empty field's "−" (or clearing it) into a
  permanent "RIR 0", since 0 is indistinguishable from unset once the
  key exists on the set. Logging RIR is back to a plain field with no
  side effect; the checkbox is the only way to mark a set done, same
  as weight and reps.

- The RIR stepper narrowed every reps-mode row's +/- buttons for
  everyone, including the majority not running an RIR-based program.
  It's now behind a `showRir` setting (Settings → Units & timer,
  default off), so the existing row is untouched unless opted in.
2026-07-30 19:20:00 +02:00
Octavio Di Marco eb582e3c7b Auto-check a set when its RIR is logged
Logging RIR is naturally the last thing you do for a set — by the
time you're rating how many reps you had left, you've already
finished it. Editing the RIR field (typing or the +/- stepper) now
checks the set off itself, same beep/vibrate/rest-timer as tapping
the checkbox by hand, so that's one less tap per set.

Weight and reps are unaffected — those are often set before the set
is performed (pre-filled targets), so editing them shouldn't imply
it's done. Guarded by !s.done so re-editing RIR on an already-done
set (e.g. a correction) doesn't re-fire the toggle side effects.
2026-07-28 22:45:28 +02:00
Octavio Di Marco 6714b16e6a Add optional RIR (reps in reserve) to reps-mode sets
Adds a third stepper column, next to weight and reps, for logging RIR
on strength sets — not shown for cardio or timed holds, where it has
no meaning. RIR is purely a logging/display addition: it never
touches the progression engine (linear/Greyskull/double progression
only ever read weight/reps/seconds), and it round-trips through the
existing whole-object backup export/import with no code changes there.

The set object only gains an `rir` key once the user actually logs a
value (buildSets/addSet don't pre-seed it), matching how missing
fields already read as undefined elsewhere in the store — no schema
version or migration needed for existing logged workouts.

Fitting a third stepper next to weight+reps on narrow phones needed
the same treatment as the exercise-config sheet's three-steppers-in-a-row
(.cfgrow): narrower buttons and a smaller value font just for rows
that show RIR, verified by hand at 360-390px with edge-case values
(2-3 digit weight, double-digit reps, decimal RIR together).

"Last time" summaries now append "(RIR n)" when a set has one logged,
covered by new setLabel tests including the rir: 0 case (0 is a valid
RIR and must not be treated as absent).
2026-07-28 17:10:03 +02:00
Pengboi 6aaf2a3eea Comments: trim to the established cadence
The MCP code came in with 5–8 line file headers, JSDoc on every
one-line wrapper, and inline explanations that referenced the PR
itself ("so the MCP server can reuse it") — none of which matches
api/server.js or frontend/src/lib/, where comments are one-line,
fact-shaped and never mention the change that introduced them.

Trimmed across mcp/src/*.js, i18n-core.js, i18n.js, exercises.js,
format.js, mcp/test/tools.test.js, mcp/vitest.config.js and
mcp/README.md. Tool prefaces lost their numbers; duplicate fs.watch
rationale folded into one; the ASCII import diagram in the README
replaced with a paragraph; the cross-references and self-references
removed. Also fixed two real defects: a corrupted Cyrillic word in a
state.js comment and a missing space in a tools.test.js comment.

No code changes; 92 frontend + 32 MCP tests still pass.
2026-07-26 19:47:52 +01:00
Pengboi 4143ab8676 Tests: Stryker mutation testing on the MCP handlers
Adds Stryker 9.6.1 as a devDep and a .stryker.conf.json scoped to the three MCP-only
modules (src/state.js, src/labels.js, src/tools.js). The reused pure lib in
frontend/src/lib/ is deliberately excluded — it has its own 92-test vitest suite, and
mutating it here would just re-test it under a different label.

Two non-obvious config choices, both learned the hard way:
 · inPlace: true. Stryker's default copies the project to a sandbox, but the MCP test
   file imports "../../frontend/src/lib/*.js" — a relative path that breaks the moment
   the source is moved. inPlace mutates files where they live, keeps a backup in
   .stryker-tmp/backup-*/ during the run, and restores on exit. Verified: after the
   run, `git diff` shows no changes and all 92+32 tests still pass.
 · vitest.related: false. The vitest runner's related-files mode uses static import
   analysis to pick which tests to run per mutant; it can't see the cross-directory
   imports and reported "no tests were found". Disabling it means every mutant runs
   the full suite — slower (~54s for 847 mutants) but accurate.

Baseline first run: 39.32% mutation score (333 killed, 330 survived, 184 no-coverage).
Most of the survivors are zod schema string literals (the unit suite bypasses the SDK's
validation by calling handlers directly), and the bulk of the no-coverage debt lives in
state.js — file watching, multi-user resolution and the mtime fallback paths. The HTML
report at mcp/reports/mutation/mutation.html (gitignored, regenerated per run) shows
each survived mutant inline.

Run with `npm run mutation:test` from mcp/.
2026-07-26 19:34:15 +01:00
Pengboi 92914dea43 MCP: read-only stdio server for LLM apps to query workout history
A Model Context Protocol bridge that lets an external LLM application (Claude Desktop,
Cursor, Cline, Continue, …) read a user's openGym profile directly from ./data — no new
container, no extra auth, no third-party service. The LLM client spawns the server
locally as a stdio process (per the official MCP model); reads the same state-<uid>.json
the api server writes; reuses the pure training helpers from frontend/src/lib/*.js so
the numbers it answers with match what the Stats screen shows exactly.

Eight tools in v1, all read-only:
 · list_routines, get_routine — names + exercise counts + per-exercise targets
 · get_week_plan — Mo/We/Fr assignments and today's routine, accounting for any
   date-specific overrides (a "rest" override cancels the day)
 · list_workouts, get_workout — newest-first session summaries + per-set breakdown
 · get_bodyweight — weigh-ins with the goal line and signed deltas vs goal
 · estimate_1rm — Epley/Brzycki/Lombardi formulas, all-time best + trend per exercise,
   or a PR table across all reps-mode exercises
 · muscle_balance — which muscles are trained vs neglected over a week/month/all window

State is read with fs.watch (mtime fallback for platforms where watchers are flaky) so
the server reflects a session the web UI just finished without a restart. No passkey
material, VAPID keys, or session secrets ever cross the boundary — handlers only ever
serialize fields from the state object plus the user's name from db.json.

The MCP server has exactly one runtime dependency beyond the SDK: none. zod is the SDK's
transitive; vitest and Stryker are devDeps only. Tests run against the demo seed fixture
(demoSeed.js) — 32 cases pinning the JSON shape and the most user-facing edge cases
(empty state, missing routine, rest-day override, zero-workout muscle_balance, three
1RM formulas, superset links, timed/cardio set labels).
2026-07-26 19:34:09 +01:00
Pengboi fadeb17b6c i18n: split the pure core out so the lib is Node-loadable
The pure training helpers (history, progression, onerm, muscles, format, exercises) are
deliberately self-contained — that is what lets them ship with their own vitest suites and
got them reused across the React and mobile builds. They were one Vite-only call away from
being loadable from plain Node too: `import.meta.glob` for the lazy locale packs, run at the
top of i18n.js. Anything that imported `t` or `dateLocale` via the chain (i.e. every helper
in src/lib) inherited the dependency.

Splitting the runtime-agnostic state, constants and readers (t, dateLocale, instrFor, getLang,
LANGS, INSTR_LANGS, DATE_LOCALES) into i18n-core.js lets plain Node require them. i18n.js
keeps the Vite-only bits (the async setLang that lazy-loads locale packs via import.meta.glob
and the React subscription hook useLang) and re-exports everything from core, so none of the
23 existing import sites change.

exercises.js had one direct `import.meta.env` access for IMG_BASE/GIF_BASE — guarded with
`?.` so the module resolves without Vite present. format.js and exercises.js import i18n-core
directly; everything else still imports i18n.js.

No public exports changed. 92/92 vitest tests pass; vite build still code-splits the locale
packs the same way.
2026-07-26 19:34:01 +01:00
Duarte Santos ab0c98ba85 Android: versionCode 3 for the v1.2.2 APK
Same versionName — v1.2.2 was never published, so this is still that release — but the code
has to increase strictly or Android refuses to install over the build already out there.
v1.2.2
2026-07-25 15:05:12 +02:00
Duarte Santos b15f7d9ec4 Release v1.2.2: docs, changelog and website for everything since v1.2.1
v1.2.2 was tagged but never published, so by the versioning rule everything since the last
published release — v1.2.1 — belongs in this one number: the mobile app, the importer, plan
sharing, the QA fix series, and now timed sets, progression rules and estimated 1RM.

The changelog was missing plan sharing and the fix series entirely; both are written up
here rather than left to the git log.
2026-07-25 15:00:43 +02:00
Duarte Santos 5c846b92d5 i18n: the new strings in all 11 language packs
49 keys per pack, 572 in total. The progression rules explain themselves in prose, so most
of these are full sentences rather than labels — a rule you cannot read is one you will
not trust, in any language.
2026-07-25 14:58:48 +02:00
Duarte Santos c248ca3bae The screens for timed sets, progression and estimated 1RM (#16 #17 #18)
Where the three features surface:

 · Routine editor — a progression rule for the whole routine, and per exercise a
   Reps/Time switch, an optional rule of its own and the step it moves in.
 · Workout — timed sets get a start button and the work-timer bar; every exercise says in
   one line why its target is what it is ("every rep last time — 2.5 kg more", "missed
   reps 3 sessions running — reset to 55 kg"). The weights are already right when the
   session opens rather than being suggested afterwards, which is what the old bump-hint
   button did.
 · Stats — the exercise curve switches between top set and estimated 1RM, and names the
   set the estimate came from. Timed exercises chart the longest hold.
 · Exercise detail — an estimated 1RM from your log plus a calculator for a set you have
   not done yet, so the number is reachable before there is any history.
 · Finish summary — a new best estimated 1RM is reported separately from a weight PR.
   Same weight for more reps is progress, but it is not a heavier lift.

Saving an exercise now replaces its config rather than merging into it, so switching back
from time to reps cannot leave a stale duration behind.
2026-07-25 14:58:42 +02:00
Duarte Santos 8e1d3b96a6 Automatic progression: named rules instead of one hard-coded hint (#17)
The old rule was a single line: all reps done, suggest 2.5 kg more. No rep ranges, no
AMRAP, no idea what to do after a bad session. This replaces it with a small set of
policies — linear, Greyskull LP, double progression, and adding time for timed work —
picked per routine and overridable per exercise.

Every function is pure and derives the next target from the log each time it is needed.
Nothing is written back into a finished workout and no counters are stored, so correcting
a mistyped set immediately produces the right next target.

Reading a session honestly is the whole point. Short reps count as a miss even when the
set was checked off; an unchecked set counts as a miss because it was not performed. A
session that fell apart can never advance the load as though it had succeeded.

Two cases the naive version gets badly wrong, both found against real data:

 · Workouts only started recording their prescription in this version. Judged against
   nothing, every past session scores as a miss — the demo history produced "missed reps
   11 sessions running, deload", and every existing user would have been greeted with the
   same on their first session after updating. Targetless history is judged against the
   exercise's current plan instead, which is what the old hint compared against.

 · Bodyweight work has no load to take off. "Reset your push-ups to 2.5 kg" is not advice,
   so with no external weight the rules progress in reps and leave the load alone.
2026-07-25 14:58:31 +02:00
Duarte Santos ec46c7e20d An exercise can be logged by time instead of reps (#16)
Until now the logging model came from the body part alone: cardio meant duration, and
everything else meant weight × reps. A plank, a hang, a wall sit or a loaded carry could
only be timed by filing it under cardio, which then put it in the wrong charts.

A routine entry can now say so itself — reps, time or cardio. Entries without a mode keep
behaving exactly as before, so every existing plan, workout and shared plan file is read
unchanged and nothing needs migrating.

Timed sets get a work timer that counts the set itself, kept deliberately separate from
the rest timer: the two mean opposite things and must never run together. Finishing early
logs the time actually held, not the target, because crediting a full 45 seconds for a
38-second hold would quietly corrupt the log it exists to keep.

Finished workouts now also store what the session prescribed. Without it, history cannot
say whether a session hit its reps, and a timed session reads back as "0 reps".
2026-07-25 14:58:20 +02:00
Duarte Santos a54bad2641 Estimated 1RM: the calculation, and only from sets that can support it (#18)
Working out how strong a set was meant leaving the app. Epley by default, with Brzycki
and Lombardi available and documented.

Two things it deliberately refuses to do:
 · guess above 12 reps, where the formulas disagree by double digits and the answer says
   more about work capacity than about maximal strength;
 · read `topW`, the working weight you confirm after an exercise — it carries no rep
   count, so it cannot produce an estimate at all.

It also knows nothing about the exercise database. An estimate needs a weight AND reps,
and only reps-mode sets carry both, so cardio and timed sets drop out of every scan on
their own rather than through a type check that would need keeping in sync.
2026-07-25 14:58:10 +02:00
Duarte Santos 0818f1b32b Tests: a runner for the pure helpers
The logic that decides what you lift next has no business being verified by hand in a
browser. Vitest is a dev dependency only — the app itself stays dependency-free.
2026-07-25 14:58:01 +02:00