fix: resolve formula aliases before tracking installed packages#20
fix: resolve formula aliases before tracking installed packages#20jerryjrxie wants to merge 2 commits intoopenbootdotdev:mainfrom
Conversation
Homebrew has formula aliases where the requested name differs from the actual installed name. Examples: - postgresql → installs as postgresql@18 - kubectl → installs as kubernetes-cli This caused packages to be reinstalled on every run because the state file tracked the alias name (e.g., postgresql) but brew list returns the actual name (e.g., postgresql@18), so they never matched during reconciliation. Fix: - Added ResolveFormulaName() function to resolve aliases using brew info --json - Updated all package tracking to use resolved names - Handles both CLI packages and casks Closes openbootdotdev#17 (formula alias tracking issue)
|
👋 Thanks for opening this pull request! 🎉 This is your first PR to OpenBoot — welcome! Before merging:
@fullstackjam will review this soon. Thanks for contributing! 🚀 |
There was a problem hiding this comment.
Good instinct — alias resolution is a real problem. A few implementation issues to address:
[HIGH] Performance: N serialized brew info subprocess calls
ResolveFormulaName is called once per package in the pre-check loop and again in the post-install loop — that is 2N synchronous subprocesses. brew info --json accepts multiple arguments, so this should be batched into a single call at the start and the results cached in a map.
[HIGH] Retry path is not fixed
The fix only covers the first-attempt success path. When a formula fails and succeeds on retry, it is still tracked using the original alias name. Please apply the same resolution logic in the retry block.
[MEDIUM] Do not apply formula alias resolution to casks
Casks do not have an alias system, and their JSON schema differs from formulae — the name field has a different meaning. Calling ResolveFormulaName on a cask silently no-ops due to the schema mismatch, but wastes a subprocess call per cask. Skip resolution for casks entirely.
[LOW] No tests
Given the number of edge cases here (alias resolution, retry path, cask vs formula), some unit test coverage would go a long way.
Dismissing — will re-review after further discussion
fullstackjam
left a comment
There was a problem hiding this comment.
Good instinct — alias resolution is a real problem. A few implementation issues to address:
[HIGH] Performance: N serialized brew info subprocess calls
ResolveFormulaName is called once per package in the pre-check loop and again in the post-install loop — that's 2N synchronous subprocesses. brew info --json accepts multiple arguments, so this should be batched into a single call at the start and the results cached in a map.
[HIGH] Retry path is not fixed
The fix only covers the first-attempt success path. When a formula fails and succeeds on retry, it's still tracked using the original alias name. Please apply the same resolution logic in the retry block.
[MEDIUM] Don't apply formula alias resolution to casks
Casks don't have an alias system, and their JSON schema differs from formulae — the name field has a different meaning. Calling ResolveFormulaName on a cask silently no-ops due to the schema mismatch, but wastes a subprocess call per cask. Skip resolution for casks entirely.
[LOW] No tests
Given the number of edge cases here (alias resolution, retry path, cask vs formula), some unit test coverage would go a long way.
Summary
Fixes an issue where packages with formula aliases (like
postgresql→postgresql@18) were being reinstalled on every run because the state tracking didn't match the actual installed names.Problem
Homebrew has formula aliases where the requested name differs from the actual installed name:
postgresql→ installs aspostgresql@18kubectl→ installs askubernetes-cliThe state file tracked the alias name ("postgresql") but
brew listreturns the actual name ("postgresql@18"), so they never matched during state reconciliation. This caused packages to be reinstalled every time openboot ran.Solution
ResolveFormulaName()function that usesbrew info --jsonto resolve aliases to canonical namesInstallWithProgress()to use resolved names:Testing
postgresqlandkubectlnow resolve to their canonical names before trackinggo vetpassesRelated
This complements PR #18 which fixed GUI apps being skipped. Both issues affected package tracking but for different reasons.