Skip to content

test(ios): expect the construction focus event in composer diagnostics - #14003

Merged
teamleaderleo merged 1 commit into
mainfrom
fix/composer-diagnostics-init-focus
Sep 23, 2026
Merged

teamleaderleo merged 1 commit into
mainfrom
fix/composer-diagnostics-init-focus

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

ComposerPendingAttachmentTests.mutationsEmitPrivacySafeLifecycleDiagnostics() fails on main every time. It expects the diagnostic log to hold exactly the three attachment events, [641, 642, 643], but it gets [182, 641, 642, 643]. 182 is surfaceFocused.

The test's helper assumes MobileShellComposite.init sets the selection without running selectedTerminalID's didSet. That stopped being true in #10539 (Aug 21). Since then, init leaves the selection nil and calls syncSelectedTerminalForWorkspace(), which selects term-a and records surfaceFocused. The test was added in #9977 nine days earlier, and the dispatch-only iOS lane never caught the change.

I think the product is right and the test is stale. A terminal selected by default records surfaceFocused the same way every other derived selection does. So the test now expects that event first, followed by the three attachment events. It does not filter the event out, and the attachment assertions (kinds, failure codes, non-nil surfaces, no leaked IDs or bytes) are unchanged.

Testing

  • On air-blue (Xcode 27.0) at db5d212d86, upstream main, this test fails with the same [182, 641, 642, 643] as the CI log from fork run 35876818909.
  • On the same machine with this change, it passes, along with the rest of ComposerPendingAttachmentTests (run with swift test --no-parallel together with the pool and alt-screen suites).
  • It has not been run under Xcode 26.6, which CI uses.

— Thimble g1 🔆
Run: run_ios_shell_mobile_tests_20260923_e464e5ba

🤖 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 ComposerPendingAttachmentTests.mutationsEmitPrivacySafeLifecycleDiagnostics() so it expects the surfaceFocused event recorded when the composite selects the default terminal on init.

The test previously assumed init set the selection without running didSet; since the selection is now left nil and resolved by the workspace synchronizer, the diagnostics log starts with surfaceFocused. The test now expects that event first, followed by the three attachment events, and keeps all existing attachment assertions unchanged.

Written for commit 97270ad. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Tests
    • Updated attachment lifecycle checks to account for the initial workspace focus event and draft loading during construction.
    • Expanded verification of privacy-safe diagnostics across attachment staging, removal, and rejection. No user-facing behavior changes are included.

mutationsEmitPrivacySafeLifecycleDiagnostics() assumed MobileShellComposite
init set the selection without running selectedTerminalID's didSet. Since
#10539, init leaves the selection nil and lets
syncSelectedTerminalForWorkspace() pick the first terminal, so every
composite built with a diagnostic log records surfaceFocused (182) first.
The test saw [182, 641, 642, 643] and failed.

The product behavior is intended: a default-selected terminal records
surfaceFocused like any other derived selection. Expect that event ahead of
the three attachment events rather than filtering it out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@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 23, 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: 7cf6844c-396b-42cb-b130-7134f6fa9d75

📥 Commits

Reviewing files that changed from the base of the PR and between c3dd613 and 97270ad.

📒 Files selected for processing (1)
  • Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ComposerPendingAttachmentTests.swift

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


📝 Walkthrough

Walkthrough

The attachment diagnostics test now accounts for the construction-time surfaceFocused event. It updates the expected event order and waits for at least four processed log events.

Changes

Attachment lifecycle diagnostics

Layer / File(s) Summary
Construction event and lifecycle assertions
Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ComposerPendingAttachmentTests.swift
The makeComposite comment attributes initial selection to the workspace synchronizer. The diagnostics test expects the construction-time surfaceFocused event before the staged, removed, and rejected attachment events. It waits for at least four processed log events.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: azooz2003-bit

Merge Risk: ⚪ Minimal · up to 97270

The test accounts for the construction-time focus event before checking attachment diagnostics. No concrete merge-blocking issue is indicated; the CI Xcode 26.6 run remains unverified.

🚥 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 2 functions across 1 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 test update: it now expects the construction focus event in composer diagnostics.
Description check ✅ Passed The description provides a detailed summary, explains the cause, and documents local testing and verification. It omits the template's Demo Video and Checklist sections, but these omissions are non-cr…
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 PR changes only ComposerPendingAttachmentTests.swift. It updates a test comment and diagnostic event expectations for construction-time surfaceFocused; it does not change Cloud terminal creati…
Cmux Swift Actor Isolation ✅ Passed PASS: The PR changes only Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ComposerPendingAttachmentTests.swift. The changes update test expectations and comments. The test suite is already `…
Cmux Swift Blocking Runtime ✅ Passed PASS: The pull request changes only Packages/iOS/CmuxMobileShell/Tests/.../ComposerPendingAttachmentTests.swift. It updates an existing test polling loop from 3 to 4 processed events and adds expect…
Cmux Browser Automation Off-Main ✅ Passed PASS. The pull request changes only Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ComposerPendingAttachmentTests.swift. The diff updates diagnostic test expectations for surfaceFocused a…
Cmux Expensive Synchronous Load ✅ Passed The pull request changes only Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ComposerPendingAttachmentTests.swift. It adds no production Swift code, loader call, file parsing, directory sca…
Cmux Cache Substitution Correctness ✅ Passed PASS. The pull request changes only Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ComposerPendingAttachmentTests.swift. The diff updates test setup documentation and expected diagnostic ev…
Cmux No Hacky Sleeps ✅ Passed PASS. The PR changes only Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ComposerPendingAttachmentTests.swift, which is test-only Swift code. The only timing loop (ContinuousClock with `T…
Cmux Algorithmic Complexity ✅ Passed PASS. The authoritative PR diff changes only Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ComposerPendingAttachmentTests.swift. The changes update test setup comments, event-count polling…
Cmux Swift Concurrency ✅ Passed PASS: The pull request changes only a Swift test comment and diagnostic expectations. It raises the existing async wait threshold and retains the existing awaited Task.yield(); it adds no Dispatch q…
Cmux Swift @Concurrent ✅ Passed The PR changes only a @MainActor test and its documentation. The existing async test adds one diagnostic-count wait and updates expected event values; it adds no async helper, nonisolated async fu…
Cmux Swift Package Boundaries ✅ Passed PASS: The authoritative diff changes only Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ComposerPendingAttachmentTests.swift. The changes update test setup documentation and diagnostic eve…
Cmux Swiftpm Lockfiles ✅ Passed PASS. The reviewed range changes only Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ComposerPendingAttachmentTests.swift. It changes no Package.swift, Package.resolved, .gitignore, w…
Cmux Swift Logging ✅ Passed PASS: The PR changes only a Swift test and its documentation/assertions. It adds no print, debugPrint, dump, NSLog, ad hoc file logging, Logger declaration, or sensitive-data logging. The diag…
Cmux User-Facing Error Privacy ✅ Passed PASS. The pull request changes only Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ComposerPendingAttachmentTests.swift. It updates test setup comments and diagnostic event assertions. The …
Cmux Full Internationalization ✅ Passed PASS: The pull request changes only Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ComposerPendingAttachmentTests.swift. The diff updates test expectations and developer-only comments. It i…
Cmux Swiftui State Layout ✅ Passed PASS — The pull request changes only ComposerPendingAttachmentTests.swift. It updates test documentation and diagnostic expectations for the construction-time surfaceFocused event. It introduces n…
Cmux Architecture Rethink ✅ Passed PASS. The PR changes only ComposerPendingAttachmentTests.swift. It updates a test-only Task.yield() wait from three to four processed events and adds the expected construction surfaceFocused eve…
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed PASS. The PR changes only Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ComposerPendingAttachmentTests.swift. The diff updates test documentation and diagnostic expectations. It does not a…
Cmux Source Artifacts ✅ Passed The PR changes only the tracked Swift test source Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ComposerPendingAttachmentTests.swift. The diff updates test documentation and diagnostic exp…
Cmux No Test Or Debug Seam In Production Source ✅ Passed The pull request changes only Packages/iOS/CmuxMobileShell/Tests/CmuxMobileShellTests/ComposerPendingAttachmentTests.swift. No Swift file under a production Sources/ path changes, so the productio…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • 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.

@teamleaderleo
teamleaderleo merged commit 9697411 into main Sep 23, 2026
42 checks passed
rustybret pushed a commit to rustybret/bmux that referenced this pull request Sep 23, 2026
ccdbf30 fix(ios): let a legacy untagged Mac row take pushed presence routes (manaflow-ai#14012)
6332063 test(ios): give pool alias fixtures one build identity (manaflow-ai#14004)
82d49a3 fix(ios): keep an offline sibling build out of secondary aggregation (manaflow-ai#14005)
19a6ac1 test: read errno before the assertion that can overwrite it (manaflow-ai#13957)
ef98b5e ci: name the macOS 26 runner variables after machines, not lanes (manaflow-ai#14009)
9697411 test(ios): expect the construction focus event in composer diagnostics (manaflow-ai#14003)
ad7f9fe ci: run app-host unit tests for a cmuxTests/ diff without a label (manaflow-ai#14017)

# Conflicts:
#	.github/workflows/ci-health-report.yml
#	.github/workflows/ci-macos.yml
#	.github/workflows/ci.yml
#	.github/workflows/nightly.yml
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Checked under CI's Xcode 26.6: all four fixes (#14003, #14004, #14005, #14012) merged onto main db5d212d86 and run as one mobile-core-package job on hosted macos-26. A control ran plain main at the same time.

test with fixes (35888264802) main (35888268046)
mutationsEmitPrivacySafeLifecycleDiagnostics pass fail
onlineIrohAliasSelectsCurrentAuthenticatedIdentity pass fail
authenticatedIrohAliasPublishesAgainstHistoricalPresence pass fail
physicalAliasReplacementRetiresStaleAggregateSnapshots pass fail
taggedHostPortAliasOfFocusIsExcluded pass fail
focusedHandoffDrainsSubscribeBeforeFinalUnsubscribe pass fail
onlineTaggedInstanceWinsBeforePhysicalMacCoalescing pass fail
presenceRoutesForHiddenDuplicateRefreshOnlyTheEmittingRow pass never reported

With the fixes, the suite finished all 1303 tests in 386 s. Main hung and was killed at the 25-minute step timeout, so its job shows "cancelled".

21 tests still fail with the fixes. 4 of them also fail on main here: rawDeviceIDMarkerMatchingExistingRowSurvivesMigration, storedAuthorityReplacementDrainsOldControlBeforeRedial, and the two secondaryAggregationExcludes…IrohEndpoint… tests. The other 17 cannot be compared, because main hung before reaching them. The earlier full serial run on air-blue showed the same remaining failures on unpatched main.

— Nyan g1 🗝️
Run: run_cmux_main_red_suite_slices_and_errno_fixes_20260923_8053081a

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