Skip to content

Copy #621's units.py into tilia_core.timemap again, after its four fixes - #743

Merged
azfoo merged 2 commits into
v1-prereleasefrom
v1/247-units-again
Oct 19, 2026
Merged

azfoo merged 2 commits into
v1-prereleasefrom
v1/247-units-again

Conversation

@azfoo

@azfoo azfoo commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

🤖 Claude

Copies #621 (beat units and time signatures)'s units.py into tilia_core.timemap again, after four more changes there. #732 (copy units.py again) made the previous copy.

Tests

  • test_timemap_units.py ports feat: beat patterns, beat units, time signatures and quarter stamps #621's changed and new cases:
    • the two messages for a long unit;
    • TestMeasureMeter: a meter built from lists holds tuples and hashes like one built from tuples, and quarter_length("1/2") raises TypeError.
  • I wrote these first: they failed against the previous copy (5 failures) and pass with this one.
  • uv run --package tilia-core pytest packages/tilia-core -q: 796 passed, 21 skipped, 8 xfailed, on v1-prerelease as of 2026-10-19. python scripts/check_packages.py passes. black and ruff are clean.

Guarantees. I neutralised the code behind each one, ran the suite, then restored it:

Guarantee Code neutralised Tests failing
a meter turns lists into tuples __post_init__'s body 1
quarter_length reads no text Fraction() for anything 1
a long unit is called too long the old message 3

Part of TimeLineAnnotator/project-management#247

🤖 Generated with Claude Code

@azfoo azfoo left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Claude

Checked against #621 (beat units and time signatures) at 0ee8ea45: no problems found.

  • The copy. units.py here and #621's tilia/timelines/beat/units.py at 0ee8ea45, its branch's head, are the same blob (537e3be).
  • The ported tests are #621's new and changed cases, case for case: the two long-unit messages and TestMeasureMeter. #621's other test changes are about the app's own beat_unit_id, which the core's tests already check as a beat id.
  • The guarantees table reproduces exactly: 1, 1 and 3 failing tests, and 676 passed again once restored.
  • With #736 (time signatures in the measure table), merged since this branch was cut: the commit applies cleanly on today's v1-prerelease, and 741 tests pass, the shared examples included. So a rebase merge needs no new push.
  • #621's quarter stamps and meters didn't change with these fixes: re-running the script in #736's description against #621 at 0ee8ea45 gives the same expected values for all 18 shared examples.
  • CI is green on all three systems.

Copied from tilia/timelines/beat/units.py (desktop#621 at 0ee8ea4),
unchanged: the file is the same blob as there. Since 07cb6d4:
beat_unit_id is the id of the beat that carries the governing unit, in
the app as in the core, with one docstring; a unit longer than
MAX_UNIT_LENGTH is refused as too long, not as not a number; MeasureMeter
turns units and beat_values into tuples itself; and quarter_length makes
only an int a Fraction. The new and changed cases of #621's tests are
ported.

Part of TimeLineAnnotator/project-management#247

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@azfoo
azfoo force-pushed the v1/247-units-again branch from 1a51aa8 to c20fecc Compare October 19, 2026 09:33
Copied from tilia/timelines/beat/units.py (desktop#621 at e5da86a),
unchanged: the file is the same blob as there (2ef3be7). Since
0ee8ea4, the commit copied before, parse_units refuses a fraction
whose denominator, in lowest terms, is above MAX_DENOMINATOR (128), with
the message of any unreadable unit. Whole numbers are unchanged. Sums of
units, such as a row's ts_numerator and the running quarter stamps of
#747 (quarter stamps), then have denominators that divide one fixed
number, where units such as 1/(10**29 + i) made them grow without limit.
The new cases of #621's tests are ported.

Part of TimeLineAnnotator/project-management#247

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@azfoo

azfoo commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator Author

🤖 Claude

90c3223f copies #621 (beat units and time signatures)'s units.py again, after one more change there. This updates the description above: the copy is now #621's tilia/timelines/beat/units.py at e5da86a9, unchanged, the same git blob (2ef3be79).

What changed in #621 since 0ee8ea45: parse_units refuses a fraction whose denominator, in lowest terms, is above 128 (MAX_DENOMINATOR, the limit of a beat unit's own denominator). It uses the message of any unreadable unit: '1/129' is not a whole number or fraction such as 1/2. Whole numbers are unchanged. Sums of units, such as a row's ts_numerator and the running quarter stamps of #747 (quarter stamps), then have denominators that divide one fixed number. Before, units such as 1/(10**29 + i) in measure i made them grow without limit.

Tests. test_timemap_units.py ports #621's new cases:

  • 1/128, 127/128, 1+1/128 and 2/256 (read as 1/128) are read;
  • 1/129, 3/7919, 1+1/129 and 1/100000000000000000000000000001 are refused with the message above;
  • 129, 7919 and 258/2 are read.

Runs:

  • uv run --package tilia-core pytest packages/tilia-core -q: 807 passed, 21 skipped, 8 xfailed (796 before, plus the 11 new cases).
  • python scripts/check_packages.py passes. black and ruff are clean.

Guarantee. With the new check neutralised in the core's copy, 4 tests fail: the 4 refusals. The other 7 new cases pass either way. I restored it after the run.

Checked on #747 (quarter stamps), in a throwaway checkout of its head f93e17dc with this units.py. The input was 8,000 two-tap measures, measure i with the beat unit 4 / 1/(10**29 + i).

build_rows time_map_for + one qstamp last row's repr and JSON
v1-prerelease 0.20–0.21 s 0.21–0.23 s work
#747 as it is 8.7 s 49.7 s raise ValueError
#747 with this units.py 0.29–0.35 s 0.41 s work

Part of TimeLineAnnotator/project-management#247

@azfoo
azfoo merged commit da204ff into v1-prerelease Oct 19, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant