Repository navigation
test(terminal): cover the recovering joiner flag edges - #1738
Conversation
Exercise the real attachment lifecycle through stream loss and a successful replacement attach. Wait for the demo replay parser to drain instead of two animation frames. Refs #1473
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 17 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Merging without a CodeRabbit review: CodeRabbit hit its review limit, so no review ran. The merge pass reviewed it instead. A gate reviewer on a different model than the author's ran 9 tests, all passing. Removing the line that clears recovery fails the new lifecycle test, at terminals.test.ts:143. All required checks are green and no review thread is open. |
…, and cover the recovering edges (#1473) (#1990) Fixes #1473 ## What changes for the user A pane that comes back after herdr could not restore it, or whose terminal herdr replaced, now shows its screen as current again when its attachment recovered meanwhile. Before, such a quiet pane kept its DONE dot until new output arrived. ## Items 1. **Server test of the `recovering` edges:** already on main from #1738 (`server/core/terminals.test.ts`). 2. **The recovery wait and a pane change:** each pane in a layout has had its own keyed `PaneTerminal` since #747, and pane frames are filtered per renderer. So a sidebar pane switch never carries the wait over; the issue's "switching panes inside the same terminal component" no longer happens. One renderer still changes pane in two ways, and `src/lib/useTerminalMount.ts` now handles both: - **herdr could not restore the pane:** the terminal goes to no pane, then attaches afresh when the pane is restored. The mark is now dropped when the renderer leaves its pane (`retireOutput`); a rejoin is told `output-recovering` again while the attachment still recovers. Before, the old mark suppressed the healthy replay. - **herdr replaced the pane's terminal:** the mark is kept, keyed by pane (`recoveringPane`), until the new attach answers: - If it announces `output-recovering` again, the join's replay (`joinReplay`) is still the screen from before, even when it arrives after the replacement. - A replay that `output-recovering` did not announce (`rejoin`) joined an attachment that recovered meanwhile. That replay ends the wait and is shown as the current screen, while output queued before it is not. 3. **The regression waits on a signal:** in `scripts/sidebar-activity-demo-regression.ts`, the "recovery" case's two-frame waits now wait until the terminal's output probe shows the text parsed, with nothing queued or in flight (`outputParsed`). 4. **Docs:** `docs/terminal-input.md` documents `output-recovering` under "Readiness and failures": what the client does not do with the replay, that output credit is still acknowledged, and how the wait ends. New demo cases: - `recovering-restored`: the restore round trip. - `recovering-replaced`: the terminal is replaced before the recovering join's replay comes. The late replay stays unshown, and the new attach's replay of the recovered attachment is shown. The fixture gains `hold`, `attaches`, `replaceTerminal` and `unrestored`, and marks the recovering replay as `replay`, as the server does. ## Verification - `bun run typecheck` passes, and `bun test src/lib server/core/terminals.test.ts` passes: 2352 pass, 0 fail (rerun on the C2 fix). - `bun scripts/sidebar-activity-demo-regression.ts` passes: exit 0, 44 PASS lines, including `recovery`, `recovering-joiner`, `recovering-restored` and `recovering-replaced` (rerun on the C2 fix). - The new cases fail without the fix: - `recovering-restored` fails on main's `useTerminalMount.ts`, and on this branch before the last fix commit (the restored screen never presents). - `recovering-replaced` fails in three variants: - On 62f94b3, the replay of the recovered attachment is never shown (C2). - With `retireOutput` always clearing the mark, the late replay is shown. - Without the `joinReplay` consumption, the late replay is shown. - The first version's `recovering-switch` case passed with the fix reverted, so it was replaced. - Browser check, `recovering-restored` at 1440x900 and 390x844: the restored pane's screen shows as current in the terminal lens, with no blank or overlapping area. - `bun run check fast`: passes before the rebase (unit 7188 pass, 0 fail). After the rebase onto 0.4.18, the only failure is the known flake #1994 (`server/grok.test.ts`, untouched here; 3/3 passes alone). Every other step is ok, and the full demo regression passes again (44 PASS). ## Reviews - `omo-native-code-reviewer`: - First pass: REQUEST CHANGES. The switch case passed on main, a round trip kept a stale wait, and the same-pane replacement case had no test. - Re-review of the fix: APPROVE, with LOW notes only. - Review of the C2 fix: APPROVE, with LOW notes only. - Codex Sol (gpt-6.1-sol, xhigh) ran on the first version and found the same two MEDIUMs, both fixed here. Codex Sol review did not run (host stall) on the fix commits; the merge pass reviews. --------- Co-authored-by: mp <mp@local>
Change
Two of #1473's test follow-ups to #1472 (recovering joiner), no product change:
server/core/terminals.test.tsnow drives the real recovery lifecycle: a ready stream ends, a newcomer attaches and getsoutput-recovering, then the next attach takes over and the newcomer's frames show recovery cleared. Removing the line that clearsrecoveringfails it.scripts/sidebar-activity-demo-regression.tswaits for the output probe's replay/parse signal instead of two animation frames before checking that nothing is shown.Item 2 (
PaneTerminal.tsx) and item 4 (docs/terminal-input.md, held by an open PR) are left open.Refs #1473
Validation
bun test server/core/terminals.test.ts server/core/terminal-mirror.test.ts: pass; mutation check as above.SIDEBAR_FINISH_CASE=recovering-joiner bun scripts/sidebar-activity-demo-regression.ts: pass.bun run check fast: pass.