Skip to content

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

Closed
nwparker wants to merge 1 commit into
mainfrom
nwparker/deslop-main
Closed

deslop(main): defer serve-sim materialization, dedupe reload flags, guard gate validators#7318
nwparker wants to merge 1 commit into
mainfrom
nwparker/deslop-main

Conversation

@nwparker

@nwparker nwparker commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Deslop 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 🐋

…uard 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 makes five unrelated changes: reliability-gates manifest validation now coerces potentially non-array fields via a new asArray helper and centralizes red/green evidence status checks via hasCompleteRedGreenEvidence; IosEmulatorBackend defers serve-sim executable resolution to a lazy cached getter instead of resolving it in the constructor; src/main/index.ts replaces ad hoc renderer-reload/recovery-reload state with a reusable createWebContentsTimedFlag helper offering mark/clear/matches (with consume-on-read) semantics; a JSDoc comment in macos-tcc-login-shell.ts was reworded without logic changes; and FABLE_WEEKLY_LABEL_RE in claude-pty.ts is now derived from WEEKLY_RE.source instead of a standalone literal.

Sequence Diagram(s)

sequenceDiagram
  participant MainIndex as main/index.ts
  participant TimedFlag as recoveryReloadInFlight
  MainIndex->>TimedFlag: markRecoveryReloadInFlight(webContentsId)
  TimedFlag-->>TimedFlag: mark({webContentsId, until})
  MainIndex->>TimedFlag: isRecoveryReloadInFlight(webContentsId)
  TimedFlag-->>TimedFlag: matches(webContentsId, {consume:true})
  TimedFlag-->>MainIndex: boolean match result
  TimedFlag-->>TimedFlag: clear() on successful match
Loading

Related issues: None found in the provided context.

Related PRs: None found in the provided context.

Suggested labels: main-process, refactor, validation

Suggested reviewers: None specified.

Poem
A rabbit hops through gates and flags,
Coercing arrays, dodging snags,
A lazy getter waits its turn,
While reload flags now mark and burn,
Regex reborn from shared old source—
Five tidy tweaks, one steady course. 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description doesn't follow the required template and is missing explicit Summary, Screenshots, Testing checklist, AI Review Report, Security Audit, and Notes sections. Rewrite it using the provided headings, add the testing checklist/results, screenshots or 'No visual change', and include the AI review, security, and notes sections.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately captures the main changes across lazy startup, reload flags, and gate validation hardening.
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.

🧹 Nitpick comments (1)
src/main/index.ts (1)

473-475: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Redundant duplicate default duration.

createWebContentsTimedFlag's mark already defaults durationMs to defaultDurationMs (10_000, set at line 442's factory default). Re-specifying durationMs = 10_000 in both wrapper functions duplicates that magic number in three places, risking drift if one is changed without the others.

♻️ Proposed simplification
-function markExpectedRendererReload(webContentsId: number, durationMs = 10_000): void {
+function markExpectedRendererReload(webContentsId: number, durationMs?: number): void {
   expectedRendererReload.mark(webContentsId, durationMs)
 }
-function markRecoveryReloadInFlight(webContentsId: number, durationMs = 10_000): void {
+function markRecoveryReloadInFlight(webContentsId: number, durationMs?: number): void {
   recoveryReloadInFlight.mark(webContentsId, durationMs)
 }

Also applies to: 491-493


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b0592c84-d0af-422e-9d09-d233467a86ac

📥 Commits

Reviewing files that changed from the base of the PR and between 22d5989 and 1d2ec38.

📒 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

@nwparker

nwparker commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #7321 (same changes, renamed to cleanup(main)).

@nwparker nwparker closed this Jul 4, 2026
@nwparker nwparker deleted the nwparker/deslop-main branch July 4, 2026 05:20
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