Skip to content

workout: treadmill ruck, with the distance typed off the belt - #1061

Draft
infrabill wants to merge 2 commits into
OpenStrap:mainfrom
infrabill:bt-rucking-indoor
Draft

infrabill wants to merge 2 commits into
OpenStrap:mainfrom
infrabill:bt-rucking-indoor

Conversation

@infrabill

@infrabill infrabill commented Dec 4, 2026 •

Copy link
Copy Markdown

Stacked on #1060. This branch contains that PR's commit plus one of its own, so until #1060 merges the diff here shows both. Only the top commit, "add a treadmill ruck, with the distance typed off the belt", is new. I'll rebase onto main and mark this ready once #1060 lands. Draft until then.

Why

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

  • Treadmill ruck is its own entry, the way Treadmill sits beside Running and Indoor bike beside Cycling: no GPS, tracked by time and heart rate, with the same pack weight row as Rucking.
  • Distance is typed, not measured. 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 v63 → v64, nullable REAL, added with _addColumnIfMissing from 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.
  • The card that shows it says where it came from ("Read off the treadmill, entered by you") and prints the pace it gives over the session's clock. It is empty until typed, and 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 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 no kAlgoVersion bump.

Before and after

  • 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).
  • After, activity list: "Treadmill ruck" appears under Cardio with the rucksack icon.
  • After, setup screen: the same "Pack weight" row as Rucking, and no GPS.
  • After, summary: a "Distance" card that opens a field to type what the belt showed, with the line "Read off the treadmill, entered by you" under it, and the pace that distance gives once one is entered.

Strings

One new key (activityMachineDistanceHint) in all eight app_<code>.arb files, plus a ktreadmillruck case in each translated activityCatalogueName. The non-English values are my best effort and have not been checked by native speakers.

Tests

  • 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.
  • flutter analyze: no issues.
  • flutter test --concurrency=1: all passed under TZ=UTC on macOS (10,588 passed, 29 skipped). The freeze golden test and test/adapters/miscale_test.dart also pass under Asia/Kolkata and America/New_York.

A build with this change has been on my own iPhone with a WHOOP band for several days. Not run on Android.

Summary by Sourcery

Add outdoor and treadmill rucking workouts, with optional pack-weight tracking and a separately recorded treadmill distance.

New Features:

  • Add Rucking and Treadmill ruck as distinct workout activities, with pack-weight entry and storage; treadmill rucks also allow users to enter the distance shown by the belt and view the resulting pace.
  • Export rucks to Apple Health and Health Connect as hiking or walking activities, and count their steps.

Bug Fixes:

  • Preserve pack weight, body weight, and entered treadmill distance when sessions are retimed or stopped through alternate workout flows.
  • Exclude weight-carrying sessions from VO₂max estimates, including sessions later recategorized as another activity.

Enhancements:

  • Keep user-entered treadmill distance separate from route-measured distance so it does not affect route-based summaries, splits, sharing, or VO₂max.

Tests:

  • Add coverage for ruck setup and summaries, typed treadmill distance, migration, session retiming and stopping, gait steps, and VO₂max exclusions.

Chores:

  • Add the rucksack icon font and source artwork, plus translations for the new activity names and treadmill-distance hint.
  • Advance the database schema through versions 63 and 64 for carried weights and entered machine distance.

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
@coderabbitai

coderabbitai Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@sourcery-ai

sourcery-ai Bot commented Dec 4, 2026

Copy link
Copy Markdown

Reviewer's Guide

Schema and migrations

Add nullable session columns for carried load, banked body weight and user-entered treadmill distance, with their versioned migrations and open-time repair.

  • lib/data/db.dart L1618-1625, L6339-6358, L16960-16978 (+2 small edits)

Data structures

Keep typed session values intact when rebuilding or retiming session rows, and exclude load-carrying outings from unloaded VO₂max estimates.

  • lib/compute/manual_session.dart L614-616
  • lib/data/local_repository_impl.dart L52, L3561-3571

Define the activities’ tracking, load and entered-distance data, and extend step-counting and route-type classifications for the new activities.

  • lib/ble/live_step_runs.dart L68-71, L78-81
  • lib/gps/route_types.dart L22
  • lib/ui2/activity/catalogue.dart L25-29, L109-119, L149-153 (+1 small edits)

API

Extend session results with carried-weight and machine-distance fields and expose typed-distance parsing and pack-weight display helpers.

  • lib/ui2/activity/summary.dart L320-369, L718-728, L956-977 (+4 small edits)

Map rucking and treadmill rucking to the closest supported platform workout categories.

  • lib/health/health_export.dart L2196-2197, L2230-2231

Uses of the API

Carry pack and body weights through every workout-stop path by matching the live draft to the session, and preserve existing values on retries.

  • lib/state/workout_controller.dart L899-906, L949-966, L1037-1053 (+2 small edits)

Populate result fields from live setup and past-session rows so summaries can display and edit the saved values.

  • lib/ui2/activity/live.dart L1121-1123
  • lib/ui2/screens/workout_screen.dart L1854-1862

Implementation

Persist edits to carried load and entered distance, render their summary cards, and calculate pace only from user-entered treadmill distance.

  • lib/ui2/activity/summary.dart L1399-1571, L1984-1991

Add setup-screen pack-weight input and save the selected value into preferences and the live draft.

  • lib/ui2/activity/setup.dart L103-107, L155-158, L311-323 (+3 small edits)

UI

Add localized activity names and the machine-distance provenance hint across the supported locales.

  • lib/l10n/app_de.arb L2825, L4162-4165
  • lib/l10n/app_en.arb L18892-18908
  • lib/l10n/app_es.arb L3351, L4162-4165
  • lib/l10n/app_fr.arb L3224, L4162-4165
  • lib/l10n/app_hi.arb L3354, L4162-4165
  • lib/l10n/app_ru.arb L6085, L9492-9502
  • lib/l10n/app_th.arb L17670-17673
  • lib/l10n/app_zh.arb L3352, L4162-4165

Configuration

Bundle the custom rucksack icon font and register it with Flutter.

  • assets/fonts/edge_icons/rucking.svg L1
  • pubspec.yaml L33-34, L775, L800-809
  • tool/gen_edge_icons.py L1-75
  • assets/fonts/EdgeIcons.ttf

Register and document the preference key that remembers the last ruck pack weight.

  • lib/data/backup_extras.dart L200
  • lib/state/prefs.dart L151-153

Tests

Verify migrations, session preservation, lifecycle persistence, gait classification, result behavior, UI input and rendering, icon bundling, and VO₂max exclusions for the new activities.

  • test/app_state_workout_lifecycle_test.dart L16-18, L477-530
  • test/db_migration_ladder_test.dart L1590-1639
  • test/gait_step_types_test.dart L110-113
  • test/manual_workout_repo_test.dart L280-319
  • test/ui2_activity_test.dart L167-195, L238-260, L720-961 (+1 small edits)
  • test/vo2max_session_test.dart L7, L120-173
  • test/whoop_freeze_golden_test.dart L181-183, L240-247

Keep the new preference in the backup settings audit and relax tests that assumed the schema remained at version 62.

  • test/backup/settings_audit_guard_test.dart L30
  • test/ed2a_input_revision_test.dart L159
  • test/ed2b_checkpoints_test.dart L115-118, L155

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant