Repository navigation
studiobench: a readiness gate that can admit a windowed thread, and three instruments that were charging their own cost to the app - #9439
Conversation
1ae8ff3 to
2d00aee
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b4ee4f0ff1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "end_present": bool(probe.get("marker_found")) | ||
| and (probe.get("marker_from_end") is not None and probe["marker_from_end"] <= 2), |
There was a problem hiding this comment.
Require the final assistant row before declaring readiness
When a windowed renderer has mounted the marked final user turn but has not yet mounted its assistant reply, marker_from_end is zero and this condition still passes. If the store already publishes the expected aria-setsize and the DOM pauses for 600 ms, every windowed condition can therefore pass even though the seeded thread's final message is still missing, starting the measured film during an incomplete mount. Require the expected assistant row after the marker (and reject markers with unexpected trailing rows) rather than accepting any marker within two rows of the end.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Rejecting this one. You are right that end_present alone passes at marker_from_end == 0, but not that every windowed condition can therefore pass: two other conditions in the same dict independently require the final row.
runtime/readiness.py, windowed mode:
out["posinset_reaches_end"] = (fully_mounted and published == 0) or (
probe.get("max_posinset") == expected_messages
)max_posinset is taken over mounted rows only, because PROBE_JS walks [data-role]. If the final assistant row is unmounted then mounted <= expected - 1, so fully_mounted is False and the waiver does not apply, and max_posinset is at most expected_messages - 1, so the condition is False. An arm that publishes no ordinals at all fails posinset_on_every_row instead, and not_over_mounted closes the last escape, a windowed arm mounting expected rows that are not the last ones. Full mode never reaches the question, since all_messages_mounted requires the count outright.
So the composite gate cannot pass in the state described.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0a029f2e7f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if drift is None: | ||
| return _check( | ||
| "scroll_extent", | ||
| None, | ||
| f"no viewport scroll height in one of the censuses (base={b!r}, treatment={t!r})", | ||
| ) |
There was a problem hiding this comment.
Refuse behavioural matches without a scroll census
When _census() fails on either arm, it emits a diagnostic without viewport_scroll_height, so this check returns ok: None; because it is not marked required, compare_behaviour() can still return MATCH when an action-specific check succeeds (for example, equal select_text counts). Behavioural mode can therefore exit 0 while its central scroll-extent invariant was never measured, so this missing reading should make the pair not comparable.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Rejecting this. You have the mechanism right -- scroll_extent returns ok: None and is not required, so compare_behaviour can still reach MATCH -- but MATCH does not assert that the scroll extent held.
analysis/behaviour.py excludes it from the pass column deliberately, because it is a property of the THREAD rather than of the action:
specific = [c for c in checks if c["ok"] is not None and c["invariant"] != "scroll_extent"]The check still travels in checks with ok: None and a detail naming both sides, so a reader sees that it was not measured rather than that it passed.
The other half is why making it required would not recover anything. viewport_scroll_height comes from (D.viewport() || {}).scrollHeight || null, which is a page-level condition: it is absent on all eighteen action pairs at once or on none. So the change would void an entire run rather than rescue a lost reading, and on any run where the viewport exists the extent is measured seventeen further times.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a24a1f0d28
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| census = self._census() | ||
| parity = self._parity() | ||
| visible = self._visible() |
There was a problem hiding this comment.
Keep post-window probes from consuming the next slot
When these synchronous observations take longer than the remaining inter-slot gap—especially on the large fully mounted rungs where the digest serializes megabytes—they still advance the fixed film clock even though they are outside the measured window. The next _run_slot then reaches its deadline late and records an action as missed, and during generation queued SSE work can spill into the following measured gap; because this probe cost scales with mounted DOM, it can remove coverage or bias later metrics differently between the base and windowed arms. The QUICK/FAST schedules contain tightly spaced slots, so recording observation_ms does not isolate this cost; the probes need an observation phase that cannot consume the following slot or contaminate its window.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Rejecting this. The physical claim is right and the correctness claim is not.
The ordering in scene/schedule.py::run puts slot i's gap window AFTER slot i-1's probes have returned, and _gap_window takes its census BEFORE opening the window. So no probe cost ever lands inside a measured window, which is exactly what was moved when over_ms was found to be sampled after the census and digest.
When the probes do overrun the inter-slot gap, _run_slot records ran = False, slot_missed = True with the due time and the arrival time, and floor_table::_action_timings skips rows that did not run. The observation cost itself is published as observation_ms with observation_outside_window: True. So nothing is reported as a value that is not one; the outcome is fewer samples, honestly labelled, which the liveness gate already fails on by default at --allow-slot-misses 0.
Coverage biasing between arms is a real design consideration for a future observation phase. It is not a wrong reading on legitimate input.
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d5da8deec3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| reference = _expect(base_row, "selected_chars") | ||
| base_full = _expect(base_row, "mounted_fraction") | ||
| if not isinstance(reference, (int, float)) or reference <= 0 or base_full != 1: |
There was a problem hiding this comment.
Use whichever arm provides the full-thread reference
When the supported --windowed-arm base configuration is used, the treatment arm can provide a valid fully mounted selection, but this code examines only the base arm and declares clipboard coverage not comparable. A truncated clipboard on the windowed base is therefore never tested, and behaviour_report() can still exit 0 when another action matches. Select the reference from either arm whose mounted_fraction is 1.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Rejecting this, though the gap you describe is real.
--windowed-arm base is accepted by _windowed_arms, and clipboard_carries_the_whole_thread keys only on the base arm's mounted_fraction, so in that configuration the check is never made. But the result is required = True with ok = None, which compare_behaviour turns into NOT COMPARABLE with the reason attached. That is the honest refusal, not a false pass, and this suite treats a refusal and a pass as different things everywhere.
The generalisation is also not free. The reference is selected_chars, the rendered text of the DOM, and the two arms are different builds. Taking the reference from the treatment arm and scoring the base's clipboard against it reintroduces the cross-arm comparison this check was rewritten to remove: it previously compared two arms' clipboards at a 2 percent tolerance across two different serialisations, and could only ever pass by widening until it tested nothing. Today's rule keeps reference and subject inside one build.
Worth doing deliberately if --windowed-arm base is to be covered, with the reference arm named in the row. Not a correctness bug, so not changed under the bar.
cf23475 to
dcba2cc
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 51d728d32b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| elements: document.getElementsByTagName("*").length, | ||
| composer: Boolean(D.composer()), | ||
| running: D.isRunning(), | ||
| setsize: distinct.length === 1 ? distinct[0] : null, |
There was a problem hiding this comment.
Require aria-setsize on every mounted row
When only a subset of a windowed renderer's mounted rows publishes the correct aria-setsize, distinct.length === 1 still exposes that value and both total_declared and total_matches_seeded pass; unlike aria-posinset, the gate never compares a set-size count with the mounted count. This admits an arm that violates the documented readiness/accessibility contract, and if the first mounted row is one of those missing the attribute, dom.threadTotal() falls back to the mounted count so action assertions read the viewport length rather than the conversation length. Record how many rows publish aria-setsize and require all mounted rows to do so.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not taking this one. The first observation is accurate and the mechanism built on it is not.
Accurate: there is no count of how many mounted rows published aria-setsize. setsize is distinct.length === 1 ? distinct[0] : null and setsize_values is the distinct set, so unlike posinset_count nothing records coverage, and a partial publisher with one distinct value does read as agreement.
Where it does not hold: dom.threadTotal() does not read the first row's own attribute. It does first.closest("[aria-setsize]"), which walks UP from the first message, so a row that lacks the attribute still resolves through the wrapper or container that carries it. The fallback needs the first row's whole ancestor chain to lack it while other rows have it, which is a narrower shape than described.
And the direction is wrong for the harm class. If that fallback did fire, threadTotal() returns the mounted count, which is what the assertions in actions.py read as the thread -- and under a windowed mount that makes a send or a delete that WORKED report after == before, as the comment on threadTotal says. That is a false red, not a green run that should have been red, so nothing quotable is published off it.
Which leaves a renderer that publishes aria-setsize on some rows and not others, including the first one's whole chain. That is a build already violating the ARIA contract, and this gate's bar is a correctness failure reachable on well-formed input, so hardening against a malformed publisher is not something I am adding here. Worth a follow-up if a real arm is ever seen doing it, at which point setsize_count beside posinset_count is the obvious shape.
| if not remaining: | ||
| return worst |
There was a problem hiding this comment.
Run the requested null audit before returning
When --audit-null is combined with --mode visible or --mode behaviour—or auto mode classifies every pair as windowed—the plan has no structural entries, so this return occurs before the args.audit_null branch. The command can therefore exit 0 from the ordinary visible/behavioural report without calling audit_null() or enforcing --compared-in, even though the explicit audit option promises to fail unless the null decided the required actions. Handle the audit before this early return, or reject audit combinations that cannot perform it.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and fixed in 59ca77d. The block reads nothing from the plan -- it takes its shards from args.payloads, audits each as a null control, resets worst and returns unconditionally -- so it was sitting below that return for no reason at all. Moved above it rather than duplicated below, so there is one call site and the auto-mode path that already worked reaches it after exactly the same windowed reports as before.
The reachability is worse than --mode visible merely being one way in. Both --mode visible and --mode behaviour hard-set structural to an empty set for EVERY pattern, unconditionally, so with either of them the audit could never run, not merely sometimes. --compared-in enforcement went with it.
New tests test_the_cli_audits_a_single_repetition_under_forced_visible_mode and the --mode behaviour twin assert the audit still fails an undecided null in those modes; both fail against the unfixed code. test_a_quiet_null_still_passes_the_audit_under_a_forced_mode checks reaching the audit does not make it fail everything -- though unlike my usual controls that one is not a both-states control, since the unfixed code never reaches the audit to pass or fail it.
…perseded cell from the floor Two more places where a guard and the rows it guards were read through different lenses. streamcost.js gated noteSse on the "data:" marker while the character counter beside it was gated on the marker OR a pending frame, so the tail of a frame the socket cut inside its JSON body was counted in the denominator and charged to nothing. It skipped the same three quantities the batched-read note above it names: sseChunks, lastSseAt and the deltaTaskMs numerator. When the suffix lands on a later task the first half rendered nothing and its chain has already closed, so the render the suffix starts is charged to no window at all and stream_delta_cost_ms_per_kchar is biased downward exactly as fragmentation rises, which is the regime the instrument exists to measure. A stale lastSseAt also lets replyChars decide the stream went idle and return null for a window still carrying it. Both call sites now read one condition. floor_table.cell_metrics named the surviving attempt as the last COMPLETED cell row while failed_invalidating_gates, computed two lines above it, names the winner as the last cell row of any completion state. skippable_cells re-runs an A/B pair whole, so a resume with any work left re-attempts cells that had already completed, and CellRunner.run writes an incomplete cell row from a finally when the retry dies. The retry's row then supersedes the dead attempt's FAILED gate while this loop kept that same attempt's numbers, so a cell refused for losing its thread's middle was republished after the resume and paired against a clean base arm as faster. That is the 28.2% false result the function's own docstring cites, reached through --resume. Fixed by reading the rows through latest_attempt_rows, as readings_by_arm and ui_parity.collect already do, with gate_failures still computed from the raw stream because a gate row is not one of the row types that function covers. cell_sessions reads through it too, which its docstring already promised. tests/studio/studiobench: 1263 passed.
Both of this round's changes to report() left actions_needing_an_excuse behind, and both drifts fail the job rather than pass it, which is why they need the same care as the excusing direction. report() no longer counts a one-arm-only result for the three actions whose ABILITY to run is a race, so no excuse can move their verdict. Scoped anyway, the null observing the same legitimate stream-timing race made audit_null return 1 and reddened a job whose verdict was 0. report() also carries the live arm in the corroboration key, so a pair blaming opposite arms across the two repetitions is uncorroborated and cannot move the verdict. Built here as bare four element tuples it corroborated, entered the scope, and an undecided null then failed a passing job. The rule is now stated where the function is: scope is what the verdict's fatal set turns on, so anything the verdict declines to count is a question nobody is going to ask. Both filters mirror report() exactly rather than approximating it. Three regression tests, three mutations confirmed, one of them showing the scope is not merely narrower: an action the verdict does fail on is still required of the null.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 79c6ca52fe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| remaining = [e for e in plan if e["structural"] is None or e["structural"]] | ||
| if not remaining: | ||
| return worst |
There was a problem hiding this comment.
Enforce the comparison floor for windowed modes
When every selected pair is windowed, or when --mode visible/--mode behaviour is forced, remaining is empty and this return bypasses the only --min-compared check in report(). Neither visible_report() nor behaviour_report() receives that threshold, so --min-compared 20 can exit 0 with just one matched visible capture or behavioural invariant, defeating the explicit coverage guard. Enforce the threshold across the windowed verdict counts before this early return, including combined-mode totals.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Accepted as correct, and deliberately NOT fixed in this PR. Recording the reasoning rather than quietly leaving it.
Confirmed genuine. min_compared is a parameter of report() alone, enforced at the one site inside it, and report() is called only from the structural loop below the early return. visible_report() and behaviour_report() do not take the threshold at all, so a windowed-only run, or either forced mode, never applies it. --min-compared 20 exiting 0 on one matched capture is a green run that should have been red.
Not fixed here because this is the third distinct consumer of that same early return found in this PR -- the visible noise floor's corpus axis, the null audit, and now the coverage floor -- after the tier axis was fixed there earlier. Patching a third one individually would be the same one-off again, and the honest fix is structural: either hoist every cross-cutting enforcement above the return, or have the windowed reports return their comparison counts so one floor check can cover all three paths. That is a larger change than this PR should absorb at this point, and doing it badly would put the coverage guard somewhere the next reader cannot find either.
So this is on the record as open, with the shape of the fix stated, rather than half-done. The behaviour to preserve when it is taken: the auto-mode path must keep applying the floor exactly where it does today, and a combined-mode run needs the windowed and structural counts summed rather than checked separately, which is the part the current single call site cannot express.
… return --audit-null reads nothing from the plan: it takes its shards from args.payloads, audits each one as a null control, resets worst and returns unconditionally. It was sitting below the structural early return anyway, so it never ran whenever that return fired. That is not an exotic payload. --mode visible and --mode behaviour both hard-set structural to an empty set for every pattern, so --audit-null with either of them could never run the audit at all, and auto mode joined them the moment every pair classified as windowed. The command exited 0 out of the ordinary visible report, having silently skipped both the audit the caller explicitly asked for and the --compared-in enforcement that goes with it, from an option whose whole promise is to fail unless the null decided the actions the result needs an excuse for. Moved above the return rather than duplicated below it, so there is one call site and the auto-mode path that already worked reaches it after exactly the same windowed reports as before. tests/studio/studiobench: 1266 passed.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 59ca77d420
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if failures > 0 or residual > 0 or (pending_at_open > 0 and carried > 0): | ||
| out["reply_chars_scoreable"] = False |
There was a problem hiding this comment.
Tie carried frames to their opening decoder
Fresh evidence after the prior fix is that S.carriedFlushes remains page-global: when stop_generation leaves the old decoder pending at open(), any split frame in the new send_turn response increments this counter, even though it did not complete the old buffer. This condition then combines the old decoder's pending_at_open with the new decoder's carried flush and rejects an otherwise valid stream-cost window. Since every shipped schedule places send_turn after stop_generation, a fragmented new response can still lose the metric; the opening buffer identity and completed-frame identity need to be correlated per decoder.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and accepted as a real residual on the fix I made in 06fafde. Not fixed in this PR; recording it rather than leaving it implicit.
Confirmed: carriedFlushes is declared on S and incremented as S.carriedFlushes, so it is page-global, while pending lives on the per-decoder st. My close condition pairs the OLD decoder's pending_at_open with a counter any decoder can move. So a send_turn response that is itself fragmented increments it on its own split, and the window is refused for a stale buffer that never flushed. That is the same false refusal I set out to remove, surviving in the fragmented case.
What it does and does not cost: the unfragmented new response, which is the ordinary one, is fixed and stays fixed. What remains is the intersection of an abort leaving a partial frame and the next response being split, so this is narrower than the original defect rather than a restatement of it.
The shape of the real fix, since a third one-off here would be the wrong move: carriedFlushes needs to be per-decoder state on st alongside pending, and wireIntegrity needs to report the identity of the decoder it sampled so close can require that the carried flush came from the SAME decoder that was pending at the open. Correlating the two identities is exactly what you say, and it is a change to the instrument's state model rather than to a condition, which is why it is not going in at this point in the PR.
| f"the gesture travelled {fraction} of what it commanded", | ||
| ) | ||
| ) | ||
| out.append(_same_number(base_row, treat_row, "bottom", "scroll_bottom_agrees")) |
There was a problem hiding this comment.
Apply the extent tolerance to the bottom check
When a correct virtualizer's estimated scroll extent differs from the fully mounted arm by 2–10%, the general scroll_extent invariant explicitly accepts it using EXTENT_TOLERANCE = 0.10, but this check compares the same extent (bottom is scrollHeight - clientHeight) using _same_number and its 2% tolerance. Such an arm therefore passes the declared extent allowance and is still reported as behaviourally broken on scroll_after; use the extent tolerance for this quantity as well.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and accepted. Not fixed in this PR.
Verified the numbers: EXACT_TOLERANCE = 0.02 and EXTENT_TOLERANCE = 0.10, and scroll_travelled ends with _same_number(base_row, treat_row, "bottom", "scroll_bottom_agrees"), which routes through EXACT_TOLERANCE. So the same physical quantity is allowed 10 percent drift by the invariant that exists to allow it and 2 percent by this one, and an arm inside the declared allowance is reported behaviourally broken on scroll_after.
Two notes on the direction, neither of which changes the verdict. The failure here is a false RED, so nothing wrong gets published off it, which is why this is not in the same class as the floor and audit bypasses I did fix. But it is worse than noise: follows_the_stream and thread_complete failures remove a cell from readings_by_arm and take the healthy partner with it through the arm intersection, so a systematically red scroll_after on a correct virtualizer quietly shrinks the comparison, and after the unmeasured_planned_cells change earlier in this PR it can VOID the plan instead. A false red that voids a run is still a wrong verdict.
The fix is to read bottom through EXTENT_TOLERANCE rather than _same_number, and the thing to be careful about when taking it is that bottom is scrollHeight - clientHeight and so is an extent, while the other _same_number keys on this path are not; widening _same_number itself would loosen checks that are correctly strict.
| out.append( | ||
| _check( | ||
| f"scroll_travelled:{label}", | ||
| None if fraction is None else fraction >= 0.9, |
There was a problem hiding this comment.
Reject scroll gestures that overshoot their command
When a virtualizer corrects estimated row heights in the same direction as the scripted scroll, travelled_px can substantially exceed commanded_px; for example, a treatment fraction of 2.0 passes this one-sided predicate just like 1.0. The pair can consequently return MATCH even though the viewport moved twice as far as the gesture requested, which is the same user-visible anchor instability this invariant is meant to catch. Bound the fraction above as well as below, with an appropriate tolerance.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and accepted. Not fixed in this PR.
Confirmed the predicate is fraction >= 0.9 and nothing above it, so a travel_fraction of 2.0 passes exactly as 1.0 does, on both arms, and the pair can return MATCH with the viewport having moved twice as far as the gesture asked. The invariant's own docstring says the gesture still covers the ground it commanded, which is the lower bound only, so the code matches its stated intent and the intent is the half that is wrong: overshoot from row-height correction is the same anchor instability this is here to catch, just in the other direction.
Ranked below the two P1s in this round deliberately, and not because it is uninteresting. A bound above needs a tolerance chosen against real virtualizer numbers rather than picked to look symmetric with 0.9, since a scripted scroll that lands slightly long is ordinary and a 2x overrun is not, and I do not have that distribution in front of me. Guessing it would either leave the hole open or start failing correct arms, and the second is the more expensive mistake here given that a failed behavioural gate now removes a cell and its healthy partner from the comparison.
Narrowing the exemption from nine actions to three fixed the wrong half. It was still keyed on the action NAME, and each of the three has non-racy failure paths as well: send_turn returns not_run for 'no composer on the page' (scene/actions.py:1016) and stop_generation for 'the stop button is not present' (scene/actions.py:501). A treatment build that REMOVES either control records exactly the one-arm-only regression this category exists to catch, and the exemption swallowed it and filed it under expected to vary. The mechanism was written down in RACY_EXECUTION all along; it just was not what the code matched on. Each entry now carries the not_run substrings that qualify, compare_rows carries the idle arm's own reason unwrapped, and racy_execution() answers whether THIS not-run is a stream-timing race rather than whether the action is capable of one. Used by the verdict, the audit scope and the evidence step alike. Two pre-existing tests asserted the exemption using 'the control never became visible', which is not a racy reason, so they were asserting the over-broad behaviour; they now supply the real not_run string the exemption names. Four regression tests, three mutations confirmed in both directions: keying by name again reopens the removed-control hole, and refusing every reason reds the legitimate stream race.
# Conflicts: # tests/studio/studiobench/__main__.py
…ch-composer-click
Four hunks, all resolved by combining both sides. Nothing was picked. ui_parity.report, collection loop. Two independent features at one insertion point: this branch buckets NOT_APPLICABLE, the incoming side collects expect_regressed. Both kept, and the ORDER is the decision. The incoming comment states its own invariant, collected before the verdict branches, and the NOT_APPLICABLE branch continues, so putting it first would drop a failed assertion whenever the pair was also a windowed mount. Assertion collection first. ui_parity.report, return. This branch added the decided == 0 guard so a run that could not fire cannot exit 0; the incoming side added expect_bad to the failure condition. Both kept, failure before could-not-tell, because expect_bad survives a pair that continues and so can be non-empty with nothing decided. Also dropped a duplicated comment pair that an earlier merge had left there. ui_parity.main, structural loop. The incoming side adds confine_to_runner and calls report without select, because on that branch this function had no windowed split to select from. select is the FOURTH positional here, so taken as written it would have bound args.min_reps to select and args.min_compared to min_reps, leaving the coverage floor at its default of 0 and scoring a structural pass against an integer, with nothing failing to say so. Combined: the runner confinement produces effective, and the call keeps label, select and both thresholds. test_studiobench_null_audit.py, 566 lines. A pure add/add at the end of the file: three tests from the audit fix here, twenty-three from the incoming instrument work. No overlap, both kept, 68 tests in the file. tests/studio/studiobench: 1298 passed. Both negative controls re-run on the merged tree and both still fail without their fix.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e802705aa7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ran = bool(sides["base"].get("ran")) and bool(sides["treatment"].get("ran")) | ||
| out = compare(sides["base"].get(key), sides["treatment"].get(key)) | ||
| out["_ran"] = ran |
There was a problem hiding this comment.
Preserve action outcomes in windowed parity
When a windowed pair has asymmetric action outcomes, this path compares only the capture subobjects and retains merely the conjunction of ran; it never applies P.compare_rows()'s checks for one-sided execution or expect_ok regression. For example, if stop_generation runs on both arms but fails its assertion only on treatment, identical visible captures are counted as a match, and in auto mode the behavioural pass from other actions can still let the command exit 0 because stop_generation has no action-specific behavioural invariant. Carry the directional ran and expect_ok failures into the visible/windowed verdict instead of discarding them here.
Useful? React with 👍 / 👎.
9351 landed as a squash, so this branch carries its real commits while main carries one blob. 13 hunks across 6 files, every one of them a case where this branch is a strict superset of main and main's side is the state before this branch's own work. Verified before resolving anything, because taking main's side on any of these would silently revert a merged PR: 2c5df95 is an ancestor, and --stream-tail-chars, latest_attempt_rows and corpus_dollars appear in the same number of files and at the same hit counts on both sides. The one real difference is IDLE_WINDOW_KINDS, 2 files on main and 1 here, and it is a rename rather than a loss: this branch renamed it to UNSCORED_WINDOW_KINDS and widened it from {"idle"} to {"idle", "setup"}, moving every use site with it. The single survivor was a stale mention in a comment, corrected here. That rename is why from_payload.py and types.py had to be read together rather than resolved apart. UNSCORED_WINDOW_KINDS excludes "setup", and "setup" is only a valid kind because this branch added it to WINDOW_KINDS; taking main's side in types.py would have left the exclusion naming a kind that can never be produced, which is dead code that looks live. Checked after resolving: UNSCORED and UNAIDED are both subsets of WINDOW_KINDS. INTERFACES.md conflicted in two places and both were shadows of the code conflicts rather than a docs merge, one documenting the "setup" kind and one the UNSCORED_WINDOW_KINDS exclusion. Resolved to match the code and then checked against it: the kind list in the doc and WINDOW_KINDS agree exactly. __main__.py took five hunks, all adding the click_probe and probe_init_script identity axes. Audited rather than eyeballed: no key present on main's side is absent from this branch's, and after resolving, every IDENTITY_AXES entry is produced by requested_identity, every HISTORICAL_DEFAULTS key is an axis, and TREATMENT_AXES is a subset. tests/studio/studiobench: 1005 passed.
Pre-absorbing the parent's resolved head before 9356 squashes, so the post-squash pass has nothing left to reconstruct from a stale base. ZERO conflicts, which is the parent-first technique doing its job: this branch already carried 9356's pre-squash head, so the only new content is main's, arriving through a base that has already reconciled with it. Checked rather than assumed, because a clean merge is not evidence of a faithful one. origin/main is now a genuine ancestor of this branch, which is the strongest containment there is. Symbol parity against main holds for every axis the stack touches; the one counter that drops, IDLE_WINDOW_KINDS at five hits to zero, is the rename verified on 9356, where the nine UNSCORED_WINDOW_KINDS hits that replace it cover every use site and add three more. Nothing main has was removed. The 116 deletions are the parent's own supersessions plus blank-line normalisation; the only content line changed in the three files that looked suspicious is the stale IDLE_WINDOW_KINDS mention in a comment, corrected on 9356 and propagating here. tests/studio/studiobench: 1298 passed. Both negative controls re-run on this tree, where they exist: neutralising the corpus axis still fails test_a_visible_floor_from_another_corpus_is_not_applied, and moving the audit block back below the early return still fails all three forced-mode audit tests.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 514a603ad9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // holes -- and those are the checks that can say what a right ordinal would be, which a | ||
| // digest comparison against an arm that publishes none never could. | ||
| const sig = signature(el, VIRTUALIZATION_ATTRS); | ||
| byOrdinal[String(ord)] = { |
There was a problem hiding this comment.
Reject duplicate visible-row ordinals
When an action leaves two mounted rows sharing an aria-posinset—for example, a virtualizer incorrectly renumbers a recycled row—this assignment silently overwrites the first row's digest, while VIS.ever also collapses both rows into one ordinal. If the surviving digest matches the base arm, compare_visible() returns MATCH even though an extra or incorrect row was visible; the pre-film readiness check cannot catch duplicates introduced during an action. Detect ordinal collisions during capture and refuse the pair rather than discarding one visible row.
Useful? React with 👍 / 👎.
9356 landed as a squash carrying its OWN resolution of main, which is not what this branch pre-absorbed: it took 9356's pre-resolution head. The two sides therefore differ by exactly the decisions made while resolving 9356, which is why these five conflicts sit in the rename region rather than being the empty merge the pre-absorb was expected to produce. Five conflicts, eight hunks. Every one taken from this branch, and in each case main's side is the state before this branch's work rather than anything this branch lacks. floor_table.py and session.py read together, since they are one pair: floor_table imports latest_attempt_rows and session defines follow_verdict, whose stream_coverage_unmeasured key ab.gate_detail_is_unmeasured reads and floor_table's gate filter depends on. Taking main's side in session.py would have deleted follow_verdict outright along with the reattachment condition. Checked after resolving: every name floor_table imports is defined in from_payload, and every stream_coverage key ab.py reads is one session produces. __main__.py hunk 1 is the guard-ordering resolution arriving again through the squash. Main carries prepare_payload, invalidate_stale_reports and a second side_specs at the position this branch moved them away from, so taking main would have produced a duplicate archive and a duplicate spec build. Verified after resolving: exactly one of each, and all three A/B guards still precede both sinks. test_studiobench_probe_survives_failure.py was decided by reading the merged code rather than the two stubs. Merged session.py reads seeded.last_marker and seeded.first_marker and SeededThread declares both, so main's stub, which omits them, would raise AttributeError on the very path these tests exercise. Nothing main has was removed. The 172 lines that appear main-side are all superseded predecessors: the pre-hoist side_specs, the guards at their old position, the pre-fix noteSse gating, and an INTERFACES.md renumbering where this branch inserts a new section 8 and moves Stability to 9. That section's body is byte-identical on both sides, checked rather than assumed. Symbol parity against main holds on all ten axes. tests/studio/studiobench: 1298 passed. Package-wide AST ImportFrom sweep clean. All three negative controls re-run and all three still fail without their fix.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f32bb0654e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| and probe.get("min_posinset") is not None | ||
| and probe["min_posinset"] >= 1 | ||
| and probe.get("posinset_distinct") == published | ||
| and probe.get("max_posinset") is not None | ||
| and probe["max_posinset"] <= declared |
There was a problem hiding this comment.
When a windowed renderer publishes fractional aria-posinset values, this predicate accepts them as long as they are distinct and bounded—for example, successive windows numbered 1.5, 2.5, …, 17.5 with a final row numbered 18 satisfy both this check and posinset_reaches_end. ordinal_coverage() later converts every observed value with int(n), so those fractions truncate to 1..18 and can falsely report complete coverage, admitting rows whose published positions are invalid. Require every observed ordinal to be an integer before treating the window as ready.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not taking this one, and recording why rather than leaving it unanswered.
Your reading of the predicate is accurate. PROBE_JS collects min_posinset, max_posinset, posinset_count and posinset_distinct and never a per-row sequence, so 1.5, 2.5, ... 17.5 with a final row at 18 does satisfy both this check and posinset_reaches_end, and ordinal_coverage does truncate every observed value with int().
Where it does not land is the input. WAI-ARIA and MDN both require aria-posinset to be an integer at least 1 and at most aria-setsize, and Element.ariaPosInSet reflects a string containing an integer, so a fractional ordinal is not well-formed input. The bar this gate is held to is a correctness failure reachable on well-formed input, which is the same reason the aria-setsize coverage count was declined earlier in this round: hardening against a publisher that is already violating the ARIA contract is a different job from refusing an arm that is wrong.
It is also the fractional half of the P1 on this same line, which was rejected on three grounds, one of them this one. Taking it now would be moving that bar rather than fixing a bug inside it, and the bar is what stops this gate from refusing the windowed thread it was written to be able to score.
Worth doing if a real arm is ever seen publishing fractional ordinals. At that point validating the per-row sequence is the obvious shape, and PROBE_JS has to start collecting one before anything downstream can check it.
…9609) * studiobench: a window's stream-cost integrity is about one response `StreamCostInstrument.close` refuses a window whose opening buffer held half a frame AND which then counted that frame. That pair is the thing that actually makes the denominator wrong: characters delivered before the window opened, counted inside it. The two halves were read at two different scopes. `pending` lives on the per-decoder state; `carriedFlushes` was page-global on `S`, so any decoder could move the counter that was supposed to be about that one buffer. `send_turn` follows `stop_generation` in all three shipped schedules, and `stop_generation` exists to cut a socket mid-frame. So the abort's orphaned half frame was routinely paired with a carried flush produced by the NEW response's own split, and a window that had delivered every one of its characters was refused for a buffer that never flushed. Measured against the real instrument in Chromium rather than argued: a two-chunk reply after an abort delivers all 13 of its characters inside the window and is refused, while the same traffic with no abort in front of it is accepted. A refused window is dropped outright, and reads go ragged exactly when the renderer is jammed, so the loss falls on the most expensive windows. That is the flattering direction on cost per character. ## What changed `carriedFlushes` moves onto the decoder's own state beside `pending`, and `wireIntegrity(id)` answers about a NAMED decoder whose id `open` records and `close` passes back. Named rather than compared at the two ends, and that distinction is the whole fix. A same-id-at-both-ends check gets the important case wrong: the response pending at the open can complete its carried frame INSIDE the window and then be replaced as the active decoder before the close, and an id comparison would see two different ids, discard exactly the carry it is looking for, and accept a window whose denominator really is wrong. Asking about the named decoder answers regardless of who is active now. Two details that would otherwise bite later. The sentinel `active` is built by the same constructor as a real decoder state rather than by hand, or a window opening before the first stream reads `undefined` where it wants zero. And the id map holds integers and no `TextDecoder` reference, so it cannot defeat the WeakMap scoping the previous fix introduced; it is bounded on the same discipline as `MAX_PENDING_CHARS`. No payload key changes. `decoder_id` is an argument between `streamcost.py` and `streamcost.js` and never reaches a row, so `INTERFACES.md` has nothing to add and the reasoning lives in the instrument. ## Tests Three new, and the second and third are the ones that matter: - the fragmented response after an abort is scoreable - the counter is shown still to MOVE, asked of the decoder that owns the split, so the first test cannot pass against an instrument that has simply stopped counting carried flushes, which would take the genuine straddle refusal down with it - a frame that really did straddle the window open still refuses its window, with another decoder active at the close, which is the case the rejected id-comparison fix would break Mutation: put the counter back on a page-global and the first fails with `assert 1 == 0` on `wire_carried_frames_counted_in_window`. Four existing exact-dict assertions gain the new key, on the same tolerance idiom they already use for `carried_flushes` beside it. `pytest tests/studio/studiobench -q`: 1301 passed, up from 1298. `ruff` clean. Follow-up to #9439, where this was accepted as a real residual on the fix made in that PR and deliberately left open. * Tighten the comments added by the stream cost integrity change * Pin the marker fragment case at the stream cost window boundary
* studiobench: two ui parity gates that could only ever say yes Both of these are gates that report a pass on input they cannot represent, which is the one failure mode this whole instrument exists to refuse. Neither could report the other answer. ## The coverage floor never ran on a windowed run `main` returns before the structural loop when no pair is fully mounted, and everything cross-cutting kept being written below that line. During the review of #9439 three consumers of that one early return were found and each was hoisted or duplicated in turn: the null control's tier axis, then its corpus axis, then `--audit-null`. This is the fourth. `--min-compared` is a parameter of `report()` and enforced at one site inside it, and `report()` is only reachable below the return, so a run with no fully mounted pair applied no coverage floor of any kind: `--min-compared 20` exits 0 on one matched capture. Two ways in, neither exotic. Every pair classifies windowed, or either of the forced `--mode visible` / `--mode behaviour` invocations, both of which hard-set the structural plan to an empty set for EVERY pattern, unconditionally. The workflow passes `--min-compared 16` on every run, and that floor is what replaces a slot-budget liveness gate for a job that reads no timings. Two blank pages have identical digests, so a run that drove nothing is the easiest possible pass, and this is the guard against it. Fixed structurally rather than a fourth time by hand. The three reports return the pairs they scored and `main` applies one floor over all of them. SUMMED across modes, not checked per report: a combined run splits one film's coverage three ways and a per-report floor fails a run that compared plenty. UNIONED rather than added: `--mode auto` scores each windowed pair twice, once on the visible region and once on the invariants, so adding two counts would double every windowed pair and let a floor of 16 pass on 8. `report` keeps its own parameter and its own exit 3, because the selftests call it directly and it is a complete report in its own right. The return type is an `int` subclass. That is deliberate and it is commented at the definition: the exit code is the primary value, `main` does `worst = max(worst, ...)` at four call sites and the selftests assert `== 0` / `== 1` / `== 2` / `== 3` against these three functions directly in several dozen places. A tuple or a dataclass would mean rewriting all of those in bulk to say exactly what they say today, and an assertion rewritten in bulk is an assertion nobody re-derived. ## Two mounted rows sharing a thread position produced MATCH `parityVisible.capture()` keys its per-message digests by thread position and the assignment was unconditional, so a second mounted row publishing a position a row already held silently REPLACED that row's digest. `VIS.ever` is a set of numbers, so it collapsed the pair as well. Three rows on screen produced a capture indistinguishable from a capture of two, and `compare_visible` then reached a verdict out of a set it did not know was short. Whether that was ever caught was DOM order and nothing else. Reproduced in Chromium: the same ghost row inserted BEFORE the row it shadows leaves the surviving digest agreeing with the other arm and the pair returns MATCH; inserted after, it returns DIFFER. Last writer wins, so the collision passes exactly when the survivor happens to be the one that agrees. The pre-film readiness gate cannot help, because it checks the ordinals an arm publishes before the film and this is introduced during an action. Counted directly rather than derived. `unmounted_at_capture` looks like it should notice, an extra row at one position and a vacancy at another, but in the renumber case the two cancel and it reads a clean zero over a live collision. Consumed BEFORE `ever_visible` and `messages` are compared, because those are the two quantities the collision made short. Read defensively, so a payload recorded before the counter compares exactly as it did. The residual is stated in the code: a collision that had resolved to one row by capture time is not detectable here, and catching it needs the clash recorded when the position is stamped, which is a change to the observer's state model rather than to this loop. ## And the two build differences a capture comparison cannot see `compare_all_with` built its whole result from a capture comparison plus the conjunction of `ran`. So an action that RUNS on one build and cannot be performed on the other collapsed into the same bucket as a missed slot, which every report here counts as lost coverage rather than a finding, and an action that ran on both arms and failed its OWN assertion on one of them left no trace at all. `compare_rows` has always asked both questions; the visible and behavioural paths never did. That is survivable on the structural path and not here, because on a windowed arm THESE two reports are the entire UI verdict: the digest is `not_applicable` by construction and `stop_generation` has no behavioural invariant of its own, so in `--mode auto` a passing invariant on another action carried the run to exit 0. Both questions now come from `analysis/parity.py`'s own functions, extracted out of `compare_rows` so there is one copy rather than a second opinion written out elsewhere -- the drift `INVALIDATING_CELL_GATES` was centralised to prevent, arriving one level down. Held to the same bar the structural path holds: `racy_execution` exempts the not-run reasons that are a lost race rather than a missing control, and `corroborated` demands the same repetition count, keyed on the arm the finding names. ## One existing expectation changed, and it moved UPWARD Calling this out rather than leaving it in the diff, because a changed expectation is the right thing for a reviewer to be suspicious of. `test_a_timed_out_rebuild_leaves_the_behavioural_run_with_no_verdict` asserted exit 2. Both statements about that payload are true: the invariant could not be read, AND the action's own assertion failed on the treatment arm alone. `report` already resolves that precedence for the structural mode, in a comment at the site -- "a run can find a real regression while deciding nothing, and 'it failed' is the more specific answer than 'it could not tell'". Running `report` over that very payload returns 1, so the two modes were disagreeing about one payload and the behavioural one was giving the vaguer answer. The test now asserts 1, keeps every one of its original assertions (`invariants held: 0`, one pair NOT COMPARABLE, NOTHING WAS COMPARED all still print), adds the new one, and pins the agreement between the two modes so they cannot drift apart again. Nothing was loosened: 1 is a failure and 2 is a refusal. ## Tests `pytest tests/studio/studiobench -q`: 1308 passed, up from 1298. `ruff` clean. Mutation study, each mutant reverting one fix to its pre-fix behaviour, with the mutation confirmed present in the tree before anything is run: | mutant | tests red | failure | | --- | --- | --- | | floor goes back below the early return | 3 | `assert 'TOO LITTLE COMPARED' in ...`, mutant exits 0 | | reports blinded to the two build differences | 3 | `assert 'ASSERTION FAILED ON ONE ARM' in ...` | | duplicate ordinal overwritten again | 2 | `assert 0 == 1` on `ordinal_collisions` | | `compare_visible` stops consuming the counter | 1 | `assert 'differ' == 'not_comparable'` | Both-direction controls are present and stay green: an assertion that failed on BOTH arms is coverage lost rather than a build difference, a missed slot is a slow machine and not a build difference, a legitimate renumber-in-place records zero collisions, and a floor set beneath what the run actually compared still exits 0. Follow-up to #9439, where the coverage floor was accepted as correct and deliberately not fixed, and where the duplicate-ordinal and action-outcome reports arrived after the last round and were merged over without an answer. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Tighten the comments added by the ui parity gate change * Check the ui parity coverage floor once per payload pattern * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * studiobench: losing the thread outranks the collision refusal Found by rehearsing the merge with #9575 and then auditing the auto-merged result rather than trusting it, which is how this class of thing is supposed to be caught. The collision refusal added in this PR returns NOT_COMPARABLE before anything else in `compare_visible`, and one of the things it was returning ahead of is the "one arm's viewport ended EMPTY and the other's did not" finding, which is raised with `severe: True` and documented at that site as NOT SUPPRESSIBLE. Losing the conversation is a different kind of statement from a capture that could not be read, and the blanket refusal was downgrading it. A collision provably cannot have manufactured that finding: a collision needs TWO mounted rows sharing one position, so the map it corrupts still holds at least one entry. It can merge two entries and it can never empty a map. So the one comparison a collision cannot have caused is still reported. Only that one, and the asymmetry is the point. Every other comparison below IS corrupted by a collision: `ever_visible` loses an ordinal on one arm alone, so "the two arms put different messages on screen" can be entirely an artefact of the collision, and the per-ordinal digests are short by a row. Those stay behind the refusal. This also puts the refusal on the same footing #9575 gives its own blindness probe -- placed so that losing the thread stays a finding whether or not the capture could be read in full -- so the two land consistently rather than establishing two different orderings for the same kind of refusal. Two tests, both live: the severe finding survives a collision on the other arm, and the control that a collision with both viewports alive is still refused. Mutation: drop the `and not lost_the_thread` guard and the first fails with `assert 'not_comparable' == 'differ'`. * Record the third UI parity exemption in the policy the gate prints The declared policy named two exemptions and there are three. The missing one is UI-PERF-POLICY.md section 1(c): select-all need not select all, PROVIDED copy stays complete. Copy may serialise the thread from the message store as markdown or plain text rather than reproducing a DOM selection. Completeness of the copied content is REQUIRED, silent truncation being data loss; visual selection fidelity is NOT. That is what makes deferral and virtualization cheap, because the copy path stops depending on what is mounted. Updated everywhere the policy is stated, not only the two places that counted it: the POLICY constant and its comment in analysis/parity.py, which is what the three report modes print into the CI job output; the header comment in scene/parity.js; CONTRIBUTING-perf.md; and INTERFACES.md. The exemption is stated with its condition attached everywhere it appears. Naming it without the condition would read as permission to lose conversation. No mode grants it off a digest, and the text says so rather than implying otherwise. --mode behaviour is the only one that speaks to it, through clipboard_carries_the_whole_thread, which already scores the copy against the THREAD rather than against the other arm; that is the required half. Where a payload carries no readable select_all_copy the gate records that the exemption exists and does not grant it. This is the same shape as the caveat the off-screen exemption already carries, and neither is weakened here. Nothing in the verdict logic enumerated the exemptions, so the gate was never narrower than its docstring: the off-screen exemption is expressed as NOT_APPLICABLE in compare() and granted in compare_visible(), the performance one is a human decision with no code path, and there is no exemption list or count anywhere. The only code carrying the two-exemption shape was prose in strings. One assertion did encode it -- "cannot grant either exemption" for the behavioural mode, where "either" means one of two -- and it now asserts the accurate three-way split. Every mode's policy line is held to naming the exemption together with its condition, which fails if the POLICY constant is reverted to two. * Say that clipboard completeness is scored by length, not by content The behaviour-mode policy line claimed the copy stays "complete", which reads as a comparison of the copied characters. It is not one. Each arm's clipboard length is divided by the thread's own visible text and the ratio has to land inside MIN_CLIPBOARD_COVERAGE-MAX_CLIPBOARD_COVERAGE. A content comparison is not available here and is not the missing half: the base arm's clipboard is the DOM's rendered text while a store-based copy is markdown source, so two correct serialisations of one conversation differ character by character. The band is what carries the claim, and it is two-sided for that reason -- the lower bound refused truncation measured at 0.61 of the thread, the upper bound refused the substitution at 2.16. So the printed line now names the measure, disclaims the comparison it does not perform, and interpolates the live band through behaviour_policy() rather than repeating numbers that would drift away from the ones enforced. * Stop behavioural coverage standing in for visible coverage The coverage floor unioned the compared sets of the two windowed modes. That is right for the structural set, which is a disjoint set of pairs whose coverage really does add up. It is wrong for these two: under --mode auto they are not two slices of one film, they are two verdicts on the same pairs. Unioned, one stood in for the other. Behavioural mode reaching all 16 pairs while the visible capture could be read on only 1 still put 16 keys in the set, cleared --min-compared 16, and exited 0 with essentially the whole appearance surface unmeasured. That is the false green the floor exists to refuse, arriving through the floor itself. It is not an intersection either, and that is worth stating because it looks like the obvious repair. The two modes are asymmetric in what they claim to reach: visible-region parity applies to every windowed pair, while a behavioural invariant only exists for the handful of actions that declare one. Every other pair is reported UNCHECKED, which is not a pass and equally not a shortfall, so requiring both verdicts on every pair fails a run for pairs behavioural mode never had an opinion about. Measured at 1 of 4 on the existing coverage fixture, where visible mode read all four. So in auto the numerator is the visible verdict, the one owed on every pair, and --mode behaviour on its own still counts its own. seen stays a union: it is the denominator, the pairs the reports were offered, and shrinking it alongside the numerator would hide the shortfall it exists to express. Both directions are pinned. Four behaviourally checked pairs with one visible capture now report 1 of 4 and exit 3; four visible pairs with three UNCHECKED behavioural ones still exit 0. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Withhold the no-verdict banner when invariants broke matched and broken are filled from disjoint branches of one loop, so an all-BROKEN payload reaches matched == 0 as well. The run listed its broken invariants, then said not one invariant was evaluated and that it carried neither a pass nor a failure, then returned 1, sending the reader off to find out why actions that had run did not run. Gate the banner on broken, which is the precondition its own paragraph argues from, matching report and visible_report. Not gated on build_failed: those shapes come from pairs whose invariants were unreadable, so the banner stays true there and the existing timed-out-rebuild test pins that pairing. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…wn allowance (#9610) * studiobench: bound the scroll gesture at both ends, at the extent's own allowance Two findings on `scroll_travelled`, both accepted during the review of #9439 and left open there. They are the same mistake in opposite directions: one quantity judged against a tolerance meant for a different quantity, and one judged against no upper bound at all. ## The extent was allowed 10 percent and then 2 `scroll_extent` grants the extent `EXTENT_TOLERANCE`, 10 percent, because a windowed list computes its total height from estimated row heights and corrects them as real rows are measured; it says so in its own comment. `scroll_travelled` then compared the SAME physical quantity through `_same_number`, which routes through the 2 percent `EXACT_TOLERANCE`. An arm inside the declared allowance was reported behaviourally BROKEN on `scroll_after`. A false red is not free here. A broken behavioural invariant removes the cell from `readings_by_arm`, takes its healthy partner with it through the arm intersection, and since `unmeasured_planned_cells` learned to consult these gates it can VOID the plan. It is worse than the report said, and this is the part worth spelling out because it reads as a subtle one. `bottom` is `scrollHeight - clientHeight` and `_drift` is PROPORTIONAL, so subtracting a shared viewport height AMPLIFIES the drift by `H / (H - C)`. On the 10,000 px extent and 800 px viewport measured here that is 1.087. The effective allowance was therefore TIGHTER than the 2 percent it appeared to be, and the two checks printed two different percentages for one scrollbar. So the fix is not a wider tolerance on the same number. The extent is reconstructed from `viewport_client_height`, which the census has carried beside the scroll height all along, and then the allowance means exactly what `EXTENT_TOLERANCE` says. `clientHeight` is the viewport's own height and does not change while the viewport scrolls, so reading it from the census and `bottom` from the gesture is not mixing two instants of a moving quantity. Falls back to comparing `bottom` when either arm's census lacks the field, and the detail names which of the two it compared so the tighter effective allowance is never silent. `_same_number` is deliberately NOT widened. Its other keys are `selected_chars`, `visible_chars` and `clipboard_chars`, none of which is an extent, and all of which are correctly strict at 2 percent. ## The gesture had no ceiling The predicate was `fraction >= 0.9` and nothing above it, so an arm whose viewport moved TWICE as far as the gesture asked passed exactly as 1.0 did and the pair returned MATCH. `travelled` is a sum of `|scrollTop_after - target_before|`, so every pixel above `commanded` is the viewport being moved by something other than the gesture, which is the anchor instability this action exists to detect, in the other direction. The ceiling is DERIVED, which is what was missing when this was deferred: a bound above needs a number, and a number picked to look symmetric with 0.9 either leaves the hole open or starts failing correct arms. Overshoot has one legitimate source, a windowed list correcting estimated row heights, and a correction moves the offset by the error in the estimate. The total of those errors is the error in the arm's extent, and this file already declares how far the extent may be wrong. So the gesture may travel further than it commanded by at most `EXTENT_TOLERANCE` of the arm's OWN scrollable extent, both terms read off the row rather than assumed: 920 px of a 9,200 px extent against a 5,880 px gesture, a ceiling of 1.156. No second constant, and it scales with the rung instead of being another 100K-era figure of the kind this suite keeps finding. A row carrying no extent gets the lower bound alone and says so in its detail, because a ceiling of zero would fail every correct arm and a ceiling of infinity is what is being fixed. ## Tests `scroll_travelled` had no direct test at all before this. Seven, in `analysis/selftest/test_studiobench_scroll_bounds.py` -- a new file beside the code rather than more of the ui-parity command's own suite -- including both controls, because widening one bound and adding another is exactly where a check quietly stops checking: - an extent that is a FRACTION of the real one is still BROKEN, which is the failure `EXTENT_TOLERANCE` was chosen against: a virtualizer that drops rows instead of sizing spacers has a scrollbar that lies - a gesture snapped back to the bottom is still BROKEN, which is the failure the lower bound was written for - an ordinary estimate correction at 1.1 passes the derived ceiling Mutation: restore `_same_number` on `bottom` and three fail, including one asserting the two checks now print the same percentage for one scrollbar; drop the upper bound and the overshoot test fails with `assert 'match' == 'broken'`. `pytest tests/studio/studiobench -q`: 1306 passed, up from 1298. `ruff` clean. Follow-up to #9439, where both were accepted as correct and deliberately not fixed. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Tighten the comments added by the scroll bounds change * Compare one scroll quantity per arm pair and take the allowance on the extent * Size the travel ceiling from the pair's reference extent The overshoot ceiling and scroll_extent read one tolerance off two different denominators, and disagreed inside it. _drift divides by the LARGER of the two extents; the ceiling divided by the arm's own. So extents of 10,000 and 9,050 pass scroll_extent at 9.5% drift, while the 950 px estimate correction that closes that very gap came out BROKEN against a ceiling granting 10% of 9,050: 1.162 travelled against 1.154 allowed. The arm that most needs the allowance is exactly the arm whose own extent is the worse yardstick for it. An estimate correction is the arm closing the gap to the real extent, so the gap is what bounds it, and the pair's reference extent is the honest basis. A false red is not free here: it removes the cell from readings_by_arm, takes its healthy partner with it through the arm intersection, and unmeasured_planned_cells can then VOID the plan. This only ever loosens, since max is never below the arm's own extent. An arm carrying no extent still gets no ceiling rather than borrowing its partner's, because newly bounding an arm that has always been unbounded above is the one direction that could invent a red rather than retire one. Both are pinned: past the reference allowance it is still reported, and the no-extent arm still prints NO CEILING. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
The blocker
studiobench's readiness gate waited for every seeded message to mount:
A virtualized thread never mounts every message, by design. So the arm that addresses the root cause of the 100K+ slowdown scored UNSCORED, and there is no number for the one change that targets the standing DOM.
Raising the timeout would not help. The count is not going to arrive.
The new readiness signal
runtime/readiness.py. Four conditions instead of one count, in one of two modes.scrollHeightaria-setsize, all agreeing, equal to the seeded count.aui-thread-scroll-to-bottomcarryinginvisible), plus--aui-scroll-stabilizeroff the viewportuse-intent-aware-autoscroll's own state rather than from scrollTop arithmetic, which a virtualizer's estimated heights make unreliable. Windowed mode onlyfullmode is strictly STRONGER than the check it replaces. It keeps the old "every seeded message mounted" condition and adds SETTLED and END PRESENT on top. The base arm of every A/B got stricter, not looser. Nothing was weakened to make room for the new arm.The mode is per-arm and never global.
--windowed-arm treatmentselects it for one side. A global switch would let two half-mounted arms both sail through and produce a ratio that still looks fine, which is the same flattering garbage the gate exists to refuse, just symmetrical.Verification: six threads, both directions
Live Chromium, the real
scene/dom.js, the real probe, the realwait_for_thread_ready.runtime/selftest/test_studiobench_readiness_live.py.fullwindowedwindowedmounted >= expected, which is the full-mount condition itself)fullandwindowedaria-setsizewindowedwindowedwindowedThe refusals are specific rather than blanket, and that is asserted:
settled,end_presentandtotal_declaredindependently, so no single mistake in an arm produces a passsettledandend_present; only the total is missingtotal_matches_seeded; onlyend_presentandanchored_at_endfailThe ordinals are accepted on the message or on the row wrapper a virtualizer positions it in, since the wrapper is the element that is actually a member of the set.
What the gate honestly cannot do
Standing at the bottom of a thread, a correct virtualizer and a thread that has lost its history are indistinguishable. Same window, same published total, same anchor. Claiming otherwise would be claiming a power the reading does not have.
So completeness is a separate probe, run once per cell before the measured window: scroll to the top and require the first message to mount, which is the only thing a user could do. It is recorded as a
thread_completegate row, not raised, because losing messages is a finding about the arm rather than a reason to lose the cell. The test asserts both halves: readiness admits that thread, completeness refuses it.aria-setsizeis a contract, not a signalStudio ships no virtualization and no ordinal attributes anywhere in the chat thread. There is no
aria-setsize, noaria-posinset, nodata-message-index;@tanstack/react-virtualis used only by the hub catalog. There is also no supported handle on the message store from outside, and reaching into a React fibre would make the gate depend on build internals, which a harness that drives two different builds in one session cannot afford.So TOTAL is a requirement placed on the arm. That is not a favour asked: WAI-ARIA already requires a list whose items are not all in the DOM to publish
aria-setsizeandaria-posinset, so an arm that omits them is broken for screen readers whatever it does to the frame rate. Refusing to score it is the right answer.fullmode requires none of it and runs unchanged against the shipped build.Downstream full-mount assumptions
window.__sb.dom.threadTotal()is new:aria-setsizewhen published,messageCount()otherwise. On the shipped build the two are the same number, so nothing about an existing run changes.Fixed. Each of these asks about the conversation and was being answered about the viewport. Under a windowed mount the window refills as fast as it empties, so all three read the wrong answer in the same direction and a working action reports as failed:
send_turn"the thread grew"delete_message"the count dropped"stop_generation's cleanup, same shapethread_reopen"it came back with the same messages"select_all_copynow recordsmessages_total/messages_mounted/mounted_fraction, and is scored on the clipboard rather than onSelection.toString(), because a windowed mount cannot select what it has not mounted but can still copy it if the app serialises from its storeFound and deliberately not changed, with the reason:
DELETE_JS'sisConnectedtiming cannot distinguish "deleted" from "unmounted by a scroll". Nothing scrolls during that action so it is safe in this scene; the timing is now only trustworthy when the total also dropped, whichexpect_okrequires. Documented in place rather than rewritten._check_equivalence's four gated keys are whole-thread counts. Both sides load in the same build, so it stays like for like, but a pass then means equivalence of the window and not of the thread. Now carriesscopeandcaveatin the payload instead of being silently reinterpreted.census_peakdegenerates on a windowed arm:elementsbarely varies across the film, so "peak" becomes near-arbitrary and the per-action denominator goes flat. Left alone; it is a reading to interpret, not a bug to patch.reasoning_toggleis window-scoped and always was. It stays self-consistent (opens N, expects N open) so it still passes, but its cost silently stops being a function of thread length. Now carriespanes_scope: "mounted"so the timing is not compared across arms without the pane count beside it.SCROLL_JS's 90 percent travel assertion can fail legitimately when estimated row heights are corrected mid-gesture. Reported here rather than loosened, because loosening it would also stop catching the autoscroll snap-back it was written for.arms/knobs.jscollectRecords/serialisekey messages by absolute index and bake a message count into the digest, sodigest_before != digest_afterwould void every EXACT arm on a windowed mount. Out of scope for this change and recorded so it is not rediscovered.UI parity is not applicable to a windowed arm
The structural digest asks "is the same DOM on screen". An arm whose purpose is to put less DOM on screen answers no on every action. Eighteen red rows that all say the same thing are not a finding, and they bury the ones that are.
analysis/parity.pygains a fourth verdict,not_applicable, kept distinct fromnot_comparable: "this measurement does not apply here" is not "we could not measure this". It is detected from the capture's own newmounted_messages/thread_total, never from a flag somebody has to remember to set.sweep/ui_parity.py --mode autoswitches itself, and in digest mode refuses to print "no stable action rendered differently" when nothing was compared, exiting 2 rather than 0.What replaces it,
analysis/behaviour.py: the scroll extent (a virtualizer that drops rows instead of sizing spacers has a scrollbar that lies), plus invariants onselect_all_copy,select_text,copy_markdown,thread_reopenandscroll_after. An action with no declared invariant reports UNCHECKED rather than passing, because the scroll extent is a property of the thread and would otherwise carry every action to a green.Stated in the banner every time it runs: what is no longer being asked is whether the mounted messages render identically.
Three instruments that were charging their own cost to the app
The census and the parity digest ran inside the measured window. Nineteen
querySelectorAllpasses over ~195,000 elements plus a 5.6 MB structural serialisation, charged to whichever action preceded them:delete_messagemessage_menuThat is not a correction at the margin. It inverted the ranking of the actions this campaign is about, in the direction that makes the standing DOM look like a smaller problem than it is, because the instrument's own cost grows with exactly the quantity under investigation. Both now run immediately after the window closes, at the same moment as before, so digest and occupancy still come from one reading of one DOM. Gap windows take theirs before opening instead, because taking it after would push the next slot and turn an instrument cost into a missed slot.
The "New chat" click silently fell back to
page.goto. A goto is a full document navigation, bundle re-execution and runtime rehydration; the click is a client-side route change that rebuilds one React subtree. Timed as though it were the click, the substitution producedthread_reopenat 6.0 fps, a number about a page load quoted as a number about a thread._click_or_navigatenow returns which route it took, andthread_reopenreportsran = Falserather thanexpect_ok = False, because a timing left in a row is a number somebody eventually averages.The reply-length read was O(document).
streamcost.jsread its denominator withquerySelectorAll('[data-role="assistant"]')at both ends of every window, and the file's own note said it "is identical on both arms of an A/B and cancels in a paired ratio". True of every arm this project had run; false for a virtualized one, which pays a fraction of it and is handed a saving it never earned. It is now counted off the SSE deltas in the decode hook, O(the chunk), and both arms are fed by the same pacer so the count is identical by construction.Measured residual, full document against windowed, same two pages, same run:
The standard film takes about 74 of these per cell, so at 40K elements that is ~16 ms per cell of pure differential; the documented figure at the real 100K rung is 289.6 ms per cell against ~195,000 elements. The test asserts the old reading really is cheaper on the smaller document before asserting the new one is not, so it cannot pass by measuring nothing.
Writing the wire counter surfaced a second defect the test caught: a decode call is a slice of the socket, not an SSE frame, and the second half of a split frame contains no
data:marker. Gating the counter on that marker dropped whole frames exactly when chunks arrive ragged, which is when the renderer is jammed, which is the condition the instrument exists to measure. The denominator would have gone short precisely where the numerator went up.Payload additions
All additive:
readinessandcompletenesson the cell row,mounted_messagesandthread_totalon every parity capture,mounted_before/mounted_afteronsend_turn,delete_messageandthread_reopen,left_via/reopened_viaonthread_reopen,reply_chars_sourceon every stream-cost window, and the gate rowsthread_ready:{mode},thread_completeandwindowed_readiness:{arm}. Contract documented inINTERFACES.mdsection 8.Tests
473 pass, ruff clean. 54 new, including four live-browser files. Rebased onto the current head of
studiobench-composer-click(16f3a051a).One interaction with the schema fixes in
9b364369bis worth flagging, because the first attempt at it was wrong. Exempting the wholeparitysubtree from the bare-zero walker would have passed that commit's own test payload and silently removed the check it had just added. The exemption is two scalars,mounted_messagesandthread_total, in the same narrow shape as itsiexemption.