Skip to content

fix(github): warn on versions host metadata fallback#10254

Merged
jdx merged 1 commit into
mainfrom
fix/warn-versions-host-metadata-fallback
Jun 6, 2026
Merged

fix(github): warn on versions host metadata fallback#10254
jdx merged 1 commit into
mainfrom
fix/warn-versions-host-metadata-fallback

Conversation

@jdx

@jdx jdx commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • warn when mise-versions GitHub metadata lookups hit rate limits or other non-404 failures
  • include the release/attestation lookup context before falling back to the GitHub API
  • keep 404 cache misses silent

Why

When mise-versions release metadata fails transiently, mise falls back to the GitHub API. If CI has lost or lacks a GitHub token, the visible failure is a GitHub 403 with no indication that the versions-host lookup failed first. These warnings make that fallback path visible.

Test plan

  • cargo fmt
  • cargo test versions_host

Note

Low Risk
Logging-only change in optional metadata fetch paths; 404 handling and fallback semantics are unchanged.

Overview
Improves visibility when mise-versions GitHub metadata lookups fail and mise silently falls back to the GitHub API.

github_release and github_attestations now pass context-specific labels (e.g. GitHub release metadata for {repo}@{tag}) into shared fetch_optional_json handling. 429 rate limits and other non-404 errors are logged at warn with explicit “falling back” wording instead of debug. 404 responses remain silent (treated as a cache miss).

No change to fallback behavior—only logging and error-message context so CI failures (e.g. GitHub 403 without a token) are easier to trace back to a prior versions-host failure.

Reviewed by Cursor Bugbot for commit 77fd1d2. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • Chores
    • Enhanced diagnostic logging for rate-limit and lookup failures with more explicit fallback indicators for improved observability.

@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This change improves debugging observability for GitHub API lookups. Two functions now format per-request labels with repository and version information, while the underlying fetch function elevates transient failure messages from debug to warn level, making rate-limit and lookup failures more visible during troubleshooting.

Changes

GitHub API Observability

Layer / File(s) Summary
Request labels and fallback logging
src/versions_host.rs
github_release and github_attestations construct specific labels containing {repo}@{tag} and {repo}@{digest} respectively; fetch_optional_json now logs 429 and non-429 lookup failures at warn! level with "falling back" messaging instead of debug!, while returning Ok(None) on errors.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Labels now sparkle with specifics clear,
{repo}@{tag} brings debugging cheer!
Warnings now shine where silence once lived,
Better observability the code receives.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding warnings when versions host metadata lookups fall back, which is the primary objective of the PR.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/warn-versions-host-metadata-fallback

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR improves observability in the fetch_optional_json helper by (1) embedding {repo}@{tag} / {repo}@{digest} context in the log label and (2) promoting debug! to warn! for rate-limit and non-404 failures so callers can see when the fallback path to the GitHub API is being taken.

  • Labels passed to fetch_optional_json now include the specific repo and tag/digest, making warning messages actionable without needing to enable debug logging.
  • Non-404 failures (429 rate-limit and all other errors) now emit warn! instead of debug!, surfacing otherwise-invisible fallback events — especially useful in CI environments without a GitHub token.

Confidence Score: 5/5

Safe to merge — the only behavioral change is promoting two log-level calls from debug to warn, with no mutations to control flow or return values.

The diff is minimal: two label format strings gain context and two debug! macro calls become warn!. Control flow, error propagation, and all Ok(None) / Ok(Some(_)) paths are unchanged. The 404 silent path is explicitly preserved. The new warning text correctly describes the fallback and includes {err:#} for the generic case. No edge cases or regressions are apparent.

No files require special attention.

Important Files Changed

Filename Overview
src/versions_host.rs Adds repo/tag context to fetch_optional_json labels and promotes debug→warn for 429 and generic error branches, making the fallback path visible when mise-versions is unavailable.

Reviews (1): Last reviewed commit: "fix(github): warn on versions host metad..." | Re-trigger Greptile

@jdx jdx enabled auto-merge (squash) June 6, 2026 21:22
@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.6.0 x -- echo 16.9 ± 0.6 15.7 19.4 1.00
mise x -- echo 17.7 ± 1.7 16.0 47.8 1.04 ± 0.11

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.6.0 env 16.9 ± 0.8 15.5 20.6 1.00
mise env 17.4 ± 0.8 15.8 21.9 1.03 ± 0.07

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.6.0 hook-env 17.5 ± 0.7 16.0 21.9 1.00
mise hook-env 18.1 ± 0.7 16.4 22.5 1.03 ± 0.06

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.6.0 ls 14.1 ± 0.7 12.7 17.4 1.00
mise ls 14.5 ± 0.7 13.3 17.9 1.03 ± 0.07

xtasks/test/perf

Command mise-2026.6.0 mise Variance
install (cached) 128ms 129ms +0%
ls (cached) 58ms 58ms +0%
bin-paths (cached) 60ms 60ms +0%
task-ls (cached) 120ms 121ms +0%

@jdx jdx merged commit 7560333 into main Jun 6, 2026
34 checks passed
@jdx jdx deleted the fix/warn-versions-host-metadata-fallback branch June 6, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant