fix: order <note> children to match the MusicXML content model - #63
Merged
Conversation
The <note> constructor built its child list without the parsed ties, so every <tie> was dropped on serialization and a parse-then-write round trip lost the tie information. Add the ties to the child list in the slot the MusicXML content model gives them, between <duration> and <voice>. Co-authored-by: SheepYang1993 <15150244+SheepYang1993@users.noreply.github.com>
<beam> was written before <stem> and <accidental> after <staff>, but the spec sequence is <accidental>, <stem>, <staff>, <beam>. The data survived but the output failed schema validation. Add a round-trip test per asset that compares every <note> child list against the source file. The set of children the library still drops (<time-modification>, <lyric>, and the ones it never parses) is listed explicitly so the gap stays visible.
Closed
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.
Stacked on #62 — review that one first. Base will switch to
mainonce #62 merges.Problem
Pre-existing on
main, unrelated to #60. The<note>child list writes<beam>before<stem>, and<accidental>after<staff>. The spec sequence is<accidental>,<stem>,<staff>,<beam>.Nothing is lost, but the output fails schema validation, so other tools may reject the file or drop elements.
Fix
Move the two entries into their spec slots, and add a round-trip test per asset that compares every
<note>child list against the source file.The children the library still drops are listed explicitly in
unwrittenChildrenrather than being silently ignored, so the remaining gap stays visible. Today that is<time-modification>and<lyric>(parsed but never written), plus the ones that are never parsed.Known, not fixed here
<measure>has a worse version of the same problem: it groups children by type, so<backup>moves after all the notes. Onvoice-element.xmlthat turns two parallel voices into eight notes in a row. That needs the source order preserved, not a fixed order, so it belongs in its own change.Test plan
dart test— 117 pass (4 new)dart analyze— cleandart format— no changes