Repository navigation
fix(vfox): honor url replacements - #11795
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughVfox now supports configurable URL rewriting for artifact downloads and Lua HTTP GET, HEAD, and download operations. The change includes origin-aware credential handling, tests, documentation, and an end-to-end plugin workflow. ChangesURL rewriting
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Vfox
participant Plugin
participant LuaHTTP
participant HTTPServer
Vfox->>Plugin: register URL rewriter
Plugin->>LuaHTTP: store url_rewriter_fn callback
LuaHTTP->>LuaHTTP: rewrite request URL
LuaHTTP->>HTTPServer: send rewritten request
Vfox->>HTTPServer: download rewritten artifact
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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 |
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 `@crates/vfox/src/plugin.rs`:
- Around line 145-150: Update Plugin::set_url_rewriter and its callers in
try_get, try_head, and try_download_file so URL rewrite failures preserve each
try_* method’s (nil, error) contract instead of raising an uncaught Lua error.
Either convert callback failures within every try_* path before request-error
handling, or make set_url_rewriter retain the original URL when Url::parse
fails.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: f221e360-b13d-46f3-a7fd-7c639e857995
📒 Files selected for processing (7)
crates/vfox/src/http.rscrates/vfox/src/lua_mod/http.rscrates/vfox/src/plugin.rscrates/vfox/src/vfox.rsdocs/dev-tools/backends/vfox.mde2e/backend/test_vfox_url_replacementssrc/plugins/vfox_plugin.rs
2506077 to
fe8131e
Compare
Greptile SummaryThe PR makes vfox honor mise URL replacements for artifact downloads and Lua HTTP requests while preserving original artifact filenames and preventing credentials from crossing origins.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (10): Last reviewed commit: "fix(vfox): honor url replacements" | Re-trigger Greptile |
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Summary
get,try_get,head,try_head,download_file, andtry_download_file)Problem
The vfox backend owns separate reqwest clients for artifact downloads and Lua HTTP helpers. Those requests bypassed mise's shared HTTP layer, so
settings.url_replacementshad no effect for vfox plugins.Implementation
Vfox now accepts an optional URL-rewriter callback. Mise supplies its existing
http::apply_url_replacementsimplementation, while standalone users of the vfox library and CLI retain the previous no-op behavior.Lua requests apply the rewrite before resolving default GitHub authentication. Automatically resolved GitHub credentials are attached only when the rewritten URL retains the original scheme, host, and effective port; cross-origin mirrors receive no implicit token. Cross-origin rewrites remove known credential-bearing plugin headers while retaining required non-credential headers. Direct artifact downloads determine their local filename from the original URL, then use the rewritten URL for requests, retries, and logging. This allows mirrors whose paths do not preserve the upstream filename or extension.
Testing
mise --cd crates/vfox run test(110 passed, 2 ignored)mise run test:e2e e2e/backend/test_vfox_url_replacementsmise run test:e2e e2e/backend/test_vfox_install_env e2e/backend/test_vfox_rolling_installmise exec -- cargo check --all-featuresmise exec -- cargo clippy --workspace --all-features --all-targets -- -D warningsmise --cd crates/vfox run lintmise exec -- cargo fmt --all --checkmise exec -- shfmt -d e2e/backend/test_vfox_url_replacementsmise exec -- shellcheck e2e/backend/test_vfox_url_replacementsThe repository-level
mise run formatandmise run lintwrappers could not runhkbecause it does not recognize this Sapling working copy as a Git repository. The corresponding Rustfmt, Clippy, shfmt, ShellCheck, and vfox lint checks were run individually as listed above.Addresses #8427
AI-assisted — Tool: Codex; model: OpenAI/GPT-5; version: unavailable.
Summary by CodeRabbit
New Features
Documentation
Tests