fix(orchestration): don't plan a music unit that can't fit before a handoff (gh-#300) - #319
Merged
Merged
Conversation
#300) The 2PM handoff aired at 2:05. gh-#254's fit biases WHICH track fills a unit; it had no move for "plan no unit at all". At the last pull before the sign-off was due, the queued audio already ran past the boundary, so desired length was deeply negative and the overshot branch still answered with a full least-late track — one extra ~3.5-minute unit inside the last minute IS the entire slip. Under a 90s floor the ceremony now becomes the unit. That number is the break-even, not a guess: planning length L into D of room lands the ceremony (L - D) late, declining lands it D early, so declining wins exactly while D < L/2 — ninety seconds for a typical three-minute unit. Two details that make it correct rather than merely earlier: - The drain runs as-of the BOUNDARY, not "now". A SignOff comes due at boundary - 15s, so an as-of-now drain returns nothing at the moment the decision is taken — which is precisely the bug. As-of-boundary also keeps both halves in one TryDequeueDue call, the documented common shape. - Planning early is not airing early: the ceremony queues behind audio still draining, so it reaches air at the boundary. Handoff kinds only — an ident is imaging that can ride the next seam, and skipping a whole track for one trades a small blemish for a large one. Never-silent is preserved: a ceremony that renders nothing at all returns null and the pull plans an ordinary music unit exactly as before. Also fixes the observability half. Every fit now writes one line carrying each term it reasoned from, at INFORMATION — the fleet ships Information and above (zero dbug: lines exist in Loki), so the Debug line this issue asked for would have been exactly as invisible as no line at all. 12 new specs. Negative control run: disabling the floor fails 6 of them and leaves the 6 that should hold regardless passing. Full suite green (2,559).
…ree (gh-#320) The floor is only ever reached because an earlier unit overshot — it limits damage rather than repairing it. Name the rung above it (the straddle handoff, gh-#320) as the real answer for the band where room is positive but no track fits, and record that this floor should collapse toward zero once that lands.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Addresses #300 (the observed incident and the fit-logging half). The remaining band is #320.
🕓 The fault
The 2PM handoff aired at 2:05. #254's fit biases which track fills a unit; it has no move for "don't plan another unit at all." At 19:59:29 the queued audio already ran past the boundary, so
desiredwas deeply negative, every candidate overshot, and the least-late branch answered with a full ~3.5-minute track. That one unit is the entire slip.🎚️ Scope — one rung of three
Dean's field note reframed this, and the PR is scoped honestly to match:
This does not close the whole class, and an earlier draft of this description wrongly said it did. With ~100s of room and 3.5-min tracks the floor doesn't trip, the fit plans the least-late track, and the ceremony still lands ~1:45 late. What this PR does is fix the incident that actually aired (room was deeply negative) and bound the rest: worst case moves from ~5 minutes late to ~2. The floor is documented in-code as interim, and should collapse toward zero once #320 owns the middle band.
Raising the floor instead of building #320 doesn't work: it converts a late sign-on into an early one — "it's two o'clock" at 1:57.
🛠️ The fix
Under a 90s floor the ceremony becomes the unit. Two details make it correct rather than merely earlier:
boundary − SignOffLeadTime, so at the instant the decision is taken it's still 15s in the future and an as-of-now drain returns nothing — precisely the bug. As-of-boundary also keeps both halves in oneTryDequeueDuecall, the documented common shape.QueuedAheadMsof audio still draining, so it reaches air at the boundary.Handoff kinds only — an ident is imaging that rides the next seam happily. Never-silent (F6.3) holds: the decline only ADDS segments, and a ceremony that renders nothing returns null so the pull plans an ordinary music unit as if the decline never fired. There's a spec for that.
🔭 The observability half
Every fit now writes one line carrying each term it reasoned from:
dbug:lines in Loki. The existing per-pick"Pick —"Debug line has never been visible in production, which is why this was undiagnosable beyond render archaeology. A Debug fit line would have satisfied the issue's letter and none of its purpose. This is also the instrument that will measure #320's band.✅ Verification
Boundary timing is an ear check in the end — worth listening to a handoff once this ships.