fix(tui): per-route vertical reserve + required panel props (#1069 round-2 follow-up)
Follow-up to the merged #1069, addressing @sahrizvi's round-2 review. Also passed a 2-model consensus panel (Claude + Gemini) — both SOUND.
What changed (from the round-2 comments)
MINOR — reserve fit only session, under-reserved home. Split into per-route constants that match each route's actual chrome:
HOME_VERTICAL_RESERVE = 10(top spacer 2 + prompt wrapper 1 + prompt ~4 + footer ~3)SESSION_VERTICAL_RESERVE = 7(gaps 2 + paddingBottom 1 + prompt ~4; no top spacer/footer in that column)
Thresholds re-expressed in usable terms (MEDIUM_MIN_HEIGHT 13, FULL_MIN_HEIGHT 34) so full still engages at a ~44-row terminal on home, and the classic 80×24 clears the medium floor with margin (the cliff the review flagged now sits at 23, off the common size).
MINOR — optional props silently defaulted to raw terminal. Made availableWidth/availableHeight required and dropped the component's own useTerminalDimensions + fallback. A call site that forgets to scale is now a compile error, not a silent regression — this is the type-level guard for the "no render test" finding.
NITs
- Medium copy wording clarified (one line on a wide terminal, two at the narrow end).
- Height now uses the same available-space model as width, so short windows shrink instead of crowding the prompt.
- Per-route note:
fullengages ~3 rows sooner on session (≥41) than home (≥44) — intentional (session has less chrome, so more usable height).
From the consensus panel (both models endorsed)
- Centralized
PANEL_HORIZONTAL_PADDING = 4— was a bare-4in the home call site + test helper (vertical reserves were already named constants). - Added the sidebar-toggle transition test:
session(150,50,false) → fullvssession(150,50,true) → medium— pins the exact #1067 case directly.
Effective terminal → variant (verified)
| Terminal | Route | Variant |
|---|---|---|
| 120×44 | home | full (the chosen "full at 44") |
| 106×31 / 80×24 | home | medium |
| 120×22 | home | compact (short-terminal height fix) |
| 130×50 + sidebar | session | medium (blocker-1) |
| 130×50 no sidebar | session | full |
Verification
tsgo clean · 12 unit + 11 render/adjacent tests pass · oxlint 0/0 · prettier. Gate-isolation tests still kill mutants (deleting or <→<=-flipping any gate fails a test).
Deferred (noted by both reviewers): a session-with-sidebar render test as the true call-site regression guard — happy to add as a follow-up.
🤖 Generated with Claude Code
Summary by cubic
Fixes welcome panel sizing so variants are chosen by available space per route, not raw terminal size. Updates reserves, thresholds, and shared route math to prevent “full” in the session sidebar and on short terminals.
-
Bug Fixes
- Per-route reserves corrected:
HOME_VERTICAL_RESERVE = 15,SESSION_VERTICAL_RESERVE = 9. - Thresholds retuned on available size:
MEDIUM_MIN_HEIGHT = 8,FULL_MIN_HEIGHT = 30. Results: 80×24 → medium; home full at ≥45 rows; session full at ≥39; 120×22 → compact. - Centralized arithmetic:
homeAvailable/sessionAvailable, sharedPANEL_HORIZONTAL_PADDING = 4andSIDEBAR_WIDTH = 42; sessioncontentWidthderives frompanelAvailable().width. - Session sizing follows the content column and narrows with the sidebar (including the overlay state); on 150×50, toggling the sidebar flips full → medium.
- Added tests for reserves, overlay narrowing, boundaries and degenerate sizes, plus a render test that asserts each variant’s content.
- Per-route reserves corrected:
-
Migration
WelcomePanelnow requiresavailableWidthandavailableHeight. Pass values fromhomeAvailable(...)/sessionAvailable(...).
Summary by CodeRabbit
- Improvements
- Improved welcome panel sizing across Home and Session views.
- Responsive layouts now account for each view’s available space, including surrounding interface elements and sidebars.
- Updated height thresholds provide more accurate compact, medium, and full panel layouts.
- Panel dimensions now adjust more reliably as available terminal space changes.
- Improved panel content and connection prompts across different layout sizes.