Skip to content

Enroll CLIIntegrationTests in CoreSimulatorHygiene before its iOS boots - #324

Merged
obj-p merged 3 commits into
mainfrom
cli-suite-coresim-hygiene
Jul 3, 2026
Merged

Enroll CLIIntegrationTests in CoreSimulatorHygiene before its iOS boots#324
obj-p merged 3 commits into
mainfrom
cli-suite-coresim-hygiene

Conversation

@obj-p

@obj-p obj-p commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Why

The merge bar's full-graph VM run timed out CLIIntegrationTests at the 300s default ceiling while the same suite passes isolated in the same VM in 184s. The VM's per-suite progression tracked a healthy local run 1:1 for 112s, then the tail suites (Snapshot/Stop/Variants) consumed the remaining 187s without completing — the suite runs after PreviewsIOSTests and IOSPreviewE2ETests have degraded the host-global CoreSimulator service. This is the exact mechanism #319 root-caused and fixed for MCPIntegrationTests (which passed at 261s in the same failing bar run); CLIIntegrationTests is the target #319's enrollment missed.

What

  • Per-target copy of CoreSimulatorHygiene (like DaemonTestLock — test sources aren't shared across swift_test targets and the once-per-process guard is per-target by design), with its commands routed through CLIRunner.runExternal bounded at 60s/15s so a wedged simctl cannot eat the suite budget the reset protects.
  • Both iOS-booting suites enrolled (iosCLIWorkflow, snapshotIOS) — suite lock order is nondeterministic, mirroring Salvage the iOS e2e deflake product fixes to main #319's all-suites pattern.
  • Review hardening applied to both copies: the done-flag flips only after the commands complete (an interrupted reset re-arms instead of silently no-opping), and the headers now state the real serialization guarantees (per-target flock within the target, exclusive tag across targets within one invocation).

Verification

  • CLIIntegrationTests isolated: green 3x (~138-142s) across the change iterations
  • /simplify (4 angles): applied — snapshotIOS enrollment and the runExternal reuse came out of it
  • /code-review (high, workflow): 3 findings, all applied (re-armable guard, bounded commands, honest lock docs)
  • Lint clean; full suite bazel test //previewsmcp/Tests/... --nocache_test_results: 9/9 green
  • The falsification test is the bar itself: mergequeue-lead runs 3x full-graph bar next; if the tail still wedges with hygiene enrolled, the mechanism theory is wrong and we farm a live serve.log

🤖 Generated with Claude Code

https://claude.ai/code/session_01PPF6gjyr2BBuz31yRSnMvG

obj-p and others added 3 commits July 2, 2026 21:23
The bar's full-graph run timed out this suite at 300s while the same
suite passes isolated in the same VM in 184s (and MCPIntegrationTests,
which got the resetOnce enrollment in #319, passed right after the
timeout). CLIIntegrationTests runs after PreviewsIOSTests and
IOSPreviewE2ETests have degraded the host-global CoreSimulator service,
and it is the one sim-booting suite #319's enrollment missed: its VM
run tracked the healthy local timeline 1:1 for 112s, then the tail
suites consumed the remaining 187s without completing.

Per-target copy of CoreSimulatorHygiene (like DaemonTestLock — test
sources aren't shared across swift_test targets and the once-per-
process guard is per-target by design); IOSCLIWorkflowTests calls
resetOnce() under DaemonTestLock before the first iOS preview boots,
mirroring IOSMCPTests/IOSHIDInputTests/IOSAppServerTests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPF6gjyr2BBuz31yRSnMvG
- snapshotIOS (SnapshotCommandTests) also boots an iOS session and suite
  lock order is nondeterministic, so it gets the same resetOnce() call —
  the faithful #319 mirror enrolls every iOS-booting suite (the MCP
  target has three call sites for the same reason).
- The copied private run() helper is replaced with CLIRunner.runExternal:
  bounded (300s) and cancellation-safe where waitUntilExit was unbounded
  in exactly the wedged-simctl scenario this code targets.
- cleanSlate() now precedes the service bounce, and the copied comment
  no longer references MCPIntegrationTests' pickUDID.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPF6gjyr2BBuz31yRSnMvG
…t lock docs

- The done-flag now flips only after both reset commands complete, so a
  reset interrupted by a time-limit cancellation is retried by the next
  enrolled test instead of silently no-opping for the rest of the
  process; DaemonTestLock (held by every caller) serializes the
  check-then-run. Applied to both per-target copies.
- The CLI copy bounds the commands at 60s/15s instead of runExternal's
  300s default, so a wedged simctl cannot eat the ten-minute suite
  budget the reset exists to protect.
- Both headers now state the real serialization guarantees: the flock
  is per-target, cross-target safety comes from the exclusive tag
  within one bazel invocation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPF6gjyr2BBuz31yRSnMvG
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