Fix cooldown breaking Docker updates when registry API calls fail#14149
Conversation
…efully When cooldown is enabled for Docker dependencies, the update checker makes additional API calls (digest + blob HEAD) to determine tag publication dates. These calls can fail with 404, 401, or other errors for certain images/registries. Changes: - Add error handling in get_tag_publication_details to catch registry errors (NotFound, auth, rate limiting) and return nil instead of crashing the entire update process - Fix apply_cooldown to treat tags with unknown publication dates as "not in cooldown" instead of skipping them (which could block all updates when the registry doesn't support the required API calls) - Remove incorrect T.cast in publication_detail that would fail when get_tag_publication_details returns nil Co-authored-by: robaiken <6567647+robaiken@users.noreply.github.com>
Co-authored-by: robaiken <6567647+robaiken@users.noreply.github.com>
|
@copilot fix conflict |
…oldown-issue # Conflicts: # docker/spec/dependabot/docker/update_checker_spec.rb Co-authored-by: robaiken <6567647+robaiken@users.noreply.github.com>
Resolved the merge conflict in |
|
@copilot could you refresh this PR now that #14691 has landed? A few things to do:
|
Co-authored-by: robaiken <6567647+robaiken@users.noreply.github.com>
…text Co-authored-by: robaiken <6567647+robaiken@users.noreply.github.com>
Done. Merged main (which includes #14691) into the branch so the diff is clean. Rescue list verification: No specs simulate a 404 specifically for the manifest-list scenario — the existing test mocks
I've updated the test name from "blob request returns 404" to "HEAD request returns 404" to reflect that the endpoint is now dynamically selected per #14691. |
|
@copilot lint Offenses: docker/spec/dependabot/docker/update_checker_spec.rb:1535:9: C: [Correctable] RSpec/ReceiveMessages: Use receive_messages instead of multiple stubs on lines [1536, 1538]. |
Co-authored-by: robaiken <6567647+robaiken@users.noreply.github.com>
Fixed — replaced individual |
There was a problem hiding this comment.
Pull request overview
This PR fixes Docker update failures when cooldown logic performs extra registry API calls (digest + HEAD) that can return errors (e.g., 404/401/403/429). Instead of letting these errors crash the update or silently filter out all candidates, the update checker now degrades gracefully by bypassing cooldown when publication details can’t be determined.
Changes:
- Add error handling in
get_tag_publication_detailsto catch common registry/auth/rate-limit failures, log a warning, and returnnil. - Change
apply_cooldownto treat missing/unknown publication timestamps as “skip cooldown and allow the tag” rather than excluding it (which could previously block all updates). - Add/extend specs to cover the new error-handling and “still returns latest version” behavior.
Show a summary per file
| File | Description |
|---|---|
| docker/lib/dependabot/docker/update_checker.rb | Makes cooldown publication-date fetching resilient to registry failures and ensures cooldown can’t block updates when dates are unavailable. |
| docker/spec/dependabot/docker/update_checker_spec.rb | Adds test coverage for registry errors (404/auth/403/429) and verifies updates still proceed when cooldown publication lookups fail. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 0
What are you trying to accomplish?
When cooldown is enabled for Docker dependencies, the update checker makes additional API calls (digest + blob HEAD) to determine tag publication dates. These calls can fail with 404, 401, or other errors depending on the registry/image. The unhandled errors crash the entire update process, preventing any Docker updates from being proposed.
Three bugs fixed:
get_tag_publication_detailshad no error handling — registry errors (NotFound, auth failures, rate limiting) propagated up and killed the updateapply_cooldownusednexton missing publication details — if details couldn't be fetched for any tag, the method returned[], silently blocking all updatespublication_detailused incorrectT.cast—T.cast(nil, PackageRelease)fails at Sorbet runtime whenget_tag_publication_detailsreturns nilThe
apply_cooldownfix changesnexttoreturn [tag]when details are nil — treating unknown publication dates as "not in cooldown" rather than skipping the tag entirely.Anything you want to highlight for special attention from reviewers?
The
apply_cooldownbehavior change is the most significant: previously, tags with nil publication details were skipped (could result in no update). Now they're returned immediately (cooldown is bypassed). This is the correct tradeoff — cooldown is an optimization that should degrade gracefully, not block updates entirely.How will you know you've accomplished your goal?
get_tag_publication_details, plus 2 integration tests validating end-to-end behavior (cooldown + blob 404, cooldown + auth failure)Checklist
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
tuf-repo-cdn.sigstore.dev/opt/bin/cosign cosign verify --certificate-oidc-issuer REDACTED --certificate-identity-regexp REDACTED ghcr.io/regclient/regctl:v0.11.1(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.