Skip to content

refactor(cmux-tui): share stack row allocation - #11867

Merged
lawrencecchen merged 1 commit into
mainfrom
feat-tui-layout-next
Sep 3, 2026
Merged

lawrencecchen merged 1 commit into
mainfrom
feat-tui-layout-next

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

  • centralize stack row height and header allocation for tiled and viewport layouts
  • preserve expanded-pane ordering and public layout APIs

Verification:

  • rustfmt --edition 2024 --check cmux-tui/crates/cmux-tui-core/src/layout.rs
  • git diff --check
  • cargo tests require Blacksmith Testbox per repository policy

The helper follows Ratatui immediate-rendering guidance by keeping frame geometry decisions in one deterministic traversal.


Summary by cubic

Centralizes stack row height and header allocation for tiled and viewport layouts in cmux-tui so both paths share the same ordering and expanded-pane behavior.

  • Extracts the row allocation logic into a shared walk_stack_rows helper.
  • Preserves existing expanded-pane ordering and public layout APIs.

Written for commit 8729fe9. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Refactor
    • Unified stacked layout calculations to improve consistency when arranging panes and collapsed stack headers.
    • Preserved existing layout behavior while reducing duplicated processing behind the scenes.
    • No visible interface changes are included in this update.

@cursor

cursor Bot commented Sep 3, 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.

@vercel

vercel Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cmux166 Ready Ready Preview Sep 4, 2026 12:19am UTC
cmux41 Ready Ready Preview Sep 4, 2026 12:19am UTC

@coderabbitai

coderabbitai Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Team

Run ID: 333118f7-55b0-4504-a17a-69cc227b03f6

📥 Commits

Reviewing files that changed from the base of the PR and between aaa600a and 8729fe9.

📒 Files selected for processing (1)
  • cmux-tui/crates/cmux-tui-core/src/layout.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Changes

Stack layout refactor

Layer / File(s) Summary
Shared stack row allocation
cmux-tui/crates/cmux-tui-core/src/layout.rs
walk_stack_rows centralizes row allocation using an explicit area height and a visitor callback. walk_viewport_stack and walk_stack use the helper to record pane rectangles and collapsed headers.

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

Merge Risk: ⚪ Minimal · up to 8729f

This change centralizes stack layout row allocation without altering public APIs or identified layout behavior. No current merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: sharing stack row allocation in cmux-tui.
Description check ✅ Passed The description explains what changed, why it changed, and how it was verified. It omits the template's Demo Video, Review Trigger, and Checklist sections, but these omissions do not prevent understan…
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 Swift Actor Isolation ✅ Passed The pull request changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, a Rust file. The commit diff contains no Swift production changes, so the Swift actor-isolation check is not applicable.
Cmux Swift Blocking Runtime ✅ Passed PASS: The pull-request commit changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, which is Rust. It introduces no production Swift changes and no Swift blocking or timing-based synchronization…
Cmux Browser Automation Off-Main ✅ Passed PASS: The pull request changes only cmux-tui/crates/cmux-tui-core/src/layout.rs. The diff adds a shared Rust stack-row traversal and contains no browser.* commands, WebKit/AppKit access, socket-wo…
Cmux Expensive Synchronous Load ✅ Passed PASS: The pull request changes only cmux-tui/crates/cmux-tui-core/src/layout.rs in Rust. The exact commit changes zero Swift files and adds no agent-history loader, file parsing, directory scan, or …
Cmux Cache Substitution Correctness ✅ Passed PASS. The pull request changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, which is Rust. The custom check applies only to production Swift, TypeScript, and JavaScript changes involving cache …
Cmux No Hacky Sleeps ✅ Passed PASS — The pull request changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, a Rust layout refactor. The exact commit diff adds no sleeps, timers, polling, delays, or wall-clock waits. The rule…
Cmux Algorithmic Complexity ✅ Passed PASS. The PR changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, a Rust file. The new walk_stack_rows traversal performs one position scan, one bounded header-allocation loop, and one pane…
Cmux Swift Concurrency ✅ Passed PASS: The pull request changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, a Rust file. The exact diff contains no Swift files or Swift concurrency patterns. Therefore, it does not introduce o…
Cmux Swift @Concurrent ✅ Passed PASS: The pull request diff changes only cmux-tui/crates/cmux-tui-core/src/layout.rs. The patch contains no Swift files and no Swift concurrency annotations or call-site changes. The cmux Swift @co`…
Cmux Swift Package Boundaries ✅ Passed PASS: The pull request changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, a Rust file. The exact diff contains no Swift source, Package.swift, or SwiftPM changes. The Swift package boundary…
Full details: Description check

Explanation

The description explains what changed, why it changed, and how it was verified. It omits the template's Demo Video, Review Trigger, and Checklist sections, but these omissions do not prevent understanding the refactor.

Full details: Cmux Swift Blocking Runtime

Explanation

PASS: The pull-request commit changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, which is Rust. It introduces no production Swift changes and no Swift blocking or timing-based synchronization.

Full details: Cmux Browser Automation Off-Main

Explanation

PASS: The pull request changes only cmux-tui/crates/cmux-tui-core/src/layout.rs. The diff adds a shared Rust stack-row traversal and contains no browser.* commands, WebKit/AppKit access, socket-worker routing, or policy-test changes. The browser automation rule is therefore not applicable, and no existing browser automation debt is changed.

Full details: Cmux Expensive Synchronous Load

Explanation

PASS: The pull request changes only cmux-tui/crates/cmux-tui-core/src/layout.rs in Rust. The exact commit changes zero Swift files and adds no agent-history loader, file parsing, directory scan, or related synchronous load. The custom check applies only to production Swift changes.

Full details: Cmux Cache Substitution Correctness

Explanation

PASS. The pull request changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, which is Rust. The custom check applies only to production Swift, TypeScript, and JavaScript changes involving cache substitution in persistence, history, undo, or snapshot paths. The diff introduces no such change.

Full details: Cmux No Hacky Sleeps

Explanation

PASS — The pull request changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, a Rust layout refactor. The exact commit diff adds no sleeps, timers, polling, delays, or wall-clock waits. The rule targets TypeScript, JavaScript, shell, and build/runtime scripts, so its failure condition is not introduced.

Full details: Cmux Algorithmic Complexity

Explanation

PASS. The PR changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, a Rust file. The new walk_stack_rows traversal performs one position scan, one bounded header-allocation loop, and one pane iteration. It does not introduce nested full-collection scans, repeated sorting/filtering, or per-target rescans. The algorithm remains linear in the pane count.

Full details: Cmux Swift Concurrency

Explanation

PASS: The pull request changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, a Rust file. The exact diff contains no Swift files or Swift concurrency patterns. Therefore, it does not introduce or expand any legacy async pattern covered by the custom check.

Full details: Cmux Swift `@Concurrent`

Explanation

PASS: The pull request diff changes only cmux-tui/crates/cmux-tui-core/src/layout.rs. The patch contains no Swift files and no Swift concurrency annotations or call-site changes. The cmux Swift @concurrent`` check is therefore not applicable.

Full details: Cmux Swift Package Boundaries

Explanation

PASS: The pull request changes only cmux-tui/crates/cmux-tui-core/src/layout.rs, a Rust file. The exact diff contains no Swift source, Package.swift, or SwiftPM changes. The Swift package boundary check does not apply.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat-tui-layout-next

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.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

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

@lawrencecchen
lawrencecchen merged commit 2748329 into main Sep 3, 2026
47 of 49 checks passed
rustybret pushed a commit to rustybret/bmux that referenced this pull request Sep 4, 2026
3812562 refactor(tui): centralize terminal input classification (manaflow-ai#11855)
7d0385f Axiom: failure rate and latency per third-party endpoint (Freestyle, Stack Auth, Stripe, ...) (manaflow-ai#11779)
ed5e826 refactor(tui): share frontend focus target mapping (manaflow-ai#11861)
7fa300e Revert "Fix terminal text bleed during live window resize (manaflow-ai#11530)" (manaflow-ai#11887)
bace77c perf(cmux-tui): avoid front-shifting layout nodes (manaflow-ai#11860)
9f8a74f cmux-tui: simplify PTY error mapping (manaflow-ai#11864)
2748329 refactor(cmux-tui): share stack row allocation (manaflow-ai#11867)
e7223a5 coderouter: PostHog traces + exceptions keyed by the cmux user, request ids, health endpoint, Slack alerts, upstream header timeout (manaflow-ai#11798)
aerickson pushed a commit to aerickson/cmux that referenced this pull request Sep 13, 2026

This branch was successfully deployed

2 active deployments
Preview – cmux166 — 8729fe96 Deployed Sep 4, 2026 by vercel[bot]
Preview – cmux41 — 8729fe96 Deployed Sep 4, 2026 by vercel[bot]
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.

1 participant