Skip to content

test: ignore NSTextView's own delegate reads during init on macOS 27 - #19189

Merged
teamleaderleo merged 2 commits into
mainfrom
fix/macos27-textview-delegate-probe-baseline
Oct 11, 2026
Merged

teamleaderleo merged 2 commits into
mainfrom
fix/macos27-textview-delegate-probe-baseline

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Four app-host tests fail on every macOS 27.0.1 mini and pass on the macOS 15/26 Blacksmith runners:

  • CmuxWebViewKeyEquivalentTests/testWindowFirstResponderGuardAvoidsTextViewDelegateLookupForWebViewResolution
  • CmuxWebViewKeyEquivalentTests/testWindowFirstResponderGuardResolvesTrackedWebViewForFieldEditorResponder
  • CommandPaletteFocusStealerClassificationTests/testDoesNotReadTextViewDelegateForFocusStealerClassification
  • GhosttyResponderResolutionTests/testDoesNotReadTextViewDelegateForGhosttyResponderResolution

All four fail with XCTAssertEqual failed: ("4") is not equal to ("0"). The Ghostty and command-palette tests only construct the probe text view and call one cmux helper, so the four reads come from NSTextView's own initializer on macOS 27, not from cmux. That is AppKit reading its own property, which the unsafe-unretained rule does not cover.

Each probe now resets its counter right after construction, so it counts only reads made by the code under test. No product code changes.

Evidence

Recent ci.yml runs (since 2026-10-10 20:14Z): each test failed 0/4 on the 27 minis and passed 10/10 (CmuxWebView) and 5-6/6 (others) on blacksmith macos-26, plus 2/2 on blacksmith macos-15.

Changelog

none

Test plan

🤖 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 four app-host tests that failed on macOS 27 because NSTextView's initializer reads its own delegate four times, which the test probes counted as cmux reads.

  • Adds a resetDelegateReadCount() to each NSTextView probe, called right after construction so only reads made by the code under test are counted.
  • No product code changes.

Written for commit e73693d. Summary will update on new commits.

View guided diff Turn on auto-fix


Note

Low Risk
Test-only changes to counter reset timing; no app behavior or security-sensitive paths modified.

Overview
Fixes four app-host tests that fail on macOS 27 because NSTextView’s initializer reads delegate during construction, so probe subclasses were reporting 4 reads before any cmux code ran.

Adds resetDelegateReadCount() on the delegate-tracking probe NSTextView types in BrowserConfigTests, ShortcutAndCommandPaletteTests, and TerminalAndGhosttyTests, and calls it immediately after creating each probe so assertions still enforce zero delegate reads from first-responder / focus-stealer / Ghostty resolution paths. No production code changes.

Reviewed by Cursor Bugbot for commit 5426df7. Bugbot is set up for automated code reviews on this repo. Configure here.

On macOS 27, NSTextView's initializer reads its own `delegate` four
times. The probes that check cmux never touches the unsafe-unretained
NSTextView.delegate counted those AppKit reads, so four tests failed
with "4 is not equal to 0" on the macOS 27 minis while passing on the
macOS 15/26 runners. Reset each probe's counter after construction so
only reads made by the code under test are counted.

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 Oct 11, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Repository: manaflow-ai/cmux/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 703ff9fe-47a9-4cd3-b128-d84739d7b7c8

📥 Commits

Reviewing files that changed from the base of the PR and between 5426df7 and e73693d.


You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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: 2c3b5c0c-2e96-488d-a425-9910d2bb9d24




📥 Commits

Reviewing files that changed from the base of the PR and between 6205c64 and 5426df7.





📒 Files selected for processing (3)
  • cmuxTests/BrowserConfigTests.swift
  • cmuxTests/ShortcutAndCommandPaletteTests.swift
  • cmuxTests/TerminalAndGhosttyTests.swift




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






📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

The tests now reset text view delegate-read counters after initialization and before measuring delegate reads in browser configuration, shortcut classification, and responder resolution tests.

Changes

Delegate-read tests

Layer / File(s) Summary
Reset counters before measurement
cmuxTests/BrowserConfigTests.swift, cmuxTests/ShortcutAndCommandPaletteTests.swift, cmuxTests/TerminalAndGhosttyTests.swift
Test helpers provide counter reset methods, and the related tests call them before measuring delegate reads. Comments distinguish initialization reads from reads measured by the tests.

Priority: ⬇️ Low

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

Change: Other








Merge Risk: ⚪ Minimal · up to 5426d

The tests exclude AppKit’s initialization reads while continuing to check reads made by the code under test. No merge-blocking risk was identified.

Pre-merge checks | Passed 24 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (24 passed)
Check name Status Explanation
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 PASS: The pull request changes only three test files and adds/reset delegate-read counters around NSTextView initialization. It does not change Cloud terminal creation, cmux-tui transport, manual rend…
Cmux Swift Actor Isolation Passed The pull request changes only three cmuxTests files. It adds counter-reset helpers and calls them in tests. No production Swift code changes exist, so the custom check's actor-isolation failure cond…
Cmux Swift Blocking Runtime Passed PASS. The PR changes only three cmuxTests/*.swift files. The additions only reset delegateReadCount after NSTextView initialization. They add no semaphore, blocking wait, sleep, delayed dispatch…
Cmux Browser Automation Off-Main Passed The pull request changes only three test files. The diff adds NSTextView delegate-read counter reset helpers and test setup calls. It does not change browser socket commands, processV2Command, `sock…
Cmux Expensive Synchronous Load Passed The pull request changes only three cmuxTests files. The diff adds delegate-read counter reset helpers and test setup calls; it adds no production Swift code and no synchronous agent-history load or…
Cmux Cache Substitution Correctness Passed The pull request changes only three cmuxTests Swift files. The diff adds test-only delegate counter reset methods and calls; it does not change production Swift, TypeScript, or JavaScript, and it do…
Cmux No Hacky Sleeps Passed PASS. The pull request changes only Swift test files. It adds delegate-read counter resets and does not add sleeps, timers, polling, delayed dispatch, or wall-clock synchronization. The rule covers no…
Cmux Algorithmic Complexity Passed PASS. The diff changes only cmuxTests/BrowserConfigTests.swift, cmuxTests/ShortcutAndCommandPaletteTests.swift, and cmuxTests/TerminalAndGhosttyTests.swift. It adds counter-reset methods and cal…
Cmux Swift Concurrency Passed The PR changes only XCTest probe helpers and calls that reset NSTextView.delegate read counters after initialization. The authoritative diff adds no Dispatch queues, Combine state, completion-handle…
Cmux Swift @Concurrent Passed The diff only adds synchronous resetDelegateReadCount() helpers and synchronous test call sites in three test files. It adds no async, nonisolated, @concurrent, or async helper call-site chang…
Cmux Swift Package Boundaries Passed The diff changes only three files under cmuxTests/. It adds counter-reset methods to test-only NSTextView probes and calls them after initialization. No production Swift feature logic, app-target …
Cmux Swiftpm Lockfiles Passed The pull request changes only three Swift test files. The diff adds delegate-read counter reset helpers and test calls. It changes no Package.swift, Package.resolved, Xcode project package references,…
Cmux Swift Logging Passed The diff changes only three files under cmuxTests/. It adds delegate-counter reset methods and calls. It adds no print, debugPrint, dump, NSLog, file logging, Logger, or sensitive-data log…
Cmux User-Facing Error Privacy Passed PASS. The pull request changes only three cmuxTests files. The additions reset delegate-read counters in test probes and add developer-only comments. No production user-facing errors, alerts, comman…
Cmux Full Internationalization Passed The pull request changes only three Swift test files. The diff adds delegate-counter reset methods, comments, and test setup calls. It adds no production user-facing text, localization API usage, stri…
Cmux Swiftui State Layout Passed PASS: The pull request changes only three XCTest files. The diff adds delegate-read counter reset methods and test calls on NSTextView probe subclasses. It introduces no SwiftUI code, ObservableObject…
Cmux Architecture Rethink Passed PASS. The diff changes only three test files and adds reset methods plus calls that clear existing probe counters after NSTextView initialization. It introduces no sleeps, delayed dispatch, polling, l…
Cmux Swift Auxiliary Window Close Shortcuts Passed The diff changes only three files under cmuxTests/. It adds delegate-read counter reset methods and calls them in test cases. It does not add or materially change any user-visible NSWindow, `NSPan…
Cmux Source Artifacts Passed All three changed paths are hand-written Swift test sources: cmuxTests/BrowserConfigTests.swift, cmuxTests/ShortcutAndCommandPaletteTests.swift, and cmuxTests/TerminalAndGhosttyTests.swift. The …
Cmux No Test Or Debug Seam In Production Source Passed The pull request changes only three files under cmuxTests/. The diff adds resetDelegateReadCount() methods and calls in test probe classes. No Swift file under a production Sources/ path changes…
Title check Passed The title clearly and concisely describes the test-only change that excludes NSTextView initializer delegate reads on macOS 27.
Description check Passed The description clearly explains the failure, root cause, implementation, affected tests, and validation results. It includes Summary, Changelog, and detailed testing information, although it omits th…



✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR





🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR





🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR



  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@cursor

cursor Bot commented Oct 11, 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.

@teamleaderleo
teamleaderleo merged commit 7848f21 into main Oct 11, 2026
54 checks passed
@teamleaderleo
teamleaderleo deleted the fix/macos27-textview-delegate-probe-baseline branch October 11, 2026 04:32
@github-actions

Copy link
Copy Markdown
Contributor

Merge receipt for e73693d930: every check was green at merge (14 verified; 19 skipped by policy). Full suite runs on main after merge.

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