cleanup(main): defer serve-sim materialization, dedupe reload flags, guard gate validators#7321
Conversation
…guard gate validators Quality pass on main-process/build PRs merged 2026-07-03: - ios-emulator-backend: resolve the serve-sim executable via a lazily-cached getter instead of eagerly in the constructor. The bridge is built before the main window is shown, so the one-time recursive copy + xattr subprocess (first launch after each version bump) no longer blocks macOS startup for a feature that may go unused (#7174). - index: collapse the two near-identical `{webContentsId, until}` reload flags (expectedRendererReload / recoveryReloadInFlight) into one `createWebContentsTimedFlag` primitive; behavior preserved, including consume-on-read for the recovery reload (#7290). - check-reliability-gates: coerce gate.commands/testFiles/platforms/providers with an `asArray` helper before `.includes`, so a hand-edited manifest with a missing/mistyped field reports a validation failure instead of throwing an uncaught TypeError; extract `hasCompleteRedGreenEvidence` for the duplicated status check (#7295). - claude-pty: derive FABLE_WEEKLY_LABEL_RE from WEEKLY_RE.source so a future weekly- wording change stays in one place and can't reopen the parsing gap it just closed. - macos-tcc-login-shell: trim the 30-line flag-by-flag JSDoc to the two non-obvious whys (TCC identity, env(1) SHELL re-assertion) per the repo comment guidance (#7003). Typecheck, oxlint, oxfmt, `check:reliability-gates`, and touched unit suites all pass.
📝 WalkthroughWalkthroughChangesThis PR bundles five independent, small changes: the reliability-gate manifest validator now coerces potentially non-array fields via a new Related PRs: None identified. Suggested labels: refactor, main-process, chore Suggested reviewers: None identified. 🤖 A rabbit taps keys with focused delight, 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/emulator/backends/ios-emulator-backend.ts (1)
56-59: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueComment exceeds the one/two-line guideline.
The
Why:comment spans 4 lines. As per coding guidelines, non-obvious-constraint comments should be "one or two lines, capturing only the non-obvious reason." Consider trimming to the core rationale (defer to avoid startup-time materialization cost) while dropping secondary detail.Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 77216068-0525-44b7-b5de-b20037e320bf
📒 Files selected for processing (5)
config/scripts/check-reliability-gates.mjssrc/main/emulator/backends/ios-emulator-backend.tssrc/main/index.tssrc/main/providers/macos-tcc-login-shell.tssrc/main/rate-limits/claude-pty.ts
| private get serveSimExecutable(): ServeSimExecutable { | ||
| this.cachedServeSimExecutable ??= resolveServeSimExecutable() | ||
| return this.cachedServeSimExecutable | ||
| } |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Inspect test coverage for lazy/memoized serve-sim executable resolution
fd 'ios-emulator-backend.test.ts' | xargs -I{} sed -n '1,200p' {}Repository: stablyai/orca
Length of output: 7613
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the backend implementation and the matching test file for coverage
# around resolveServeSimExecutable() being lazy and memoized.
printf '\n== ios-emulator-backend.ts ==\n'
sed -n '1,180p' src/main/emulator/backends/ios-emulator-backend.ts
printf '\n== ios-emulator-backend.test.ts (resolveServeSimExecutable references) ==\n'
rg -n "resolveServeSimExecutable|serveSimExecutable|cachedServeSimExecutable|constructor" src/main/emulator/backends/ios-emulator-backend.test.ts src/main/emulator/backends/ios-emulator-backend.tsRepository: stablyai/orca
Length of output: 7606
Add coverage for lazy serve-sim resolution. src/main/emulator/backends/ios-emulator-backend.test.ts should assert that resolveServeSimExecutable() is not called on construction and is only invoked once across repeated serveSimExecutable-backed calls.
Cleanup pass — main process & build (2 of 3)
Code-quality follow-ups on main-process / build-script PRs merged 2026-07-03. Surfaced by an automated multi-agent review; every finding adversarially verified before fixing.
ios-emulator-backend: resolve serve-sim executable lazily (cached getter) instead of eagerly in the constructorindex: collapse the two near-identical{webContentsId, until}reload flags into onecreateWebContentsTimedFlagprimitivecheck-reliability-gates: coerce array fields before.includesso a malformed manifest reports a failure instead of throwingcheck-reliability-gates: extracthasCompleteRedGreenEvidencefor a duplicated checkclaude-pty: deriveFABLE_WEEKLY_LABEL_REfromWEEKLY_RE.source(one source of truth)macos-tcc-login-shell: trim the 30-line flag-by-flag JSDoc to its two non-obvious whysNotable details
cpSync+xattrsubprocess (first launch after each version bump) on the main thread. Deferring it to first emulator use keeps that work off the boot path for a feature that may go unused in a session.validateEvidenceRun/validateAssertionRef/validateCoveredScopecall.includesongate.commands/testFiles/platforms/providers. Earlier type checks onlypusha failure without returning, so a hand-editedreliability-gates.jsoncwith a missing/mistyped field threw an uncaughtTypeErrorinstead of the intended structured report.Verification
pnpm run typecheck·oxlint·oxfmt·pnpm run check:reliability-gates(27 gates pass) · touched unit suites — all green.🤖 Generated with Claude Code
Made with Orca 🐋