Skip to content

Fix multiple bugs across monitors, formatters, and views#7

Merged
ysyyork merged 3 commits into
mainfrom
fix/bugs-review
Jun 13, 2026
Merged

Fix multiple bugs across monitors, formatters, and views#7
ysyyork merged 3 commits into
mainfrom
fix/bugs-review

Conversation

@ysyyork

@ysyyork ysyyork commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • UInt64 overflow: cap rssKB before multiplying by 1024 in CPUMonitor to prevent silent integer overflow before min() can clamp it
  • Health check never triggers: all three monitors used the same 30s value for both the check interval and the staleness threshold — the monitor would never be stale at fire time; now uses a separate 10s staleness threshold
  • Post-eject disk refresh silently skipped: the rate limiter blocked the updateDisks() call triggered after a successful disk eject; added a force parameter to bypass it
  • NSBitmapImageRep force-unwrap crash: replaced ! with guard let ... else { return NSImage() } in MacStatusBarApp and DiskContentView
  • NSImage.copy() forced cast crash: replaced as! NSImage with as? NSImage in both files
  • Wrong unit for negative speed: menuBarSpeed(-100) returned " 0 KB/s" while zero returned " 0 B/s"; normalized both to " 0 B/s" and updated the test
  • Duplicate RawRepresentable conformance: SpeedUnit declared String raw value (auto-synthesizing the conformance) and then re-declared it in an extension; removed the conformance clause from the extension
  • VPN traffic showing 0: nettop only queried wifi and wired interfaces, silently ignoring VPN tunnels; added -t vpn

Test plan

  • Build succeeds (⌘B)
  • Run tests (⌘U) — testMenuBarSpeedNegative updated to assert " 0 B/s"
  • Eject a removable disk and confirm the UI refreshes immediately
  • Confirm network speeds are non-zero while connected via VPN
  • Monitor health check: confirm stale monitors restart within ~40s of a hung update

🤖 Generated with Claude Code

ysyyork and others added 3 commits June 12, 2026 22:30
- Fix UInt64 overflow: cap rssKB before multiplying by 1024 in CPUMonitor
- Fix health check always skipping: use 10s staleness threshold instead of same 30s as check interval
- Fix post-eject disk refresh silently skipped by rate limiter: add force param to updateDisks()
- Fix NSBitmapImageRep force-unwrap crash: use guard let in MacStatusBarApp and DiskContentView
- Fix NSImage.copy() forced cast crash: use as? instead of as! in both files
- Fix menuBarSpeed returning wrong unit "KB/s" for negative values: normalize to "B/s" like zero case
- Fix duplicate RawRepresentable conformance on SpeedUnit: remove conformance clause from extension
- Fix VPN traffic showing 0: add -t vpn to nettop arguments in NetworkMonitor

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
-t vpn is not a valid nettop interface type — passing it caused nettop
to print its help text instead of CSV data, making parseNettopOutput
return empty results and speeds to always show 0.

Replace -t wifi -t wired -t vpn with -t external, which nettop defines
as all non-loopback interfaces (covers wifi, wired, and VPN tunnels).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Each speed now displays the byte-rate (e.g. 1.2 MB/s) as the primary
value with the bit-rate (e.g. 9.6 Mbps) below it in secondary style,
making it easy to cross-reference with ISP speed ratings.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ysyyork ysyyork merged commit f920fe8 into main Jun 13, 2026
1 check passed
@ysyyork ysyyork deleted the fix/bugs-review branch June 13, 2026 20:59
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