Skip to content

feat(activity): improve weightlifting exercise selection - #460

Open
timothydjon wants to merge 4 commits into
OpenStrap:mainfrom
timothydjon:feat/strength-exercise-picker
Open

timothydjon wants to merge 4 commits into
OpenStrap:mainfrom
timothydjon:feat/strength-exercise-picker

Conversation

@timothydjon

@timothydjon timothydjon commented Sep 25, 2026 •

Copy link
Copy Markdown

Why

Weightlifting tracking has a short exercise list and no clear way to change an exercise after choosing it. This adds a searchable offline lifting catalogue and a safe change/add flow within strength sessions.

Scope

The additions are lifting/resistance exercises, confined to the existing sets-based strength flow. Edge already shares that flow between weight training, powerlifting, bodyweight, calisthenics, and functional sessions; this PR keeps that routing. The main workout/activity catalogue and the running, cycling, swimming, yoga, and HIIT screens are unchanged. No cardio, stretching, yoga, or breathing entries are added to the exercise picker.

Behavior

  • Choose the first exercise explicitly instead of starting with bench press.
  • Search lifting exercises by name, aliases, muscles, equipment, or category; browse recent/common exercises and category filters.
  • Replace an empty exercise slot. Once sets have been logged, changing exercises switches/adds a lift without relabeling completed sets.
  • Restore the exercise plan and active position from the live draft, including exercises without sets yet.
  • Display localized exercise names where available, with English fallback.

Catalogue

  • Preserve the 18 original exercises and their existing storage keys.
  • Add 195 explicitly reviewed wger lifting/resistance movements, for 213 exercises total.
  • Keep the reviewed UUIDs and names in tool/wger_weightlifting_selection.dart. Refreshes cannot automatically add unreviewed records, even if wger places them in a lifting-related category. Missing records, renamed labels, duplicate UUIDs, or non-lifting categories stop the refresh for review.
  • Vendor names, aliases, muscles, equipment, and categories only. No descriptions, images, videos, notes, or invented muscle percentages; no runtime API dependency.
  • Retain each imported base record and translation's upstream author/license credits, source links, and notices. The importer accepts only explicitly allowed CC0 / CC BY-SA licenses.

The generated snapshot is 5,398 lines / 156,079 bytes and is marked as generated for GitHub review. Retained records are unchanged from the earlier snapshot; this revision removes unrelated activities rather than adding fresh upstream content.

Implementation

  • Load strength-history candidates in two SQL queries rather than querying once per catalogue entry.
  • Preserve previous-set and heaviest-set handling, including the reps tie-break and absent bodyweight loads.
  • No schema, analytics algorithm, dependency, or lockfile change.

Validation

  • Focused importer, activity/widget, and strength-database tests: 101 passed, 32 skipped.
  • flutter test --no-pub --concurrency=1: 4,146 passed, 462 skipped.
  • flutter analyze --no-pub: no issues found.
  • git diff --check: clean.
  • Tests cover the reviewed catalogue boundary, unchanged workout routing, refresh rejection cases, provenance and stable keys, history queries, choosing/replacing/changing exercises, completed-set identity, draft restoration, and picker accessibility at 3.1x text scale.

Summary by CodeRabbit

  • New Features
    • Browse a larger offline exercise catalogue with search, category filters, equipment details, and links to source and license information.
    • Choose or change exercises during a strength workout. Workouts start without a preselected exercise, and changing exercises won’t relabel sets already logged.
    • Exercise names appear in the available language, with fallback labels when translations aren’t available.
  • Bug Fixes
    • Strength history shows the latest and best logged sets for each exercise.
  • Documentation
    • Added notices explaining catalogue sources, attribution, licensing, and included content.

@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: OpenStrap/edge/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 6cac44aa-6aba-4d87-9154-626faa767308

📥 Commits

Reviewing files that changed from the base of the PR and between 6585b0e and 64d21b7.

⛔ Files ignored due to path filters (2)
  • test/ui2_activity_test.dart is excluded by !test/**
  • test/wger_weightlifting_selection_test.dart is excluded by !test/**
📒 Files selected for processing (6)
  • .gitattributes
  • NOTICE.md
  • docs/notice.html
  • lib/ui2/activity/wger_exercises.g.dart
  • tool/update_wger_exercises.dart
  • tool/wger_weightlifting_selection.dart

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The strength catalogue combines 18 hand-written entries with generated wger data. It supports localized search, attribution, and offline exercise selection. Live strength sessions restore and persist exercise plans. Users can add or change exercises, and set logging requires an active selection. History retrieval and summary labels use updated paths.

Changes

Strength Exercise Catalogue and Workouts

Layer / File(s) Summary
Select, generate, and document wger data
tool/wger_weightlifting_selection.dart, tool/update_wger_exercises.dart, .gitattributes, NOTICE.md, docs/notice.html
A reviewed UUID selection defines the included exercises. The generator validates wger data and creates the snapshot. Notices describe attribution, accepted licenses, retained fields, and refresh instructions.
Combine catalogue entries
lib/ui2/activity/catalogue.dart
The exercise model adds descriptive metadata, localized labels, query matching, and source credits. The hand-written entries are combined with generated wger entries.
Search and select exercises
lib/ui2/activity/exercise_picker.dart, lib/l10n/*.arb
The picker searches and filters catalogue entries, displays exercise details and source links, and returns the selected key. Picker labels and attribution are localized.
Persist and update live exercise plans
lib/ui2/activity/live.dart, lib/l10n/*.arb
Live sessions restore and persist exercise plans. Users can add or change exercises, and set logging requires an active selection.
Load strength history and localized labels
lib/data/db.dart, lib/ui2/screens/workout_screen.dart, lib/ui2/activity/summary.dart
The database provides previous and best set candidates. Workout history uses those results, and strength summaries use localized exercise labels.

Priority: ⬇️ Low

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant StrengthScreen
  participant ExercisePicker
  participant Catalogue
  User->>StrengthScreen: Choose, add, or change exercise
  StrengthScreen->>ExercisePicker: Open picker with mode and exercise keys
  ExercisePicker->>Catalogue: Search or filter exerciseLibrary
  Catalogue-->>ExercisePicker: Return matching exercises
  User->>ExercisePicker: Select exercise
  ExercisePicker-->>StrengthScreen: Return selected exercise key
Loading

Merge Risk: ⚪ Minimal · up to 64d21

The offline catalogue and exercise-selection changes have no identified merge-blocking issue in the supplied evidence. Merge after normal checks confirm the generated catalogue and workout behavior.

Architecture Summary

Architecture risk: 🔵 Low · up to 64d21

The change affects 4 systems.

Changed systems: tool, lib, docs, NOTICE.md

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — tool (service) was modified; 2 changed files map to changed impact.
  • observed — lib (service) was modified; 12 changed files map to changed impact.
  • observed — docs (service) was modified; 1 changed file maps to changed impact.
  • observed — NOTICE.md (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in lib/ui2/activity/catalogue.dart: The file now includes the generated wger_exercises.g.dart part.
  • observed — Modified behavior in lib/ui2/activity/catalogue.dart: The exercise model replaces the weighted muscles map with primary and secondary muscle lists and adds category, equipment, aliases, localized labels, and optional source ID, update timestamp, and credits. ExerciseCredit stores license name, license URL, and author. New helpers identify wger-backed entries, construct their public record URL, return a localized label with English fallback, and match trimmed, case-insensitive queries across labels, aliases, muscles, equipment, and category; empty queries match all entries.
  • observed — Modified behavior in lib/ui2/activity/catalogue.dart: The original 18 hand-written exercises remain the initial catalogue entries, but their muscle-share maps are replaced by primary muscle lists and descriptive category, equipment, alias, and step metadata where specified. A private list now holds these entries for combination with the generated catalogue.
  • observed — Modified behavior in lib/ui2/activity/catalogue.dart: exerciseLibrary now concatenates the hand-written entries with _wgerExerciseLibrary; coreExerciseCount and wgerExerciseCount expose the respective list lengths.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: improved weightlifting exercise selection through the new picker, catalogue, and exercise-change flow.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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

Comment @coderabbitai help to get the list of available commands.

@timothydjon
timothydjon marked this pull request as ready for review September 25, 2026 17:46
Copilot AI lite review requested due to automatic review settings September 25, 2026 17:46

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @timothydjon, your pull request is larger than the review limit of 150,000 diff characters

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

One critical and four moderate unresolved issues affect catalogue trust, picker correctness, persistence, scope, and localization.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

Adds an offline, searchable strength-exercise catalogue with localized labels, exercise switching, draft persistence, and batched history loading.

Changes:

  • Vendors and validates attributed wger catalogue data.
  • Adds search, category filters, replacement, and multi-exercise plans.
  • Updates history queries, summaries, localization, notices, and tests.

Review findings:

  • Critical — tool/update_wger_exercises.dart: redirects can bypass the wger-only trust boundary.
  • Moderate — lib/ui2/activity/exercise_picker.dart: search ignores the selected category filter.
  • Moderate — lib/ui2/activity/live.dart: plan and active index persistence is not atomic.
  • Moderate — tool/update_wger_exercises.dart: non-strength activities are included in the strength picker.
  • Moderate — tool/update_wger_exercises.dart: Hindi translations are omitted despite Hindi being supported.
File Description
tool/​update_wger_exercises.dart Generates and validates the offline exercise catalogue.
test/​ui2_activity_test.dart Tests catalogue, picker, and session behavior.
test/​db_strength_schema_test.dart Tests strength-history query behavior.
NOTICE.md Documents wger attribution and licensing.
lib/​ui2/​screens/​workout_screen.dart Loads batched history and localized exercise names.
lib/​ui2/​activity/​summary.dart Displays localized exercise summaries.
lib/​ui2/​activity/​live.dart Manages exercise plans, switching, and draft restoration.
lib/​ui2/​activity/​exercise_picker.dart Provides searchable exercise selection and filters.
lib/​ui2/​activity/​catalogue.dart Defines catalogue models and legacy exercises.
lib/​l10n/​app_zh.arb Adds picker translations for Chinese.
lib/​l10n/​app_hi.arb Adds picker translations for Hindi.
lib/​l10n/​app_fr.arb Adds picker translations for French.
lib/​l10n/​app_es.arb Adds picker translations for Spanish.
lib/​l10n/​app_en.arb Adds picker translations for English.
lib/​l10n/​app_de.arb Adds picker translations for German.
lib/​data/​db.dart Adds aggregate strength-history queries.
docs/​notice.html Publishes catalogue attribution details.
.gitattributes Marks generated catalogue data.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +196 to +198
final request = await client.getUrl(next);
request.headers.set(HttpHeaders.acceptHeader, 'application/json');
final response = await request.close();
@timothydjon
timothydjon force-pushed the feat/strength-exercise-picker branch from 9b6b8cd to 00ecd05 Compare September 26, 2026 08:37
@timothydjon timothydjon changed the title feat(activity): add searchable strength exercise picker feat(activity): improve weightlifting exercise selection Oct 1, 2026

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.

2 participants