Repository navigation
Classify a late in-progress flag as an in-gate start, and spend budgets as deadlines (Re Sodalite#49) - #338
Conversation
…nd spend budgets as deadlines (Re Sodalite#49) The first measurement round made the reported settle times real. The second round showed the signal they hang off is not: all three reporter runs came back `start pre-gate`, including one whose in-progress flag was demonstrably false for the first 376 ms. Stage 1 tested `isDisplayModeSwitchInProgress` on every poll but drew the conclusion the enum only licenses for the first one. A flag observed false at entry cannot describe a switch that predates entry, so that run was logged as the ordering Sodalite#49 was filed on while actually being its opposite. The new `inGateFlagOnly` case keeps the two apart: the switch began inside the gate either way, and what is missing is the start notification, which indicts the observer registration point rather than the panel. Both stages also spent poll counts rather than deadlines. `n` sleeps of `m` ms is only `n * m` on an idle scheduler, and the reporter's Apple TV runs `thermal=serious` throughout: the same 40 x 50 ms Stage 2 took 2082 ms in one run and 2862 ms in another. A budget with a 40 % spread under the load it exists to survive is not a budget, and this is the second measurement defect in a row to make these logs unreadable. Stage 1 and Stage 2 now measure against `budgetMs` / `stage2CapMs`. Deliberately not changed: the cap is not raised and `.brief` is not widened. The reporter's panel has now been measured at ~2.9 s for a rate-only SDR switch, which does contradict the d87b54d sub-second premise, but one panel is not grounds for making every session's cold start wait longer, and the runs that produced these numbers played cleanly. The doc comments carry the measurements so the next change to those budgets starts from evidence. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01HX5zV3Fcf7Nzq4DYGdXvQE
One behavioural consequence worth deciding before this mergesThe deadline change is not purely cosmetic for Stage 1, and I understated that in the description.
That is a shortening, and it lands on the one guarantee this gate exists for: DV Profile 5 cold start, where starting the decode before the switch begins races an AVPlayer error. #274 verified the budget against the log line that printed Three ways to read it:
I have left it at 1, because the alternative is keeping a budget that is only correct when nothing else is happening. But it wants a DV P5 cold start on hardware before it ships, not just green CI, and that is not something the test suite can cover. |
Second round of measurement work on Sodalite#49. The reporter's three new logs are the first unfiltered ones, and they settle one question, expose two defects in the instrumentation, and produce one number worth keeping.
What the logs settle
The panel is innocent for the third time:
content=29.970 → panel nominal 59.943in all three runs. And the judder is gone on the current build.Defect 1:
pre-gatewas reported for a switch that started inside the gateAll three runs came back
start pre-gate, including the flipped run atafter 376ms. Stage 1 testedisDisplayModeSwitchInProgresson every poll but drew the conclusionStartSignal.preGatedocuments for the first one only ("already set when polling began"). A flag observed false at entry cannot describe a switch that predates entry, so that run was logged as the exact ordering the issue was filed on while being its opposite.classifyStartis now a pure function with a third case,inGateFlagOnly, for a flag that rises later with no start notification. The switch began inside the gate either way; the missing piece is the notification, which points at the observer registration point (they are registered on gate entry) rather than at the panel.Defect 2: budgets were poll counts, not deadlines
nsleeps ofmms is onlyn * mon an idle scheduler. The reporter's Apple TV reportsthermal=seriousfrom the first sample onward in all three logs, and the same 40 x 50 ms Stage 2 took 2082 ms in one run and 2862 ms in another. Both stages now measure elapsed time againstbudgetMs/stage2CapMs.This is the second measurement defect in a row on this path; the first one (#279) inflated every settle time by the whole Stage 1 budget.
The number worth keeping
The flipped run is the only one where the panel ever reported an end, and it came at 3238 ms total (2862 ms after the start was seen). Two of three runs instead hit the Stage 2 cap with no end reported at all, both rate-only SDR. So on this panel a rate-only switch is neither sub-second nor reliably observable, which contradicts the d87b54d premise
.briefrests on.Not changed here: the cap is not raised and
.briefis not widened. One panel is not grounds for making every session's cold start wait longer, and the runs that produced these numbers played cleanly. The measurements are in the doc comments so the next change to those budgets starts from evidence rather than from a premise.Also not changed, deliberately
Registering the switch observers at the criteria write instead of at gate entry would be the real fix for "end never reported", and
inGateFlagOnlyis precisely the evidence that would justify it. It touchesapply(), the path carrying DV P5 cold start, #133 and #176, and it cannot be verified without hardware. The order that was missing last time: be able to measure first, then rebuild. If the next round showsinGateFlagOnlydominating, the rebuild has a target and a way to tell whether it worked.Tests
23 in the suite, 7 new, covering the classification table and the deadline behaviour with the reporter's two measured cap durations as cases. Full run: 1631 tests in 241 suites green, plus a
generic/platform=tvOSbuild, since the changed loops sit under#if os(tvOS)andswift teston macOS never compiles them.🤖 Generated with Claude Code
https://claude.ai/code/session_01HX5zV3Fcf7Nzq4DYGdXvQE