Repository navigation
test(terminal): pin layout invariants the mirror refactor must keep - #26073
Conversation
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (5)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe pull request adds tests for terminal topology persistence, seeded topology operations, setup-split ownership during first activation, and exited-pane liveness. It also adds helpers to seed and reopen topology stores for persistence tests. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to This change adds terminal-layout tests and makes no product-code changes, so it does not change application behavior. Two tests are deliberately marked as expected failures to record a known duplicate-tab bug that the planned refactor will fix. No merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
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 |
ELI5
We're about to change who's in charge of terminal layout: main will own it and the window will only show it. This PR adds tests for the rules that change has to keep, and one test for the bug it has to fix, so the change is checked against a bar set beforehand. No product code changes.
What Changed
Test-only. Five new files:
Must pass today and after the change
terminal-topology-model.test.ts(main): a seeded, repeatable random test. Each seed makes 40 changes through main's real Store on SQLite, the way the desktop window makes them today: new tab, split, close pane, close tab, drag a pane out to its own tab, a terminal exits, a pane respawns, an agent sleeps or wakes, restart, and quit-then-restart. It covers a git worktree, a folder workspace and the floating terminal. After every step, and again after a cold reload, it checks that:A failure prints the seed and its list of steps. 6 seeds take about 1.5 s. 300 seeds also pass on main.
terminal-sleep-quit-resume.test.ts(main): an agent is slept, then the app quits through the before-unload path and reopens. The resume record is still there, it's the newer quit capture rather than the earlier periodic one, it shows up in main's projected layout, it survives the relaunched window's first save, and it still builds acodex resume <id>command. A second case covers a record that only the before-unload save carried.terminal-exited-pane-liveness.test.ts(window): Ctrl-D in one pane of a split takes only that terminal out of the live list. The pane's saved binding stays. When both panes exit, the tab reads as not running.Expected to fail until the mirror PR fixes STA-9417
setup-split-activation-single-owner.test.ts(window), ported from the Stage A branch. A host-created worktree runs its setup script in a split of a tab that isn't mounted yet, and then gets its first activation.it.fails. Today the activation sweep creates a second tab for the setup terminal.it.fails(4 duplicates today).B2-4, in the mirror PR, flips both by removing
.fails. In the no-reveal case, that PR delivers main's split before the sweep runs.Shared setup lives in
terminal-topology-profile-fixture.ts.Why
The mirror PR replaces how the window writes layout. Without a bar fixed in advance, it would write its own tests to match its own behavior. Writing these against today's main shows which behavior is current (it passes now) and which is the named fix (expected to fail now). Store-level tests run in the PR unit gate. End-to-end tests don't block merges.
Not included, and why:
ssh:workspaces in the model test.Linked Issue
STA-9417 (expected-failure test only; not fixed here).
Visual Proof
N/A: test-only, with no UI or behavior change.
Testing
pnpm tcpasses.pnpm run check:code-quality:changedpasses.New tests ran 3 times: 6 passed and 2 expected-fail each time.
300 model seeds pass.
Checked that the tests can fail:
.failsshows the STA-9417 duplicate tab.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Test-only. Paths go through
path.join, and the resume command is built for a pinned platform.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)