Skip to content

Fix timestamp editor reading short fractions as milliseconds - #1660

Open
Dev-next-gen wants to merge 1 commit into
chidiwilliams:mainfrom
Dev-next-gen:fix/timestamp-editor-fraction
Open

Dev-next-gen wants to merge 1 commit into
chidiwilliams:mainfrom
Dev-next-gen:fix/timestamp-editor-fraction

Conversation

@Dev-next-gen

Copy link
Copy Markdown

In the transcription viewer, editing a segment's start or end cell and typing 00:00:05.5 stores 5005 ms, not 5500 ms. On focus out the cell is redrawn as 00:00:05.005. Typing 00:00:05.1234 stores 6234 ms, so the extra digit pushes the segment more than a second later.

parse_timestamp reads everything after the dot as a whole number of milliseconds (int("5"), int("1234")), whatever its length. The editor itself writes the fraction as three digits (to_timestamp), so 05.5 and 05.005 end up as the same value even though the cell shows 05.500 for half a second.

The fix reads the fraction as a decimal: it is padded or cut to three digits before converting, so .5 is 500 ms, .45 is 450 ms and .1234 is 123 ms. Three-digit input such as 01:23:45.678 gives the same result as before.

I added parser tests for short and long fractions and a TimeStampLineEdit test that types 00:00:05.5 and fires a focus out. Before the change the three new tests fail (5005 != 5500, 6234 != 5123, and the widget's get_milliseconds() returns 5005). After it they pass, along with the other tests in transcription_segments_editor_widget_test.py (44 passed).

Found by a defect-hunting pipeline I build and run (Dev-next-gen), using Claude Code with Anthropic's Claude Opus 5.5.

Typing 00:00:05.5 in a segment start or end cell stored 5005 ms
instead of 5500 ms, and 00:00:05.1234 stored 6234 ms. The digits after
the dot were parsed as a whole number of milliseconds regardless of
their count.

This branch has not been deployed

No deployments
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