Conversation
Snapshot installed formulas and casks before bundle reconciliation so declarations already present on the system are not adopted into Bluefin managed state. Preserve prior managed entries and fail closed when inventory cannot be collected. Fixes projectbluefin#915 Assisted-by: GPT-5 via GitHub Copilot Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Danathar <doug.baggett@gmail.com>
Danathar
requested review from
a team,
ahmedadan,
castrojo,
hanthor,
inffy,
ledif and
repires
as code owners
September 12, 2026 10:52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #915.
Root cause
brew-preinstallpreviously wrote every formula and cask declared by thecurrent managed Brewfiles into
brew-preinstall-state.jsonafter a successfulbrew bundle. Becausebrew bundleis idempotent, a package already installedby the user was indistinguishable from one installed by Bluefin. If the
declaration was later removed, the persisted entry authorized Bluefin to
uninstall the user's package.
What changed
pre-bundle inventory and the bundle pass succeeds.
the existing hash fast path, cask lifecycle, ChairLift handoff, atomic state
writes, and legacy state files without a
caskskey.Formulae and casks now follow the same ownership rule: previously user-owned
items remain outside Bluefin's managed state and therefore remain installed
when their temporary Brewfile declaration disappears. Items installed by the
managed reconciliation remain removable, and previously managed items remain
managed across later reconciliations.
Regression coverage
Added BATS coverage for:
The new ownership tests fail against the pre-fix implementation: both the
formula and cask user-owned cases were adopted into state.
Validation
/var/tmp/bats-core/bin/bats tests/test_brew_preinstall.bats— 56/56 pass.bash -n system_files/shared/usr/libexec/brew-preinstall— pass.shellcheck -S warning system_files/shared/usr/libexec/brew-preinstall— pass.just check— pass.python3 scripts/generate_skill_index.py --check— pass.PATH=/var/tmp/bluefin-common-validation/bin:$PATH pre-commit run --all-files— pass.PATH=/var/tmp/bluefin-common-validation/bin:/var/tmp/bats-core/bin:$PATH just test— all 109 Python tests pass; the suite then reaches 5 existingtests/test_ujust.batscommand-availability failures. The same failures reproduce onorigin/main.tests/test_shared_just.bats(2) andtests/test_ujust.bats(5), with nobrew-preinstallfailures.git diff --check— pass.