Commit Graph
787 Commits
Author SHA1 Message Date
dsantillan 5eb0a5298a The deploy path's api container now keeps itself on the clone's revision
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
gym.dploy.lol runs deploy/compose-build-at-deploy.yml, and that stack has an asymmetry
that has now cost two deploys: `web` serves the frontend build out of a shared volume, so
every deploy refreshes the app by itself, while `api` copies the clone INTO its container
at start-up. Compose recreates a service only when its configuration or image changed, and
the clone is a volume, so neither does — the api kept running the previous revision while
the frontend moved on.

That is invisible from the outside except as a route that answers 404 although the screen
that calls it is already deployed and visibly new, which is exactly what "Crear clave de
ingesta → not found" was: POST /api/vitals/key hitting last week's server.

The api's command is now a small loop instead of a one-liner: it syncs /app from the
clone whenever the clone's revision changes, restarts the server on it, and starts it
again if it ever exits (the old one-liner left that to the container restart policy, which
also meant a full re-copy every time). Dependencies are reinstalled only when
package.json itself changed, so a deploy costs a couple of seconds of downtime rather
than a minute of npm install.

It is careful about the window a deploy opens: `source` does `rm -rf /work/repo` before it
re-clones, and the loop tests for api/server.js — a file a fresh clone writes and that
rm removes — so a deploy caught mid-clone is waited out instead of half-copied.

Two things this file has to get right, both verified rather than assumed. Every `$` in the
container's script is written `$$`, because compose interpolates `$VAR` in block scalars
too and an unescaped `$src` would have arrived empty (this is the same reason the web
service writes `$$host`). And the loop's control flow was simulated before pushing: first
start, a new clone, a package.json change, a server that dies, and a clone that disappears
mid-deploy and comes back — five paths, all as intended.
2026-09-23 10:44:49 -04:00
dsantillan c150101232 The app's own mark: assets/logoym.png becomes the icon, the brand, and the Start button
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
Every icon the app ships now comes from one source image, generated rather than drawn:
frontend/scripts/build-app-icons.mjs writes public/icon-512.png (declared "any maskable"
in the manifest, hence an opaque square), public/icon-180.png (iOS home screen and
favicon), public/logo.png (transparent, for the UI) and resources/icon.png (the
@capacitor/assets source for the native shells).

The file was a PNG despite its .jpeg name — it has a real alpha channel — so it is
assets/logoym.png now. It is the file the owner dropped in, and the icons are derived
from it, which is what keeps the PWA icon, the home-screen icon, the in-app mark and the
native icon from ever drifting apart.

The emblem is dark green (its most common colour is #031808, its accents are greens too)
with transparent corners, which decides two things. The icon squares are filled with that
same dark green and the mark is centred at 88% of the canvas: the corners blend into it,
the maskable safe circle stays clean, and a transparent icon can't disappear on a dark
home screen. And the tab bar's Start button keeps the accent as a RING instead of a fill —
on the old lime disc the emblem would have read as a dark blob. The ring still marks the
primary action, and it still turns orange with the pulse while a session is running, with
the label underneath saying Start / Resume / Workout, so nothing that button communicated
was lost by swapping its glyph for the mark.

Login, the mobile onboarding and the boot placeholder in App.jsx showed the dumbbell glyph
as a stand-in for the brand; they all show the mark now, so the app cannot flash a
different logo on its way in. Three now-unused Icon imports go with it.

Icons are written as 256-colour palettes: measured against the full RGBA versions the mean
per-channel error is 1.5/255, invisible, and the files are ~2.5× smaller (161 KB for
everything the browser downloads, against 532 KB of source). Transparency survives it as
the palette's own alpha entries — verified, not assumed.

docs/MOBILE.md says how to regenerate and why resources/icon.svg is now inert
(@capacitor/assets tries .png before .svg, so the new icon.png wins), and that comment is
repeated in the SVG itself so nobody edits the file that no longer decides anything.
2026-09-23 10:41:33 -04:00
dsantillan ba37ef8a44 Deploy path: give the health ingest 32 MB, and stop appending to X-Forwarded-For
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
gym.dploy.lol does not run docker-compose.yml. It runs deploy/compose-build-at-deploy.yml,
where nginx is generated inline by the web service from a printf in its command, with a
single global `client_max_body_size 5m`. The per-route 32 MB added for the Apple Health
ingest lives in web/nginx.conf.template, which belongs to the registry-image path and is
never read here — so a first export of more than 5 MB came back as nginx's own 413 HTML
before the API saw a byte of it.

That path now has a second location for /api/vitals/ingest with 32m; nginx picks the
longest matching prefix, so that one route takes the bigger body and everything else
keeps matching the API's MAX_BODY. Both limits are spelled out in comment 3 at the top,
with a note that the two deployment shapes have to be changed together.

Also fixes a smaller thing found while reading it: X-Forwarded-For was
$proxy_add_x_forwarded_for, which APPENDS to whatever the client sent, and the API reads
the first entry — so a caller could choose the address recorded about it. It is now
$remote_addr, which is what web/nginx.conf.template already does and for the same reason
documented there. Audit IPs are off by default, so nothing was being recorded; this
matters the day somebody sets AUDIT_IP=net.

Comment 3 also now records the two things that make a deploy confusing rather than
broken: the api service copies the clone into /app at container start, so an api that was
not recreated keeps serving the previous revision while web-build serves the new frontend
(exactly the 404-on-a-new-route symptom), and web resolves api's IP once at start-up, so
recreating api without web leaves nginx pointing at a dead address and every /api call
answering 502.
2026-09-23 10:32:24 -04:00
dsantillan 8d190bb591 Salud moves to Home's header: a sixth tab pushed Start off centre
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
The tab bar is a flex row of equal columns with the Start button raised in the
middle, so the tab count has to stay odd. Adding Salud as a sixth pushed that disc
half a column to the right, and it read immediately as "the button moved" — the
app's primary action is the one thing in the bar that must not drift.

Salud is now the heart button in Home's header, next to the gear, with the same
destination and the same route (/health). It is reachable from Settings → Data as
well, which was already there. The tab bar is back to five: Home, Plan, Start,
Stats, Exercises.

Two tests, because this is the kind of change that regresses silently: TabBar.test.jsx
asserts the odd count and that the raised button is the middle child (plus that no tab
points at /health), and Home.health-door.test.jsx asserts the heart sits in the same
non-shrinking container as the gear and navigates to /health — if that breaks, the
screen is only reachable from Settings, where nobody looks for it.

Also: the Comments in Home, TabBar, README, CHANGELOG and docs/HEALTH.md now say
where Salud is, and one test assertion checks flexGrow/flexShrink rather than the
`flex: none` shorthand — the CSSOM rewrites that to `0 0 auto`, which is what the
first version of the test tripped over.
2026-09-23 10:23:31 -04:00
dsantillan 691e664d3f Apple Health (Salud): a per-profile ingest endpoint, and a tab that draws it
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
An iOS automation in Health Auto Export POSTs Apple Health to /api/vitals/ingest,
and the new Salud tab (next to Plan) draws whatever arrived: steps, heart rate,
sleep, weight, oxygen, workouts and every other metric HAE can export, grouped into
cards with a trend, a sparkline and a 7/30/90/365-day range. Nothing on that screen
is an input, and the watch's workouts stay out of the history on purpose — they
carry no sets and no weights, so folding them into progression, PRs and the recovery
model would be inventing data.

The interesting part is duplicates. A five-minute automation re-sends overlapping
windows: with Date Range "Today", appending would count a day of steps again on
every run, and with "Since Last Sync", replacing would throw away everything but the
last five minutes. So the endpoint decides per payload instead. Datapoints that sit
on midnight are HAE's own day grouping, i.e. a *total*, and a day total replaces the
day it names — re-sending the same day all afternoon converges on that day's total.
Anything else is a real sample, identified by its instant plus its numbers and
stored once, which is right for overlapping and disjoint windows alike. Every sync
answers with a receipt (received / duplicates / stored), so a misconfigured
automation is visible rather than silent, and day keys come from the date the phone
wrote — never the server's clock, or every evening's steps would land on tomorrow.

Per profile and private by construction. Each profile mints its own ingest key
(Salud → ⚙), which is write-only: it can add to that one profile's health file and
cannot read a single number back, so a key leaking out of a phone is a nuisance
rather than a disclosure. It is its own credential, so rotating it disconnects a
phone without signing anybody out anywhere. The data lives in
data/vitals-<uid>.json, outside the synced state document, so a year of heart rate
never round-trips through localStorage on every device, and it is bounded on write:
400 days per metric, a 72 h dedupe ledger, the newest 300 workouts.

Two traps that only exist in production, both fixed here and both of which would
have shipped broken. api/Dockerfile copies the modules server.js imports by name,
and vitals.js was not on that list — a container that boots straight into
ERR_MODULE_NOT_FOUND. And the web container's nginx capped every /api body at 5 MB,
which a health export with Summarize Data off exceeds; that one route now gets the
API's own 32 MB while every other path keeps 5 MB, with the shared proxy settings
hoisted to server level so the two locations cannot drift apart.

Coverage: vitals.js (13 tests — overlapping, disjoint, day-grouped, raw, heart rate,
sleep, blood pressure, pruning, timezones), the routes against a real server (4 —
isolation between profiles, a key that cannot read, ten re-sends changing nothing),
the card model (18) and the screen (4). docs/HEALTH.md has the Health Auto Export
settings and the merge table; the five endpoints are in api/openapi.yaml under the
health tag, and website/api.html is rebuilt from it.
2026-09-23 10:11:00 -04:00
dsantillan 0819d03efb Measure the iOS touch offset on the device that has it
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
Tests / test (push) Canceled after 0s
Press a row on an iPhone and the one above it reacts — but only sometimes, and
only after typing. That is the shape of the keyboard displacement the app already
fights in lib/viewport-guard.js: iOS slides the *visual* viewport inside the layout
one, everything `position:fixed` is painted against the layout viewport, and the
app and the finger disagree until something scrolls. The guard stands down while a
text field has focus on purpose (touching the page there threw the keyboard back
out — issue #242), and that is precisely the window this falls into.

Which correction is right depends on numbers that only exist on the phone:
visualViewport.offsetTop, innerHeight, the scale, whether the body is pinned. So
this adds a readout instead of a guess. Open the app with `vvdebug` anywhere in the
URL, type in a field, tap the row that misbehaves, and read what the viewports were
at the moment of that tap — plus which element the browser believed was under the
finger, which is the other half of the question ("did it hit the row above, or the
row it hit is not where it is drawn?").

It renders nothing without the parameter, and removing it is this file plus one
line in App.jsx.
2026-09-21 16:07:23 -04:00
dsantillan 903a435af3 Build a routine with AI: the screen the builder was missing
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
"Add exercise" now has a sibling: it asks which muscles, whether the session
starts with cardio, and how hard — then the Coach fills the routine in. Three
taps instead of picking ten exercises one at a time, and it is the only place in
the app that asks what you want to train today.

Why it exists in this shape:

- The Coach's own intake asks about the *person* — goal, days, equipment, limits
  — and is answered once. Nothing in it asks which muscles, so a three-day plan
  reasonably came back full body; that is what prompted this. The builder asks
  only what changes between sessions and reads the rest from the saved profile,
  so a second routine costs three taps and not a questionnaire.

- It adds a NEW routine rather than filling the one you opened. The questions are
  about a session you are about to build, and replacing the routine somebody
  opened would be the wrong guess. It does not touch the week either: nobody was
  asked about days.

- The muscle buttons are the catalogue's own body-part words ("back", "waist"),
  which the Library and the body map already translate, so a button and the list
  behind it cannot drift apart. "Light" and "Hard" are NOT reused for the effort
  chips: those keys already mean the light theme and hard sets, and a chip reading
  "Claro" for an easy session would be nonsense in Spanish.

The async half: requestPlan only *starts* a job (the server runs it in the
background and the result arrives on a status poll), so `awaitCoachJob` waits for
that job by the id of the last finished one — a proposal left over from an
earlier question can never be mistaken for this answer — and throws with the
job's own error class for jobErrorText to phrase.

Five tests drive the whole thing: the three steps, the exact questions sent (the
muscles as bp/tg selectors with cardio in the library, not only in the sentence),
that what comes back lands as a new routine with the cardios and the modes the app
owns normalised, that a failure is shown in the app's words and can be retried,
and that an answer with no routine is refused rather than added empty.

The 22 new strings exist in Spanish only, by decision. Rather than leave
check-locales.mjs permanently red — a guard nobody reads is not a guard — the
pending set is written down in src/locales/PENDING.md: the check still fails on
anything NEW, and the debt is a list somebody can work through.
2026-09-21 15:56:51 -04:00
dsantillan 996797bf00 Spanish exercise names for the whole catalogue
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
A Spanish profile now reads the catalogue in Spanish. Only pt-BR and hu had a
name pack, so every other language — Spanish included, which is this fork's
default — showed 1,324 English titles.

The pack is generated the way the pt-BR and hu ones were, with two differences
that matter to a self-hosted instance:

- `scripts/translate-es-exercise-names.mjs` talks to an OpenAI-compatible
  endpoint instead of the `claude` CLI, because that is what the instance
  already has: the same router the Coach runs on. Point it at one with
  COACH_BASE_URL / COACH_MODEL / COACH_API_KEY.
- It is resumable. Ids already in the source file are skipped, so a run that
  stops half way continues where it left off and a review only re-translates
  what it deletes. With 1,324 rows, a pass that had to start over would never be
  repeated.

Three rounds of review went into the file, each one caught by reading the output
rather than by the script succeeding:

1. "chin-up" and "pull-up" came back as English loanwords — the terms the
   catalogue itself uses — so the core vocabulary is now pinned in the prompt and
   asserted by the test (dominada, sentadilla, peso muerto, zancada, plancha…).
2. 142 rows led with the equipment ("Banda sentadilla", "Mancuerna press"), which
   is the English word order. Spanish names the movement first: "Sentadilla con
   banda". Those rows were re-translated, and the test now refuses a title that
   starts with a piece of equipment — "Peso muerto" is why "Peso" is not on that
   list.
3. Four rows dropped their (male) qualifier and four named variations kept an
   English head noun ("Hack squat con barra"); both were fixed, the first by hand
   since the review is allowed to edit the source.

The pack is honest about its provenance, like the pt-BR one: model-produced,
not reviewed by a native speaker, and the README says so.
2026-09-21 15:50:19 -04:00
dsantillan 40959de0a2 Forward the COACH_* variables to the api container in the deploy compose
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
The api service lists its environment explicitly, and that list is an allowlist:
a variable set in the host's .env reaches the container only when it is named
there. Everything else in the panel is used solely to substitute ${…} in the
compose file — which is how COACH_PROVIDER can sit in Dokploy looking applied
while the api never sees it, the Coach stays off, and no screen anywhere shows a
button. That is exactly what happened on this instance.

The `:-` defaults keep an instance that sets none of them byte-for-byte as it
was: an empty value reads as unset in coach/config.js.
2026-09-21 15:24:28 -04:00
dsantillan 238eb635c5 Configure the Coach from the environment
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
An instance can now be pointed at a model entirely from its environment — so a
container is redeployed with the Coach already working, and nobody has to open
an admin screen:

    COACH_PROVIDER=compatible
    COACH_BASE_URL=https://ai.example.com     # WITHOUT /v1 — the adapter adds it
    COACH_MODEL=vendor/model-name
    COACH_API_KEY=sk-...                      # or the provider's own variable

Naming a provider is the whole configuration, so it also turns the Coach on: an
instance started this way that then reported itself "off" would be a puzzle with
no clue in it.

Three decisions worth stating:

- The environment is the *base*, the way DEFAULTS is, and the saved file is
  layered on top: an admin who picked a provider in the app meant it, and this
  only fills what is absent.

- The key is deliberately NOT a field of the config. That object is cached,
  written to data/coach.json by any admin action, and included in the backup the
  docs tell people to make. envCredentialFor reads it from the process
  environment instead, so it is written nowhere and never surfaced by any route
  that reports configuration. A pasted credential still outranks it, and a filed
  one that fails to decrypt stays a failure rather than quietly falling back to
  a key nobody knows is being spent.

- What the environment supplies is stripped before the file is written. A saved
  config used to be written back whole, which would have frozen this start-up's
  values on disk — and since the file outranks the environment, a later change
  to COACH_MODEL would have been silently ignored.

Verified through the server's own path (config → credentialFor → jobEnv →
adapter) against the OpenAI-compatible router this fork runs on: a chest+triceps
request came back as a six-exercise routine with the cardio row first and
correctly marked `mode: cardio`.
2026-09-21 15:16:50 -04:00
dsantillan 327aa5211b The core of "build a routine with AI": muscles, cardio, intensity
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
The screen that will drive this needs three things underneath it, and all three
are here, tested, with no UI yet.

1. `librarySlice` can be narrowed to the muscles someone picked. A selector is
   `{ bp }` or `{ tg }` — the target muscle matters because "biceps" and "triceps"
   are both `upper arms`, and asking for one must not hand back the other — and an
   exercise is kept when it matches any of them, so "back and biceps" is one list.
   `catalogueOnly` drops the person's own exercises, which are the only rows in
   the app with no animation; the builder promises every pick can be watched.

   Both answers ride in the existing `intake` object rather than a second channel:
   the intake is already how "which muscles" reaches the payload, and it travels
   the whole way (route → job → build, and local → build) untouched. `cleanGroups`
   sanitises it, since it is the one intake field that reaches a filter rather than
   the model's reading.

2. `lib/ai-routine.js` — the three questions and what to do with the answer: the
   intake the model is asked with, and the routine it hands back, normalised for
   this app. Cardio lands in the library and not only in the sentence (a model told
   to start with cardio but handed no cardio exercise can only improvise, which is
   what it did the first time this was tried), a cardio row becomes one bout
   whatever set count came back, and a missing mode is read from the exercise the
   same way `modeOf` reads it everywhere else.

3. A validator fix found on the way: the cardio branch set `min` and `speed` but
   never `clean.mode = 'cardio'`, unlike the time and reps branches. The app
   recovered it from the catalogue, so nothing was visibly broken — but the bundle
   did not describe its own prescription, and a model that omitted `mode` (which is
   what a model prescribing "8 minutes of cardio" usually does) got "3 × 10 reps"
   with a stray `min` nothing reads. Now the mode is stated, and inferred from the
   catalogue when it is missing. `time` is deliberately not inferred: nothing in the
   catalogue says an exercise is held for seconds.

Verified against the real router behind gym.dploy.lol with the real pipeline: a
back+biceps request produced a 6-exercise routine from an 80/80/22 library slice.
2026-09-21 15:12:27 -04:00
dsantillan ea1af681c2 Read an answer that arrives with an SSE terminator glued to it
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
A gateway may answer a request that did not ask for streaming with SSE framing
anyway: the whole chat.completion object followed by "\ndata: [DONE]". That body
is not JSON, so readJson's strict parse rejected it, `data` came back null, and
the job failed with "unexpected response shape: Cannot read properties of null
(reading 'choices')" — while the answer it wanted sat in the first few kilobytes.

Not hypothetical: the OpenAI-compatible router behind this fork's own instance
answers exactly that way, which made every coach job fail against it with a
message that says nothing about the real problem.

The lenient read takes the first complete JSON value and ignores what follows,
counting braces outside of strings so a "}" inside a rationale cannot end the
scan early. It cannot paper over a truncated answer — an object that never closes
still returns null, which is what the token-limit path depends on — and there are
three tests for that: the terminator case, trailing junk after a complete object,
and an object that never closes.
2026-09-21 15:05:03 -04:00
dsantillan 1c201ab6f9 Merge #1: rebrand to KuentaGYM, pounds/Spanish defaults, build-at-deploy stack
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s
2026-09-21 18:39:37 +00:00
dsantillan 1a48efdbcc Add deploy/compose-build-at-deploy.yml for hosts that build at deploy time
Tests / test (pull_request) Canceled after 0s
The instance at gym.dploy.lol runs a five-service stack that clones the source
and builds it on every deploy, rather than pulling the images
docker-compose.yml names. That shape has three requirements nothing in the
repository stated, and getting any of them wrong costs a deploy:

- web-build has to copy the whole repository and build from frontend/. The
  frontend imports the Coach's core from ../../../api/coach/core/, so a build
  stage holding only frontend/ fails with nine UNRESOLVED_IMPORT errors — the
  reason web/Dockerfile copies api/coach/core/ into its build stage.
- The volume names have to be pinned with `name:`. Unpinned, a restyled stack
  silently creates empty volumes and the profiles and training history look
  gone.
- nginx needs client_max_body_size. Its default request limit is 1 MB while the
  app PUTs the whole profile to /api/data and the API accepts 5 MB — the sync
  starts failing with a 413 the UI cannot explain once a history grows past 1 MB.
  web/nginx.conf.template already sets 5m; this matches it.

The file is the shape that instance runs, with its volume names filled in.
2026-09-21 14:38:38 -04:00
dsantillan affac4a2a0 Add scripts/build-images.sh: build the two images and publish them
The images docker-compose.yml pulls are normally built by
.gitea/workflows/docker-publish.yml, which needs a registered Actions runner
and a PACKAGES_TOKEN secret. Neither exists on this instance's forge yet, so a
host that pulls rather than builds has nothing to pull — and the two builds are
easy to get wrong by hand: api builds from ./api, web from the repository root,
because the web image compiles frontend/ inside its first stage. A wrong context
produces an image that builds fine and then fails at runtime.

One command now does both and pushes them:

    GITEA_TOKEN=<token with write:package> ./scripts/build-images.sh

TAG, REGISTRY, OWNER, PLATFORM, PUSH and API_TARGET (default vs coach) are all
overridable, and the tags default to exactly what docker-compose.yml asks for.
2026-09-21 14:33:30 -04:00
dsantillan 87bfd6d4c4 Rebrand to KuentaGYM, and start a new profile in pounds and Spanish
The app is now KuentaGYM everywhere a user can see it, and a fresh profile no
longer starts on upstream's English/kg defaults. Both are this fork's decisions,
so both are pinned by tests rather than left to a find-and-replace.

Rename (1,270 references, 149 files)

- Visible surfaces: the Login/Home/mobile-onboarding wordmark, the Settings
  version line, the printed plan, the PWA title + manifest, and the 17 branded
  strings across all 14 locale packs.
- Infrastructure: repo links, the container images and the release endpoints now
  name git.dploy.lol/dsantillan/kuentagym; .gitea/workflows/docker-publish.yml
  publishes to this forge's registry instead of gitea.com.
- The Android/iOS application id stays ch.duartesantos.opengym on purpose:
  changing it would make the mobile app a different app that could never update
  an installed copy.

Three things the mechanical pass would have broken, fixed here

- The update check asked gitlab.com for upstream's releases and would have
  installed upstream's APK, putting the old name back on the phone. It now reads
  this fork's Gitea releases API (the assets shape differs), with the tests
  rewritten to the payload Gitea actually returns.
- Renaming the mobile state/pairing files (opengym-state.json,
  opengym-remote.json) would lose the on-device copy of a history whose WebView
  storage may have been evicted, and silently unpair the device. Both are read
  under their old names and written forward under the new ones.
- Renaming the exported plan-file marker (openGym_plan) rejected every plan
  shared before the rename as "not a plan file". Both markers are accepted.

Defaults: pounds and Spanish

- DEF.unit = 'lb', DEF.lang = 'es', plus every fallback that independently
  assumed en/kg (the <html lang> attribute, the Settings pickers, the Store, the
  MCP, the Coach payload).
- Server-generated push copy existed only in English and pt-BR, so a Spanish
  profile would have been notified in English; Spanish added.
- The demo seed states unit: 'kg' — its seeded numbers are kilograms, and
  inheriting the new default would have introduced an 82.4 lb lifter benching 60.
- The module-level language in i18n-core stays English: it is the only language
  whose strings need no pack, so `t()`, dates, numbers and lists agree before a
  pack loads. Starting there on 'es' formats a Spanish-shaped UI with English
  strings.

Also
- api/package.json's test glob missed push-messages.test.js and
  verify-error.test.js, which sat beside the modules they cover and never ran.
- README, docs/, website/ and the issue templates no longer describe upstream's
  GitLab/GitHub pipeline, Discord, sponsorship or public demo as if they were
  this fork's; upstream history and attribution are preserved (NOTICE.md).
2026-09-21 14:29:54 -04:00
Duarte Santos f91cde15a1 v1.3.8: twenty-four reports, the four promised items, and eleven community pull requests
versionCode 22. The milestone was due on the 27th; it ships a week early because the QA round
that followed the bug fixes found — and closed — enough to be worth releasing on its own.
v1.3.8
2026-09-20 21:26:06 +02:00
Duarte Santos 90a1e8956a Admin: delete an account, not just disable it (#107)
Disabling locks someone out but deliberately leaves their state file and credential on disk, so
'no data remains' was not reachable from the dashboard — which is what the request asked for.

POST /api/admin/user/delete removes the user, their passkeys, their push subscriptions, their
presence entry, their training history and any Coach credential of theirs. Two refusals, because
nothing in the UI could undo either: an admin cannot delete their own account, and the last
remaining admin cannot be removed. The invite code they joined with stays burned — it was used,
and freeing it would quietly widen an invite-only instance.

In the dashboard it asks twice, naming the account both times, and offers their data as a
download first: the training history is theirs. Five tests drive the real server.
2026-09-20 21:04:56 +02:00
Duarte Santos ae1c8fe8b2 Weights can show two decimals, for quarter plates and microplates (#139)
A per-side figure off kg plates lands on .25 and .75, and one decimal reported those as .3 and
.8 — close enough to be wrong, and no use at all to anyone loading microplates.

Settings carries the choice and lib/format.js reads it the way it already reads the date
locale, so all sixty-odd places that print a weight follow without being touched. It only ever
shows precision that is already in the number: a whole number still prints whole, 62.5 is 62.5
either way, and nothing about what is stored or how it rounds changes.
2026-09-20 21:04:56 +02:00
Duarte Santos 22c2ff9d2c Bar weight: 'No bar' for a Smith machine that carries its own carriage (#138)
Typing 0 in the bar field meant 'clear the override', so it snapped straight back to the 9 kg
default and the plate math, the drop-set steps and the warm-up ramp all counted a bar that is
not in your hands.

A stored 0 is now a value of its own — no bar — and the key being absent is what means 'use the
default for this bar type'. A switch in the bar-weight editor sets it; turning it off gives the
default back. The chip in a session drops the bar half and shows the plate math alone, which
with no bar is simply half of what you logged.

Two existing tests asserted the old meaning of 0 and are updated: that is the behaviour change.
2026-09-20 21:04:44 +02:00
Duarte Santos 82646843c6 Plan: move a routine up or down, and every screen follows (#142)
Routines sat in the order they were created, so a plan added in the wrong order stayed that
way — the reporter's PushA PullA LegsB PushB PullB LegsB could not be straightened out.

Arrows on each row in Plan, the same pair the routine editor uses for exercises. `S.routines`
is the one order the whole app reads, so moving a routine here moves it in the Start screen,
the day-assignment sheets and every routine picker at once, which is what the request asked
for. They are left out entirely when there is only one routine to order.
2026-09-20 21:04:44 +02:00
Duarte Santos 0345abc925 No one-rep-max calculator on an assistance machine — it was offering a max of the help you were given (#232) 2026-09-20 20:31:47 +02:00
Duarte Santos 6aa43e7a06 Assistance machines: a sync no longer hands the help back, and Stats reads the best the same way (#232)
Two readers were still folding the kept load upwards, so on a signed-in profile the lighter
setting was saved and then overwritten on the next sync — the symptom the fix was supposed to
remove, one layer down.

`sync-merge` kept the larger `w` per exercise, on the stated grounds that the app only ever
raises it. That is no longer true: on an assistance machine it lowers it, so merging with a
device that still held 30 kg handed back the help the other one had just dropped. Both sides now
go through `beatsWeight`, which knows which way each exercise runs.

Stats tracked its per-exercise best with a plain maximum, so the curve's "best" line disagreed
with the exercise's own record. Weighted reps work now folds by the exercise; reps, duration and
speed are unchanged, since more is better in all three.

Also makes the list-view scroll test deterministic. It waited on the component's 0 ms fallback
and raced under a loaded full-suite run; the test DOM now carries a frame queue the test drains
itself, which is the requestAnimationFrame path a browser actually takes.
2026-09-20 20:27:24 +02:00
Duarte Santos 542c3f493a Serving openGym under a subpath works, with or without the prefix reaching the container (#238)
The app's assets were already relative — the shell loads fine from any directory, which is how
the demo lives under /demo/. What assumed the site root was the API call: `fetch('/api/...')`
went to the proxy's own root, where there is nothing to answer it, so behind
`https://example.com/gym/` the app booted and then could not talk to its server.

It now asks its own address instead: `appBase()` reads the directory the app is being served
from, which the router never leaves — every screen is a hash, and a path that is not a file is
sent back to the app's root before React boots. A proxy that strips its prefix (Caddy's
`handle_path`, Traefik's StripPrefix) therefore needs no configuration at all.

For a proxy that passes the prefix through, the web container takes `BASE_PATH=/gym`, rendered
into its nginx config at start-up like the other settings, so it applies to a prebuilt image.
Wired through docker-compose.yml as well — a documented setting the compose file does not pass
on is no setting at all.

Both shapes were checked in containers rather than read: with BASE_PATH empty the shell, the
assets, /api and the deep-path redirect behave exactly as before; with BASE_PATH=/gym all four
work under the prefix and the redirect stays inside it. The first attempt passed at /gym/ and
404'd /gym/assets/app.js, because a regex location outranks the prefix block and never saw its
rewrite — the cache-control blocks carry it too now. The built app was then loaded in a browser
under /gym/ and its own requests go to /gym/api/config and /gym/api/me.

Reported by leon332157.
2026-09-20 20:16:52 +02:00
Duarte Santos f7b9a80a93 Assistance machines run the other way round: less help is the record, and the plan takes help away (#232)
On an assisted pull-up or dip the stack carries part of your body weight, so 20 kg of help is
a harder set than 30. The app read it like every other lift: 30 kg stayed the best, dropping to
20 was not a record, and progression answered a clean session by asking for even more help.

Which exercises these are is deliberately narrow. Twenty-nine entries in the catalogue have
"assisted" in the name, but only eight are the machine: the rest are partner-assisted stretches,
a medicine-ball twist, band and bodyweight leg curls, where the weight is ordinary load and
inverting it would be the same bug pointed the other way. The rule is therefore the leverage
machine whose name says assisted — and `assisted: true` (or false) on a custom exercise or on a
routine's config overrides it in either direction.

What changes for those eight: the best load folds to the smallest, in a session and across
history; a lighter set is the PR and what the app offers next time; progression takes a step of
help away after a clean session and gives one back on a stall, with wording that says so
instead of "2.5 kg more"; and they are out of the estimated one-rep max entirely, because Epley
on the help you were given rises as you get weaker.

A logged 0 counts as "no load entered" rather than a set done with no help at all, so it cannot
invent a perfect record and ask for negative assistance afterwards.

The progression tests picked their plain lift as "the first catalogue entry that is not cardio,
legs, back or bodyweight" — which is `assisted chest dip`. They now exclude assistance machines
explicitly, since they are about the ordinary direction.

Reported by dpatrongomez. PR #231 fixes the same issue by matching the name alone.
2026-09-20 20:10:21 +02:00
Duarte Santos b5d55467d0 Progression reads the sets the plan asked for, not the extra ones logged on top (#233)
An extra set — the one you add because you felt strong, or to chase a heavy single — was read
as part of the prescription. A heavier bonus set pulled the weight for the next session up
with it, and a bonus set taken short of the target reps reported the whole session as missed
and started counting stalls toward a deload.

`readSession` now stops at the planned number of work sets. A set past that is still logged,
still counts in the volume, the PRs and the history; it just has no say in what the plan does
next. A session with fewer sets than planned is short exactly as before.
2026-09-20 20:01:33 +02:00
Duarte Santos a7d710902c iOS: the keyboard stays open — the viewport guard no longer blurs the field you are typing in (#242)
Tapping the name or invite-code field on the login sheet threw the keyboard straight back
out, about four times in five, and the same happened in every other sheet on iPad and iPhone.

`realign()` corrects a page iOS left displaced after the keyboard closed, and it used to let
go of a text field that still held focus, because WebKit does not blur an input when a button
is tapped and iOS only puts the viewports back once focus has left. The guard around it is
`keyboardOpen()`, which compares `innerHeight` with the visual viewport — and both of those
move while the keyboard animates in, because the browser chrome collapses at the same time.
Measured on iOS 26.6: `innerHeight` fell 684 → 374 while the visual viewport sat at 158, so
the difference dipped back under the threshold and the keyboard read as closed roughly 100 ms
after every tap. The guard then blurred the field the person had just tapped.

The detector cannot be made reliable, so nothing acts on it while somebody is typing: with a
text field focused, `realign()` now does nothing at all — no blur, no scroll, and no unpin of
a body that a sheet has pinned. The correction still runs from `focusout`, which is when iOS
actually needs it, and the two cases the blur was written for already let go of the field
themselves: Workout.jsx blurs when a set is ticked, Modals.jsx when a sheet opens.

Reported by FabianReitz with a screen recording, and diagnosed by hectorroaz, who instrumented
a build on a real device and posted the timings that show the mid-animation misfire.
2026-09-20 19:56:42 +02:00
Duarte Santos c04fd512d4 Rename workout: the two strings #228 brought in are translated in all fourteen packs, and pt-BR inherits them from pt-PT 2026-09-20 19:45:22 +02:00
Duarte Santos 4f003073d0 Merge #190: i18n(de): use standard ß, not Swiss ss (mkoester) 2026-09-20 19:43:05 +02:00
Duarte Santos 9dcda4bfc2 Merge #234: accessibility: typable weight input (Strazdonis) 2026-09-20 19:43:04 +02:00
Duarte Santos 1bb0806436 Merge #237: fix(home): a door to the Start screen — freestyle and Other routines are unreachable on a planned day (kurktchiev) 2026-09-20 19:43:04 +02:00
Duarte Santos b9079c98db Merge #228: workout: allow renaming workout title from header menu (ncbachh) 2026-09-20 19:43:03 +02:00
Duarte Santos 069cb6d9f9 Merge r3/custom-tg-edit: QA round 3 2026-09-20 (dev team) 2026-09-20 18:05:27 +02:00
Duarte Santos 1ee9970c71 Merge r3/admin-null-routine: QA round 3 2026-09-20 (dev team) 2026-09-20 18:05:27 +02:00
Duarte Santos 6859624e0f Merge r3/setrow-band: QA round 3 2026-09-20 (dev team) 2026-09-20 18:05:27 +02:00
Duarte Santos d35ba5643b Merge r3/layout-collateral: QA round 3 2026-09-20 (dev team) 2026-09-20 18:05:27 +02:00
Duarte Santos a0a44cb6c0 Phone-width layout: a list row's title asks only for its own longest word, a date or time field drops a line rather than the screen edge, and the page title steps down instead of shredding
Three pieces of collateral from d7bb67a, which fixed C8/C23 and C25 with two blunter
rules than those findings needed. Both of its fixes stay fixed; what they cost the
rows and titles around them does not.

.lrow-m, the title column. The 104px floor was the width of one long word, but every
row pays it, and a row whose only flexible part is the title has nothing else to give.
In the backfill sheet's Date and Start-time rows the floor came straight out of the
<input type=date>: at 320px it ended 23px off the right of the screen with its calendar
picker entirely off-screen, so on a small phone there was no way to open the picker at
all. The floor also took space from values that used to fit — "Freies Training" became
"Freies …", and the Rule row's value dropped from 141px to 113px. min-width:auto, the
flex default this rule had switched off, is the floor the Progression row was actually
asking for: its own longest word, which for "Routine" is 63px and for "Progression"
96px. Every row now asks for exactly what its title needs and no more. It also closes a
row the floor never reached: German "Intensivierungstechnik" ran 18px over the value
beside it on v1.3.7 and on the branch, and now it does not.

The two rows with a date or time field. Even at its own longest word a title can leave
that field nothing: Polish "Godzina rozpoczęcia" plus the clock is 17px more than a
320px row holds, and the same is true of the Settings reminder row, whose field hung
3px off the screen in every language. Those rows now wrap the field onto a line of its
own under the title, still flush right — the same shape a row with an inline segmented
control already uses when its control and title cannot share a line.

.hdr h1, the page title. min-width:0 on the title block and flex:none on the button are
what keep the header button reachable, and they stay. What came apart was the title left
in the 95 to 125px the Library's "By muscle" button leaves it: hyphens:auto spends a
character's worth of width on the hyphen itself, and in a box that tight that was the
difference between two lines and three — "Упражнения" rendered as "Упра / жнен / ия" in
a 170px header, "Ćwiczenia" and "Gyakorlatok" the same. Below 420px, every phone width
we test, the title now drops a step to 30px, at which all 14 packs take two lines at
most with a character of slack; hyphens:auto is gone, and a word that still does not fit
is broken with overflow-wrap:break-word rather than :anywhere, which moves the whole word
to the next line before breaking it — :anywhere broke "Bartholomew_Jones" mid-word even
at 412px, where a line of its own was waiting for it.

Measured on the QA rig (scripts/opengym-qa/run/r3-layout-collateral/, en/de/ru at
320/368/412 plus all 14 packs at 320/368, the header set also with Roboto injected):
  backfill  <input type=date> / <input type=time> right edge at 320px, de: 343 / 325
            (23px and 5px off a 320px screen) -> 288 / 288, both inside the card, both
            picker icons visible. pl "Godzina rozpoczęcia" 325 (5px off) -> wraps, 288.
            en and ru 288 / 288 on one line. 360, 368 and 412 clean in every pack.
  Routine   value box at 320px, de: 72px ("Freies …") -> 113px ("Freies Train…"). The
            German string wants 119px and the row has 176px for title plus value, so
            v1.3.7's 119px was bought by letting "Routine" spill 6px into the value's
            box. en 72px (clipped) -> 75px, not clipped, as on v1.3.7.
  Rule      value box at 320 / 368 / 412: 113 / 161 / 191 -> 141 / 167 / 191, which is
            v1.3.7's 141 / 167 / 191 exactly.
  C8/C23    "Progression" title box / how far the title runs onto the value, 320px:
            v1.3.7 37px / +47, branch 104 / -20, now 96 / -12 (ru 102 / -12). 368px:
            v1.3.7 65-74 / +10..+19, now 96 / -12. ru 412: v1.3.7 80 / +10, now 102 / -12.
  C25       Library button right edge, ru at 320 / 368: v1.3.7 388 / 388 (off both
            screens) -> 304 / 352, button reachable. Title lines at 320: branch
            Упра/жнен/ия, header 170px -> Упраж/нения, 126px; hu Gyak/orlat/ok, 151px ->
            two lines; pl Ćwic/zeni/a -> Ćwicz/enia. ru at 412 is back to one line.
  headers   15 packs x /library /settings /home x 320/368/412 with Roboto: 135 headers,
            none over two lines, every button on screen. The one title that still takes
            three lines is "Hi Bartholomew_Jones" at 320 and 368 — a 17-character token
            with no break in it; at 412 it is two lines, where the branch had three.
  sweep     Every .lrow of Settings, the routine editor, the exercise config sheet and
            the backfill sheet in all 14 packs at 320 and 368: 1170 rows, 30 of them
            poking out of their row on the branch, 0 now.
Known trade: German "Intensivierungstechnik" and "Keine" cannot both fit a 320px row.
The title now has its word and the value ellipsises to "K…" (46px -> 28px) where before
the title ran 18px over it. Thai wraps "การเพิ่มระดับ" onto two lines at 320 rather than
holding a 104px column open for it.
Vitest: 117 files, 1535 tests green (1533 plus the two added here); locales in sync; the
source-string baseline stays at 33. No new user-facing strings.
2026-09-20 17:46:09 +02:00
Duarte Santos d302088c11 Set rows: every give-way now lasts until the full-size row fits — the L/R effort −/+ shrink once more at 360–365 px and the list view's cards keep their extra width to 404 px (QA re-test of 0b1072d)
Two narrow bands were left where a set row was wider than the content box of the card it sits in,
so its done tick reached into the card's side padding: 360–365 px on an L/R row with an effort
column (over by 6, 5, 4, 3, 2 and 1 px, in a sets card inside a superset card or a list unit,
cards, list and compact alike, with a rating logged or not), and 401–404 px on a plain row with
an effort column in a superset in the list and compact view (over by 4, 3, 2 and 1 px). Nothing
was clipped and nothing left the screen — the page never overflowed and every number field still
had scrollWidth == clientWidth — but a row may not stand in its card's padding.

Both are the same shape: a give-way that ends one pixel before the layout it hands back to fits.
At 401 px the nested cards' padding snapped back to 16 + 14 + 14 per side and took 48 px off the
row in the one pixel the screen had gained, leaving 281 px for cells that want 285; at 360 px the
effort −/+ returned and asked for 35 px more than the row had. So each give-way now ends where
its full-size counterpart fits. The padding give-back for the list view's units, superset cards
and sets cards runs to 404 px instead of 400, because 405 px is the width where the three full
insets and the row's 285 px of cells first add up to the screen. And the effort column, which had
one step (nothing below 360 px, 64 px from 360), gets the intermediate one it was missing: from
360 to 365 px an L/R row's pill is 56 px, its −/+ shrinking to a 12 px floor. They are what that
cell sheds first — a pixel lower they go altogether — and the rating keeps its 28 px tap target.
The weight and reps columns were deliberately left alone: they have the 41 px numbers and the
18 px button floors of every other row, and "WEIGHT (KG)" needs 75.5 px of the weight column's
77, so taking the six pixels there would have wrapped the header onto a second line at the most
common phone width there is.

Measured with scripts/opengym-qa/run/r3-setrow-band/sweep.mjs on the QA rig (slot 31, slot 71 for
fixes-0917), a 1 px sweep from 320 to 440 px across cards / list / compact x effort none / RIR /
RPE x steppers on / off x a plain and an L/R row inside a superset and outside one (3630
measurements per build, values 102.5 / 227.5 kg, 12 / 100 reps per side, RIR 2.5 / RPE 8.5,
Liberation Sans as the Roboto-metric proxy): before, 64 measurements had a row past its card's
content box — exactly 360–365 and 401–404 px — and after, none, with no clipped number field, no
card or unit past its parent or the screen and no page overflow anywhere in the sweep. The empty
effort cell (empty-eff.mjs) was over by the same 6 / 3 / 1 px at 360 / 363 / 365 and is now 0.
The effort cell is 56 px wide at 360–365 px and 64 px again at 366; the weight column stays 77 px
and its header label one line (before: one line at 77 px, two at 73). The picker still opens:
tap-effort.mjs at 360, 363 and 365 px in cards and list, taps at the value's centre ±6 px, 30 of
30 opened it. 320, 368 and 412 px lie outside both edges, and fix-setrow-layout/measure.mjs — the harness of
0b1072d, 108 combinations of width, view, effort, steppers and superset — prints byte-identical
output on this build and on fixes-0917, 0 with problems (QA C2, C3, C4, C5, C21, C22, C24).
2026-09-20 16:29:30 +02:00
Duarte Santos 36123c0d19 Admin: a stored state written before the entry filter opens the drill-down instead of 500ing it (QA C16 follow-up)
GET /api/admin/user mapped S.routines straight off disk — `r.id` on every entry — so a single
null routine threw, the route answered 500 {"error":"server error"} with a stack trace in the
log, and the sheet never left "Loading…". The Disable button lives inside that sheet, so the
one account an operator opened the dashboard to stop was the one they could not: exactly the
end state C16 described, reached through routines instead of workouts. C16 hardened the sheet
and taught PUT /api/data to drop such entries, but a document v1.3.7 accepted still sits on
disk and answers to nobody.

A `records(list)` helper next to readState now hands every reader the entries of a stored list
and nothing else, and both admin routes go through it: the routine map, the body-weight log,
the workout history (whose `.slice()` threw in its own right when `workouts` was an object
rather than an array) and the user list's workout count, which counted entries the drill-down
then dropped and read `null` for a non-array list. A routine's exercise count counts entries
too, rather than the length of whatever `ex` happens to be. PUT /api/data reuses the helper
for the filter it already had, unchanged in behaviour.

The reminder tick walks the same two lists outside any route: a null entry threw there, was
logged and skipped, and cost that profile every reminder from then on, day after day. It
skips the entry now, not the profile.

Measured on QA slot 32 with each shape planted directly in the slot's data dir
(scripts/opengym-qa/run/r3-admin-null-routine/plant.mjs, shots alongside it):

  routines [null, r]     before  GET /api/admin/user 500, sheet "Loading…", 0 Disable
                                 buttons, 16 stack frames in api.log
                         after   200, sheet shows Workouts 1 · Weigh-ins 1 · Routines 1,
                                 disable and re-enable both land in the audit log,
                                 0 stack frames, no console or HTTP errors
  workouts/routines as   before  500, same dead sheet, 12 stack frames
  objects, not arrays    after   200 with empty lists
  bodyweight [null, b]   before  200 but "Weigh-ins 2" for one weigh-in (4 for one plus
                                 three junk entries)
                         after   1, the number of weigh-ins there are
  null and shapeless workout entries, a null customEx, absent lists and an ordinary
  profile all open, disable and enable, before and after.

api/test/server-admin-state.test.js covers both admin routes against ten stored shapes, and
server-reminder.test.js gains the null-entry case: 188 api tests (was 185). Frontend
untouched — the sheet's own guard from C16 still does the work the server cannot: 1533 vitest
green, 14 locales in sync, 33 demo-only source strings.
2026-09-20 16:01:26 +02:00
Duarte Santos 668002b066 Custom exercises: un-ticking the target hands it to a muscle you tapped, not to the topmost one (QA C10 follow-up)
cc116bd gave a custom exercise the primary tapped first as its target and let an edit keep that
target while the muscle is still a primary. Un-tick it, though, and the fallback was the first
entry of the form's primaries — and for an existing exercise that list is seeded from the store,
which holds the muscles in the map's head-to-toe order. So editing "QA Hip Thrust Pull" (upper
legs, primaries Traps/Glutes/Hamstrings, target Hamstrings), dropping Hamstrings and tapping
Quads, put the target on Traps and the library, picker and Muscles rows read "Traps · barbell"
again: exactly the symptom C10 was about.

The form now remembers which primary chips were tapped in this sheet, in that order. That is the
only record of the user's own order, since the stored list has none, and a dropped target goes to
the first of those taps that is still a primary. A tap that only turned a chip off is skipped with
it, and the sorted list stays as the last resort for the user who drops the target and adds
nothing in its place. Stored primaries and secondaries keep the map's order.

Rig check (slot 33, 412 px, seeded exercise, un-tick Hamstrings + tap Quads): tg "quadriceps",
primaries ['trapezius','gluteal','quadriceps'], library row "Quads · Barbell" - the same script on
the branch build reports tg "trapezius" and "Traps · barbell". The C9/C10 sweep (create tapping
Hamstrings, Glutes, Traps; untouched re-save; library, picker, config, Muscles and workout rows in
English and German) prints byte-identical output on both builds: tg "hamstring" before and after
the re-save, no raw muscle ids, cardio reads "Herz-Kreislauf".
2026-09-20 15:52:29 +02:00
Duarte Santos 0fa35030ee Merge fix/layout-misc: QA round 2026-09-19 (dev team) 2026-09-20 13:58:21 +02:00
Duarte Santos 145c668dd1 Merge fix/setrow-layout: QA round 2026-09-19 (dev team)
# Conflicts:
#	frontend/src/views/Workout.test.jsx
2026-09-20 13:58:21 +02:00
Duarte Santos 0b1072dbf8 Set rows: the number outranks the buttons in every row — 102.5 kg, 100 reps, 10.5 km/h, RPE 8.5 and a drop's weight stay readable at 320/368/412 px, and the header sits over the L/R cells (QA C2 C3 C4 C21 C22 C24 C5)
The weight/reps steppers gave their two 32 px buttons priority over the number between them, so
on narrow phones the field shrank to nothing: at 320 px a fresh profile (no effort column,
buttons on) showed an empty reps field and "102" for 102.5; per-side rows lost the reps number at
368 px, and inside a superset at 412; the cardio row's 10.5 km/h read "10"; a per-side drop set's
two fields collapsed to 0 px; with an effort column the decimal weights lost their last digit at
320 px; a weighted timed hold showed "102.!" for its load at every phone width; the logged
effort's value shrank to 4 px under its own digits so a tap on it stepped the rating instead of
opening the picker; and the column header over per-side rows stood 17-23 px left of the cells
because it never accounted for the L/R badge. Only the #235 mitigations existed, scoped to rows
with an effort column.

Every number field now reserves the widest value it shows at its own font (`--num`, plus the
field's padding and 2 px against font rounding), the cell is never narrower than that plus two
button floors (18 px, 16 px on the tightest rows), and the buttons shrink first. The weight and
reps buttons, that is: the effort cell is a `.stp` too and its value is a `<button>`, so that
rule stays off it and the value keeps filling its cell instead of sitting in a 32 px box with
dead space beside it. The effort column keeps a 28 px value with 16 px floors; where a row cannot
hold three numbers and six buttons — every row below 360 px, and an L/R row inside a superset in
the list view below 430 px, where three insets leave it 260 px of a 412 px screen for the 277 its
cells want — the effort's −/+ give way and the value alone stays, still opening the picker; from
430 px up that row keeps its −/+ like the plain row above it. A timed hold logs the seconds first
and the load second, so those two columns swap their reserve and their share at every width, not
only below 360. The header carries `per-side`, `timed` and `plain` from Workout.jsx so its columns
freeze exactly where the cells do; per-side drop rows no longer pay the straight row's 32 px
indent twice; a weighted timed hold (one control more than a straight row) gets the effort-row
sizing below 360 px. The list view's grid gets minmax(0,1fr): with floors on the cells the default
`auto` track grew a unit past the screen and carried the ticks off it, which is also why an
earlier draft's list numbers looked fine. The sets card nested in a list unit or superset card
gives up 8 px of side padding at <=400 px so every row has the same 256 px at 320 as in a plain
card.

Measured with scripts/opengym-qa/run/fix-setrow-layout-2/measure.mjs on the QA rig (slot 70), one
fresh guest per combination, 320/368/412 px x cards/list/compact x effort none/RIR/RPE x buttons
on/off x plain/superset (108 combinations), values 102.5 / 227.5 kg, 12 / 100 reps, 22 min @
10.5 km/h, timed holds of 120 s @ 32.5 kg, 90 s @ 102.5 kg and 600 s @ 227.5 kg, per-side
22.5 x 12 and 102.5 x 100 with drops, RIR 2.5 / RPE 8.5, Liberation Sans as the Roboto-metric
proxy: before (fixes-0917) 0 of 108 clean, 698 clipped fields and the list unit 23 px wider than
a 320 px screen; after 108 of 108 clean, no row or unit overflow, header drift 0 px on plain and
per-side rows, the tightest field ("227.5" in a drop row) 2.1 px of slack. The same matrix at 768
and 1280 px (48 combinations): clean. The timed load — the field the earlier run only ever put
32.5 kg in — has 37 px for "102.5" and "227.5" at 320 px, 44 at 368 and 51-67 at 412, with
scrollWidth == clientWidth everywhere (before 17-29 px for a 41.7 px value, i.e. "102.!").
Effort cell (tap-effort.mjs, RPE 8.5, taps at the value's centre +-6 px, 320/368/412, cards and
list): 30 of 30 open the picker (before: 2-3 of 5 stepped the rating at 320/368); its value is
28 px next to 24.4 px of text on a phone and 71.5 px in a 115 px cell at 1280 px, centred between
the −/+ (before 32 px in a 105 px cell, bunched left). L/R rows in a superset in the list view
(budget.mjs, ss-eff.mjs): the effort −/+ are gone at 320-429 px and back from 430 px, where the
row is 278 px wide and nothing overflows — 1 px short at 428 — and at 768 and 1280 px both
buttons and a 28-35 px value are there, as on the plain row beside them. Per-side drop inputs
(drop-rows.mjs): 34/24 px for "22"/"5" at 320 cards, 368 list+superset and 412 list+superset
(before 0/0, 5/5, 13/13). Cardio speed "10.5" (cardio-speed.mjs): 35-45 px for a 32.5 px value at
every width and view (before 0-33 px). Header vs cell centres (header-drift.mjs): 0 px in all 12
configurations (before w -18..-23, r -6..-14).
2026-09-20 12:50:14 +02:00
Duarte Santos cca8ecd848 Merge fix/custom-muscles: QA round 2026-09-19 (dev team) 2026-09-20 07:01:54 +02:00
Duarte Santos d7bb67a1c0 Phone-width layout: the double-progression row wraps into pairs, the Progression title keeps its width, page headers give way before their button, the body-weight buttons drop a line (QA C6, C8/C23, C25)
Four fixes to layouts that only fall apart on narrow phones, all pre-existing:

Exercise config sheet (C6). Double progression on a weighted exercise puts four
steppers in one .cfgrow (Step, Reps from, Reps up to, Deload 1RM). Each spends 64 px
on its buttons, so four abreast left the input 1 px at 320 and 13 px at 368 — "1.25"
read "1.2", "90" read "9(". The row now carries `cfgrow-4` when it holds the four,
and below 480 px it wraps into two pairs (basis half the row minus half the gap).
From 480 up four abreast still leaves 41 px, enough for "1.25".

Routine editor, "Progression" row (C8, same as C23). .lrow-m had a basis of 0 and got
only what the capped value left over: a 37 px box for a 96 px title at 320, so
"Progression" was painted over by "Linear progression". The title column now keeps
104 px, the width of one long word; the value shrinks and ellipsises as before. This
is the same floor the segmented-control rows already use (150 px), which the more
specific rule keeps. All 60 title+value rows in the 15 packs fit at 320 px.

Page header (.hdr) (C25 plus the two reported header cases). The title block could
not shrink below its longest word, so "Упражнения" at 34 px, "Izom szerint" next to
it, or a profile name like "Hi Bartholomew_Jones" pushed the Settings gear or the
"By muscle" button off the right edge, and before that the button's own label wrapped
into two lines. The title block gets min-width:0, a word that does not fit is
hyphenated (hyphens:auto — <html lang> follows the app language) and broken anywhere
only as a last resort, and the header button is flex:none so it keeps its width.

Body-weight card header, Home and Stats. In German the title plus "Ziel" and
"+ Eintragen" outgrow a 320 px card by ~55 px and the last button poked past the
card; the header (`bw-head`) may now wrap the button pair onto a second line, still
flush right.

Measured on the QA rig (scripts/opengym-qa/run/fix-layout-misc/measure.mjs, en/de/ru;
after in DejaVu and with Roboto injected, before in DejaVu):
  C6  input clientWidth for "1.25" (needs 37): before 1 / 13 / 24 at 320 / 368 / 412
      → 74 / 98 / 120, two lines; 480: 41, 600: 71, one line (c6-wide.mjs)
  C8  title box / paint-over onto the value, 320 en: before 37 px / 47 px over
      → 104 / −20 (Roboto −27); 368 de before 65 / 19 → 104 / −20; 412 ru before 80 / 10
      → 104 / −14; no title clipped in any of the 9 cases
  C25 Library button right edge, viewport 320 / 368: ru before 388 / 388 → 304 / 352;
      Roboto 304 / 352 / 396 (412), title hyphenated "Упраж-нения" at 320 and 368
  hdr Home gear right edge with "Hi Bartholomew_Jones": before 423 at every width
      → 304 / 352 / 396
  bw  last button past the card's padding, 320 de: before 53 px → 0 (second line);
      368 de before 5 → 0
Regression sweep (sweep.mjs: /home /settings /plan /plan/r /stats /library /muscles
/history at 320 and 368 in en/de/ru/hu): no page overflow, nothing off-screen, no row
wider than its card. Vitest: 115 files, 1520 tests green; locales in sync; the
source-string baseline stays at 33.
2026-09-20 02:36:03 +02:00
Duarte Santos 185afe6a96 Merge fixes-0917 into fix/custom-muscles: the cardio label translates through one key (QA C9 follow-up)
Both sides cured the same English "Cardiovascular system" for the built-in cardio exercises:
this branch (6796e55) added a capitalised "Cardiovascular system" key to the 13 translated packs,
fix/copy (10ff64b, merged into fixes-0917) made MUSCLE_NAME['cardiovascular system'] lowercase so
the packs' existing dataset key translates it and the places that show it capitalise with CSS.
One mechanism is enough: the lowercase key stays, the 13 capitalised duplicates go, and the pt-BR
guard is back at fixes-0917's numbers (645 overrides, 647 inherited, fingerprint 185cca3d…,
regenerated with scripts/pt-br-inheritance-fingerprint.mjs). The locale packs are now identical
to fixes-0917; the branch's own changes (C10 target = first-tapped primary, C9 MUSCLE_NAME at the
picker row, config sheet, Muscles rows and workout tag) merge cleanly on top.
2026-09-20 02:19:30 +02:00
Duarte Santos fcb2fc576a Merge fix/copy: QA round 2026-09-19 (dev team) 2026-09-20 02:05:07 +02:00
Duarte Santos cb4fc99dcc Merge fix/list-scroll: QA round 2026-09-19 (dev team) 2026-09-20 02:05:07 +02:00
Duarte Santos 6a86f54e4c Merge fix/api-admin: QA round 2026-09-19 (dev team) 2026-09-20 02:05:06 +02:00
Duarte Santos 1d6e49fb2b Merge fix/import: QA round 2026-09-19 (dev team) 2026-09-20 02:05:06 +02:00