Repository navigation
Conversation
there was no rucking activity. a ruck had to be logged as a hike or a walk, and the one number that defines it, the weight carried, had nowhere to go. rucking is a route activity with gps, listed beside hiking and priced at the compendium backpacking rate (17010, 7.0 met). that rate is flat, so it reads the same for a light pack and a heavy one. no load-aware estimate is added here; that is a metric and belongs in analytics. the pack weight is asked for on the setup screen and stored on the session (sessions.load_kg, schema v63), because it changes from one outing to the next. the screen opens on the weight used last time, shown before start; someone who has never entered one sees a dash, and a dash stores null. the profile body weight the session started with is banked beside it (body_kg), so the share of body weight on the summary describes that day and not today's profile. the summary shows the pack weight where it can still be corrected, since a forgotten or wrong one is only noticed afterwards. putSession replaces the whole row, so stopWorkout carries both columns in the row it writes, whichever way the session was ended, and a retime carries them too. two things follow from adding the type. rucking joins the gait step types on hiking's footing: the same walk, arms free to swing. and a session that carried weight is left out of the per-session vo2max estimate: that estimate reads the split's speed as unloaded, so the same split under a pack would bank a lower figure than the person has. apple health and health connect have no rucking type, so a ruck is exported as a hike. a whoop "hiking/rucking" import still lands as hiking. the icon is a rucksack drawn for it on lucide's grid and stroke rules, since lucide's only backpack is a school bag. it ships as a one-glyph font (assets/fonts/EdgeIcons.ttf, built from the svg beside it by tool/gen_edge_icons.py), because an activity's icon is an IconData everywhere it is drawn, so no call site changes. the whoop freeze golden snapshots every sessions column, so its test drops the two new ones while they are null, the way it already drops day_result.imported. a value there would be one the derive made up, and it still fails. the goldens themselves are untouched. Authored by : BT
a ruck on a treadmill has no route. logged as rucking it arms gps indoors, where a fix wanders and the distance it adds up is not one anybody walked. this adds the indoor ruck as its own entry, the way treadmill sits beside running and indoor bike beside cycling: no gps, tracked by time and heart rate, and the same pack weight. the belt shows a distance and nothing in the app can measure one indoors, so the summary takes what the user reads off the machine. it is stored in its own column (sessions.entered_distance_m, schema v64) and carried on the result as its own field, never as the measured route distance: it does not feed the hero, the splits, the share card or the vo2max estimate. the card that shows it says where it came from, and prints the pace it gives over the session's clock. empty until typed; clearing it stores null. a retime carries the column. a treadmill ruck is exported to apple health and health connect as a walk, and counts steps on treadmill's footing. the whoop freeze golden test drops the new column while it is null, with the pack weight columns; the goldens are untouched. Authored by : BT
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Reviewer's GuideSchema and migrationsAdd the nullable session column for machine-entered distance, include it in schema migration and open-time repair, and provide the narrow session update used to save or clear it.
Data structuresDefine the new activity categories and result fields that keep pack weight and machine-entered distance separate from measured route data.
APIExpose the treadmill-ruck activity as walking and outdoor rucking as hiking to health platforms that lack a rucking activity type.
Uses of the APILoad the saved pack weight and typed distance into past-session results so the summary can display the values belonging to that session.
ImplementationPreserve the new session values through manual-row reconstruction, workout stop and stale-session reconciliation, while excluding carried-load sessions from unloaded VO₂max estimates.
UIAdd setup and summary controls for carried weight and treadmill distance, including validation, unit conversion, pace display, and session-scoped saves.
ConfigurationRegister the remembered pack-weight preference and add the new activity and distance-hint strings across the supported locales.
TestsCover migration, activity classification, live-session persistence, typed-distance and pack-weight UI behavior, and the carried-load VO₂max exclusion.
Other changesFiles not grouped.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
… setup screen Authored by : BT
…d live, remember only a real pack weight a session recorded as a hike or a run banks a vo2max estimate. retyped to a ruck, or given a pack weight afterwards, it kept showing that figure, which was worked out as if nothing was carried. the estimate is now served empty for a session that is a ruck or holds a weight, by the same check the rescore uses to decide whether to bank one. the stored value stays, so retyping it back serves it again. the rescore asks that check of the row it re-read, not of the snapshot it started from. stopWorkout swallowed a failed read of the session row and went on to write without it, which could store an empty device family or drop a weight the row already held. a failed read now gets the same handling as a failed write: logged, the session kept live, the error rethrown, so the stop can be retried. the existing "a stop whose write fails" test hides the table, so it fails on this read first and covers the path. there is no seam to fail the read alone and let the write through. starting a ruck with the pack weight on the dash stored 0 as the weight used last, so the next ruck opened on a dash. only a weight above zero is remembered now. the summary's pack weight stepper ignored a press that landed while the last one was still saving, with no sign of it. it is dimmed and takes no press until the save returns, a failed save hands it back, and the saved weight is only put on screen for the session it was saved on. Authored by : BT
…hown for the session it was saved on Authored by : BT
…he write failing alone and the stepper mid-save the read stopWorkout makes of the session row now rethrows. if a reset wiped the store under that read, the session is already discarded and there is nothing to keep live, so the catch checks for that first, the way the code below the read always did. the existing "a stop whose write fails" test hides the whole table, so since the read became unconditional it fails on the read and no test reached the write's own catch. a second test refuses inserts with a trigger while the table still reads: the write alone keeps the session live and the retry finishes it. there is still no seam to fail the read and let the write through. the pack weight stepper on the summary gets a test off a real database with the write held open: dimmed, a second press not taken, then one step on screen and in the row. Authored by : BT
Authored by : BT
Authored by : BT
The app keeps to one icon family. The rucksack glyph, its font, the source drawing and the script that built it are gone, and pubspec.yaml is back to main's. Authored by : BT
…mill ruck takes the same icon Authored by : BT
It read the EdgeIcons entry from pubspec.yaml and looked the codepoint up in the .ttf. Every activity icon is Lucide again, so there is nothing left for it to check. Authored by : BT
Authored by : BT
…ives the stop Authored by : BT
…stop The row of a ruck still running is in the history list and its summary has the stepper, so the weight can be put right on the row before the session ends. The stop and the stale-row reconcile then wrote the setup draft's weight over it. The row is never older than the draft, so what the row holds stays and the draft only fills what it lacks. Authored by : BT
… stop The stop replaces the whole row and did not carry entered_distance_m, so a distance typed on the summary of a session still running (it is in the history list) was dropped when the session ended. The stop now carries what the row holds. The stale-row reconcile already spreads the row. Authored by : BT
…rdic walking Authored by : BT
It is the profile weight the setup screen opened with, not one read when the session ends. Authored by : BT
Authored by : BT
Adds Treadmill ruck: a ruck with no GPS, the same pack weight row as Rucking, and a distance the user types off the belt.
REALcolumn onsessionskAlgoVersionPRIVACY.mdWhy
A ruck on a treadmill has no route. Logged as Rucking it arms GPS indoors, where a fix wanders and the distance it adds up is not one anybody walked.
What
sessions.entered_distance_m, schema v63 → v64, nullableREAL, added with_addColumnIfMissingfrom the rung and from the open-time repair) and carried on the result as its own field, never as the measured route distance. It does not feed the hero, the splits, the share card or the VO2max estimate.NULL.The freeze golden test drops the new column while it is
NULL, with the pack weight columns from #1060; the goldens are untouched.No network calls, so nothing for
PRIVACY.md. No analytics output changes, so nokAlgoVersionbump.Screenshots
Before: an indoor ruck had to be logged as Rucking (GPS armed indoors, a wandering route and a made-up distance) or as Treadmill (no pack weight). Tap an image for full size.
Activity list: Treadmill ruck under Cardio
Setup: the same Pack weight row, and no Route row
Summary before a distance is typed: a dash and no pace
Typing what the belt showed
The typed distance and the pace it gives
The same screens in the light theme
Activity list: Treadmill ruck under Cardio
Setup: the same Pack weight row, and no Route row
Summary before a distance is typed: a dash and no pace
Typing what the belt showed
The typed distance and the pace it gives
The images are drawn from the app's own screens by a widget driver, the way
tool/guides/does it (412×915 at 2.625, real fonts). They are not device captures. The data is synthetic: a 35 lb pack, a 180 lb body weight and a made-up 45-minute session with 2.5 mi typed in.Change size
This PR's own part:
git diff --numstat c87045a9...768ef976, against the head of #1060.lib/ui2/test/lib/l10n/lib/data/lib/ble,lib/compute,lib/healthlib/state/With #1060 included, the diff GitHub shows against
mainis 34 files, +1,329 / −26.Risk and rollback
What it can touch outside a treadmill ruck
ALTER TABLE … ADD COLUMN, no backfill and no index.stopWorkoutcopiesentered_distance_mfrom the stored row into the row it writes, for every activity. It isNULLon every session that is not a treadmill ruck with a typed distance.Rollback
Run locally, both ways this PR can be reverted. A v64 database written by this branch (a ruck, a treadmill ruck with a typed distance, and a run as a control) was opened and used by older code, then opened again by this branch. In both cases the older build opens it and loses nothing outside the new columns.
What the two runs showed
This PR reverted alone, #1060 kept (v64 opened by v63 code)
user_versiongoes from 64 back to 63, andentered_distance_mand its value stay on disk.entered_distance_m; the two weights survive it. Rating, the private flag and a type change leave all three alone.Both PRs reverted (v64 opened by
mainat9fa55d92)Either way
LocalDb.exportDaysDbthrows on the older build for any day holding a session, because it copiesSELECT *rows into a file built with the older schema. Nothing inlib/calls it outside itsAppStatewrapper.This PR can be reverted without #1060; the reverse is not true.
Strings
One new key (
activityMachineDistanceHint) in all eightapp_<code>.arbfiles, plus aktreadmillruckcase in each translatedactivityCatalogueName. That is six files: English and Thai translate none of the catalogue names. The non-English values are my best effort and have not been checked by native speakers.Tests
Whole suite,
flutter test --concurrency=1underTZ=UTC, head against base:768ef976c87045a9mainat9e8b816e, the commit merged into bothThis PR adds 6 passing tests on top of #1060's 22, with the same number skipped and none failing in any of the three runs.
flutter analyze: no issues.test/whoop_freeze_golden_test.dartandtest/adapters/miscale_test.dartpass underTZ=UTC,Asia/KolkataandAmerica/New_York.What the new tests cover, file by file
test/ui2_activity_test.dart: a treadmill ruck is a ruck with no route; a typed distance is its own figure, never the measured one; the distance field takes a distance, an empty field, and no more; a treadmill ruck offers its distance and pace appears with it.test/manual_workout_repo_test.dart: retiming keeps the distance typed off the treadmill.test/db_migration_ladder_test.dart: the v64 rung.test/gait_step_types_test.dart.test/app_state_workout_lifecycle_test.dart: a distance typed on the row while a treadmill ruck is live survives the stop.On a device. A build with the treadmill ruck commit has been on my own iPhone with a WHOOP band for several days. The follow-ups merged in from #1060 are on the same phone and were checked there by hand (listed in #1060). The guard that shows a typed distance only for the session it was saved on has not been exercised on a device, and neither have the backpack icon or the fixes for a weight or distance entered on a live session. Not run on Android.
Summary by Sourcery
Add outdoor and treadmill rucking activities with per-session pack weights and a separately entered treadmill distance.
New Features:
Bug Fixes:
Enhancements:
Tests:
Chores: