Repository navigation
[code-deduplication] Consolidate CLI network argument forwarding - #255
Merged
Pedro Henrique Penna (ppenna) merged 1 commit intoSep 29, 2026
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot started reviewing on behalf of
Pedro Henrique Penna (ppenna)
September 29, 2026 15:01
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The extraction preserves the existing argument sequence, and the focused test covers both call sites.
Review effort: Balanced
Findings: None
What changed in this PR
This PR consolidates network-option forwarding shared by the run and one-shot sandbox commands, reducing duplication in the NVX CLI.
Changes:
- Extracts the existing forwarding sequence into a private helper.
- Adds a test that checks the forwarded arguments for both commands.
| File | Description |
|---|---|
scripts/test_nvx_tools.py |
Tests network-option forwarding for both commands. |
scripts/nvx.py |
Replaces duplicate forwarding blocks with a shared helper. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Pedro Henrique Penna (ppenna)
marked this pull request as ready for review
September 29, 2026 15:13
Pedro Henrique Penna (ppenna)
deleted the
code-deduplication/code-dedup-network-args-36586067650-f6a4eec22fe2007e
branch
September 29, 2026 17:42
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.
Deduplication
command_run()and one-shotcommand_sandbox()each contained the same ordered network-option forwarding sequence for the address/profile pair, ingress and egress policy, repeated allow and deny rules, host-loopback policy, proxy endpoint, and repeated port forwards. This change consolidates both inline copies into the module-private_extend_network_arguments()helper inscripts/nvx.py.The helper accepts only the command and the existing parsed namespace, adds no flags or branches, and preserves the original argument order, values, and absence behavior. The focused test invokes both call sites with every forwarded option and verifies their exact resulting suffixes.
Evidence and novelty
command_run()inscripts/nvx.py.command_sandbox()inscripts/nvx.py._extend_network_arguments()inscripts/nvx.py.performance.py; it does not touch this function or concern.Patch
scripts/nvx.py: 21 additions, 32 deletions.scripts/test_nvx_tools.py: 42 additions, 0 deletions.Validation
python3 -m unittest scripts.test_nvx_tools.CliTests.test_run_and_sandbox_forward_network_arguments -v— passed.python3 -m unittest scripts/test_performance.py scripts/test_nvx_tools.py scripts/test_microvm_tests.py scripts/test_development_release.py -v— passed.python3 scripts/test_adversarial.py -v— passed (54 tests).python3 .github/skills/nvx-host-connect/scripts/test_hosts.py -vplus every CLI help smoke command fromvalidate-nvx— passed.python3 -m compileall -q scripts— passed.python3 -m ruff check scripts— passed.python3 -m pyright --pythonplatform Linux— passed with 0 errors.python3 -m pyright --pythonplatform Windows— passed with 0 errors.python3 -m ruff format --check scripts— passed.git diff --check— passed.No dependency, public API/CLI/ABI, gitlink, or OpenVMM change was made.