fix: stop api round-trip crashes on metronome/tempo marks#223
Merged
Conversation
The api pipeline crashed outright (no output) on 16 corpus metronome/tempo files: 8 GETDATAFAIL on read and 8 CREATEFAIL on write. Two long-standing MX_THROW sites were responsible. Read (MetronomeReader): - parseNoteRelationNote() threw "wtf is this" on the <metronome-note> form. The api has no representation for it; leave the tempo unspecified instead of crashing, so the rest of the document still round-trips. - parseMetronomeModulation() was an empty stub that left the tempo unspecified (which then crashed the writer). Implement it: read the two beat-units into api::MetricModulation. Write (DirectionWriter): - The tempo loop threw on any non-beatsPerMinute tempo. Replace with a switch that writes beatsPerMinute and metricModulation, and skips tempoText / unspecified tempos gracefully rather than throwing. Metric modulation now round-trips through the api. The metronome-note form and non-numeric <per-minute> (a legal xs:string, e.g. "ca. 76") no longer crash; their tempo is dropped, producing imperfect output instead of none. Adds targeted red/green tests covering both former crash sites and metric modulation fidelity. Closes #218
gen-quality
|
Coverage reportCore-dev coverage
|
| Metric | Coverage | Covered / Total |
|---|---|---|
| Lines | 77.9% | 28539 / 36624 |
| Functions | 74.4% | 6360 / 8550 |
| Branches | 50.7% | 22672 / 44725 |
API coverage src/private/mx/{api,impl,utility}/
| Metric | Coverage | Covered / Total |
|---|---|---|
| Lines | 72.6% | 5406 / 7451 |
| Functions | 60.3% | 1827 / 3030 |
| Branches | 43.5% | 4504 / 10347 |
Core HTML report | API HTML report
Commit f204033dcbf6a36e622d6bf927e5af2baddb2173.
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.
Summary
The api pipeline crashed outright (no output at all) on 16 corpus metronome/tempo files — 8 GETDATAFAIL on read, 8 CREATEFAIL on write — caused by two long-standing MX_THROW sites in the impl layer (present in the original library too; the round-trip classifier from #217 is what surfaced them).
Read (MetronomeReader):
Write (DirectionWriter):
Result: metric modulation now round-trips through the api. The metronome-note form and a non-numeric per-minute (a legal xs:string, e.g. "ca. 76") no longer crash — their tempo is dropped, producing imperfect output instead of none.
Corpus discovery confirms GETDATAFAIL and CREATEFAIL both drop from 8 to 0. No file reaches a full PASS: all 16 still fail the strict DOM compare on pre-existing, by-design fidelity losses unrelated to metronomes (identification / encoding / part-list reordering), so there are no new live-corpus baseline entries — as the issue anticipated.
Testing
*_MetronomeApi: 17 assertions in 4 test cases)References