Skip to content

feat(workout): add secondary swim CSS offset target - #456

Draft
fasoxy-it wants to merge 1 commit into
cyberjunky:masterfrom
fasoxy-it:codex/swim-css-offset-target
Draft

fasoxy-it wants to merge 1 commit into
cyberjunky:masterfrom
fasoxy-it:codex/swim-css-offset-target

Conversation

@fasoxy-it

Copy link
Copy Markdown

The typed workout helpers support pace, speed, cadence, power, and heart-rate targets, but swimming CSS offsets still require manually constructing the secondary target fields.

This adds SwimCssOffsetTarget(offset_seconds=...) and TargetType.SWIM_CSS_OFFSET (17, swim.css.offset). Both targeted step helpers now accept an omitted primary target, so callers can use Garmin's no.target primary with a CSS offset as the secondary target. Existing calls remain compatible.

The offset is a signed value rather than a lower/upper range: it is serialized into secondaryTargetValueOne, with secondaryTargetValueTwo=0. Non-finite offsets and primary placement are rejected. The README includes a secondary-only example; interval types and swimming stroke/rest/pool configuration are otherwise unchanged.

Validation

  • 42 focused workout tests passed, including signed/zero offsets, both step helpers, finite-value validation, primary-placement rejection, unchanged untargeted output, and full swimming-workout serialization.
  • Full offline suite: 463 passed, 22 integration tests deselected, 1 existing platform-specific failure. TestTokenFilePath.test_absolute_path_outside_home_still_allowed uses /var/lib/...; on macOS /var is a symlink and the token path guard rejects it. Neither the test nor the client code was changed.
  • Ruff lint and format checks passed.
  • Mypy passed for all 8 source files.

Maintainer review

This is a draft proposal based on a downstream serializer's existing CSS payload shape, not a new captured Garmin response or a live upload performed for this PR. Please confirm the signed-offset interpretation, units, and secondaryTargetValueTwo=0 convention against Garmin before merging. No live-account tests or private workout/account data are included.

@coderabbitai

coderabbitai Bot commented Oct 10, 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

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

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