Skip to content

Tab drag: forward index decisions to Rust (migration shard 002) - #34545

Merged
teamleaderleo merged 7 commits into
feat-cmux-nextfrom
lane/tab-drag-policy-port-002
Nov 4, 2026
Merged

teamleaderleo merged 7 commits into
feat-cmux-nextfrom
lane/tab-drag-policy-port-002

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

TabMoveIndex now forwards all three index decisions to Rust through the existing public Swift signatures. A call-local dictionary assigns integer IDs using Swift String equality, preserving canonically equivalent Unicode and embedded NULs across every input buffer.

Leo’s request: “A Rosie-style migration harness for large code moves ... pick one Swift-logic-to-Rust move ... run it through the harness, and land the shards.”

This is shard 002 of the two-shard pilot. It stays on by default, preserves defined behavior, and can be rolled back by reverting this PR. The new parity suite compares against the original Swift bodies from 448f224, covering reordered and hidden tabs, duplicates, empty arrays, Unicode/NUL identity, group membership subsets, and extreme signed indices. The original Int.max increment trap is excluded from parity.

Depends on #34507 and the subsequent app-FFI pin. After both land, this branch must merge the current base before independent review. The migration owner runs the fixed build and parity gates and performs the merge.

Validation

  • The pre-push static gate passes at 71aeefd.
  • Source comparison confirms that the test oracle preserves the original policy bodies verbatim, changing only the helper name and visibility.
  • Local syntax verification is unavailable because swiftc is not installed. The scoped preflight passes localization defaults and feature flags; workspace package grouping already fails on the planned base (missing CmuxDeviceHub entry). No unrelated files changed.
  • Fleet app compile-check passed at exact head 9ed07234a434be2ce53f505fd36092edecd67b20 (job dd5c9e887cfd77c489b709aa).
  • Focused macOS parity suite TabMoveIndexRustParityTests passed at the exact head (fleet step c2faad7f8ac29ccdd06d64f2).

Performance

These are policy ownership counts, measured by inspecting the same TabMoveIndex source before and after; they are not runtime latency measurements.

Metric Before After Delta Harness or run link
Production Swift index decisions implemented locally 3 0 -3 Same-source inspection at 448f224 and 71aeefd
Index decisions forwarded to Rust 0 3 +3 Same-source inspection

Migration throughput report: awaiting the migration owner’s supplied report link.

Prior art

Read the original wire conversion from #15555, the daemon matrix conversion from #20253, and the source-path group-index fix at 19700ba. The path has no newer changes in the last 14 days. Read #34507’s header, index implementation, and Bridge dependency change. The prior-art and overlap helpers hit the shared GitHub quota; the available overlap cache is partial and cannot establish complete current open-PR coverage.

Changelog

none

🤖 Generated with Codex

Agent session: agent session


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Forwards all three TabMoveIndex index decisions to Rust through the existing public Swift API. A call-local nonisolated string interner maps Swift String values to integer IDs, preserving canonical Unicode equivalence and embedded NULs without crossing the ABI. A parity suite compares against the original Swift bodies from the pre-move commit, covering reordered and hidden tabs, duplicates, empty arrays, Unicode/NUL identity, group membership subsets, and extreme signed indices; the Int.max increment trap case is excluded.

This is shard 002 of the migration pilot. It stays on by default and preserves defined behavior; reverting it restores the Swift implementations. It depends on the prerequisite PR and app-FFI pin, and the branch has merged the current feat-cmux-next base.

Validation

  • Pre-push static gate passes; the migration owner's build and parity gates are pending.

Performance

  • These are policy ownership counts, not runtime measurements: the three index decisions now forward to Rust instead of being implemented locally in Swift.

Written for commit 2981fa6. Summary will update on new commits.

View guided diff Turn on auto-fix

Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-0ecf34a54b76bbeec642
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review 9ed0723: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr34545 -f ref=lane/tab-drag-policy-port-002 -f platform=macos -f backend_mode=local

web and size checks: green

Shipped in:

@github-actions github-actions Bot added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Nov 4, 2026
Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-0ecf34a54b76bbeec642
teamleaderleo and others added 2 commits November 4, 2026 04:17
Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-0ecf34a54b76bbeec642

@teamleaderleo teamleaderleo left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review (claude-opus-5.5-medium-router-review): SHIP at 51a158b

@teamleaderleo teamleaderleo left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review (claude-opus-5.5 medium, router-review): SHIP at 51a158b

@teamleaderleo teamleaderleo left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review (claude-opus-5.5 medium, router-review): SHIP at 51a158b

@teamleaderleo

teamleaderleo commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator Author

Owned by an agent session · session

Co-authored-by: Codex <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-462643789e72e77eafeb
@blacksmith-sh

blacksmith-sh Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Found 3 test failures on Blacksmith runners:

Failures

Test View Logs
nightly cmux-tui resolve/nightly cmux-tui resolve View Logs
nightly.yml must not read vars.NIGHTLY_SIGN while nightly-sign.yml is in shadow mode/
nightly.yml must not read vars.NIGHTLY_SIGN while nightly-sign.yml is in shadow mode
View Logs
the short nightly decide gate must use the pooled Linux route with a Blacksmith fallbac
k/
the short nightly decide gate must use the pooled Linux route with a Blacksmith fallbac
k
View Logs

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

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

The cmux-ci parity job fbdd652f… (--filter TabMoveIndexRustParityTests) was given up as not_dispatched because the broker hit GitHub's rate limit on a read before the dispatch, and nothing sent it again once the limit lifted. manaflow-ai/cmuxterm-hq#7015 now re-sends such jobs after the retry-after. For this PR it is dispatched by hand at head 9ed07234a434be2ce53f505fd36092edecd67b20: run 41821132135. Follow it with glaeda-gh wait run manaflow-ai/cmux/41821132135 --sha 9ed07234a434be2ce53f505fd36092edecd67b20.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Run 41821132135 dispatched and finished: failure in Run fast checks. It isn't a test failure: the macOS-only package doesn't compile on the Linux fast-checks runner (fatal error: 'QuartzCore/QuartzCore.h' file not found). swift test --package-path Packages/macOS/CmuxNext needs a macOS route (cmux-ci on a fleet Mac), not lane-gh ci/fast-checks.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex, router-review): SHIP at 9ed0723

Reviewer: codex gpt-6-astra high, fast tier.

SHIP at 9ed0723

Visual verdict: unchanged by this diff

The Rust implementations match the original Swift behavior across the reviewed edge cases, and the FFI/package wiring is present.

Follow-ups: none

cmux-bot[bot]
cmux-bot Bot previously approved these changes Nov 4, 2026

@cmux-bot cmux-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmux-bot approves 9ed0723: an independent review passed this exact head (router-review receipt by teamleaderleo). A push needs a new review; a later BLOCK at this head dismisses this approval.

@teamleaderleo teamleaderleo left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review (subagent claude-opus-5-5 medium): SHIP at 9ed0723

Independent Opus review of the full diff from merge base ab7e724.

  • Parity: wireIndex matches the original for every defined input. The one difference is that final == Int.max with final > current now saturates instead of trapping, which is strictly safer; the test excludes that case correctly. cmux_tab_move_pane_final_index matches the original step by step: remove moving, clamp-insert, find the first later shown id present in pane-minus-moving, else count. cmux_tab_move_group_index matches the original's clamp-prefix count of members. clamp_index handles Int.min/Int.max without wrapping.
  • Identity: the call-local StringInterner keys on Swift String hashing and equality, so canonically equivalent strings and embedded NULs get the same id across display, pane, members and moving. The tests cover this across buffers. Members missing from display get fresh ids and cannot collide.
  • Test: the oracle is the verbatim body from 448f224; it was diffed against that commit and the only changes are the name and visibility. The sweep covers 12 sequences × 12 sequences × 8 ids × 9 indices, plus every subset of 8 members. Focused fleet parity step exit 0 at this head.
  • FFI: withUnsafeBufferPointer keeps the arrays alive for the call. An empty array gives a nil base address with count 0, which ids() accepts. A non-empty array always has a base address, so the -1 sentinel can't reach callers. Rust doesn't keep the pointers and has no panic path (the insert and slice bounds are clamped).
  • Concurrency: pure, nonisolated, no shared state.
  • User-visible: none. Costs one small dictionary per drop.
  • Nit (non-blocking): the same import-style inconsistency with #34563 (internal import here, @_implementationOnly there) in CmuxNextBridge.

Evidence: fleet compile check dd5c9e887cfd77c489b709aa done at this head (package scope); parity step c2faad7f8ac29ccdd06d64f2 exit 0 at this head; cargo test for cmux-layout-reducer-ffi passes (74 tests, tab_drag 4/4).

@cursor

cursor Bot commented Nov 4, 2026

Copy link
Copy Markdown

Bugbot needs on-demand usage enabled

Bugbot uses usage-based billing for this team and requires on-demand usage to be enabled.

A team admin can enable on-demand usage in the Cursor dashboard.

@cmux-bot
cmux-bot Bot temporarily deployed to ci-routing-agent November 4, 2026 13:02 Inactive
@cmux-bot
cmux-bot Bot temporarily deployed to ci-routing-agent November 4, 2026 13:02 Inactive
@cmux-bot
cmux-bot Bot temporarily deployed to ci-routing-agent November 4, 2026 13:02 Inactive
@cmux-bot
cmux-bot Bot dismissed their stale review November 4, 2026 13:13

A newer verdict blocks 8db933f (no independent SHIP at the head).

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (claude/opus): SHIP at 8db933f

Independent review: the three Rust index decisions match the prior Swift behavior across boundary, duplicate, Unicode/NUL, empty-list, and extreme-index cases; the ABI types and pinned FFI exports line up; public Swift signatures are unchanged; and the parity suite covers the migrated behavior. Non-blocking nits: the test import appears unused, and the PR body can be refreshed now that dependencies and gates are on base.

@cursor

cursor Bot commented Nov 4, 2026

Copy link
Copy Markdown

Bugbot needs on-demand usage enabled

Bugbot uses usage-based billing for this team and requires on-demand usage to be enabled.

A team admin can enable on-demand usage in the Cursor dashboard.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (claude/opus): SHIP at 2981fa6

Independent exact-head review: all three index decisions match the prior Swift behavior across boundaries, duplicates, Unicode/NUL, empty arrays, and extreme indices; the ABI/header and updated FFI pin line up; public APIs are unchanged; and parity coverage is comprehensive. The base merge leaves the migrated files correct. Non-blocking nit: the test file's CmuxNextAppCore import appears unused.

@teamleaderleo
teamleaderleo merged commit d3950c6 into feat-cmux-next Nov 4, 2026
214 of 219 checks passed
@teamleaderleo
teamleaderleo deleted the lane/tab-drag-policy-port-002 branch November 4, 2026 15:04
@cmux-bot cmux-bot Bot removed the stack-blocker label Nov 4, 2026

This branch was previously deployed

1 inactive deployment
ci-routing-agent — 2981fa65 Deployed Nov 4, 2026 by teamleaderleo via wait for same-key tree publisher #111988
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:normal Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant