feat: expose first-fret text and location in mx::api - #430
Merged
webern merged 1 commit intoAug 26, 2026
Merged
Conversation
## Human Summary Round-trip the `<first-fret>` text and location attributes through `mx::api`. ## Summary MusicXML's `<first-fret>` carries two display attributes beside its value: `text`, the label to print (Finale writes `4fr.` for a frame starting at the fourth fret), and `location`, whether that label appears to the left or the right of the grid. `mx::core` has modeled both since it was generated, but `mx::api` exposed only `firstFret` and `isFirstFretSpecified`, so the writer emitted a bare `<first-fret>4</first-fret>` and a reading application had to invent the label and its side. `FrameData` gains `firstFretText`, an optional string, and `firstFretLocation`, a new `FirstFretLocation` enum whose `unspecified` default writes no attribute. The two are independent: MusicXML permits either alone, and a frame that wants only the fret number keeps working untouched. The value and its `is...Specified` flag are left as they are rather than folded into a sub-struct, per the AGENTS.md rule that the legacy sentinel fields are migrated deliberately and separately (webern#249). Non-breaking: two new fields on `FrameData`, both absent by default. ## Testing - [x] New `harmonyFrameFirstFretRoundTrip` test covers both attributes through XML and back; `harmonyFrameFirstFretBareRoundTrip` verifies a frame with neither still emits `<first-fret>3</first-fret>` and reads back as `unspecified` - [x] `make api-test` (6367 assertions in 582 test cases) - [x] `make api-roundtrip` (405 of 405 pinned) - [x] `synthetic/first-fret.3.0.xml` unlocked and added to the round-trip baseline; confirmed it fails on the parent commit with `attribute count mismatch at .../frame/first-fret` and passes with this change 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UbK99eFKnXpH5ki6ysZMdA
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human Summary
Round-trip the
<first-fret>text and location attributes throughmx::api.Summary
MusicXML's
<first-fret>carries two display attributes beside its value:text, the label toprint (Finale writes
4fr.for a frame starting at the fourth fret), andlocation, whether thatlabel appears to the left or the right of the grid.
mx::corehas modeled both since it wasgenerated, but
mx::apiexposed onlyfirstFretandisFirstFretSpecified, so the writer emitteda bare
<first-fret>4</first-fret>and a reading application had to invent the label and its side.FrameDatagainsfirstFretText, an optional string, andfirstFretLocation, a newFirstFretLocationenum whoseunspecifieddefault writes no attribute. The two are independent:MusicXML permits either alone, and a frame that wants only the fret number keeps working untouched.
The value and its
is...Specifiedflag are left as they are rather than folded into a sub-struct,per the AGENTS.md rule that the legacy sentinel fields are migrated deliberately and separately.
Non-breaking: two new fields on
FrameData, both absent by default.Testing
harmonyFrameFirstFretRoundTripcovers both attributes through XML and back;harmonyFrameFirstFretBareRoundTripverifies a frame with neither still emits<first-fret>3</first-fret>and reads back as unspecifiedmake api-test(6367 assertions in 582 test cases)make api-roundtrip(405 of 405 pinned)synthetic/first-fret.3.0.xmlunlocked and added to the round-trip baseline; confirmed itfails on the parent commit with
attribute count mismatch at .../frame/first-fretand passes withthis change
References
mx::api#406, the other outstanding<frame>gap in the same reader and writer