Skip to content

Interleave casks and formulae in Installed and Upgrades lists - #108

Merged
graeme merged 1 commit into
mainfrom
interleave-casks-and-formulae
Aug 3, 2026
Merged

Interleave casks and formulae in Installed and Upgrades lists#108
graeme merged 1 commit into
mainfrom
interleave-casks-and-formulae

Conversation

@graeme

@graeme graeme commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

PR: Interleave casks and formulae in Installed and Upgrades lists

Summary

The Installed and Upgrades package lists previously split formulae and casks into two separate sections. This PR renders each as a single list ordered by name across both kinds. The per-row FORMULA/CASK badge already tells the two apart, so the section split was redundant, and removing it deletes noticeably more code than it adds.

Changes

  • InstalledPackagesContent: drop shouldShowFormulaeSection / shouldShowCasksSection and expose one name-ordered list of packages.
  • InstalledViewModel and UpgradesViewModel: collapse the two-section rendering and the formulae-then-casks search filter into a single ordered pass.
  • InstalledPackagesView and UpgradesPackagesView: replace the two Section blocks with one ForEach over the interleaved rows.
  • Remove the now-unused InstalledSectionHeader.
  • Behaviour note: default and keyboard selection now follow the interleaved order, so the first row wins regardless of kind (previously formulae were preferred). Tests updated to match.

Why this split

Discover was originally part of this work but has been intentionally left out. Its Trending list is fed by two independent analytics calls (top formulae and top casks) whose rankings are not comparable, so interleaving there is misleading. This PR is scoped to the two lists where a single name-ordered list is clearly correct.

Testing

  • xcrun swift buil
  • xcrun swift test
  • swiftformat and swiftlint (strict) clean on the changed files.

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: Claude Code made the edits and updated the tests; changes were reviewed locally and verified with a clean build, the full test suite, and lint.

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.

Pull request overview

This PR simplifies the Installed and Upgrades package lists by removing the separate Formulae/Casks sections and rendering a single, name-ordered list interleaving both kinds, relying on the per-row kind badge for distinction.

Changes:

  • Collapse Installed/Upgrades list rendering from two sections into a single ForEach over an interleaved package array.
  • Update Installed/Upgrades view models to treat the rendered row order as the single packages list (including search filtering and default selection behavior).
  • Update tests to reflect the new single-list/selection behavior and remove section-visibility assertions.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Tests/BrewFeatureInstalledTests/UpgradesViewModelTests.swift Updates default-selection expectations to follow interleaved row order.
Tests/BrewFeatureInstalledTests/InstalledViewModelTests.swift Renames/adjusts test wording to reflect a single interleaved list.
Tests/BrewFeatureInstalledTests/InstalledViewModelPresentationTests.swift Removes section-visibility tests and adds a single-list assertion for loaded content.
Sources/BrewFeatureInstalled/Views/UpgradesPackagesView.swift Replaces Formulae/Casks sections with a single ForEach over content.packages.
Sources/BrewFeatureInstalled/Views/InstalledPackagesView.swift Replaces Formulae/Casks sections with a single ForEach over content.packages.
Sources/BrewFeatureInstalled/ViewModels/UpgradesViewModel.swift Updates row-order/selection + search filtering to operate on the single ordered package list.
Sources/BrewFeatureInstalled/ViewModels/InstalledViewModel.swift Removes section-visibility helpers and updates ordered IDs + search filtering for the single list.
Sources/BrewFeatureInstalled/ViewModels/InstalledPackagesContent+Placeholdable.swift Updates placeholder documentation to reflect the new single-list presentation.

馃挕 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Tests/BrewFeatureInstalledTests/InstalledViewModelPresentationTests.swift Outdated
Render each package list as a single list ordered by name across both
kinds, instead of splitting formulae and casks into separate sections.
The per-row FORMULA/CASK badge keeps the two distinguishable.

Drops shouldShowFormulaeSection/shouldShowCasksSection from
InstalledPackagesContent, collapses the two-section List and the
formulae-then-casks search filter in both view models to a single
ordered pass, and removes the now-unused InstalledSectionHeader.

Default and keyboard selection now follow the interleaved order, so the
first row wins regardless of kind. Tests updated accordingly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@graeme
graeme force-pushed the interleave-casks-and-formulae branch from c5db659 to 6a06e90 Compare August 2, 2026 23:10
@graeme
graeme marked this pull request as ready for review August 3, 2026 08:53
@graeme
graeme merged commit 6293784 into main Aug 3, 2026
10 checks passed
@graeme
graeme deleted the interleave-casks-and-formulae branch August 3, 2026 08:54
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.

3 participants