Skip to content

feat: show StableBar's crashes in Settings and copy them into a bug report - #338

Merged
M4n0x merged 1 commit into
mainfrom
feat/crash-reports
Oct 26, 2026
Merged

M4n0x merged 1 commit into
mainfrom
feat/crash-reports

Conversation

@M4n0x

@M4n0x M4n0x commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Problem

StableBar reports no crashes. When it crashes on someone's Mac, nobody learns why unless that person files an issue and finds the crash log on their own. StableBar sends no data, so crash reports have to stay on the Mac unless the person chooses to share one. Fixes #333.

Changes

  • Reads macOS's own crash reports. CrashReport parses the .ips file macOS writes after every crash: a JSON header line, then a JSON body. It keeps only StableBar's crash reports (bug_type 309, app_name StableBar) and reads the version, macOS, Mac model, exception, termination, Swift's error message and the crashing thread's frames. Other apps' reports, hang reports and files macOS is still writing are skipped. MetricKit is left out: it delivers only when the user shares analytics with app developers, which is off on most Macs.
  • Keeps the last 30 days, in place. CrashReports (on BarStore) reads ~/Library/Logs/DiagnosticReports and its Retired folder off the main actor. It refreshes at launch, when a menu opens and when Crashes is shown. A report in both folders counts once. StableBar stores only crashReportsSeenThrough and dismissedCrashReports in its defaults, and macOS removes old reports on its own.
  • Settings → Status → Crashes. A sidebar row below All widgets shows the count. The overview gets a "Crashes in the last 30 days" row when there are any. Each crash shows its exception, the first StableBar frame and the error message, with Copy report, Report on GitHub…, Show in Finder and Dismiss, plus the report text under a disclosure. Dismiss hides the crash and leaves the macOS file alone. Status's selection moved to ConfigurationEditor.diagnosticSelection (overview, crashes or a widget), so a widget named crashes can't collide with the new row.
  • Sharing is the user's choice. Copy report produces Markdown with home folders written as ~. Report on GitHub opens bug_report.yml in the browser with the title, What happens, Environment and Evidence filled in. Nothing is sent until the user submits the form. Long Swift symbols, deep stacks and long messages are cut so the link stays under 8,000 characters and the title under GitHub's 256.
  • Menus. After a new crash, the menu-bar icon's menu and the bar's right-click menu show StableBar Quit Unexpectedly… until Crashes is opened. The item opens Settings on Crashes. Searching settings for "crash" finds Status.
  • Triage. StableBar triage lists the last 30 days of crashes (time, exception, where, build, file name) in its context file.
  • Docs and form. The Status section of docs/settings.md describes Crashes. docs/command-line.md notes that triage includes crashes, and the bug report form's Evidence field asks for the copied report when StableBar quit.
  • Copy a bug report with versions, displays and permissions #93. This PR covers crashes only. As agreed, Copy a bug report with versions, displays and permissions #93's Copy report and --report follow in a second pull request stacked on this one, with recent crashes included.

Testing

  • New tests in CrashReportTests, each seen failing first, cover:
    • parsing a report, including unsymbolicated frames, sourceFile/sourceLine and a build with an empty version;
    • skipping other apps' reports, hang reports and partly written files;
    • the Markdown, and the issue link's fields, encoding (no literal +) and length for deep stacks, a 20,000-character message and a 2,700-character symbol;
    • listing 30 days across both folders with duplicates;
    • seen and dismissed state across instances, and pruning;
    • the menu note;
    • Status and search routing.
      TriageTests covers the new context lines.
  • Before writing the tests, I checked the parser against real .ips files on this Mac, from test-runner crashes renamed to StableBar. A separate review repeated that check on three more.
  • swift test on this branch, rebased on main (068b6fc): 294 XCTest and 482 Swift Testing tests pass. swift build -c release --disable-keychain builds.
  • Screenshots: Settings → Status drawn offscreen from a scratch configuration and sample reports, before (main) and after. The app wasn't launched.
Before After
Crashes Crashes (dark) No crashes
  • Not checked:
    • a real StableBar crash on a running bar;
    • the two menus on screen, which tests cover through CrashReports.note and menuWillOpen;
    • the prefilled form in a browser. GitHub documents prefilling issue-form fields by their id, and the ids match bug_report.yml.
  • git diff --check and commitlint on the full message pass.

Merging

A merge commit or rebase merge, which keeps the one commit. As a feat, it makes a minor release.

Claude Opus 5.5 via Claude Code

…eport

StableBar reported no crashes: one on someone's Mac stayed invisible unless they filed an
issue and found the crash log themselves.

StableBar now reads the crash reports macOS writes for it, in ~/Library/Logs/DiagnosticReports
and its Retired folder, where they are. Settings → Status → Crashes lists the last 30 days with
Copy report, Report on GitHub…, Show in Finder and Dismiss. Report on GitHub opens the bug
report form with the crash filled in, and nothing is sent until the user submits it. After a
new crash, the status menu shows "StableBar Quit Unexpectedly…" until the crash is seen.
StableBar stores only which crashes were seen or dismissed. `StableBar triage` lists recent
crashes in its context file.

Fixes #333
@M4n0x
M4n0x requested a review from Seb-GRAF as a code owner October 26, 2026 17:33
@M4n0x
M4n0x merged commit b0e4a7a into main Oct 26, 2026
7 checks passed
@M4n0x
M4n0x deleted the feat/crash-reports branch October 26, 2026 17:58
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.

Show StableBar's crashes in Settings and copy them into a bug report

1 participant