perf(readiness): reduce Homebrew trust operations - #11125
Conversation
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 12 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughHomebrew gateway discovery now uses validated ChangesHomebrew gateway readiness
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: ⚪ Minimal · up to This change reduces macOS Homebrew readiness-check latency by caching validated formula metadata within an observation while retaining repeated runtime identity samples and resetting evidence between observations. Current coverage supports the intended behavior without an identified merge-blocking risk. Sequence Diagram(s)sequenceDiagram
participant ReadinessObserver
participant HomebrewOperation
participant launchctl
participant GatewayService
ReadinessObserver->>HomebrewOperation: request cached formula metadata
HomebrewOperation-->>ReadinessObserver: return trusted service paths
ReadinessObserver->>launchctl: query supported service labels
launchctl-->>ReadinessObserver: return state, program, and PID
ReadinessObserver->>GatewayService: collect managed gateway observations
GatewayService-->>ReadinessObserver: return readiness evidence
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall line coverage in commit 39e98b6 in the TypeScript / code-coverage/cliThe overall line coverage in commit 39e98b6 in the Show a line coverage summary of the most impacted files.
Updated |
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
|
PR Review Advisor finished for commit |
Outcome
macOS gateway readiness now grants temporary Homebrew formula trust once per observation. The live observation sequence fell from 10 trust-wrapper calls and 119.95 seconds to 1 trust-wrapper call and 9.46 seconds on the reproducing Mac, below the 30-second freshness window.
Reason
Each trusted wrapper call grants and removes formula trust. Repeating identical formula reads and using Homebrew formula evaluation for both service samples made a healthy gateway observation stale before onboarding could use it.
Related issues
Fixes #11112
Changes
brew info --json=v2as the single source for installed-keg state, official tap identity, and the exact formula-defined service and gateway paths.launchctl print. Require one running job, its exact formula-defined program, one positive PID, and the expected gateway binary.Verification
npm exec vitest -- run --project cli src/lib/readiness/gateway-production.test.ts src/lib/onboard/docker-driver-gateway-service-homebrew.test.ts src/lib/onboard/docker-driver-gateway-service.test.ts src/lib/onboard/homebrew-formula-operation.test.ts— 145 tests passed.npm run typecheck:cli— passed.npm run checks:repository— passed.npm run validate:pr— passed againstorigin/mainat0e5f18654524c2fe00292f18227dfb1a03cded2e.sh.brew.openshellservice stayed running with the same PID and formula-defined program.npm run test:changed— 4,262 tests passed and 15 unrelated ambient-host tests failed. The failures require Linux Podman tools, inspect live host ports, or encounter the installed OpenShell 0.0.101 formula while this branch pins 0.0.106; none exercise the changed readiness cache.Review notes
The checksum-verified wrapper remains the only source of formula identity and executable paths. The cache lasts for one observation. Both live service/PID samples and both executable samples remain uncached, so service replacement, formula path drift, foreign launchd programs, and ambiguous active labels fail closed.
The
docker-driver-*module names are historical. This change selects no compute runtime and adds no Docker command. Managed Docker and the managed/portable OpenShell Podman driver on macOS share this Homebrew gateway readiness path, so both receive the fix. The separate native Podman provider uses the Linux systemd path and never invokes the Homebrew cache. External and other supervised gateways use the attachment path and clear the cache without consuming it.Signed-off-by: Aaron Erickson aerickson@nvidia.com
Summary by CodeRabbit
Bug Fixes
Reliability