Skip to content

TT-7621 fix: make More/Fewer Segments move the way they say - #532

Closed
nabalone wants to merge 2 commits into
TT-7621_pbt-segment-selection-and-recorder-statefrom
TT-7621_pbt-fewer-segments-direction
Closed

TT-7621 fix: make More/Fewer Segments move the way they say#532
nabalone wants to merge 2 commits into
TT-7621_pbt-segment-selection-and-recorder-statefrom
TT-7621_pbt-fewer-segments-direction

Conversation

@nabalone

Copy link
Copy Markdown
Collaborator

Fix 5 of the PBT series. Into #527. Addresses TT-7543.

The fault

Tapping Fewer Segments could leave more segments than before.

More/Fewer only nudge the auto-segment parameters and re-run silence detection, and that is not monotonic: one nudge of "fewer" lowers the silence threshold, which can split the audio further instead of merging it. Whatever came back was applied regardless of direction.

The fix

Both buttons keep nudging in the requested direction until the segment count actually moves that way (small attempt budget), and if it never does they put back the map the user had rather than applying a result they did not ask for.

Still outstanding

The silent no-op half of TT-7543 remains: when re-segmenting cannot do better, the button does nothing and says nothing. Greg's note on that ticket asks the same question ("Should we be putting up a message?"). Telling the user needs a new localized string, which means an XLIFF round-trip, so it belongs in its own change rather than bundled here.

Verification

Note on the run: with the dev server and another browser up, CT timings roughly double and tests can time out spuriously — the two failures I first saw here were load, and passed cleanly on a re-run.

🤖 Generated with Claude Code

nabalone and others added 2 commits August 22, 2026 01:30
Tapping Fewer Segments could leave more segments than before (TT-7543).

More/Fewer only nudge the auto-segment parameters and re-run silence detection,
and that is not monotonic: one nudge of "fewer" lowers the silence threshold,
which can split the audio further instead of merging it. Whatever came back was
applied regardless of direction.

Both buttons now keep nudging in the requested direction until the segment count
actually moves that way, up to a small attempt budget, and if it never does they
put back the map the user had rather than applying a result they did not ask for.

The silent no-op is still there when re-segmenting cannot do better - the button
does nothing and says nothing. Telling the user needs a new localized string, so
it belongs in its own change rather than being bundled in here.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Three findings, all correct.

Phantom undo entry (bug): the undo point was taken before the attempts, so a tap
that could not move the count left the undo button lit for a change that never
happened - and pressing it reset the selection to the first segment and cleared
listen progress. The undo point is now taken only when a result is accepted, and
takes the map explicitly rather than reading state the attempts have moved on.

Up to five writes per tap: each attempt persisted its result to the mediafile,
including the ones being rejected. resegmentWithParams takes { persist: false }
for trials, and only the accepted result is written.

Restore skipped for an empty starting map: the hasPhraseRegions guard meant a
user with no segments kept the last rejected attempt. Since nothing is persisted
during the attempts, the restore is now just state and player, unconditionally.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@nabalone

Copy link
Copy Markdown
Collaborator Author

Claude opened this but it is out of scope for my current card and I believe Greg has other changes planned for the more/fewer segments algorithm

@nabalone nabalone closed this Aug 24, 2026
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