Skip to content

test: give split fixtures their own window geometry instead of inheriting a narrow one - #15919

Closed
lawrencecchen wants to merge 1 commit into
mainfrom
fix-split-admission-window-geometry
Closed

lawrencecchen wants to merge 1 commit into
mainfrom
fix-split-admission-window-geometry

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Two app-host tests fail on main when they share a host process with earlier window tests:

  • WorkspaceManualUnreadTests.testToggleFocusedNotificationUnreadKeepsManualUnreadOnOriginalPanelAfterFocusMoves (XCTUnwrap of the split panel, main run 36685498203 shard 1/7)
  • RemoteTmuxMirrorSplitRoutingTests.localWorkspaceSplitStillCreatesLocalPanel() (panel → nil, main shards 1/3/7 since 2026-09-28 18:00 PDT)

createMainWindow() copies the size of the current main window, and earlier tests in the same app host leave 320-point main windows registered. After the 240-point sidebar, the new window's split container is narrower than two 160-point panes, so split admission from #15392 correctly refuses a side-by-side split. The tests had relied on inherited window geometry. In run 36685498203 the same process (pid 51066) also failed the AppDelegateEqualizeSplitsShortcutTests split setups for this reason; that suite is not changed here.

#15434 fixed the same symptom for the shortcut-routing fixtures with a helper local to AppDelegateShortcutRoutingTests. This moves that geometry setup onto Workspace.newTerminalSplitInRealisticWindowForTesting(window:from:orientation:focus:) in the shared test support file, keeps the old helper as a forwarder, and uses it where these two tests split inside a real window. Admission logic is unchanged. Tests that split a windowless Workspace() still measure zero geometry, which admission treats as fitting, so they are left alone.

Testing

Swift syntax check passed locally. App-host tests don't run on this Mac; the full ci.yml run on this branch is the evidence (linked in a comment).

Changelog

none

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Fixes two app-host tests that failed depending on which tests shared the host process, by giving split fixtures their own window geometry instead of inheriting a narrow one.

  • createMainWindow() copies the current main window's size, and earlier tests leave 320-point main windows too narrow for split admission to allow a side-by-side split.
  • Adds Workspace.newTerminalSplitInRealisticWindowForTesting to the shared test support file and switches the failing tests over to it; the shortcut-routing helper now forwards to it. No production code changes.

Written for commit 01c09c9. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Tests
    • Updated split-creation tests to use a realistically sized window and layout.
    • Existing checks for panel creation, workspace panel counts, and unread states remain unchanged.

…dow geometry

createMainWindow copies the current main window's size, and earlier tests
in the same app host leave 320-point main windows registered. Since split
admission (#15392) refuses a side-by-side split below two minimum-width
panes, the fixtures' newTerminalSplit returned nil depending on which
tests shared the host. Move the geometry setup #15434 used for the
shortcut-routing fixtures onto Workspace and use it where these tests split.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@cursor

cursor Bot commented Sep 30, 2026

Copy link
Copy Markdown

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

@lawrencecchen
lawrencecchen marked this pull request as draft September 30, 2026 09:48
@lawrencecchen

Copy link
Copy Markdown
Contributor Author

Parked as draft: the leaked 320-pt main window cause is now owned by one root-cause fix for all affected split tests (including AppDelegateEqualizeSplitsShortcutTests). This branch may be reused or closed by that owner.

@github-actions

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: manaflow-ai/cmux/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 5bfd59d6-52ee-433d-bddb-16f322b5acd9

📥 Commits

Reviewing files that changed from the base of the PR and between 1b06f84 and 01c09c9.

📒 Files selected for processing (4)
  • cmuxTests/AppDelegateMainWindowTestingSupport.swift
  • cmuxTests/AppDelegateShortcutRoutingRepairProbe.swift
  • cmuxTests/RemoteTmuxMirrorSplitRoutingTests.swift
  • cmuxTests/WorkspaceManualUnreadTests.swift

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Tests now use a shared helper to configure realistic window geometry before creating terminal splits. The helper is used in shortcut-routing, remote tmux mirror, and unread-state tests.

Changes

Realistic-window split test setup

Layer / File(s) Summary
Add and adopt realistic-window split helper
cmuxTests/AppDelegateMainWindowTestingSupport.swift, cmuxTests/AppDelegateShortcutRoutingRepairProbe.swift, cmuxTests/RemoteTmuxMirrorSplitRoutingTests.swift, cmuxTests/WorkspaceManualUnreadTests.swift
The helper sets window and Bonsplit container geometry before creating a terminal split. Three test locations now use it; their existing assertions remain unchanged.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: austinywang

Merge Risk: ⚪ Minimal · up to 01c09

No merge-blocking issue is established for the shared split-test setup; the reported height mismatch does not affect the current callers.

🚥 Pre-merge checks | ✅ 24 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (24 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: giving split test fixtures independent window geometry instead of inheriting narrow geometry.
Description check ✅ Passed The description includes the required Summary, Testing, and Changelog sections. It explains the failure cause, the implementation, test limitations, and expected behavior. The omitted demo video is ap…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Cmux Cloud Persistent Session And Early Input ✅ Passed The pull request contains only test-support code changes in the cmuxTests/ directory. The changes add a shared test helper method newTerminalSplitInRealisticWindowForTesting() that sets explicit w…
Cmux Swift Actor Isolation ✅ Passed PASS. The pull request changes only four files under cmuxTests/. It adds and uses a test-only Workspace.newTerminalSplitInRealisticWindowForTesting helper, and the existing AppContextSerialGate …
Cmux Swift Blocking Runtime ✅ Passed PASS. The PR changes only four files under cmuxTests; it does not change production or runtime Swift files. The added helper only sets deterministic test window geometry, lays out the view, sets the…
Cmux Browser Automation Off-Main ✅ Passed PASS. The pull request changes only test fixtures and split-window geometry. It does not change Sources/TerminalController.swift or ControlCommandExecutionPolicy.swift, add or move a browser.* c…
Cmux Expensive Synchronous Load ✅ Passed PASS: The pull request changes only four files under cmuxTests/; no production Swift files changed. The diff adds test-only window geometry and split-fixture forwarding, with no agent-history load, …
Cmux Cache Substitution Correctness ✅ Passed PASS. The reviewed diff changes only four files under cmuxTests/. It adds and uses a test-only window-geometry helper; it does not change production Swift, TypeScript, or JavaScript persistence, his…
Cmux No Hacky Sleeps ✅ Passed PASS: The pull request changes only four Swift test and test-support files. It adds window geometry setup and delegates split creation; it does not add sleeps, timers, polling, delayed dispatch, or wa…
Cmux Algorithmic Complexity ✅ Passed PASS. The authoritative diff changes only cmuxTests files. The new helper performs fixed-size window geometry assignments and one newTerminalSplit call. The other changes only delegate test fixtur…
Cmux Swift Concurrency ✅ Passed PASS. The diff adds a synchronous test-only Workspace.newTerminalSplitInRealisticWindowForTesting helper and redirects split fixtures to it. Added code uses window sizing, layout, and `newTerminalSp…
Cmux Swift @Concurrent ✅ Passed PASS: The PR adds one synchronous Workspace.newTerminalSplitInRealisticWindowForTesting helper and redirects synchronous split call sites. The authoritative diff adds no async, nonisolated, `@co…
Cmux Swift Package Boundaries ✅ Passed PASS. The PR changes only files under cmuxTests/. It adds and uses test-only split geometry support and does not add production app-target logic. The boundary rule explicitly allows test fixtures an…
Cmux Swiftpm Lockfiles ✅ Passed PASS: The PR changes only four cmuxTests Swift source files. The authoritative diff contains no Package.swift, Package.resolved, .gitignore, workflow, Xcode project, or dependency changes. Therefore t…
Cmux Swift Logging ✅ Passed The PR changes only Swift test support and test fixtures. The diff adds no print, debugPrint, dump, NSLog, file/stdout logging, Logger, or sensitive-data logging. The new helper only sets te…
Cmux User-Facing Error Privacy ✅ Passed PASS. The pull request changes only files under cmuxTests/. The added helper and its callers set test window geometry and create split fixtures; they do not add production UI errors, alerts, command…
Cmux Full Internationalization ✅ Passed PASS: The pull request changes only files under cmuxTests/. The diff adds and uses a test-only split helper and changes test fixtures; it does not change production user-facing Swift text, catalogs,…
Cmux Swiftui State Layout ✅ Passed The pull request changes only AppKit/Bonsplit test support and split-fixture calls. The diff adds no SwiftUI views, ObservableObject/@Published state, @Observable, GeometryReader, lazy/list ro…
Cmux Architecture Rethink ✅ Passed PASS. The diff is limited to cmuxTests and adds a test-only Workspace.newTerminalSplitInRealisticWindowForTesting helper. The helper sets deterministic window and Bonsplit geometry, then delegates…
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed PASS. The PR changes only cmuxTests test support and test fixtures. It adds a helper that configures an existing NSWindow and updates split-test calls; it does not add or materially change a user-visi…
Cmux Source Artifacts ✅ Passed All four changed paths are hand-written Swift test/support files under cmuxTests/. The diff adds or updates test helper and test code only. It adds no logs, screenshots, recordings, temporary folder…
Cmux No Test Or Debug Seam In Production Source ✅ Passed PASS: The authoritative diff changes only files under cmuxTests/. The added Workspace.newTerminalSplitInRealisticWindowForTesting member and its callers are test-support/test code, not Swift files…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@austinywang

Copy link
Copy Markdown
Contributor

The split failures this fixes have a second source, which #15953 addresses. The two are complementary and merged cleanly in #15960.

  • In process. A closed main window saves its frame as the last window geometry. A new window with no source window opens at that size, and at the last saved right-sidebar visibility, width and mode. testCmdShiftNCreatesWindowFromEventWindowWithoutAddingWorkspace closes a 560 pt window, which leaves later windows a 320 pt terminal area.
  • Across jobs. The per-run home doesn't move the app's preferences; cfprefsd keeps them in the runner account's own com.cmuxterm.app.debug domain. Reading it on the minis found the right sidebar left visible on all of them, with Dock mode on cmux7s, a 75% font magnification on cmux9s, and the tmux overlay on cmux13s.

#15953 resets that domain before each app-host batch, and isolates the window-shaping keys per test for every XCTest case and for the 36 Swift Testing suites that open main windows. That also covers the call sites this PR leaves alone, such as AppDelegateEqualizeSplitsShortcutTests and AppDelegateSurfaceShortcutRoutingTests (:382/:221). Pinning the geometry at the split, as here, still helps against a narrow source window.

@github-actions

Copy link
Copy Markdown
Contributor

CI failure attribution

CI failed on 01c09c9a32 (run 36698469691 attempt 1): 4 code.

Job Verdict Why
macos / app-host unit tests (1/7) code a test failed
macos / app-host unit tests (7/7) code a test failed
macos / app-host unit tests (2/7) code a test failed
macos / app-host unit tests (6/7) code a test failed
Matched log lines
macos / app-host unit tests (1/7): ✘ Test aMissingTrackedTabClearsCoordinatesEvenWhenOtherViewsRemain() recorded an issue at CloudPlacementCoordinatorTests.swift:635:9: Expectation failed: (catalog.projection(forPanel: panel)?.remoteTabID → "tab_gone") == nil
macos / app-host unit tests (7/7): ✘ Test "A create adopts the reserved workspace and tab once without selecting it" recorded an issue at CloudMachineWorkspaceAdoptionTests.swift:99:6: Time limit was exceeded: 300.000 seconds
macos / app-host unit tests (2/7): /tmp/cmux-ci/src/cmuxTests/SSHStartupSignalLifecycleTests.swift:130: error: -[cmuxTests.CLINotifyProcessIntegrationRegressionTests testSSHPaneCloseSignalDoesNotTerminateWrappedSSHChild] : XCTAssertFalse failed
macos / app-host unit tests (6/7): ✘ Test "Receipt, older snapshot, and accepted graph retain one native terminal and its first input" recorded an issue at CloudWorkspaceCreationSidebarTests.swift:93:6: Time limit was exceeded: 300.000 seconds

Not re-run automatically: macos / app-host unit tests (1/7), macos / app-host unit tests (7/7), macos / app-host unit tests (2/7), macos / app-host unit tests (6/7) are not machine failures.

Written by scripts/ci/classify_failures.py (ci-failure-attribution.yml); signatures are its SIGNATURES table. A machine verdict is the runner's fault, not this PR's.

@lawrencecchen

Copy link
Copy Markdown
Contributor Author

Superseded by #15985, which fixes the root cause (the persisted cmux.session.lastWindowGeometry.v2 frame shared across app-host processes on a runner) instead of opting single tests into a larger window.

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.

2 participants