Skip to content

Scope the 鈱楻 doctor re-check to the Doctor screen - #156

Merged
graeme merged 2 commits into
mainfrom
doctor-refreshes-atomically-only
Sep 10, 2026
Merged

graeme merged 2 commits into
mainfrom
doctor-refreshes-atomically-only

Conversation

@graeme

@graeme graeme commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

PR: Only re-run brew doctor when the Doctor screen asks

Summary

Cmd+R refetched every cached surface and also kicked off a full brew doctor
run, whichever screen was showing. The doctor re-check now runs only when
Doctor is the selected sidebar item.

Changes

  • MainWindowView.refreshAll() routes the doctor leg through
    refreshDoctorReportIfSelected(), which returns early unless Doctor is
    selected. It is still started concurrently with the three cache reloads, so
    refreshing from Doctor is no slower than before.
  • SidebarItem.refreshesDoctorReport carries the decision as an explicit
    switch, mirroring axDestination, so a future sidebar case cannot silently
    opt in.
  • Installed, upgrades, catalogue and config still refresh from any screen except Doctor.
    Doctor's own "Run Again" button is untouched.

Testing

  • BrewTests/SidebarItemRefreshTests.swift: Doctor re-runs, every other
    sidebar item does not, and exactly one item does. These are the first
    tests in the BrewTests target; it is a file-system-synchronized group, so
    no project file change was needed.
  • xcodebuild build-for-testing -scheme Brew-Unit: TEST BUILD SUCCEEDED.
  • The new tests were not executed locally: the app-hosted bundle will not
    launch in my sandbox (LaunchServices -10810). CI runs the Brew-Unit
    scheme, so they execute there.
  • scripts/test: all package tests passed (BrewKit and BrewUILint).
  • swiftformat made no changes; swiftlint --strict clean on the three
    changed files; BrewUILint clean over Homebrew and Sources.
  • No manual pass in a running app (no GUI session available). Worth
    checking by hand: Cmd+R on Installed leaves Doctor's "last checked"
    timestamp alone, Cmd+R on Doctor moves it.

PR checklist

  • Have you followed this repository's contribution and workflow guidance?
  • Have you explained what changed and why this should land now?
  • Have you run relevant local checks for the changed scope?
  • Are changes scoped and free of unrelated modifications?

  • AI was used to generate or assist with generating this PR.
  • Claude Code wrote the change, the tests and this description. Manual
    verification: the checks listed above, minus the two unchecked items.

鈱楻 refetched every cached surface plus the doctor report, so browsing
Installed or Discover and hitting refresh kicked off a full `brew doctor`
diagnostic run in the background. Unlike the other surfaces that is not a
cache refetch, and nothing on screen was waiting for it.

Installed, upgrades, catalogue and config still refresh from any screen;
the doctor report now only re-runs when Doctor is the selected sidebar
item. The decision lives on SidebarItem as an explicit switch, mirroring
axDestination, so a future sidebar case cannot silently opt in.

Adds the first tests to the BrewTests target (file-system-synchronized
group, so no project file change): Doctor re-runs, every other item does
not, and exactly one item does. They compile and run under the Brew-Unit
scheme on CI; the sandbox cannot launch the app-hosted bundle.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YXUw1iTa4GM7qAmFX247Zn
@graeme
graeme requested a review from MikeMcQuaid September 9, 2026 13:25
@graeme
graeme merged commit afe1027 into main Sep 10, 2026
11 checks passed
@graeme
graeme deleted the doctor-refreshes-atomically-only branch September 10, 2026 02:10
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.

2 participants