Use GitHub Repo Activity API to fetch Nix branch tips#14840
Merged
Conversation
thavaahariharangit
previously approved these changes
Apr 28, 2026
fe11bec to
d4daa92
Compare
f9a8f98 to
997e1e0
Compare
jpinz
approved these changes
May 5, 2026
For Nix flake inputs that track a branch on GitHub, fetch update candidates from the Repo Activity API instead of paginating /commits. Each activity entry's after SHA was once the actual branch tip, which for nixpkgs channels means it's Hydra-evaluated and cache-backed. The existing /commits walker stays as a fallback for non-GitHub URLs, SHA-pinned refs, and HTTP errors. Fixes #14836
- Scope Sorbet/ForbidTUnsafe disable to the single T.unsafe call - Keep locked SHA in trim_entries_to_locked_sha when it appears as 'before' - Read the documented 'timestamp' field from the Repo Activity API
be7fd61 to
807590a
Compare
casey-robertson-paypal
pushed a commit
to casey-robertson-paypal/dependabot-core
that referenced
this pull request
May 5, 2026
…-api Use GitHub Repo Activity API to fetch Nix branch tips
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.
What are you trying to accomplish?
For Nix flake inputs that track a branch on GitHub, fetch update candidates from the Repo Activity API instead of paginating
/commits. Each activity entry'safterSHA was once the actual branch tip. Fornixpkgschannels that means it was Hydra-evaluated and is cache-backed. The current/commitswalker returns mostly intermediatemastercommits that were never branch tips and aren't covered by the binary cache, which means any code that picks from the candidate set (cooldown fallbacks, "pick an older commit" heuristics) risks handing users a flake.lock that builds the world from source.Fixes #14836. Came up while reviewing #14829.
Anything you want to highlight for special attention from reviewers?
/commitswalker is kept as a fallback for non-GitHub URLs, SHA-pinned refs, empty results, and HTTP errors. No regression for any case that already worked.Dependabot::Clients::GithubWithRetries.for_github_dot_com(credentials:), matching the pattern inpre_commit/andbazel/.T.unsafe(github_client).get(...)is needed becauseGithubWithRetriesproxies viamethod_missing. Same pattern asbazel/lib/dependabot/bazel/update_checker/registry_client.rb, including theSorbet/ForbidTUnsafeexclude innix/.rubocop.yml.How will you know you've accomplished your goal?
nix/spec/dependabot/nix/package/package_details_fetcher_spec.rbcovers the happy path, pseudo-version ordering, auth header injection, 403 fallback, empty-response fallback, SHA-pinned skip, non-GitHub skip, and credentials-absent path.nixpkgsnixos-unstableinput with cooldown enabled, the proposed update SHA appears in the first page of/repos/NixOS/nixpkgs/activity?ref=refs/heads/nixos-unstable&activity_type=push,force_push.Checklist