fix(github): add structured versions host logs#10256
Conversation
📝 WalkthroughWalkthroughAdds VersionsHostLogContext and replaces ad-hoc trace/warn messages with structured, context-rich logs across list_versions, fetch_optional_json, github_release, github_attestations, and install tracking; includes tests for field rendering and URL redaction. ChangesVersions-host structured logging
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/versions_host.rs`:
- Around line 124-133: The struct is including the raw `full` backend URL which
can leak credentials; update the code to never log raw `full` by redacting or
omitting userinfo and query/fragment parts before it's stored or logged.
Specifically, in the factory `install_track(tool: &str, full: &str, version:
&str) -> Self` stop assigning the raw `full` into the struct — instead pass a
sanitized value (or None) produced by a small sanitizer that strips userinfo
(user:pass@), query (`?...`) and fragment (`#...`) from the URL; and apply the
same sanitizer at every place where `full` is included in structured logs or
serialized (the other occurrences that currently log `full`) so logs only
contain the redacted URL or no URL at all.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
Greptile SummaryThis PR replaces free-form trace/warn messages in
Confidence Score: 5/5Observability-only change; no HTTP, caching, or fallback logic is altered. Every changed line is a log statement replacement or the new helpers/context struct that back them. Runtime outcomes (what gets returned, what gets propagated as an error) are identical to the original code. The only non-obvious logic — credential sanitization in sanitize_full_for_log — is covered by a dedicated unit test. No data paths, API calls, or fallback decisions were modified. No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "fix(github): redact versions host struct..." | Re-trigger Greptile |
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.6.0 x -- echo |
17.2 ± 0.8 | 15.6 | 21.1 | 1.00 |
mise x -- echo |
17.9 ± 1.5 | 16.3 | 41.2 | 1.04 ± 0.10 |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.6.0 env |
17.1 ± 0.8 | 15.5 | 20.4 | 1.00 |
mise env |
17.7 ± 0.8 | 16.3 | 21.9 | 1.03 ± 0.07 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.6.0 hook-env |
17.9 ± 0.8 | 16.2 | 21.0 | 1.00 |
mise hook-env |
18.3 ± 0.7 | 16.7 | 21.4 | 1.02 ± 0.06 |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.6.0 ls |
14.2 ± 0.7 | 12.9 | 18.6 | 1.00 |
mise ls |
14.8 ± 0.7 | 13.3 | 18.4 | 1.04 ± 0.07 |
xtasks/test/perf
| Command | mise-2026.6.0 | mise | Variance |
|---|---|---|---|
| install (cached) | 128ms | 131ms | -2% |
| ls (cached) | 57ms | 59ms | -3% |
| bin-paths (cached) | 62ms | 63ms | -1% |
| task-ls (cached) | 122ms | 123ms | +0% |
Summary
endpoint,tool/repo/tag/digest,outcome,status, andfallbackfields for successes and fallback pathsTests
cargo test -q versions_hostcargo clippy --all-features --all-targets -- -D warningsNote: This PR was generated by an AI coding assistant.
Note
Low Risk
Observability-only changes in versions-host HTTP paths; fallbacks and error handling are preserved, with safer logging for credentials in
fullURLs.Overview
Adds structured, logfmt-style tracing for all mise-versions (
versions_host) traffic so debug/warn logs are easier to filter and correlate.A shared
VersionsHostLogContextnow drives logs for version list, GitHub release, GitHub attestations, and install tracking, emitting stable fields (endpoint,tool/repo/tag/digest/full/version,outcome,status,fallback, counts where relevant). Values with spaces are quoted;fullURLs are sanitized (credentials, query, fragment stripped) before logging.Ad-hoc
warn!/trace!strings are replaced on success and fallback paths (disabled, cache hit, 404, 429, empty, validation failures, etc.). Runtime behavior is unchanged: same fallbacks and error propagation (e.g. version-list still returnsErron non-404 failures; optional JSON fetches still returnNone).Unit tests cover log field formatting and URL redaction.
Reviewed by Cursor Bugbot for commit d3fb9fa. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
Chores
Tests