Repository navigation
studio: measure the code block collapse the thread override prevents - #9464
Conversation
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d7c372fdf4
ℹ️ 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 previous >= TALL_PX and height <= previous * 0.5: | ||
| open_drop = (frame_index, previous) |
There was a problem hiding this comment.
Detect collapses against a retained tall height
When a collapse is distributed across frames so that no adjacent step halves the height—for example, 1700 → 1000 → 600 → 350 → 200 → 350 → 600 → 1000 → 1700—this condition never opens a drop because it compares only with the immediately preceding height, which eventually falls below TALL_PX. The detector consequently reports zero collapses for a full transition to the placeholder and back; retain the last tall/reference height while evaluating a multi-frame descent.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The arithmetic reproduces on the log you give, but a monotone multi-frame descent is not producible by the phenomenon being measured: the node is replaced and drops to the contain-intrinsic-size fallback in one frame, and heights otherwise only grow while a reply streams. The MUST_FLICKER positive controls would fail loudly if the detector went blind.
| "toFrame": None, | ||
| "heightBefore": before, | ||
| "heightAtFloor": height, | ||
| "frames": None, |
There was a problem hiding this comment.
Preserve the true floor for timed-out drops
When an unrecovered drop bottoms out and then partially rebounds before exceeding RECOVERY_FRAMES—for example, 1700 → 200 → 500 held for 240 frames—this branch records heightAtFloor as 500 even though the floor was 200. The newly added per-frame worstDropPx update makes the artifact internally contradictory (worstDropPx is 1500 while the recorded floor implies only 1200); compute the minimum over the open drop here as the recovered and EOF branches do.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Reproduces, and it is inconsistent with the two sibling branches that use min(), but heightAtFloor is a diagnostic field in detail only. The pass/fail path is built from collapses, worstDropPx and blocks, so no verdict, crash or data loss turns on it.
| for v in os.environ.get("SMOKE_FLICKER_VARIANTS", "tree,legacy,released,streamdown").split(",") | ||
| if v.strip() | ||
| ] | ||
| REPEATS = int(os.environ.get("SMOKE_FLICKER_REPEATS", "3")) |
There was a problem hiding this comment.
Reject zero repetitions before declaring success
With SMOKE_FLICKER_REPEATS=0, the selected variants still satisfy the new positive-control guard, but the inner repetition loop executes no cases, all_rows remains empty, every verdict is skipped, and the harness exits successfully with “every variant behaved.” Validate that REPEATS is positive so a configuration error cannot produce a clean result without measuring any positive control.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The hole is real but it needs an operator to export SMOKE_FLICKER_REPEATS=0 explicitly. No CI step sets it, and a deliberate misconfiguration is not legitimate well-formed input.
The content-visibility override on thread code blocks in index.css has been re-litigated three times because nothing measures what it prevents. This adds the measurement and no behaviour change. A Playwright fixture streams a reply ending in code fences and records every block's rendered height per frame, across four injected CSS variants including streamdown's own defaults, and a detector separates a collapse to the placeholder band from a block that is simply still filling in. Against the tree as it ships the run reports no collapses; against streamdown's defaults it reports them. Nothing in src/ changes.
8247aa1 to
877258c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 877258cd0d
ℹ️ 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".
| ENGINES = [ | ||
| e.strip() for e in os.environ.get("SMOKE_FLICKER_ENGINES", "chromium").split(",") if e.strip() | ||
| ] |
There was a problem hiding this comment.
Reject an empty engine selection
When SMOKE_FLICKER_ENGINES is empty or contains only commas/whitespace, this comprehension produces an empty list. Both execution and verdict loops are then skipped, failures remains empty, and the harness returns success with an empty artifact despite running neither the positive control nor the tree variant. Validate that at least one engine remains after filtering.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Same shape as the SMOKE_FLICKER_REPEATS=0 item on this PR: it needs an operator to export SMOKE_FLICKER_ENGINES as empty or all-separators on purpose. No CI step does, and the step added in 72ca291 sets it explicitly to chromium. Deliberate misconfiguration is not legitimate well-formed input.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 72ca2916e4
ℹ️ 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".
| moved = abs( | ||
| (current["anchorTop"] + current["scrollTop"]) | ||
| - (previous["anchorTop"] + previous["scrollTop"]) | ||
| ) |
There was a problem hiding this comment.
Preserve the viewport shift in the anchor metric
Because the streamed reply and all of its collapsing blocks are appended after anchor, that anchor's content-space position remains fixed while the visible jump appears as a change in the scroll container's scrollTop. Adding scrollTop to anchorTop cancels exactly that movement, so the default collapse scenario reports anchorShiftPx == 0 even when the viewport visibly jumps; measure the viewport-relative displacement, or another quantity that retains the scroll-position change.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Document space is the deliberate definition here, stated in the comment on the line and in the module docstring: the metric is movement of settled content that existed before the stream, and the viewport scrolling under an anchor is not that anchor moving. It also gates nothing, failures is built from collapses and blocks only, and this PR's own contract test asserts anchorShiftPx == 900.0 for a case where settled content really does move, so it is not structurally zero. Measuring viewport-relative displacement instead is a different quantity, not a fix to this one.
|
Codex Review: Didn't find any major issues. Breezy! 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 |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4fc0d9f3d8
ℹ️ 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".
| "The variant stylesheet did not win the cascade, so this run would have measured " | ||
| "the tree under another name." | ||
| ) | ||
| page.evaluate("(m) => window.__flicker.park(m)", PARK) |
There was a problem hiding this comment.
Apply edge parking after the run-start pin
When SMOKE_FLICKER_PARK=edge is selected, this parks the viewport before window.__flicker.run() appends the user message. That append emits thread.runStart, and the real Thread handles it in use-intent-aware-autoscroll.tsx by unconditionally calling pinToBottom("auto"), so the requested edge position is immediately overwritten; the park option copied into the fixture config is never read during the run. Consequently, edge-mode artifacts actually measure the same bottom-pinned scenario as the default, so apply the edge positioning after run start or otherwise prevent the subsequent pin.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The mechanism is real and I confirmed both halves: config.park is never read, the fixture only reads chunkChars, fences, gapMs and linesPerFence, and the real Thread's use-intent-aware-autoscroll pins to bottom on thread.runStart unconditionally, clearing the detach flag first. It still does not clear the bar. PARK appears at exactly three sites and reaches no output: not the per-case row, not the JSON artifact, not the summary table. So no artifact says edge while holding bottom-pinned numbers, and no verdict moves, because the exit code comes from the MUST_FLICKER and MUST_NOT_FLICKER sets evaluated on whatever ran, which in edge mode is the default configuration complete with its positive controls. An opt-in knob that silently degrades to the validated default is dead code, not a wrong measurement, and this PR has already converged and had its final comment pass, so the bar for reopening it is a genuine correctness bug.
Adds the measurement for a rule that keeps getting re-litigated, and changes no behaviour.
Why
src/index.cssforcescontent-visibility: visibleon thread code blocks. That override has now been questioned or removed three separate times, and each time the argument has been made from reasoning rather than from a number, because nothing in the tree measures what the override prevents. This adds that measurement.The failure it guards against is a one-frame collapse: a code block whose height drops to the
contain-intrinsic-sizeplaceholder band and then springs back, taking the scroll position with it. It reads as the chat area reloading for a frame.What is here
studio/frontend/smoke-code-block-flicker{-main.tsx,.html}-- a fixture that mounts the realThread, streams a reply ending in code fences, and samples every block's rendered height on every frame, along with what the tree actually computed forcontent-visibilityandcontain-intrinsic-sizeso a run records which CSS it measured.tests/studio/playwright_code_block_flicker.py-- the driver. It runs four variants:tree(inject nothing, measure whateverindex.cssships),legacy,releasedandstreamdown(the library's own defaults).treeandlegacyare required not to flicker; the others exist so a run that reports no collapses anywhere is visibly a broken harness rather than a pass.tests/studio/_code_block_flicker_analysis.py-- the detector. Separates a genuine collapse to the placeholder band from a block that is merely still filling in as its content streams, and separately reports anchor shift.tests/studio/test_code_block_flicker_contract.py-- 20 tests over the detector and the fixture, driven by hand-written frame logs, so the contract is checked without a browser in the loop.Scope
src/is untouched. The only edit to an existing file is one line added totsconfig.app.json'sincludelist for the new smoke entry; everything else is a new file.tests/studio/test_code_block_flicker_contract.pypasses 20/20 againstmainunmodified.The variant stylesheets are checked to have won the cascade before a result is believed, and the
treevariant asserts the tree computescontent-visibility: visible, which is the override doing its job. If someone drops the override, that assertion is what fails.