Skip to content

refactor: prune unused iOS code#91996

Merged
steipete merged 14 commits into
openclaw:mainfrom
zats:ios-prune-unused-code
Jun 15, 2026
Merged

refactor: prune unused iOS code#91996
steipete merged 14 commits into
openclaw:mainfrom
zats:ios-prune-unused-code

Conversation

@zats

@zats zats commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Prunes unused internal iOS helpers, constants, view surfaces, and tests that only covered deleted helper surfaces.
  • Keeps persisted Codable shapes and active decode paths intact.
  • Adds an iOS Periphery PR gate for future apps/ios/** changes.
  • Adds a trusted follow-up workflow that comments on the PR with the dead Swift symbols when Periphery finds violations.

Why Periphery in GitHub PR CI

SwiftLint is the wrong source of truth for this gate. Its dead-code rules are lint-style checks and do not model the full Xcode/Swift build graph well enough for high-trust cleanup. Periphery indexes the real iOS Xcode project and is designed to find unused Swift declarations/files across the compiled target graph, so it is the tool we use for both cleanup and regression prevention.

This is a PR workflow instead of a pre-commit hook because Periphery requires Xcode project generation and an Xcode build/index pass. That is too slow and environment-dependent to rely on for every contributor locally, and hooks are optional. The GitHub check is the authoritative enforcement point before merge.

The PR comment is handled by a separate workflow_run workflow so untrusted PR code runs without a writable token. The scan workflow uploads sanitized Periphery output as an artifact; the trusted commenter reads that artifact and updates one bot comment with the dead-code table.

Verification

Build Note

A full OpenClaw app build with Xcode 27 beta is blocked on current main by the deprecated WatchKit product type com.apple.product-type.watchkit2-extension. For build-only confirmation during cleanup, I temporarily removed the generated watch targets, regenerated the Xcode project, and verified xcodebuild build -scheme OpenClaw -destination 'generic/platform=iOS' CODE_SIGNING_ALLOWED=NO -> BUILD SUCCEEDED; that temporary watch-target removal was reverted before this PR.

Real behavior proof

  • Behavior addressed: unused iOS code was removed, and future PRs touching apps/ios/** are gated against reintroducing Periphery-detected dead Swift code.

  • Real environment tested: local macOS with Xcode 26.5, plus GitHub Actions macOS runner using the generated apps/ios/OpenClaw.xcodeproj and apps/ios/.periphery.yml.

  • Exact steps or command run after this patch: Periphery scan, workflow YAML parse, comment JavaScript parse, synthetic failing-report check, GitHub synthetic failure run, GitHub clean-head run after probe removal, autoreview, and the iOS logic test command above.

  • Evidence after fix: Periphery reports an empty JSON array for the cleaned iOS app scope; the clean-head GitHub Periphery check passes; the temporary proof probe made the GitHub check fail with a Periphery annotation and uploaded report artifact; active iOS logic tests pass.

    Screenshot 1 shows the expected failing GitHub job from the temporary PeripheryProofProbe: Periphery reported the unused Swift symbol, uploaded the dead-code artifact, and the final Fail on dead code step failed the PR check.

    Expected Periphery failure for temporary unused Swift probe

    Screenshot 2 shows the PR comment path: the workflow surfaced the Periphery finding back on the PR so reviewers can see which Swift declaration is dead.

    Periphery PR comment showing dead Swift declaration
  • Observed result after fix: After removing PeripheryProofProbe, the latest PR-head Scan iOS dead code job passed on GitHub at commit 8b6bfc021578f500ef21c7d3036fef1ea0114653. The earlier proof run failed only after Periphery reported the intentionally unused PeripheryProofProbe symbol and uploaded the dead-code report artifact.

  • What was not tested: external-fork contributor PR behavior after these workflows land on main.

@openclaw-barnacle openclaw-barnacle Bot added app: ios App: ios size: XL triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 10, 2026
@zats
zats force-pushed the ios-prune-unused-code branch from 5242ebc to 6a161ec Compare June 12, 2026 09:59
@clawsweeper

clawsweeper Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 15, 2026, 4:27 AM ET / 08:27 UTC.

Summary
The PR removes unused iOS Swift surfaces and tests, adds an iOS Periphery config, adds a pull-request dead-code scan workflow, and adds a workflow_run commenter for Periphery findings.

PR surface: Tests +676, Config +599, Other -1319. Total -44 across 44 files.

Reproducibility: not applicable. as a bug report; the cleanup and CI behavior instead have source inspection, real GitHub workflow proof, and focused workflow tests.

Review metrics: 1 noteworthy metric.

  • Artifact safety bounds: 1 MiB compressed, 5 entries, 2 MiB per entry, 4 MiB expanded. These limits are the main safety control before the trusted workflow parses pull-request-produced ZIP content with issue-write permission.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster ✨ media proof bonus
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Get owner acceptance for the Periphery gate as an authoritative iOS PR dependency.
  • Wait for the unrelated check-test-types failure to be fixed or rerun clean before landing.

Risk before merge

  • [P1] The new Periphery job becomes an authoritative iOS pull-request gate, so hosted macOS, Xcode 26, Homebrew, and Periphery availability can block otherwise valid iOS changes.
  • [P1] The workflow_run commenter intentionally crosses a security boundary by parsing pull-request-produced artifacts with issue-write permission; the current validation substantially constrains this, but future edits should stay security-sensitive.
  • [P1] Current required CI is not fully green because check-test-types fails in an untouched gateway-protocol test; that does not appear PR-introduced but still needs resolution before landing.

Maintainer options:

  1. Accept the guarded Periphery gate (recommended)
    Merge after owner review if maintainers are comfortable making hosted macOS, Xcode 26, Homebrew, and Periphery availability part of the iOS PR gate.
  2. Keep scanning but stop trusted comments
    Retain the Periphery scan and uploaded artifact but remove the workflow_run commenter if maintainers do not want to own a write-token job that consumes PR artifacts.
  3. Pause until CI is clean
    Wait for the unrelated type-check failure to be fixed or rerun cleanly before making a final land decision.

Next step before merge

  • [P2] No narrow automated repair is indicated; the next action is owner review plus maintainer acceptance of the automation/security-boundary tradeoffs and a clean required-check state.

Security
Cleared: No concrete security defect remains in the current workflow_run commenter because it validates the PR head, bounds and validates the ZIP artifact, rechecks freshness, and sanitizes comment cells before writing.

Review details

Best possible solution:

Land the dead-code cleanup and guarded Periphery reporting workflow after iOS and automation owners explicitly accept the gate’s availability tradeoff and preserve the exact-head, bounded-artifact, and comment-sanitization checks.

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

Not applicable as a bug report; the cleanup and CI behavior instead have source inspection, real GitHub workflow proof, and focused workflow tests.

Is this the best way to solve the issue?

Yes, with maintainer acceptance of the tradeoffs: Periphery is the right whole-Xcode-graph tool for Swift dead-code pruning, and the split read-only scan plus tightly validated workflow_run commenter is the right trust-boundary shape.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 44bf1c6d728a.

Label changes

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR supplies real clean and intentional-failure GitHub Periphery runs, visible generated-comment proof, and iOS logic-test output; the linked screenshots were inspectable and matched the described workflow behavior.

Label justifications:

  • P3: This is low-urgency internal iOS cleanup plus preventative CI enforcement rather than a user-facing regression fix.
  • merge-risk: 🚨 automation: The added Periphery job becomes an authoritative iOS PR gate backed by hosted macOS, Xcode, Homebrew, and Periphery availability.
  • merge-risk: 🚨 security-boundary: The added workflow_run commenter has issue-write permission and consumes artifacts produced by pull_request code.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR supplies real clean and intentional-failure GitHub Periphery runs, visible generated-comment proof, and iOS logic-test output; the linked screenshots were inspectable and matched the described workflow behavior.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR supplies real clean and intentional-failure GitHub Periphery runs, visible generated-comment proof, and iOS logic-test output; the linked screenshots were inspectable and matched the described workflow behavior.
Evidence reviewed

PR surface:

Tests +676, Config +599, Other -1319. Total -44 across 44 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 676 0 +676
Docs 0 0 0 0
Config 2 599 0 +599
Generated 0 0 0 0
Other 41 44 1363 -1319
Total 44 1319 1363 -44

What I checked:

Likely related people:

  • steipete: Recent main history shows repeated iOS gateway/setup and CI infrastructure work, and this PR was force-pushed by steipete after contributor commits. (role: iOS and CI area contributor; confidence: high; commits: c94c51371457, d93c59732b71, 466f7183207d; files: apps/ios/Sources/Gateway/GatewayConnectionController.swift, apps/ios/Sources/Voice/TalkModeManager.swift, .github/actions/setup-node-env/action.yml)
  • ngutman: Recent main commits changed iOS realtime Talk behavior and fallback handling adjacent to several cleaned voice files. (role: recent iOS talk contributor; confidence: high; commits: 47dbc675e953, 6897711d1991, 19e4c37c3775; files: apps/ios/Sources/Voice/TalkModeManager.swift, apps/ios/Sources/Voice/TalkModeGatewayConfig.swift, apps/ios/Sources/Gateway/GatewayConnectionController.swift)
  • Colin Johnson: Recent main history introduced the Pro UI, gateway flows, and iPad/iPhone control surfaces that contain many of the cleaned design files. (role: iOS UI and gateway-flow feature contributor; confidence: high; commits: f6e51ff99af4, bf89552e6783; files: apps/ios/Sources/Design/AgentProTab.swift, apps/ios/Sources/Gateway/GatewayConnectionController.swift, apps/ios/Sources/RootTabs.swift)
  • joshavant: Recent main commits touched iOS gateway reconnect and tab behavior adjacent to the cleanup surface. (role: recent iOS stability contributor; confidence: medium; commits: 81c8f525ebfd, d5d3e9983edb, a6582f787c3f; files: apps/ios/Sources/Gateway/GatewayConnectionController.swift, apps/ios/Sources/RootTabs.swift)
  • vincentkoc: Recent main history changed CI guard behavior in .github/workflows/ci.yml, relevant to reviewing a new authoritative iOS CI gate. (role: recent CI contributor; confidence: medium; commits: fc6d448138fc; files: .github/workflows/ci.yml)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@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. 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. rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jun 12, 2026
@zats
zats force-pushed the ios-prune-unused-code branch from 6a161ec to 9ceefe2 Compare June 12, 2026 13:14
@openclaw-barnacle openclaw-barnacle Bot added triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. and removed proof: supplied External PR includes structured after-fix real behavior proof. labels Jun 12, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 12, 2026
@openclaw-barnacle openclaw-barnacle Bot removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. proof: sufficient ClawSweeper judged the real behavior proof convincing. labels Jun 12, 2026
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jun 12, 2026
@steipete steipete self-assigned this Jun 15, 2026
@steipete
steipete force-pushed the ios-prune-unused-code branch from 25fcfe7 to 42b7247 Compare June 15, 2026 08:20
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 15, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 15, 2026
@steipete
steipete force-pushed the ios-prune-unused-code branch from 42b7247 to af76bfd Compare June 15, 2026 08:58
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 15, 2026
@steipete

Copy link
Copy Markdown
Contributor

Land-ready verification for af76bfd486e83060005fd110251e1d13b0d0927f:

  • Pruned caller-free iOS surfaces and regenerated the Xcode project.
  • Added the Periphery PR gate plus a least-privilege workflow_run commenter with bounded artifact parsing, stale-head/run protection, attempt-scoped artifacts, scope-transition handling, and sanitized report rendering.
  • pnpm test test/scripts/ios-periphery-comment-workflow.test.ts - 23 passed.
  • pnpm test packages/gateway-protocol/src/native-protocol-levels.guard.test.ts - 4 passed.
  • pnpm check:test-types - passed.
  • actionlint .github/workflows/ios-periphery-comment.yml .github/workflows/ios-periphery.yml - passed.
  • Oxlint, YAML parsing, SwiftFormat, and SwiftLint - passed; SwiftLint reported only existing warnings.
  • OpenClawLogicTests - 7 passed.
  • Fresh branch-wide autoreview - clean.
  • Exact-head CI: CI 27535318352, Periphery 27535318369, Workflow Sanity 27535318348, and Testbox 27535318376 all passed.

Local full Periphery execution was blocked only by this Mac lacking the watchOS 26.5 runtime; the exact-head GitHub Periphery run passed. The prerequisite Swift protocol generator/type-guard repairs are on main in 7a7165ad22c40938998779befc2c06ac83202224 and d012d29e6f.

@steipete
steipete merged commit 233b48d into openclaw:main Jun 15, 2026
153 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 16, 2026
Prune unused iOS surfaces and regenerate the Xcode project. Add a scoped Periphery PR gate with hardened artifact handling and stale-status cleanup.

Co-authored-by: Sash Zats <[email protected]>
crh-code pushed a commit to crh-code/openclaw that referenced this pull request Jun 18, 2026
Prune unused iOS surfaces and regenerate the Xcode project. Add a scoped Periphery PR gate with hardened artifact handling and stale-status cleanup.

Co-authored-by: Sash Zats <[email protected]>
badgerbees pushed a commit to badgerbees/openclaw that referenced this pull request Jul 8, 2026
Prune unused iOS surfaces and regenerate the Xcode project. Add a scoped Periphery PR gate with hardened artifact handling and stale-status cleanup.

Co-authored-by: Sash Zats <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: ios App: ios merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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.

2 participants