Skip to content

cleanup(main): defer serve-sim materialization, dedupe reload flags, guard gate validators#7321

Merged
nwparker merged 1 commit into
mainfrom
nwparker/cleanup-main
Jul 4, 2026
Merged

cleanup(main): defer serve-sim materialization, dedupe reload flags, guard gate validators#7321
nwparker merged 1 commit into
mainfrom
nwparker/cleanup-main

Conversation

@nwparker

@nwparker nwparker commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

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.

Fix Kind Origin PR
ios-emulator-backend: resolve serve-sim executable lazily (cached getter) instead of eagerly in the constructor perf (macOS startup) #7174
index: collapse the two near-identical {webContentsId, until} reload flags into one createWebContentsTimedFlag primitive elegance #7290
check-reliability-gates: coerce array fields before .includes so a malformed manifest reports a failure instead of throwing bug #7295
check-reliability-gates: extract hasCompleteRedGreenEvidence for a duplicated check clean #7295
claude-pty: derive FABLE_WEEKLY_LABEL_RE from WEEKLY_RE.source (one source of truth) clean Fable weekly parsing
macos-tcc-login-shell: trim the 30-line flag-by-flag JSDoc to its two non-obvious whys comment #7003

Notable details

  • Startup perf: the emulator bridge is constructed before the main window is shown. After Inject serve-sim camera dylib from an unquarantined runtime copy #7174, resolving the executable can trigger a one-time recursive cpSync + xattr subprocess (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.
  • Gate validator crash: validateEvidenceRun/validateAssertionRef/validateCoveredScope call .includes on gate.commands/testFiles/platforms/providers. Earlier type checks only push a failure without returning, so a hand-edited reliability-gates.jsonc with a missing/mistyped field threw an uncaught TypeError instead of the intended structured report.
  • The reload-flag refactor preserves semantics exactly, including consume-on-read for the recovery reload.

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 🐋

…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.
@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

This PR bundles five independent, small changes: the reliability-gate manifest validator now coerces potentially non-array fields via a new asArray helper and centralizes red/green evidence status checks via hasCompleteRedGreenEvidence; the iOS emulator backend defers serve-sim executable resolution to a memoized getter instead of resolving it in the constructor; the main process introduces a createWebContentsTimedFlag helper to unify expected-renderer-reload and recovery-reload-in-flight tracking with mark/clear/matches semantics; a JSDoc comment in the macOS TCC login shell wrapper is condensed; and the Fable weekly label regex is now derived from the shared WEEKLY_RE source pattern.

Related PRs: None identified.

Suggested labels: refactor, main-process, chore

Suggested reviewers: None identified.

🤖 A rabbit taps keys with focused delight,
Arrays now safe, evidence checks set right,
A getter that waits till the sim is called,
A timer that tracks reloads, unwalled,
Regex reused, docs trimmed down tight.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description has a summary and verification notes, but it is missing required template sections like Screenshots, AI Review Report, Security Audit, and Notes. Add the missing template sections and include the AI review/security audit details, screenshots or 'No visual change,' and the testing checklist.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately reflects the main cleanup changes across serve-sim, reload flags, and gate validation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/main/emulator/backends/ios-emulator-backend.ts (1)

56-59: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Comment 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

📥 Commits

Reviewing files that changed from the base of the PR and between 22d5989 and 836635e.

📒 Files selected for processing (5)
  • config/scripts/check-reliability-gates.mjs
  • src/main/emulator/backends/ios-emulator-backend.ts
  • src/main/index.ts
  • src/main/providers/macos-tcc-login-shell.ts
  • src/main/rate-limits/claude-pty.ts

Comment on lines +60 to +63
private get serveSimExecutable(): ServeSimExecutable {
this.cachedServeSimExecutable ??= resolveServeSimExecutable()
return this.cachedServeSimExecutable
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 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.ts

Repository: 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.

@nwparker nwparker merged commit bec4392 into main Jul 4, 2026
2 checks passed
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