Skip to content

fix(api): round-trip repeat times attribute - #285

Merged
webern merged 1 commit into
mainfrom
repeat-times
Jul 1, 2026
Merged

fix(api): round-trip repeat times attribute#285
webern merged 1 commit into
mainfrom
repeat-times

Conversation

@webern

@webern webern commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Summary

A <repeat> lost its times count on api round-trip. BarlineData carried only a
bool repeat, so the barline reader discarded the count and the writer never emitted it.

Added BarlineData::repeatTimes (an int where 0 means not specified, mirroring the
existing endingNumber convention on the same struct). The barline reader now reads
repeat()->times(), and the barline writer emits times when the count is set. The
common no-times case stays at 0 and nothing is written.

Testing

  • New rightBarlineRepeatTimes MeasureWriter test: a backward repeat with
    repeatTimes = 5 emits a <repeat> carrying times="5"
  • Full unit suite passes (4334 assertions in 320 test cases)
  • Corpus api round-trip regression: 121 passed, 0 failed (up from 119).
    lysuite/ly45a_SimpleRepeat.xml and lysuite/ly45c_RepeatMultipleTimes.xml now
    round-trip and are pinned in the baseline.

References

The barline reader recorded only a bool for a repeat and dropped the
times count; the writer never emitted it. Add BarlineData::repeatTimes
(0 = unspecified, mirroring endingNumber), read it from the source
repeat, and emit it when set. Harvest ly45a and ly45c into the
roundtrip baseline.
@webern webern added bug software defect api Affects the mx::api layer impl Affects the mx::impl layer non-breaking fixes or implementation that do not require breaking changes ai Issues opened by, or through, a coding agent. labels Jul 1, 2026
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

Coverage report

Core-dev coverage src/private/mx/core/

Metric Coverage Covered / Total
Lines 77.8% 28487 / 36624
Functions 74.3% 6349 / 8550
Branches 50.6% 22632 / 44725

API coverage src/private/mx/{api,impl,utility}/

Metric Coverage Covered / Total
Lines 78.4% 6029 / 7687
Functions 63.7% 2045 / 3209
Branches 47.6% 5112 / 10733

Core HTML report | API HTML report

Commit 9fe0f61b3e5ebfbdc1c2ead4c434a41b0e193df9.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

gen-quality gen/

gen-quality: 84.5 / 100   (floor 84.5, +0.0)

  structure     86.5  x0.50   [fn 90.5 / file 82.6]
  cyclomatic    88.4  x0.25
  cognitive     76.6  x0.25

  409 functions across 31 files, 7702 lines (largest file 1044)
  max cc 56  max cognitive 44  max fn loc 152

Worst offenders (top 5 per axis; full lists in score.json):
  cyclomatic gen/xsd/analyze.py:311     report                             56
  cyclomatic gen/plates/build.py:956    _validate_config_against_ir        35
  cyclomatic gen/press/context.py:145   plate_context                      34
  cyclomatic gen/__main__.py:46         _ir                                23
  cyclomatic gen/tests/test_ir.py:102   _check_references                  20
  cognitive  gen/xsd/analyze.py:311     report                             44
  cognitive  gen/ir/resolve.py:119      flat_elements                      40
  cognitive  gen/tests/test_ir.py:102   _check_references                  38
  cognitive  gen/press/context.py:145   plate_context                      37
  cognitive  gen/xsd/analyze.py:207     _sccs                              37
  size       gen/xsd/analyze.py:311     report                             152
  size       gen/press/context.py:145   plate_context                      96
  size       gen/plates/build.py:533    _value_plate                       89
  size       gen/plates/build.py:956    _validate_config_against_ir        89
  size       gen/ir/resolve.py:119      flat_elements                      78

Commit 9fe0f61b3e5ebfbdc1c2ead4c434a41b0e193df9.

@webern
webern merged commit 99ff45d into main Jul 1, 2026
7 checks passed
@webern
webern deleted the repeat-times branch July 1, 2026 05:55
rpatters1 added a commit to rpatters1/mx that referenced this pull request Jul 2, 2026
* write-lyricdata:
  commit test as well
  Add write side for lyrics data.
  test: add rpatters1 composite time-sig sample (webern#287)
  fix(api): round-trip repeat times attribute (webern#285)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai Issues opened by, or through, a coding agent. api Affects the mx::api layer bug software defect impl Affects the mx::impl layer non-breaking fixes or implementation that do not require breaking changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

api: round-trip drops repeat times attribute

1 participant