Skip to content

fix(breath): clamp negative stage durations - #1436

Merged
ryanbr merged 1 commit into
ryanbr:mainfrom
bhelm:fix/breath-stage-negative-duration
Aug 19, 2026
Merged

ryanbr merged 1 commit into
ryanbr:mainfrom
bhelm:fix/breath-stage-negative-duration

Conversation

@bhelm

@bhelm bhelm commented Aug 18, 2026

Copy link
Copy Markdown

What this PR does

Aligns Android breath-stage duration handling with Swift by normalizing negative stage durations to zero at construction time.

The Kotlin model remains immutable and retains its data-class value semantics. Mirrored Swift and Kotlin regression tests verify the stored duration, zero cycle duration, and empty scheduling result for a negative stage.

This addresses only the negative-duration parity finding in bhelm#32. The other findings in that issue remain out of scope.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Documentation
  • CI / tooling

How it was tested

  • cd Packages/StrandAnalytics && swift test --filter BreathProtocolPlayerTests — 7 tests passed
  • cd android && ./gradlew :app:testFullDebugUnitTest --tests "com.noop.analytics.BreathProtocolPlayerTest" --no-daemon --max-workers=1 --no-parallel — 7 tests passed

Only the focused suites were run. No manual, device, or strap testing was performed; the behavior is covered by deterministic unit fixtures.

Checklist

  • Swift package tests pass for any package I touched (swift test in Packages/<name>) — focused BreathProtocolPlayerTests passed; the full package suite was not run
  • Android unit tests pass if I touched android/ (./gradlew testFullDebugUnitTest) — focused BreathProtocolPlayerTest passed; the full Android suite was not run
  • No new build warnings introduced
  • UI changes use only StrandDesign tokens — not applicable; no UI changed
  • No hardcoded hex frame bytes; protocol facts live in the schema / decoders — not applicable; no protocol code changed
  • Follows the conventions in docs/CONTRIBUTING.md
  • I did not commit generated output (Strand.xcodeproj/) or any secrets/keystores

Related issues

Related: bhelm#32

@ryanbr
ryanbr merged commit 117f769 into ryanbr:main Aug 19, 2026
14 checks passed
@bhelm
bhelm deleted the fix/breath-stage-negative-duration branch September 15, 2026 22:35
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