fix: rogue "s" next to roman numeral harmony labels - #596
Closed
FelipeDefensor wants to merge 2 commits into
Closed
Conversation
Fixture and its generator, per the repro-bundle guideline in #580. Harmony is outside the CLI's `timelines add` / `components` coverage, so the state is built through `commands.execute(...)` and saved with `file.save`. The fixture reproduces on v0.6.4: the same file shows Is6 / Iss64 / Vss65 / Vss43 / Vss42 / Vss65/V / iiss65 without the fix, and I6 / I64 / V65 / V43 / V42 / V65/V / ii65 with it. The root-position I and the stacked V%sss432 are unchanged either way, as controls. Both files are throwaway: delete before merge. The durable artifact is TestRomanNumeralDisplay::test_roman_label_has_no_blank_accidental_placeholder.
_figs_to_str emitted "s" for every figured-bass slot without an accidental. That placeholder is only consumed by MusAnalysis inside the three-figure stack introduced by "%"; there is no blank slot in the one- and two-figure forms, so the character was drawn literally: "Is6" for a first-inversion triad, "Vss42" for a third-inversion dominant seventh. Emit the placeholder only in the stacked form.
Collaborator
Author
|
Superseded by the combined
The remaining defect in this area — accidentals being emitted as a block before the numbers, so they can be drawn against the wrong figure — is pre-existing at v0.6.4 and tracked separately in #598. |
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.
Harmony labels in roman-numeral display mode carry a stray
sinside the numeral: a first-inversion triad readsIs6instead ofI6, a third-inversion dominant seventhVss42instead ofV42.Reported against 0.6.4 while importing a harmony CSV; this branch is off
v0.6.4.Cause
_figs_to_stremits"s"for every figured-bass slot without an accidental:That placeholder is only consumed by MusAnalysis inside the three-figure stack introduced by
%— the encoding is positional, so each of the three accidental slots needs a filler (%sbs765). The one- and two-figure forms have no blank slot, so the character reaches the glyph run and is drawn as a literal letter.Verified against the font:
Is6really rendersI+s+ superscript 6. Two-figure forms accept accidentals positionally without any filler (#b65draws ♯6 over ♭5), so dropping the placeholder outside the stack is the whole fix.Fix
Emit the placeholder only in the stacked form. The
%path is unchanged —V%sss432is identical before and after.Repro bundle
The fixture commit sits before the fix, so "before" is one checkout back.
One-time setup (re-running can discard local edits — it aborts when the head branch is checked out in another worktree, and
--forceresets the branch):After (branch tip):
uv run --python 3.12 tilia "$PWD/repro/harmony-roman-s.tla"Before:
uv run --python 3.12 tilia "$PWD/repro/harmony-roman-s.tla"Back to the tip:
Acceptance criteria
sinside the numerals —Is6,Iss64,Vss65,Vss43,Vss42,Vss65/V,iiss65.I6,I64,V65,V43,V42,V65/V,ii65. TheIat 0 s and the stackedV%sss432at 80 s are unchanged controls.Both states were checked by actually checking out the two commits and opening that file, not inferred from the diff.
Fixture lifecycle
repro/harmony-roman-s.tlaand its generatortests/repro_harmony_roman_s.pyare throwaway — delete both before merge. The generator is not auto-collected (notest_prefix); run it withuv run --python 3.12 pytest tests/repro_harmony_roman_s.py -q. Harmony is outside the CLI'stimelines add/componentscoverage, so it builds state throughcommands.execute(...)and saves viafile.save, asCLAUDE.mdprescribes.The durable artifact is
TestRomanNumeralDisplay::test_roman_label_has_no_blank_accidental_placeholder, which pinsI6/I64/ii7/ii65/V65/V43/V42, plus a companion test pinningV%sss432so the stacked form stays covered.Out of scope, found while investigating
viio65/iirendersviio#b65/II. The numeral is spelled against the applied key but_chord_fbcomputes the figures against the home key.%. Unchanged by this PR (before it, that case also printed the literals).mode._get_music21_object_from_textreturnsNonewhen the text does not start with a note name, so akeyrow with an invalid symbol raisesTypeError: cannot unpack non-iterable NoneType objectand aborts the whole CSV import instead of reporting one error.