Skip to content

Add 'Hide dependencies' filter checkbox to Installed packages view - #160

Closed
stybo wants to merge 1 commit into
Homebrew:mainfrom
stybo:filter-installed-dependencies
Closed

stybo wants to merge 1 commit into
Homebrew:mainfrom
stybo:filter-installed-dependencies

Conversation

@stybo

@stybo stybo commented Sep 10, 2026

Copy link
Copy Markdown

PR: Add 'Hide dependencies' filter checkbox to Installed packages view

Summary

Adds an optional "Hide dependencies" checkbox toggle to the Installed packages view, allowing users to filter the list down to explicitly requested packages (installedOnRequest) and reduce clutter from secondary dependencies.

Changes

UI & Presentation

  • InstalledPackagesView: Added a hideDependenciesToggle checkbox beneath the scope picker, styled with .brewSubheadline and secondary text coloring.

View Model & Filtering

  • InstalledViewModel:
    • Added hideDependencies: Bool (defaults to false).
    • Updated InstalledPackagesContent.filtered(hidingDependencies:) and filteredContent(...) to filter by \.installedOnRequest.
    • Generalized selection re-homing (updateSelectionForFilterChange) to handle row preview fallbacks and restorations when toggling the dependency filter.

Accessibility & Test Support

  • BrewAccessibilityID: Added .installedHideDependenciesCheckbox ("installed.hideDependencies") to AXID and verified wire-format in AXIDTests.
  • InstalledScreen: Added hideDependenciesCheckbox and toggleHideDependencies() helpers for UI tests.
  • BrewPackageFixtures: Added installedOnRequest parameter to InstalledBrewPackage.fixture (defaults to true).
  • InstalledViewModelHideDependenciesTests: Added unit test coverage for default state, filtering direct vs. dependency packages, composition with scope picker and search queries, and row selection fallback/restoration.

Why this split (optional)

Leverages the existing installedOnRequest flag already exposed by InstalledBrewPackage to provide immediate filtering capability in the Installed tab without modifying the underlying data layer or database schema.

Testing

  • Ran unit and integration test suite: DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer swift test --filter BrewFeatureInstalledTests (226 tests passed across 26 suites).
  • Verified accessibility ID stability and string serialization in AXIDTests.
  • Verified selection state fallback and restoration when toggling hideDependencies.

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.
  • If yes, describe exactly how AI was used and what manual verification was performed:
    • AI assisted with structuring unit tests and formatting the PR description. All changes were verified locally via automated test suites.

Follow-ups (optional)

  • Persist the user's checkbox preference across app restarts if desired.

Copilot AI balanced review requested due to automatic review settings September 10, 2026 18:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@MikeMcQuaid MikeMcQuaid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not accepting PRs until 7.0.0 launched.

@MikeMcQuaid
MikeMcQuaid dismissed their stale review September 13, 2026 14:09

7.0.0 launched.

@MikeMcQuaid
MikeMcQuaid requested a review from graeme September 13, 2026 14:11
@MikeMcQuaid

Copy link
Copy Markdown
Member

Please provide a screenshot of before/after.

@stybo

stybo commented Sep 14, 2026

Copy link
Copy Markdown
Author

Please provide a screenshot of before/after.

image

Here you go!

@graeme

graeme commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

Could you please fix the SwiftLint issue(s) and figure out why the UI tests are failing, fixing them if you can.

@stybo

stybo commented Sep 15, 2026

Copy link
Copy Markdown
Author

Could you please fix the SwiftLint issue(s) and figure out why the UI tests are failing, fixing them if you can.

I've pushed a fix for the CI failures:

  1. UI Tests Compilation: InstalledScreen.swift:26 was typed as BrewUIElement.swift rather than BrewUIButton.swift, causing toggleHideDependencies() to fail to compile with Value of type 'BrewUIElement' has no member 'tap'. Updated it to return BrewUIButton.swift.
  2. SwiftLint function_body_length: Adding .installedHideDependenciesCheckbox pushed static identifiers keep their wire format in AXIDTests.swift:13 over the 50 line limit (52 lines). Split the wire format assertions into two focused tests (navigation and screen / control and status) to bring both well within the threshold.
Screenshot 2026-09-15 at 18 49 41 Screenshot 2026-09-15 at 18 49 27

@stybo

stybo commented Sep 15, 2026

Copy link
Copy Markdown
Author

Im not sure if the build tests will pass but on my end it all works seamlessly

@stybo stybo closed this Sep 15, 2026
@stybo stybo reopened this Sep 15, 2026
@github-actions

Copy link
Copy Markdown

Thanks for your pull request. This has been closed because it appears to be missing the current pull request template. Please describe the problem, the change and how you verified it.

Please edit this pull request to fill in the current pull request template. This workflow will reopen this pull request automatically once the template is complete. Do not open a new pull request for this.

@github-actions github-actions Bot closed this Sep 15, 2026
@stybo

stybo commented Sep 15, 2026

Copy link
Copy Markdown
Author

I accidentally closed the PR instead of sending my message. Oops

@stybo

stybo commented Sep 15, 2026

Copy link
Copy Markdown
Author

I don't think my new commits are shown here now. Should I open a new pull request. Sorry for the inconvenience.

@MikeMcQuaid

Copy link
Copy Markdown
Member

Let's discuss here first so you don't waste your time.

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.

4 participants