Skip to content

fix: preserve stem position attributes on round-trip#265

Merged
webern merged 5 commits into
mainfrom
stem-default-y
Jun 30, 2026
Merged

fix: preserve stem position attributes on round-trip#265
webern merged 5 commits into
mainfrom
stem-default-y

Conversation

@webern

@webern webern commented Jun 29, 2026

Copy link
Copy Markdown
Owner

Summary

Add stemPositionData to NoteData so that position attributes on <stem> elements
(default-x, default-y, relative-x, relative-y) survive the api round-trip. Previously
the reader extracted only the stem direction enum and the writer created a bare core::Stem
with no position attributes, so <stem default-y="0">up</stem> lost its default-y.

The fix reuses the existing PositionData struct and the getPositionData/setAttributesFromPositionData
templates from PositionFunctions.h which already handle the new optional<Tenths> core API
via C++20 requires detection.

Changes

  • NoteData.h - add PositionData stemPositionData field and equality member
  • NoteFunctions.cpp - extract stem position data via getPositionData(*myNote.stem())
  • NoteWriter.cpp - apply stem position data via setAttributesFromPositionData before emitting

Testing

  • CI passes
  • attr:stem@default-y signature eliminated from classifier worklist
  • ksuite/k002a_Fermatas.xml flips to PASS (sole blocker was this signature)

References

webern added 3 commits June 29, 2026 20:58
Add isOctaveChangeSpecified to ClefData, mirroring
the isLineSpecified pattern. The writer guard was
!= 0, dropping valid <clef-octave-change>0</…>
elements on round-trip. Fixes #257.
dump-api-roundtrip and classify-api-roundtrip wrote
output into the Docker volume, invisible on the host.
Add a post-run copy step to extract roundtrip-dump/
and classified.json to the host build/ directory.
@webern webern added bug software defect ai Issues opened by, or through, a coding agent. labels Jun 29, 2026
@github-actions

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.3% 6012 / 7675
Functions 63.7% 2042 / 3207
Branches 47.5% 5090 / 10707

Core HTML report | API HTML report

Commit 1f775e3d89023af9ef04aa4ab5dc9820375135fe.

@github-actions

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 1f775e3d89023af9ef04aa4ab5dc9820375135fe.

@github-actions

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.3% 6012 / 7675
Functions 63.7% 2044 / 3208
Branches 47.6% 5092 / 10707

Core HTML report | API HTML report

Commit b9873ecea290286e4d06d38b12756081f943daee.

@github-actions

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 b9873ecea290286e4d06d38b12756081f943daee.

Base automatically changed from diatonic-zero to main June 30, 2026 05:19
@webern webern merged commit f2b84b3 into main Jun 30, 2026
7 checks passed
@webern webern deleted the stem-default-y branch June 30, 2026 05:20
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. bug software defect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

api: round-trip drops stem @default-y when value is 0

1 participant