Skip to content

Remove issue #135 Phase 4A diagnostic markers#140

Merged
obj-p merged 1 commit intomainfrom
chore/phase4-cleanup
Apr 22, 2026
Merged

Remove issue #135 Phase 4A diagnostic markers#140
obj-p merged 1 commit intomainfrom
chore/phase4-cleanup

Conversation

@obj-p
Copy link
Copy Markdown
Owner

@obj-p obj-p commented Apr 22, 2026

Cleanup follow-up to PR #139. The markers (`[snapshot] enter`, `[snapshot] pre session-check`, `[reload] main-actor block returned`, etc.) were added on the explicit understanding — and a `TODO(#135-4B)` tag — that they'd be removed once Phase 4B landed. 4B landed in the same PR (#139) and issue #135 is closed, so the markers have served their purpose.

What's removed

  • 8 `fputs(...); fflush(stderr)` marker pairs in `handlePreviewSnapshot` (MCPServer.swift)
  • 1 marker in `HostApp.swift` after the reload's `MainActor.run` block
  • The `do { ... } catch` wrapper around `MainActor.run` in `handlePreviewSnapshot` that only existed to print a throw-path marker — replaced with the original direct `try await MainActor.run { ... }`
  • ~15-line historical narrative comment on the removed 300ms `Task.sleep`, trimmed to a 3-line forward-facing note

What stays

  • `fflush(stderr)` added to pre-existing `Reloaded!` / `Reload failed:` lines — real correctness improvement (without it, libc buffering could mask those on a wedge)
  • A concise comment at the site where the sleep used to be, warning future authors not to re-add a cooperative sleep (would re-introduce the Daemon can become non-responsive after hot-reload; MCP client has no liveness detection #135 starvation failure mode)
  • Architectural docs in `AGENTS.md` and the `StallTimer` / `runMCPServer` / watchdog docstrings — these describe current behavior, not investigation history

Rationale

Own repo guidance on code comments says don't reference specific task/PR/CI IDs in code since they rot. The removed comments name specific PR numbers, CI run IDs, and phase labels — exactly that category.

Test plan

  • `swift build` — clean
  • `swift-format lint --strict --recursive Sources/ Tests/ examples/` — clean
  • `swift test --filter MacOSMCPTests` — 7/7 pass in 92.9s locally
  • CI

Net: 61 lines removed, 7 added. Pure code deletion / comment trim. No behavior change.

🤖 Generated with Claude Code

The markers were added on the agreement that they'd be removed once
Phase 4B landed (the TODO(#135-4B) tag committed to this explicitly).
4B landed in the same PR (#139) and closed issue #135, so the
markers have served their purpose.

Also trims the 15-line "Previously: Task.sleep(for: .milliseconds(300))
with the comment 'Wait briefly for SwiftUI to finish layout' ..."
historical narrative down to a short forward-facing note warning
future authors not to re-add a cooperative sleep there. Git history
has the full root-cause walkthrough for anyone who needs it.

Net removal: ~60 lines of transient investigation context from
production code. Architectural notes (`AGENTS.md`, `StallTimer` /
`runMCPServer` docstrings) are unaffected — those describe current
behavior, not past bug hunts.

Verification: 7/7 MacOSMCPTests pass in 93s. `build` + `swift-format
lint` clean. The `fflush(stderr)` additions on `Reloaded!` /
`Reload failed:` stay — those are a real correctness fix.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@obj-p obj-p enabled auto-merge (squash) April 22, 2026 12:32
@obj-p obj-p merged commit 7cbafdb into main Apr 22, 2026
7 of 8 checks passed
@obj-p obj-p deleted the chore/phase4-cleanup branch April 22, 2026 15:41
obj-p added a commit that referenced this pull request Apr 22, 2026
First CI run on this PR caught two ios-tests failing with the new
AsyncProcessTimeout at 15s — both passed on prior green CI runs
(PR #140 had `Boot and shutdown a device` in 32s and
`End-to-end... screenshot` in 223s total). That tells us the IOSurface
→ simctl fallback path can legitimately take longer than 15s on slow
CI runners, not that simctl is always hung.

Bump to 60s. Still catches the pathological 10-minute hang
(72501335737 showed 15+ minutes of silence), still gives simctl
ample room on realistic CI variance. Fast local runs are unaffected —
the timer only fires on actual hangs.

Note that local `AsyncProcessTests.timeoutFiresOnHungChild` still
runs with a 500ms timeout against `/bin/sleep 30` — it validates the
timeout *mechanism* on a guaranteed-hung child regardless of what
production code chooses for the bound.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
obj-p added a commit that referenced this pull request Apr 22, 2026
Prior "iOS simulator tests" bullet list predated this branch. Replace
with the architecture that actually exists after the stability +
observability work: per-test distinct device via IOSSimulatorPicker,
bootDevice blocking via simctl bootstatus, display-attach retry in
screenshotData, CI boot-variance budget, iPhone-only filter,
AsyncProcessTimeout's captured output.

Follows the same rot-avoidance as the PR #140 cleanup: describes
current behavior, not investigation history or PR numbers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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