Skip to content

Cut portal churn residue that leaks into typing latency - #302

Merged
arzafran merged 2 commits into
mainfrom
fix/portal-churn-residue
Aug 14, 2026
Merged

Cut portal churn residue that leaks into typing latency#302
arzafran merged 2 commits into
mainfrom
fix/portal-churn-residue

Conversation

@arzafran

Copy link
Copy Markdown
Member

What this does

The typing-lag gate on main failed first-attempt on both post-glass merges (3.57x, then 2.44x vs the 1.70x cap) and passed on rerun — the glass portal raised workspace-churn typing latency into gate-adjacent territory. This removes the two cheapest real costs the portal adds during churn. Both changes are strictly less work; no behavior changes.

Summary

  • Reassert requests (posted per pane close) are now scoped to the closing window instead of broadcast app-wide, so churn no longer triggers republish storms across every workspace. The dismantle-race survivor the mechanism protects is always in the same window; a nil object still broadcasts.
  • Control clusters no longer re-add themselves to the host view on every coalesced geometry pass (re-adding an existing subview removes and re-inserts it, dirtying layout per runloop turn during animation storms); they reorder only when a newly added pane bar actually sits above them.

Test plan

  • CI green, including tests-build-and-lag on the merge run
  • Manual: split churn (split, close, repeat) — pills and control capsules stay positioned and clickable; closing a pane during split churn still restores the surviving pane's tab bar (the reassert race)

Workspace churn (the lag-gate scenario) closes panes and cycles workspaces,
then types immediately. Two portal behaviors added latency residue inside
that window:

- removePaneChrome broadcast its reassert request app-wide (object: nil),
  so every anchor in every window republished on every pane close. The
  request is now scoped to the closing registry's window; nil stays a
  broadcast for compatibility. The dismantle-race survivor it exists for is
  always in the same window.
- updateClusters re-added the control clusters on every coalesced geometry
  pass; re-adding an existing subview removes and re-inserts it, dirtying
  layout every runloop turn during animation storms. Clusters now reorder
  only when a pane bar actually sits above them.
Posting with a nil object is an app-wide broadcast — the storm the scoping
exists to prevent — and a window that died before the post has no anchors
left to reassert. Skip the post instead.
@arzafran
arzafran merged commit 14e2ebd into main Aug 14, 2026
10 checks passed
arzafran added a commit that referenced this pull request Aug 14, 2026
Resolves WindowPaneChromePortal: keep the single-row strip layout and adopt
main's ensureAboveBars z-order helper from the portal-churn fix (#302).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant