Skip to content

api: segno and coda suport#203

Merged
webern merged 1 commit into
mainfrom
coda-segno
Jun 17, 2026
Merged

api: segno and coda suport#203
webern merged 1 commit into
mainfrom
coda-segno

Conversation

@webern

@webern webern commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Summary

mx::api exposed SegnoData/CodaData but support was partial: the reader only captured position
and color (and even then never set isColorSpecified, so color was dropped), and the writer emitted
nothing for segno or coda, silently losing them on write.

This widens both data classes to the full <segno>/<coda> attribute surface and makes the trip
lossless in both directions:

  • Added fontData, smufl (+ isSmuflSpecified), and id (+ isIdSpecified) to SegnoData and
    CodaData. Position and halign/valign already ride along in positionData.
  • DirectionReader::parseSegno/parseCoda now read font, smufl, id, and set isColorSpecified.
  • DirectionWriter now writes segno and coda (position, font, color, smufl, id), replacing the
    lossy MX_UNUSED stub proposed in the superseded PR.

Note: positionData carries a placement member that does not apply to <segno>/<coda>
(placement lives on the parent <direction>). The read/write helpers are attribute-tolerant
(if constexpr (requires ...)), so this is inert, not a data bug. Documented in the headers.

Testing

  • New impl round-trip test segnoAndCodaRoundTrip_DirectionWriter: builds a segno and a coda
    with every field set, writes via DirectionWriter, reads back via DirectionReader, asserts
    equality. Passes (8 assertions in 2 test cases with the existing ottava test).
  • make dev builds clean; make fmt applied.
  • Full make test deferred to CI.

TODO (planned, not done in this PR)

References

Widen mx::api SegnoData and CodaData to carry font, smufl, and
id in addition to position and color, and add the writer path
so segno and coda now survive an api round-trip.

The reader set colorData but never isColorSpecified, so color
was dropped; the writer emitted nothing for segno or coda.
@webern webern added feature new feature request non-breaking fixes or implementation that do not require breaking changes area/mx::api area/mx::impl ai Issues opened by, or through, a coding agent. labels Jun 17, 2026
@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 711beff9b90591806b14f870563027242bf34185.

@github-actions

Copy link
Copy Markdown

Coverage report

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

Metric Coverage Covered / Total
Lines 77.9% 28539 / 36620
Functions 74.4% 6360 / 8548
Branches 50.7% 22672 / 44725

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

Metric Coverage Covered / Total
Lines 71.4% 5181 / 7260
Functions 59.9% 1815 / 3029
Branches 42.5% 4322 / 10169

Core HTML report | API HTML report

Commit 711beff9b90591806b14f870563027242bf34185.

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. area/mx::api area/mx::impl feature new feature request non-breaking fixes or implementation that do not require breaking changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement segno reading

1 participant