Repository navigation
nvx: name the HTTP statuses of the GitHub release client - #2247
Merged
Pedro Henrique Penna (ppenna) merged 1 commit intoNov 27, 2026
Merged
Conversation
The GitHub release client of nvx download spelled the HTTP statuses that it acts on as bare literals, and the same class in different forms: the success check was !(200..300).contains(..) in download but the range pattern 200..=299 in json, the redirect check (300..400) appeared twice, the least valid status was a bare 100, and 404 was repeated in json and hint next to 401 and 403. Name them once, in module-private constants whose doc comments cite RFC 9110 section 15: MIN_STATUS, SUCCESSFUL, REDIRECTION, UNAUTHORIZED, FORBIDDEN, and NOT_FOUND. json matches a successful status with a guard first, as 200..=299 did, so the arms keep their order. The values, requests, redirects, errors, and hints are unchanged. Tests: the 13 host::cli::download::github unit tests, which cover redirects, response parsing, error responses, and hints, pass unchanged at the base 2e30219 and with this change on Windows. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The HTTP status constant refactor has no active review issues.
No open issues 🎉
What changed in this PR
Makes HTTP status checks in nvx download’s GitHub release client consistent and self-documenting, addressing #2245 without changing behavior.
Changes:
- Adds module-private status constants and ranges with RFC 9110 references.
- Replaces literals in success checks, redirect handling, status parsing, and error hints, preserving match order and messages.
| File | Description |
|---|---|
nvx/src/host/cli/download/github.rs |
Defines documented HTTP status constants and reuses them throughout the release client. |
Review effort: Balanced
Pedro Henrique Penna (ppenna)
enabled auto-merge
November 27, 2026 05:38
Pedro Henrique Penna (ppenna)
deleted the
agents/issue-2245-github-http-statuses
branch
November 27, 2026 07:38
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.
Fixes #2245
What does this pull request change?
The GitHub release client of
nvx download,nvx/src/host/cli/download/github.rs, names the HTTP statuses that it acts on once, in module-private constants whose doc comments cite RFC 9110 section 15:SUCCESSFUL: Range<u16> = 200..300replaces(200..300)inGitHub::downloadand the pattern200..=299inGitHub::json, which now matchesstatus if SUCCESSFUL.contains(&status)as its first arm, as before.REDIRECTION: Range<u16> = 300..400replaces(300..400)inGitHub::getandread_response.MIN_STATUS: u16 = 100replaces the bound instatus_code.UNAUTHORIZED,FORBIDDEN, andNOT_FOUNDreplace401,403, and404inGitHub::jsonandhint.The values, the order of the match arms, and every message are unchanged. Start with the constants after
HEADERS_NAME. Nothing else changes; the issue lists no follow-ups.Why is this change needed?
The client spelled the same status class in two forms (
200..300and200..=299), repeated the 3xx range and404across functions, and gave no reason for the bounds. One name per class states what each check means and keeps the four call sites from drifting apart. Matching constants as patterns compiles to the same comparisons as the literals, so behavior is unchanged. A helper function such asis_redirectwas rejected: it adds an indirection for a one-line range check, and the ranges read as directly as the class names.How was this change validated?
Checks and results:
2e302197d90, Windows:cargo test --locked --features cli --manifest-path nvx/Cargo.toml --lib -- host::cli::download::github: 13 passed. Same command at heada9ab3996fce: 13 passed, tests unchanged.python scripts\local_gates.py --base origin/dev --runon this Windows workstation (local): test-changes, markdown-links, test-layout, nvx-format, nvx-lint, nvx-test, nvx-doc, nvx-msrv, nvx-cli all passed (nvx-cli: 2326 tests OK, skipped=92; 84 tests OK, skipped=11). Releasenvxwas not built there, so the tests that runnvxskipped on Windows; they ran on Linux below.python3 scripts/local_gates.py --base origin/dev --runin WSL 2 (local fallback, clone ata9ab3996fce): test-changes, markdown-links, test-layout, nvx-format, nvx-lint, nvx-test, nvx-doc, nvx-public-api, nvx-msrv, nvx-macos, nvx-guest-binaries-lint, nvx-guest-binaries-build passed. nvx-cli first failed in itspip installstep because the WSL system Python is externally managed (PEP 668); rerun whole with--only nvx-cliin a temporary--system-site-packagesvenv (PyYAML 6.0.3 already satisfied, nothing installed) and releasenvxbuilt: passed (2326 tests OK, skipped=41; 84 tests OK).Backend, host OS, host type, and guest: no runtime path changes; no microVM was booted. All configured kvm profiles were unreachable (azure-intel-kvm-1 to -5 and -7, azure-amd-kvm-1 to -4), so Linux gates ran in this workstation's WSL 2 rather than on a configured host.
Left to CI: the microVM scenarios that the selector lists for kvm, mshv, and whp (they do not exercise
nvx download's GitHub client), and mshv entirely.Checklist
python3 scripts/check_test_layout.pychecks.python3 scripts/check_test_changes.py --base origin/devlists no changeto an existing test, or a Changes to existing tests section below
explains each one.
.github/copilot-instructions.mdand the skills when a convention orworkflow changes.
nvxupdatesnvx/public-api/withpython3 scripts/public_api.py --update.description says how the change versions or migrates them.