fix(app): rankings carry an id, ties arriving mid-ranking are ranked, timer moves forward

- Action::Rank and ranked() carry a ranking id; answers to a replaced or
  dropped ranking are ignored.
- A candidate tying the ranked ones while a ranking is pending replaces
  it with a new ranking over all of them (plus the running answer when
  the ranking is about interrupting it), keeping the first deadline, so
  only compared candidates are missed as lower_score. A better one makes
  the ranking moot.
- next_deadline returns the collect timer while collecting, and the
  settle deadline only while an ending utterance holds the choice up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-11 22:13:39 +09:00
parent 46eebcd256
commit e885630e91
2 changed files with 154 additions and 50 deletions

View File

@@ -101,6 +101,13 @@ when two or more candidates tie on (1) and (2). While the ranking is pending not
does not come within 1.5 s (a ranking that arrives later counts as late), or fails, the earliest-ended
of the tied candidates wins. Candidates are kept in `ended_at` order, whenever they arrived.
Each ranking carries an id (`Rank { id, candidates }`, answered with `ranked(id, order)`). Only the
pending ranking's answer is used: an answer to a ranking that was replaced, or dropped (its answer ended,
or a stop), is ignored. A candidate that ties the ranked ones while a ranking is pending replaces it with
a new ranking over all of them (and the running answer, when the ranking was about interrupting it),
keeping the first ranking's deadline, so only candidates that were compared are missed (`lower_score`).
A candidate that beats the ranked ones makes the ranking moot.
A new request that beats the running answer on (1) or (2) interrupts it at once. One that ties it on
both is ranked against it (the running answer keeps playing meanwhile): if the ranking puts the new
request first, the answer stops (missed, `interrupted`) and the new request is answered; if it puts the