Skip to content

test(fix): wait for launch arguments in menu interaction tests - #86

Merged
Ducksss merged 1 commit into
mainfrom
test/menu-launch-waits
Oct 11, 2026
Merged

Ducksss merged 1 commit into
mainfrom
test/menu-launch-waits

Conversation

@Ducksss

@Ducksss Ducksss commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

MenuInteractionTests polled for about 1 second after each launch (for _ in 0..<100 where !closed) and then read the shim's marker with try String(contentsOf:). On a loaded machine the shim took longer than that, so the read threw NSCocoaErrorDomain Code=260 at top level and test/macos/menu-app-test.sh died with Trace/BPT trap 5. This pattern came in with #75.

  • A new launchArguments(recordedIn:until:_:launch:) helper clears the marker, runs the launch, then polls every 10 ms for up to 10 seconds until the menu has closed and the marker has content. The menu closes only after the launch process exits, so both conditions together mean the arguments are complete. Clearing the marker first stops a wait from reading the previous launch's arguments.
  • On timeout it reports a named expect failure (for example, a profile launch must dismiss the menu and record its arguments within 10 seconds) instead of an uncaught error.
  • All five launch waits use the helper. The two alert-toggle waits use the shared waitUntil with the same 10-second bound.

The change is test-only, so there is no CHANGELOG entry.

Verification

  • bash test/macos/menu-app-test.sh passes.
  • make check passes (exit 0).
  • In the normal case the interaction binary still finishes in about 3.6 s.
  • To reproduce the failure, I added sleep 2 to the shim in scratch copies (not committed):
    • The old test crashes with the same Code=260 … "launch" couldn’t be opened.
    • The new test passes in about 15.6 s.
  • When the shim never writes the marker, the new test fails after 10 s with Fatal error: a profile launch must dismiss the menu and record its arguments within 10 seconds.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Updated menu interaction tests to wait for launch actions, menu closure, and low-quota alerts to complete, with a bounded timeout. Coverage includes profile launches, keyboard and Open actions, and alternate destinations.

The menu interaction tests polled for about one second after each launch
and then read the shim's marker file with a throwing call. On a loaded
machine the shim took longer, so the read raised NSCocoaErrorDomain 260
at top level and the binary died with Trace/BPT trap 5.

A shared helper now clears the marker, runs the launch and polls for up
to 10 seconds until the menu has closed and the marker has content. The
menu closes only after the launch process exits, so those two together
mean the arguments are complete. A timeout reports a named expectation
instead of an uncaught error. The two alert-toggle waits use the same
bounded poll. The normal run still finishes in about 4 seconds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 11, 2026 13:55

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 34a2df44-757c-4e63-aba0-8cae33606f78

📥 Commits

Reviewing files that changed from the base of the PR and between a00e4b4 and ad8b2c6.


📒 Files selected for processing (1)
  • macos/CodexProfilesMenu/Tests/CodexProfilesMenuTests/MenuInteractionTests.swift

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



📝 Walkthrough

Walkthrough

Menu interaction tests now use bounded polling to check for menu closure, recorded launch arguments, and alert state changes.

Changes

Menu interaction test waits

Layer / File(s) Summary
Launch completion waits
macos/CodexProfilesMenu/Tests/CodexProfilesMenuTests/MenuInteractionTests.swift
Launch tests use launchArguments to trigger actions and wait for menu closure and recorded arguments.
Alert state waits
macos/CodexProfilesMenu/Tests/CodexProfilesMenuTests/MenuInteractionTests.swift
Alert-toggle and alert-disable tests use waitUntil instead of fixed polling loops.

Priority: ⬇️ Low

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

Change: Bug fix


Merge Risk: ⚪ Minimal · up to ad8b2

The updated waits have bounded completion checks, and the alert tests report which behavior failed. No issue identified here needs to block merging.

Pre-merge checks | Passed 4 | 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 5 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: updating menu interaction tests to wait for launch arguments.
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.

  • 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

  • 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.

@Ducksss
Ducksss merged commit b8733b5 into main Oct 11, 2026
4 checks passed
@Ducksss
Ducksss deleted the test/menu-launch-waits branch October 11, 2026 14:28
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