Skip to content

Python: write stroke rate as cadence256 and rounded cadence. - #33

Open
sanderroosendaal wants to merge 4 commits into
mainfrom
python/stroke-rate-cadence256
Open

sanderroosendaal wants to merge 4 commits into
mainfrom
python/stroke-rate-cadence256

Conversation

@sanderroosendaal

Copy link
Copy Markdown
Collaborator

Developer field 93 and fractional_cadence are no longer written. 28.5 spm rounds half up to cadence 29.

Co-authored-by: Cursor cursoragent@cursor.com

Implements the Python side of #16. Should be merged after #16.

The diff against main contains only this change.

🤖 Generated with Claude Code

Sander Roosendaal and others added 2 commits October 7, 2026 09:29
Developer field 93 and fractional_cadence are no longer written. 28.5 spm rounds half up to cadence 29.

Co-authored-by: Cursor <cursoragent@cursor.com>

@JBlaak JBlaak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Two things before this goes in:

  1. Precedence differs between writer and reader. _native_cadence prefers stroke_rate, resolve_stroke_rate prefers cadence256. With Record(stroke_rate=30, cadence256=28.5) the file gets 30 while validate() checks timing against 28.5. Could Record keep a single stroke-rate attribute (e.g. cadence256 in spm, written and read), or at least use the same order in both places?

  2. The stroke-rate typical-range warning goes dead. validation.py only looks up _TYPICAL while looping over RECORD_DEVELOPER_ATTRS, and stroke_rate was mapped through field 93. With 93 removed, the "stroke_rate": (10.0, 100.0) entry is never reached. It needs checking against the resolved rate, plus a test.

The writer now prefers cadence256 over stroke_rate, as resolve_stroke_rate
does. The typical-range warning checks the resolved stroke rate.

Merges main.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@sanderroosendaal

Copy link
Copy Markdown
Collaborator Author

Both points addressed in 83f4431, which also merges main:

  1. Precedence now matches: the writer prefers cadence256 over stroke_rate, the same order as resolve_stroke_rate. Record(stroke_rate=30, cadence256=28.5) writes 28.5 and validate() checks timing against 28.5. I kept both attributes rather than collapsing to one, to avoid changing the public model; happy to do that instead if you prefer. Test added in test_roundtrip.py.
  2. The 10–100 spm typical-range warning now checks the resolved stroke rate (the dead _TYPICAL entry is removed). Tests cover 5 and 120 spm warning, and 24 spm not warning.

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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