← Back to Pull requests

perf(desktop): bound rendering within oversized turns #4259

Closed
unknown closed this pull request without merging on Sep 06, 2026 02:23 UTC
View on GitHub
unknown unknown commented on Aug 30, 2026 11:11 UTC
Author

Summary

Bound render-active work inside one oversized transcript Turn with nested Chromium content-visibility boundaries at the answer, Processing, reasoning, and tool blocks (5 marker sites in chat-turn.tsx/tool-activity.tsx, one CSS rule). The Turn stays the persistence and paging unit; component identity, disclosure, selection and accessibility are unchanged.

First-paint intrinsic-size estimates follow measured shapes: collapsed disclosures (a folded reasoning run, a tool/activity card) estimate at their 24–32px collapsed row, container blocks (Processing sequences, linked-agent lists) at a multi-line 320px, answers at the 96px single-line baseline. auto remembers each block's real size once rendered.

The measured win is hover: Astryx's :where(parent:hover *) rules invalidate the whole Turn subtree on a mouse sweep, and sub-turn containment keeps that off the ~15k-element oversized Turn (review A/B: hover p95 9ms vs 59ms, 0 vs ~20 LoAF > 50ms, hover recalc ~100ms vs ~1270ms).

Coverage lives below Electron, following #4825: one app-shell story (OversizedTurnHoldsAReadingAnchorOnColdScroll, light/dark) asserts that offscreen boundaries are genuinely skipped by Chromium, and that a cold upward scroll holds a visible reading anchor — |viewport move − intended step| bounded at half a step (120px), with the per-step record printed on failure. The gate caught and drove out a real stall: with the old inverted 320px estimate, materializing a collapsed disclosure swallowed a reader's whole 240px step (measured 244px); with the corrected estimate it passes.

Fixes #4256

Scope note (#4269)

This PR does not touch the scroll authority. main carries its own #4269 fix (the unexplained-delta guard, now with the pin owning overflow-anchor); this branch takes those files wholesale on merge.

Verification

  • npm run format:check / lint / Biome on changed files — passed

  • @maka/core + @maka/ui build clean; transcript-scroll-authority suite (main's) — 13 passed

  • Storybook build + full visual smoke incl. the new story and its AX audit — green on hosted CI

  • Reviewer validation at the prior head: clean install, full build:test, UI 374/374, renderer architecture 98/98, 291-story smoke, exact-head hosted test — no remaining P0–P3 (automated review by @hqhq1025's agent)
  • AI use

  • Generative tooling made a substantive contribution
  • Tool(s) and scope: authored the sub-turn containment, its estimates and the cold-scroll story; adopted main's scroll-authority and fixture direction on merge; ran verification under maintainer direction.

    Checklist

  • Tests cover the change and fail without it

  • Lint, format, typecheck and the affected suites pass locally
  • Does this PR entail a change in behavior?

  • Yes — described under Summary above

  • No
  • Diff: 354 lines (+265 / -89) across 4 files Reviewer: liugddx Review duration: 9551m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 354 lines diff across 4 files
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.351
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #4259"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 47.5% (MEDIUM) · Higher = larger blast radius
    47.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.8% · Safe to merge
    18.8%
    Repository