Skip to content

Fix distance-step read path and validate duration_meters (#52 follow-up) - #54

Merged
cygnusb merged 1 commit into
mainfrom
fix-distance-step-followups
Aug 12, 2026
Merged

cygnusb merged 1 commit into
mainfrom
fix-distance-step-followups

Conversation

@cygnusb

@cygnusb cygnusb commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Follow-up to #52, addressing the remaining warnings from the Hermes Agent (Grok Build) review there.

Fixes

  • Read path (review ⚠️ 2): _parse_workout now decodes targetType=5 exercises as distance_meters (÷100) and unscales ×1000 intensity values when intensityMultiplier=1000. Previously list_workout_templates reported a 1 km step as duration_seconds: 100000 (≈28 h) with intensity 235000.
  • Input validation (review ⚠️ 3): duration_meters is coerced via float() and must be positive — negative/zero raise ValueError, a non-numeric string no longer triggers Python string-repeat ("1000" * 100), a numeric string now builds correctly.
  • Docs (review ⚠️ 5 + suggestions): coros_api.save_workout_template docstring, module comment (targetType=5 encoding), list_workout_templates return shape, README distance example + updated return keys.

Not addressed here: review ⚠️ 4 (pure-distance repeat groups emit a time-typed group header with targetValue=0) — needs live verification against the Coros API before changing the header encoding.

Testing

  • 15 new tests: validation cases (negative/zero/non-numeric/numeric-string duration_meters) and _parse_workout round-trips for distance and time steps.
  • 222 total tests pass; ruff and mypy clean.

🤖 Generated with Claude Code

…ow-up)

Addresses the remaining warnings from the Hermes Agent review on PR #52:

- _parse_workout now decodes targetType=5 exercises as distance_meters
  (meters x100 unscaled) and unscales x1000 intensity values, instead of
  misreporting a 1km step as duration_seconds=100000 with intensity
  235000 in list_workout_templates.
- duration_meters is coerced via float() and must be positive: negative
  and zero values raise ValueError, a non-numeric string no longer hits
  Python string-repeat, a numeric string now builds correctly.
- Docs caught up: coros_api.save_workout_template docstring, module
  comment (targetType=5), list_workout_templates return shape, README
  distance example and updated return keys.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cygnusb
cygnusb merged commit 11b1e66 into main Aug 12, 2026
4 checks passed
@cygnusb
cygnusb deleted the fix-distance-step-followups branch August 12, 2026 04:48
@cygnusb cygnusb mentioned this pull request Aug 28, 2026
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