Skip to content

Bugfix: nym-node-cly.py argument mismatch fix and sync up with NTM updates#6743

Open
serinko wants to merge 4 commits intodevelopfrom
serinko/node-cli-args-fix
Open

Bugfix: nym-node-cly.py argument mismatch fix and sync up with NTM updates#6743
serinko wants to merge 4 commits intodevelopfrom
serinko/node-cli-args-fix

Conversation

@serinko
Copy link
Copy Markdown
Contributor

@serinko serinko commented May 7, 2026

This PR resolves #6725 as it adds missing self to _resolve_field(). Additionally the PR adds args for uplink interface global, IPv4 and IPv6 and writes them to env.sh.

NOTE: Docs update for these new flags will be in separated PR


This change is Reviewable

Summary by CodeRabbit

  • New Features

    • CLI supports independent IPv4 and IPv6 uplink interface overrides during node installation.
    • Provided overrides are persisted for future runs.
  • Improvements

    • Uplink option remains backward-compatible; help text clarifies IPv4/IPv6 behavior.
    • WireGuard enablement respects supplied CLI options (with clearer precedence) rather than relying solely on interactive prompts or env detection.

@serinko serinko self-assigned this May 7, 2026
@serinko serinko added this to the Independent Release milestone May 7, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

The install CLI now supports --uplink-dev-v4 and --uplink-dev-v6; _resolve_field accepts parsed args; run_node_installation writes NETWORK_DEVICE/NETWORK_DEVICE_V4/NETWORK_DEVICE_V6 into env.sh and os.environ; WireGuard checks use args; a script lookup key was corrected.

Changes

Uplink Interface IPv4/IPv6 Separation

Layer / File(s) Summary
Method Signature Update
scripts/nym-node-setup/nym-node-cli.py
_resolve_field method signature updated to accept args parameter as first argument.
WireGuard Precedence
scripts/nym-node-setup/nym-node-cli.py
check_wg_enabled now reads args.wireguard_enabled (normalized) before env values and persists the normalized value back to env.sh.
CLI Argument Definitions
scripts/nym-node-setup/nym-node-cli.py
New --uplink-dev-v4 and --uplink-dev-v6 options added; --uplink-dev help text updated to indicate it overrides both IPv4 and IPv6.
Installation Flow Integration
scripts/nym-node-setup/nym-node-cli.py
run_node_installation maps --uplink-devNETWORK_DEVICE, --uplink-dev-v4/--uplink-dev-v6NETWORK_DEVICE_V4/NETWORK_DEVICE_V6, removes prior UPLINK_DEV assignment, and persists provided values via _upsert_env_vars and exports them to os.environ.
WireGuard Callsite
scripts/nym-node-setup/nym-node-cli.py
run_node_installation now calls check_wg_enabled(args) so CLI flags influence detection.
Script URL Mapping
scripts/nym-node-setup/nym-node-cli.py
Lookup key for nginx proxy WSS setup script changed to setup-nginx-proxy-wss.sh in _return_script_url.

Sequence Diagram(s)

sequenceDiagram
  participant User as CLI User
  participant Parser as Argparse
  participant Install as run_node_installation
  participant WG as check_wg_enabled
  participant Env as env.sh/os.environ
  User->>Parser: provide flags (--uplink-dev, --uplink-dev-v4, --uplink-dev-v6, --wireguard-enabled)
  Parser->>Install: parsed args
  Install->>WG: check_wg_enabled(args)
  WG->>Env: read/persist WIREGUARD value
  Install->>Env: set NETWORK_DEVICE / NETWORK_DEVICE_V4 / NETWORK_DEVICE_V6
  Install->>Env: _upsert_env_vars(...)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit hops through network lanes,
Splits IPv4 and IPv6 reins,
The CLI now hears the call,
Separate paths, no more stall—
Install flows tidy, joy remains. 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately identifies the main fix (argument mismatch) and mentions syncing with NTM updates, both of which are reflected in the changeset.
Linked Issues check ✅ Passed The PR directly addresses issue #6725 by fixing the Python TypeError caused by missing 'self' parameter in _resolve_field() and adds IPv4/IPv6 uplink interface arguments as part of the sync.
Out of Scope Changes check ✅ Passed All changes are within scope: fixing _resolve_field() method signature, adding IPv4/IPv6 uplink CLI arguments, updating check_wg_enabled() implementation, and correcting nginx proxy script key.
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 serinko/node-cli-args-fix

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.

❤️ Share

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

@vercel
Copy link
Copy Markdown

vercel Bot commented May 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nym-explorer-v2 Error Error May 7, 2026 10:56am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs-nextra Ignored Ignored Preview May 7, 2026 10:56am
nym-node-status Ignored Ignored Preview May 7, 2026 10:56am

Request Review

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 `@scripts/nym-node-setup/nym-node-cli.py`:
- Around line 614-623: The uplink override logic never populates uplink_updates
so env changes never persist; update the block in nym-node-cli.py to add keys to
the uplink_updates dict when args.uplink_dev, args.uplink_dev_v4, or
args.uplink_dev_v6 are present (e.g., set uplink_updates["NETWORK_DEVICE"] =
args.uplink_dev, uplink_updates["NETWORK_DEVICE_V4"] = args.uplink_dev_v4,
uplink_updates["NETWORK_DEVICE_V6"] = args.uplink_dev_v6), continue to set
os.environ for immediate effect, and then call
self._upsert_env_vars(uplink_updates) when uplink_updates is non-empty so the
values are written to env.sh.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro

Run ID: daa76a5d-d115-4cb7-af77-dc013dff4f78

📥 Commits

Reviewing files that changed from the base of the PR and between e9f6d1d and c41bbac.

📒 Files selected for processing (1)
  • scripts/nym-node-setup/nym-node-cli.py

Comment thread scripts/nym-node-setup/nym-node-cli.py
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
scripts/nym-node-setup/nym-node-cli.py (1)

613-623: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

uplink_updates is still never populated — uplink values not persisted to env.sh.

All three branches assign directly to os.environ[...] without also writing into uplink_updates, so the dict stays empty and _upsert_env_vars is never called. The uplink overrides only affect the current process and are lost across restarts.

🐛 Proposed fix
         uplink_updates = {}
         if getattr(args, "uplink_dev", None):
-            os.environ["NETWORK_DEVICE"] = args.uplink_dev
+            uplink_updates["NETWORK_DEVICE"] = args.uplink_dev
         if getattr(args, "uplink_dev_v4", None):
-           os.environ["NETWORK_DEVICE_V4"] = args.uplink_dev_v4
+            uplink_updates["NETWORK_DEVICE_V4"] = args.uplink_dev_v4
         if getattr(args, "uplink_dev_v6", None):
-            os.environ["NETWORK_DEVICE_V6"] = args.uplink_dev_v6
+            uplink_updates["NETWORK_DEVICE_V6"] = args.uplink_dev_v6
         if uplink_updates:
             os.environ.update(uplink_updates)
             self._upsert_env_vars(uplink_updates)
🤖 Prompt for 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.

In `@scripts/nym-node-setup/nym-node-cli.py` around lines 613 - 623, The
uplink_updates dict is never populated so _upsert_env_vars is never called; when
handling args.uplink_dev, args.uplink_dev_v4, and args.uplink_dev_v6 you should
add the corresponding key/value pairs to uplink_updates (e.g. "NETWORK_DEVICE",
"NETWORK_DEVICE_V4", "NETWORK_DEVICE_V6") instead of only writing to os.environ,
then update os.environ with uplink_updates and call
self._upsert_env_vars(uplink_updates) so the overrides are persisted across
restarts; update the logic around uplink_updates, os.environ and the call to
_upsert_env_vars accordingly.
🧹 Nitpick comments (1)
scripts/nym-node-setup/nym-node-cli.py (1)

228-234: ⚡ Quick win

Remove the stale "nginx_proxy_wss_sh" dict entry at line 230.

The _return_script_url method looks up dict keys based on the script_name argument. Line 33 calls fetch_script("setup-nginx-proxy-wss.sh"), which uses the correct key at line 228. The entry at line 230 is never accessed and can be removed.

♻️ Proposed cleanup
                 "setup-nginx-proxy-wss.sh": f"{github_raw_nymtech_nym_scripts_url}nym-node-setup/setup-nginx-proxy-wss.sh",
                 "start-node-systemd-service.sh": f"{github_raw_nymtech_nym_scripts_url}nym-node-setup/start-node-systemd-service.sh",
-                "nginx_proxy_wss_sh": f"{github_raw_nymtech_nym_scripts_url}nym-node-setup/setup-nginx-proxy-wss.sh",
                 "landing-page.html": f"{github_raw_nymtech_nym_scripts_url}nym-node-setup/landing-page.html",
🤖 Prompt for 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.

In `@scripts/nym-node-setup/nym-node-cli.py` around lines 228 - 234, The scripts
mapping in nym-node-cli.py contains a stale key "nginx_proxy_wss_sh" that
duplicates "setup-nginx-proxy-wss.sh" and is never used by
_return_script_url/fetch_script; remove the "nginx_proxy_wss_sh" entry from the
scripts dict (the dict that includes "setup-nginx-proxy-wss.sh",
"start-node-systemd-service.sh", etc.) and ensure no other code references
"nginx_proxy_wss_sh" before committing.
🤖 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.

Duplicate comments:
In `@scripts/nym-node-setup/nym-node-cli.py`:
- Around line 613-623: The uplink_updates dict is never populated so
_upsert_env_vars is never called; when handling args.uplink_dev,
args.uplink_dev_v4, and args.uplink_dev_v6 you should add the corresponding
key/value pairs to uplink_updates (e.g. "NETWORK_DEVICE", "NETWORK_DEVICE_V4",
"NETWORK_DEVICE_V6") instead of only writing to os.environ, then update
os.environ with uplink_updates and call self._upsert_env_vars(uplink_updates) so
the overrides are persisted across restarts; update the logic around
uplink_updates, os.environ and the call to _upsert_env_vars accordingly.

---

Nitpick comments:
In `@scripts/nym-node-setup/nym-node-cli.py`:
- Around line 228-234: The scripts mapping in nym-node-cli.py contains a stale
key "nginx_proxy_wss_sh" that duplicates "setup-nginx-proxy-wss.sh" and is never
used by _return_script_url/fetch_script; remove the "nginx_proxy_wss_sh" entry
from the scripts dict (the dict that includes "setup-nginx-proxy-wss.sh",
"start-node-systemd-service.sh", etc.) and ensure no other code references
"nginx_proxy_wss_sh" before committing.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f07a9a9f-6c48-4f8c-a8c8-d05021236134

📥 Commits

Reviewing files that changed from the base of the PR and between c41bbac and e22bf4a.

📒 Files selected for processing (1)
  • scripts/nym-node-setup/nym-node-cli.py

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.

nym-node-setup.sh fails on develop branch due to CLI argument mismatch (TypeError)

1 participant