Skip to content

Platform/VM/deeplinks: budgetCap per-run miscount, dev auto-update noise, Keychain argv (cross-ref), and platform god-file decomposition #463

@arul28

Description

@arul28

Summary: Two low-severity platform-layer bugs (per-run budget cap counts the whole week; auto-update runs in dev surfacing a spurious 'error') plus the platform/VM/deeplink god-file decomposition and duplicated pure helpers.

Platform usage/updates bugs:

  • budgetCap 'usd-per-run' cap evaluated against the whole week's cumulative spend. evaluateCap's branch calls getCumulativeUsage(…weekKey); the automation caller passes a stable scopeId=rule.id, so the 2nd run already sees the 1st's cost. budgetCapService.ts:218,:162; automationService.ts:2093; BudgetCapEditor.tsx:35. Fix: scope the query to the active run (run id in scopeId or a recorded_at window), or rename the cap type if weekly-per-rule is intended.
  • Auto-update runs unconditionally in dev, surfacing a spurious 'error' state ~5s after launch. createAutoUpdateService is constructed regardless of app.isPackaged; the 5s check rejects (no app-update.yml) → 'error' broadcast to every renderer. main.ts:1671,:5557; autoUpdateService.ts:567,:447. Fix: skip scheduling when !app.isPackaged, or swallow the known dev error.

Decompose platform/VM/deeplink god-files & centralize pure helpers:

  • usageTrackingService.ts (3,397 lines) mixing 9 provider ledger scanners + polling + GitHub stats + pricing + pacing. :596,:808,:1633 — extract usage/ledgers/<provider>.ts.
  • createMacosVmService (~2,620 lines) record/lease persistence + Lume driver + rsync mirror + VNC proxy + window control. macosVmService.ts:889,:1103,:1941,:1738,:2922,:3192.
  • appControlService.ts (2,409 lines) CDP client + image parsers + injected scripts + source-map heuristics + ~1,300-line factory. :328,:452,:494,:903,:1102. Launch-command rewriting is fragile untested stacked-regex string surgery (rewrites fail closed — a coverage gap, not a live bug) :171,:190,:198,:211,:1483 — prefer env-based injection.
  • createBuiltInBrowserWindowService (~1,055 lines) tab/view lifecycle + session policy + navigation + bounds. builtInBrowserService.ts:237,:346,:392,:479.
  • onboardingService mixes tour persistence with pure project stack-detection; buildSuggestedConfig leaks any[]. :212,:238,:244,:261.
  • Identical pure helpers (isRecord, PNG/image-dimension parsers) re-implemented per file. macosVmService.ts:233; usagePricing.ts:191; builtInBrowserService.ts:1292; appControlService.ts:452; iosSimulatorService.ts:1084 — import the canonical shared util; add one services/shared/imageDimensions.ts.

Verification confidence: High for both bugs and all line counts; appControl launch-rewrite reframed from bug to quality.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions