Skip to content

fix: pr-bug-scan validated finding from #4598#4737

Open
buf0-bot[bot] wants to merge 1 commit into
mainfrom
bot/pr-bug-scan-4598-1780718089
Open

fix: pr-bug-scan validated finding from #4598#4737
buf0-bot[bot] wants to merge 1 commit into
mainfrom
bot/pr-bug-scan-4598-1780718089

Conversation

@buf0-bot
Copy link
Copy Markdown
Contributor

@buf0-bot buf0-bot Bot commented Jun 6, 2026

Automated fix-PR from pr-bug-scan for parent #4598.

Fixer status: FIXED_WITH_CODE_PROOF
Summary: Wrap writeToDiskSync() in flush() with try/catch+console.error so stats write errors during will-quit no longer propagate.
Blocked proof link: src/main/stats/collector.ts:152 — writeToDiskSync() now wrapped in try/catch matching the deleted writeToDiskBestEffort behavior; will-quit handler at src/main/index.ts:1423 no longer sees an exception from flush().
Typecheck: skipped

Proof (from validator)

  • C3 — proof_type: code_analysis
    • trigger: App shutdown (will-quit) when writeFileSync to the stats file throws — e.g. parent path is not a directory, EACCES, ENOSPC.
    • observable: Uncaught exception during app quit; stats write error surfaces as a shutdown crash instead of a console.error log. The deleted test src/main/stats/collector.test.ts:63-76 ('does not throw from flush when stats cannot be written') asserted exactly this behavior pre-diff.
    • path:
      • src/main/index.ts:1413 app.on('will-quit', ...)
      • src/main/index.ts:1423 stats?.flush() — no try/catch wrapper
      • src/main/stats/collector.ts:152 flush() now calls this.writeToDiskSync() directly (was writeToDiskBestEffort())
      • src/main/stats/collector.ts:265 writeFileSync(tmpFile, ...) throws on IO error
      • exception propagates out of flush() and out of the will-quit listener

Generated by pr-bug-scan (proof-machine architecture). Human approval required before merge.

Wrap writeToDiskSync() in flush() with try/catch+console.error so stats write errors during will-quit no longer propagate.
Copy link
Copy Markdown
Contributor

@pullfrog pullfrog Bot left a comment

Choose a reason for hiding this comment

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

Reviewed changes — wraps writeToDiskSync() in StatsCollector.flush() with try/catch to prevent IO errors during will-quit from crashing the app.

  • Wrap writeToDiskSync() in flush() — catches IO errors (EACCES, ENOSPC, etc.) and logs them via console.error instead of letting exceptions propagate out of the will-quit handler at src/main/index.ts:1422.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

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.

0 participants