Repository navigation
Release — Transparent Stream churn reduction (#5456, #5367) - #5524
Conversation
Stacey2911's follow-up to the identity-preserving live-row reconcile: skip redundant innerHTML rewrite when unchanged, skip reinsert when already in position, stop thinking-block scrollbar flicker. Deep-review subagent + gate: no identity-invariant break (attrs/className/_tcData/interactive-state all still synced unconditionally; only redundant DOM writes gated). Staged on current master (resolves the stale-base #4295 test artifact — 114 transparent/anchor tests green on merge).
|
| Filename | Overview |
|---|---|
| static/ui.js | Three optimisation gates added: reverse-walk position-skip in _renderLiveAnchorActivitySceneTransparent, exact-string innerHTML guard in _refreshTransparentLiveRow, and new _refreshTransparentThinkingLiveRow specialisation. Logic is sound; _rehydrateTransparentLiveRow and preservedState capture are unchanged so interactive-state restoration is unaffected. |
| static/style.css | Adds scrollbar-gutter:stable to .transparent-event-row .thinking-card.open .thinking-card-body; one-line change matching existing precedent in the stylesheet. |
| tests/test_issue5367_transparent_live_row_reconcile.py | Extensive new test coverage: position-skip counting, stable-render zero-insertion, reorder correctness, footer-repair, _tcData carry-forward, innerHTML-skip with interactive-state survival, and thinking-scroll-container preservation. |
| tests/test_issue3820_chat_activity_display_mode.py | Single assertion updated to include scrollbar-gutter:stable in the expected CSS snapshot string; change is mechanical and correct. |
| tests/test_live_to_final_anchor_visible_order.py | Adds eval of the new _refreshTransparentThinkingLiveRow function so existing live-to-final order tests can load the updated _refreshTransparentLiveRow dependency chain; no logic changes to test assertions. |
| CHANGELOG.md | Adds the release entry for the churn-reduction work; maintained by the release process as expected for this repository. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[_renderLiveAnchorActivitySceneTransparent] --> B[Build targetRenderedRows\nforward walk over scene rows]
B --> C{renderedNode exists?}
C -- No --> D[skip]
C -- Yes --> E[push to targetRenderedRows\nwrote=true]
E --> F[Reverse-walk targetRenderedRows]
F --> G{transparentLiveRowAlreadyPositioned?\nparentElement===blocks\nnextSibling===expectedNextSibling}
G -- Yes skip DOM op --> H[expectedNextSibling = renderedNode]
H --> F
G -- No --> I{expectedNextSibling\nin blocks?}
I -- Yes --> J[blocks.insertBefore\nrenderedNode, expectedNextSibling]
I -- No --> K[blocks.appendChild\nrenderedNode]
J --> H
K --> H
F --> L[preserveByKey: remove stale rows]
L --> M{wrote?}
M -- Yes --> N[_syncTransparentEventControls]
subgraph _refreshTransparentLiveRow
R1[Sync attributes + className unconditionally] --> R2{_refreshTransparentThinkingLiveRow?}
R2 -- Yes thinking row --> R3[Update pre.textContent only\npreserves scrollTop\n_decorateTransparentEventRow]
R3 --> R4[_rehydrateTransparentLiveRow\ntcData carry-forward\nrewire interactive state]
R2 -- No general row --> R5{innerHTML changed?}
R5 -- Yes --> R6[existing.innerHTML = newHtml]
R5 -- No skip DOM write --> R4
R6 --> R4
end
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[_renderLiveAnchorActivitySceneTransparent] --> B[Build targetRenderedRows\nforward walk over scene rows]
B --> C{renderedNode exists?}
C -- No --> D[skip]
C -- Yes --> E[push to targetRenderedRows\nwrote=true]
E --> F[Reverse-walk targetRenderedRows]
F --> G{transparentLiveRowAlreadyPositioned?\nparentElement===blocks\nnextSibling===expectedNextSibling}
G -- Yes skip DOM op --> H[expectedNextSibling = renderedNode]
H --> F
G -- No --> I{expectedNextSibling\nin blocks?}
I -- Yes --> J[blocks.insertBefore\nrenderedNode, expectedNextSibling]
I -- No --> K[blocks.appendChild\nrenderedNode]
J --> H
K --> H
F --> L[preserveByKey: remove stale rows]
L --> M{wrote?}
M -- Yes --> N[_syncTransparentEventControls]
subgraph _refreshTransparentLiveRow
R1[Sync attributes + className unconditionally] --> R2{_refreshTransparentThinkingLiveRow?}
R2 -- Yes thinking row --> R3[Update pre.textContent only\npreserves scrollTop\n_decorateTransparentEventRow]
R3 --> R4[_rehydrateTransparentLiveRow\ntcData carry-forward\nrewire interactive state]
R2 -- No general row --> R5{innerHTML changed?}
R5 -- Yes --> R6[existing.innerHTML = newHtml]
R5 -- No skip DOM write --> R4
R6 --> R4
end
Reviews (1): Last reviewed commit: "release #5456: transparent-stream churn ..." | Re-trigger Greptile
Release — Transparent Stream churn reduction (#5456, #5367)
Ships @Stacey2911's follow-up to the identity-preserving live-row reconcile: the renderer skips redundant work while a response streams, reducing visible flicker and jank.
What it does
innerHTMLwhen the incoming HTML is unchanged (exact-string compare).expectedNextSibling, reproduces the old terminal order).scrollbar-gutter:stable(matches four in-repo precedents).Gate results (Codex + Fable-UX + full suite + independent deep review)
_tcDatacarry-forward + interactive-state restore run always via_rehydrateTransparentLiveRoweven on skip; only the redundant DOM write is gated. Identity-preservation invariant intact.scrollbar-gutterline is a ~5px static delta matching in-repo precedent, below the screenshot-gate threshold. No visual sign-off required for merge.Note: the PR branched before master's #4295 scroll-anchor fix, so the raw head showed 2 unrelated scroll-anchor reds; they clear on merge-forward (verified: 114 transparent/anchor tests green on the merged tree). Staged on current master.
Diff scope:
static/ui.js,static/style.css+ tests. Credit: @Stacey2911.