orca icon indicating copy to clipboard operation
orca copied to clipboard

Prove visible terminal size convergence

Open brennanb2025 opened this issue 5 months ago • 1 comments

Summary

  • Adds a deterministic renderer-unit oracle for terminal-geometry.visible-convergence at the post-spawn PTY size reconcile layer.
  • Covers first 0x0 visible measurement, delayed hidden-to-visible layout settle, and requested-size versus provider-applied-size drift when a resize application is dropped.
  • Updates the reliability gate manifest with the focused command, test files, perf note, and explicit live-shell/provider-contract gaps.

ELI5

A terminal needs to agree on its size in several places: what the UI thinks, what the terminal renderer thinks, what the PTY thinks, and what the shell sees. When those disagree, users get blank panes, wrapped text, or broken splits. This PR adds a deterministic test for the size-recovery logic so visible terminals keep trying in bounded steps until the important sizes line up.

Why We Need This

This covers the visible terminal-size convergence class. Blank panes, broken wrapping, and split-layout failures can happen when xterm, fit/proposed size, provider-applied PTY size, and the visible layout disagree, especially after 0x0 measurements or hidden-to-visible transitions.

Product Code vs Gate Coverage

This PR is gate coverage, not terminal sizing restructuring. It adds deterministic renderer-unit tests for the existing post-spawn PTY size reconciliation layer and records the remaining live-shell/provider-contract gaps in the manifest. The gate proves convergence attempts are bounded and do not rely on blind sleeps.

Merge Order

Requires #7001 first because this PR updates the reliability gate manifest introduced there.

After #7001 lands, this PR can merge independently of #7004, #7005, #7007, and #7008. No other child PR must merge before this one. Later child PRs may need a normal manifest rebase if this one lands first.

Why These Tests Stay Useful

  • Invariant protected: visible terminal size must converge across xterm size, fit/proposed size, requested PTY size, and provider-applied size, or stop in a bounded degraded state instead of looping forever.
  • Right layer: the first gate targets the post-spawn size-reconcile decision layer, where the 0x0, hidden-to-visible, and dropped-applied-size cases can be made deterministic. A real shell stty/echo-wrap test remains a follow-up provider-contract or Electron gate.
  • Stable oracle: the test uses controlled measurements, controlled provider applied-size state, and a controlled frame scheduler. It waits on explicit reconcile steps rather than wall-clock sleeps or browser rendering luck.
  • How we know it works: removing the bounded retry/convergence behavior, trusting the first 0x0 measurement, or ignoring provider-applied-size drift makes the focused tests fail. With the gate intact, convergence happens within the asserted frame/call budget.
  • Why it stays useful: the test encodes the durable contract reviewers care about: visible terminals cannot blindly trust stale or zero geometry, and recovery work must remain bounded. The manifest keeps live-shell, remote-runtime, and provider readback gaps explicit.
  • Anti-flake policy: the oracle counts resize/reconcile work and final state under a deterministic scheduler. The gate remains experimental until soak history, runtime evidence, and provider/Electron follow-up coverage justify promotion.

Validation

  • pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/terminal-geometry-visible-convergence.test.ts src/renderer/src/components/terminal-pane/pty-size-reconcile.test.ts src/renderer/src/components/terminal-pane/split-right-white-screen.test.ts
  • pnpm run check:reliability-gates
  • Pre-commit oxlint, oxlint react-doctor config, and oxfmt on staged TypeScript

Residual risks

  • This first harness is renderer-unit coverage; it does not execute a real shell, so stty size and echo-wrap behavior remain follow-up provider-contract/Electron coverage.
  • Providers without applied-size readback, including the remote-runtime seam, are documented as unconfirmed at this layer.
  • Manifest maturity remains experimental until soak/red-green evidence exists.

Performance note

  • The oracle uses a controlled frame scheduler with no sleeps, asserts convergence stops before the hard frame cap, and keeps resize calls bounded so hidden/parked paths do not add redundant SIGWINCH or frame loops.

Made with Orca 🐋


Open in Stage

Post-PR Stabilization

  • CI checks pass after the post-PR wait.
  • PR comments and review-comment surfaces were checked; no actionable automated review comments remain.

brennanb2025 avatar Jul 01 '26 08:07 brennanb2025

Ready to review this PR? Stage has broken it down into 2 individual chapters for you:

Title
1 Implement deterministic renderer-unit convergence oracle
2 Update reliability gate manifest for terminal convergence
Open in Stage

Chapters generated by Stage for commit 9344a0488101a29b3d1e842e2b22b3eb0055ffb4 on Jul 1, 2026 8:23am UTC.

ghost avatar Jul 01 '26 08:07 ghost

Closing because the proposed geometry gate and regression objectives are now covered by the current executable terminal-geometry.visible-convergence contract.

Current main lists the reconcile, reassertion, split-right, wake, applied-size and runtime suites, with assertion references for zero-size recovery, late hidden layout, dropped/applied-size divergence, bounded work and ordered mirror geometry. The existing reconcile/split-right tests cover this PR's three scenarios. The current gate also preserves the live-shell/Windows limitations instead of replacing its provider-contract scope with a renderer-unit-only description.

I reviewed the complete 266-line patch at 9344a0488101a29b3d1e842e2b22b3eb0055ffb4 against main b1d1200ddabcdd28ab2bcbcf29b363c4d5eba0fb. The three added tests pass, but also all pass after removing only the positive-size measurement guard, so the nominal initial-0x0 case does not add the claimed guard oracle. This is a supersession decision, without claiming that every live-shell/platform gap is solved. The branch is preserved.

OrcaWin avatar Oct 27 '26 08:10 OrcaWin