Repository navigation
Share analytics queries and package downloads - #24350
Conversation
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes.
|
| Layer / File(s) | Summary |
|---|---|
Influx client setup and query bridge Library/Homebrew/utils/analytics/influx.rb, Library/Homebrew/test/utils/analytics/influx_spec.rb |
The new client sets up its Python environment, sends query requests, yields JSON-line records, and reports query failures. |
Query construction and result formatting Library/Homebrew/utils/analytics/influx.rb, Library/Homebrew/test/utils/analytics/influx_spec.rb |
The client validates settings, builds category queries, filters and aggregates records, and formats ranked results and OS-version dimensions. Specs cover query output, ranking, and version formatting. |
Command delegation Library/Homebrew/dev-cmd/formula-analytics.rb, Library/Homebrew/test/dev-cmd/formula-analytics_spec.rb |
The command delegates setup and queries to the client, handles the setup-check option, and prints results as pretty JSON. The spec retains the parseable-arguments example. |
GitHub Packages download reporting
| Layer / File(s) | Summary |
|---|---|
Download snapshot and cache Library/Homebrew/github_packages.rb, Library/Homebrew/test/github_packages_spec.rb |
GitHubPackages.downloads returns a same-day cached snapshot or fetches and validates fresh totals and daily counts. Specs cover counts, cache refresh, and missing chart data. |
Analytics output and documentation Library/Homebrew/utils/analytics.rb, Library/Homebrew/test/utils/analytics_spec.rb, docs/Analytics.md |
Analytics output displays all-time and 30-day counts, the date range, fetch time, and the ratio to install events. Specs and documentation reflect the updated output. |
Priority:
Merge Risk: 
Low · up to 999b0
-
The new GitHub Packages download reporting works as intended. One new test does not exercise the case it is named for, so a future regression in missing-chart handling could go unnoticed. Fixing the fixture is a one-line change and is not a blocker for merging.
Pre-merge checks: 
4
-
Full details: Title check
-
Explanation
The title "Share analytics queries and package downloads" matches the main changes. The PR extracts InfluxDB queries into a Ruby utility (utils/analytics/influx.rb) and adds a shared GitHubPackages.downloads method used by brew info and analytics output. The title is specific and concise, and it names both main parts of the change.
Full details: Description check
-
Explanation
The description lists the three goals of the PR: extracting InfluxDB queries for API generators, sharing cached package totals between brew info and API generation, and keeping query formatting and reader tests with their implementations. These match the changeset, which moves query logic into Utils::Analytics::Influx, adds GitHubPackages.downloads with a per-formula cache, and moves related specs. The description is specific enough to relate to the change.
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
There was a problem hiding this comment.
🧹 Nitpick comments: 1
Library/Homebrew/test/github_packages_spec.rb: 1
46-46:Trivial · Maintainability & Code Quality · Quick win Give the missing-chart example a valid total.
This fixture omits both the chart and the
Total downloadslabel.GitHubPackages.downloadsreturns attotal.nil?, so the example cannot detect a regression in the missing-chart check. Add matching total markup and leave the chart absent.
🔇 Additional comments: 4
Library/Homebrew/utils/analytics/influx.rb: 1
1-386: LGTM!Library/Homebrew/test/utils/analytics/influx_spec.rb: 1
1-158: LGTM!Library/Homebrew/dev-cmd/formula-analytics.rb: 1
4-4: LGTM!Also applies to: 67-70, 89-91
Library/Homebrew/github_packages.rb-67-67: 1
67-67:Minor · Data Integrity & Integration · Quick win
⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.Reject incomplete chart date coverage.
If the chart omits a day with downloads, this check still accepts the remaining bars. The method then caches a partial sum as
last_30_days, andbrew inforeports it as a 30-day count. Check date coverage before caching the snapshot. Allow a shorter range when the package has not existed for 30 days.

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
0834bbdc-20d4-45f7-a253-9fa06a4ef2ba
Files selected for processing: 9-
Library/Homebrew/dev-cmd/formula-analytics.rbLibrary/Homebrew/github_packages.rbLibrary/Homebrew/test/dev-cmd/formula-analytics_spec.rbLibrary/Homebrew/test/github_packages_spec.rbLibrary/Homebrew/test/utils/analytics/influx_spec.rbLibrary/Homebrew/test/utils/analytics_spec.rbLibrary/Homebrew/utils/analytics.rbLibrary/Homebrew/utils/analytics/influx.rbdocs/Analytics.md
Files with no reviewable changes: 1-
- Library/Homebrew/test/dev-cmd/formula-analytics_spec.rb
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
-
- Extract InfluxDB queries so API generators can call Ruby directly. - Share cached package totals between `brew info` and API generation. - Keep query formatting and reader tests with their implementations.
999b063 to
d8fcbd4
Compare
brew infoand API generation.brew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Codex with GPT 6 Astra at Extra High effort, with local review and testing.