Skip to content

refactor(macos): consolidate node runtime test fixtures - #118521

Merged
steipete merged 1 commit into
mainfrom
codex/cleanup50k-macos-wave3-2d45
Aug 3, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/cleanup50k-macos-wave3-2d45

Conversation

@steipete

@steipete steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The macOS node-runtime tests repeated the complete MacNodeRuntimeMainActorServices conformance across four fixtures and rebuilt the same invoke envelope throughout the suite. Protocol changes therefore required synchronized edits in unrelated test cases and made the runtime contract harder to audit.

Why This Change Was Made

Use one configurable main-actor services probe for screen, recording, and computer-control behavior, plus typed and raw invoke helpers for request construction. The concurrency gates, lifecycle-generation tracking, callback observations, catalog-worker behavior, payload limits, and all assertions stay unchanged.

User Impact

No user-visible behavior changes. This removes 205 test lines and makes future macOS node-runtime contract changes less error-prone.

Evidence

  • swift test --package-path apps/macos --build-system native -j 4 --filter MacNodeRuntimeTests — 30/30 passed.
  • SwiftFormat — 0 files require formatting.
  • SwiftLint — 0 violations.
  • git diff --check — clean.
  • Static preservation audit — all 30 test declarations and all 112 #expect lines are byte-identical and remain in source order.
  • Blacksmith Testbox tbx_01kz334gm1wfgtpg8jsjg731qx — changed-path gate passed: https://github.com/openclaw/openclaw/actions/runs/30788599380
  • GPT-5.6 Sol xhigh autoreview thread 019fc635-779b-7a80-bf01-1287208187a0 — no findings, correctness 0.99.

LOC: production +0/-0; tests +150/-355 (net -205).

@openclaw-barnacle openclaw-barnacle Bot added app: macos App: macos size: L maintainer Maintainer-authored PR labels Aug 3, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 3, 2026
@steipete steipete self-assigned this Aug 3, 2026
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 3, 2026
@clawsweeper

clawsweeper Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 2:06 AM ET / 06:06 UTC.

ClawSweeper review

What this changes

The PR replaces several duplicated macOS node-runtime service fixtures and repeated bridge-request construction with one configurable probe and typed helper methods, preserving the existing test cases and assertions.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

This is a focused test-only refactor with no blocking correctness or security finding in the reviewed patch. It remains necessary because current main still contains the repeated fixtures; the protected maintainer label appropriately leaves merge approval with the macOS owner after the pending Swift validation completes.

Priority: P3
Reviewed head: 77ff93835612df01f186ffad9520c8da76253146
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-consistent test refactor with preserved coverage counts and reported native Swift validation; only normal protected-label approval and pending Swift completion remain.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): For this test-only refactor, the PR provides a focused after-change Swift test run reporting 30/30 passing tests, with a successful macOS-node check in the supplied status context.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): For this test-only refactor, the PR provides a focused after-change Swift test run reporting 30/30 passing tests, with a successful macOS-node check in the supplied status context.
Evidence reviewed 5 items Focused test refactor: The branch adds a shared MainActorServicesProbe and two request helpers only in the macOS node-runtime test file; production runtime code and the service protocol are not changed.
Protocol coverage retained: The consolidated probe implements the complete main-actor service contract that the runtime uses for snapshots, recordings, location, computer actions, and lifecycle input release.
Test coverage count preserved: The branch retains all 30 @Test declarations and all 112 #expect assertions while removing duplicated conformance boilerplate.
Findings None None.
Security None None.

How this fits together

The macOS node runtime accepts bridge invocation requests from paired nodes and delegates screen, recording, location, and computer-control work to main-actor services. This test suite injects those services to verify request translation, lifecycle invalidation, and response behavior without using the live desktop services.

flowchart LR
    A[Paired node request] --> B[macOS node runtime]
    B --> C[Main-actor service contract]
    C --> D[Screen, recording, and computer control]
    D --> E[Bridge response]
    F[Injected test probe] --> C
    F --> G[Lifecycle and request assertions]
Loading

Decision needed

Question Recommendation
Does the macOS owner approve this protected, test-only fixture consolidation once the queued macOS Swift validation completes on the current head? Approve after Swift validation: Merge the refactor if the pending macOS Swift checks pass on this head, retaining the shared fixture as the sole test conformance.

Why: The patch is mechanically sound from source review, but the maintainer label requires explicit human handling rather than automated cleanup or merge.

Before merge

  • Complete next step (P2) - The protected maintainer label requires an owner approval after the remaining macOS Swift gate, not an automated repair or cleanup action.
Agent review details

Security

None.

PR surface

Other -205. Total -205 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 150 355 -205
Total 1 150 355 -205

Review metrics

Metric Value Why it matters
Production vs test LOC production +0/-0; tests +150/-355 (net -205) The patch meaningfully reduces test-only boilerplate while retaining the same 30 test declarations and 112 assertions.

Technical review

Best possible solution:

Keep one configurable test probe as the canonical fixture for this protocol, preserving the existing lifecycle and payload-bound assertions; merge after the macOS Swift validation confirms the exact head.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR refactors test fixtures rather than reporting a user-facing defect. The contributor provides a focused 30-test Swift execution result, and the reviewed source retains the existing test inventory.

Is this the best way to solve the issue?

Yes. Consolidating identical protocol conformances behind one configurable test probe is the maintainable owner-boundary solution because the runtime protocol remains unchanged and the existing behavior-sensitive assertions stay covered.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 6f6d501ccf9a.

Labels

Label changes:

  • add P3: This is low-risk test maintenance with no user-visible behavior change and no current correctness finding.
  • add proof: sufficient: Contributor real behavior proof is sufficient. For this test-only refactor, the PR provides a focused after-change Swift test run reporting 30/30 passing tests, with a successful macOS-node check in the supplied status context.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): For this test-only refactor, the PR provides a focused after-change Swift test run reporting 30/30 passing tests, with a successful macOS-node check in the supplied status context.

Label justifications:

  • P3: This is low-risk test maintenance with no user-visible behavior change and no current correctness finding.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): For this test-only refactor, the PR provides a focused after-change Swift test run reporting 30/30 passing tests, with a successful macOS-node check in the supplied status context.
  • proof: sufficient: Contributor real behavior proof is sufficient. For this test-only refactor, the PR provides a focused after-change Swift test run reporting 30/30 passing tests, with a successful macOS-node check in the supplied status context.

Evidence

What I checked:

Likely related people:

  • steipete: Peter Steinberger authored the current test-file history and the computer-action lifecycle hardening that the refactored fixtures continue to exercise. (role: recent area contributor and lifecycle-hardening author; confidence: high; commits: 5c5aeaddc2bb, 461772868da3, 77ff93835612; files: apps/macos/Tests/OpenClawIPCTests/MacNodeRuntimeTests.swift, apps/macos/Sources/OpenClaw/NodeMode/MacNodeRuntime.swift)
  • Val Alexander: Val Alexander authored the earlier screen-snapshot validation and payload-bound hardening exercised by the shared probe's snapshot cases. (role: adjacent screen-snapshot contributor; confidence: medium; commits: 5f89cabeb55a; files: apps/macos/Tests/OpenClawIPCTests/MacNodeRuntimeTests.swift, apps/macos/Sources/OpenClaw/NodeMode/MacNodeRuntimeMainActorServices.swift)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer land-ready review completed on exact head 77ff93835612df01f186ffad9520c8da76253146.

  • Native review artifacts: READY FOR /prepare-pr, 0 findings.
  • Scope/LOC: one test file, +150/-355 (net -205); production +0/-0.
  • Focused macOS proof: MacNodeRuntimeTests passed 30/30.
  • SwiftFormat and SwiftLint: clean; git diff --check: clean.
  • Static invariants: all 30 test declarations and all 112 expectations are identical and retain their original order.
  • Blacksmith Testbox: tbx_01kz334gm1wfgtpg8jsjg731qx, run 30788599380, passed changed-path checks.
  • Xhigh commit autoreview: thread 019fc635-779b-7a80-bf01-1287208187a0, no findings, correctness 0.99.
  • Hosted exact-head CI: run 30788801939 passed, including macos-node job 91607932970, macos-swift job 91607933016, and openclaw/ci-gate job 91609504673.
  • ClawSweeper substantive exact-head review: no correctness/security findings and no Rank-up moves. Its remaining owner-approval-after-Swift item is satisfied by this maintainer review after the Swift and CI gates passed. The newer status placeholder contains no additional requested move.
  • Docs/changelog: not applicable; no user-visible behavior change.

The canonical fix stays in the test owner boundary: one complete configurable service probe plus two request helpers. It removes duplicate conformances without changing the production runtime or protocol and preserves catalog, canvas, screen, recording, computer action, concurrency, lifecycle, and payload-bound coverage.

Ready for native prepare and merge.

@steipete
steipete merged commit fd2fb64 into main Aug 3, 2026
60 of 70 checks passed
@steipete
steipete deleted the codex/cleanup50k-macos-wave3-2d45 branch August 3, 2026 06:15
@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant