feat(tools): add linux-diag/ dispatcher for speedtest-cli, iperf3, mtr, traceroute - #13
Conversation
…r, traceroute
lzt-netdiag (164 LOC) is a thin bash dispatcher over the four
network diagnostic tools that are not packaged for Debian Forky
upstream. They run inside an Arch Linux distrobox (arch-loust) and
are exported back to host PATH via distrobox-export --bin.
Why a dispatcher instead of calling the wrappers directly:
- One short command (lzt-netdiag st --simple) instead of writing
'distrobox enter arch-loust -- speedtest-cli --simple' each time
- Tab-completion target (single canonical name with subcommands)
- Local-only affordances: 'host' (NIC auto-detect via sysfs +
iproute2) and 'version' (one-liner of all 4 versions)
Subcommands: st | i3 | mtr | trace | host | version | --help.
Pre-flight: ensure_container_running + check_tool for all 4 binaries,
fail-fast with actionable error message.
.gitignore: tools/ is gitignored for one-off dev scripts. Add explicit
exception !tools/linux-diag/ so the dispatcher + README are committed.
Verified: bash -n OK, shellcheck clean (after read -ra for word-split
intent), lzt-netdiag --help extracts the doc block, lzt-netdiag host
prints NIC inventory including wireless wlp3s0 on this host.
|
Warning Review limit reached
Next review available in: 6 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds the tracked ChangesLinux network diagnostics
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Operator
participant lzt-netdiag
participant distrobox
participant HostDiagnostics
Operator->>lzt-netdiag: invoke subcommand
lzt-netdiag->>distrobox: validate container and exported tools
distrobox-->>lzt-netdiag: prerequisite status
alt tool subcommand
lzt-netdiag->>distrobox: run selected network tool
distrobox-->>Operator: diagnostic output
else host subcommand
lzt-netdiag->>HostDiagnostics: inspect local network state
HostDiagnostics-->>Operator: host diagnostic output
end
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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: 8
🤖 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 @.gitignore:
- Line 61: Update the .gitignore rules for tools/linux-diag so the ignored
tools/ parent directory and its contents are explicitly re-included, allowing
lzt-netdiag and README.md to be tracked. Preserve the intended exclusion of
unrelated tools entries, and verify both files with git check-ignore -v.
In `@tools/linux-diag/lzt-netdiag`:
- Around line 57-60: Align the missing-tool exit status across the diagnostic
script and documentation: update die() in tools/linux-diag/lzt-netdiag (57-60)
to use the selected status, make check_tool() in tools/linux-diag/lzt-netdiag
(84-88) consistently return that status, and document the same status in
tools/linux-diag/README.md (82-89).
- Around line 142-145: Update the gateway reachability block in lzt-netdiag to
detect whether the host-side ping command is available, report it as unavailable
when missing, and continue the diagnostic without aborting; otherwise preserve
the existing unreachable/reachability output. In tools/linux-diag/README.md
lines 101-106, document the required host package or explicitly state the
supported ping prerequisite.
- Around line 18-26: Ensure the canonical setup instructions install or verify
the package providing /usr/bin/traceroute before exporting it in
tools/linux-diag/lzt-netdiag lines 18-26, then mirror the same guaranteed setup
step in tools/linux-diag/README.md lines 33-45 so both documented setup surfaces
are consistent.
- Around line 90-94: Scope the preflight block in tools/linux-diag/lzt-netdiag
around ensure_container_running and check_tool so help and host dispatch without
container or tool checks, while commands requiring those dependencies retain the
appropriate checks. Preserve the local-only/help contract documented in
tools/linux-diag/README.md lines 26-28; no direct README change is needed unless
the implementation requires documentation alignment.
- Around line 71-81: Update ensure_container_running to filter distrobox list
output for ${CONTAINER_NAME} before evaluating its status, removing the global
“any container is Up” shortcut. Explicitly fail when the requested container is
missing, and require its row to report Up while handling supported distrobox
list output formats without relying on a fixed positional field.
- Around line 122-130: Update the wireless-interface parsing in the wl_list
handling block to use mapfile -t or readarray, preserving every
newline-separated interface from the subshell. Keep the existing printf output
and wireless-directory detection unchanged.
In `@tools/linux-diag/README.md`:
- Around line 47-48: Update the installation instructions near the lzt-netdiag
install command to create ~/.local/bin before installing, using either mkdir -p
or install’s directory-creation option, while preserving the existing 0755
permissions and destination.
🪄 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 Plus
Run ID: 635af002-e711-43d6-a48d-0c4a9b8650ee
📒 Files selected for processing (3)
.gitignoretools/linux-diag/README.mdtools/linux-diag/lzt-netdiag
|
|
||
| # Development tools (NOT for end users - gitignored) | ||
| tools/ # Dev scripts (screenshot gen, favicon gen, etc.) | ||
| !tools/linux-diag/ # Linux network diagnostics dispatcher (lzt-netdiag) - COMMITTED |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Re-include the parent directory and its contents.
Because tools/ is ignored, the negation for tools/linux-diag/ does not make tools/linux-diag/lzt-netdiag or README.md trackable. Use parent/content exception rules, for example:
+!tools/
+tools/*
!tools/linux-diag/
+!tools/linux-diag/**Verify with git check-ignore -v tools/linux-diag/lzt-netdiag tools/linux-diag/README.md.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| !tools/linux-diag/ # Linux network diagnostics dispatcher (lzt-netdiag) - COMMITTED | |
| !tools/ | |
| tools/* | |
| !tools/linux-diag/ | |
| !tools/linux-diag/** |
🤖 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 @.gitignore at line 61, Update the .gitignore rules for tools/linux-diag so
the ignored tools/ parent directory and its contents are explicitly re-included,
allowing lzt-netdiag and README.md to be tracked. Preserve the intended
exclusion of unrelated tools entries, and verify both files with git
check-ignore -v.
| die() { | ||
| echo "lzt-netdiag: $*" >&2 | ||
| exit 1 | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Align the missing-tool exit-code contract.
tools/linux-diag/lzt-netdiag#L57-L60: return 127 for missing exported tools, or change the documented status.tools/linux-diag/lzt-netdiag#L84-L88: makecheck_tool()use the selected status consistently.tools/linux-diag/README.md#L82-L89: document the same status exposed by the script.
📍 Affects 2 files
tools/linux-diag/lzt-netdiag#L57-L60(this comment)tools/linux-diag/lzt-netdiag#L84-L88tools/linux-diag/README.md#L82-L89
🤖 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 `@tools/linux-diag/lzt-netdiag` around lines 57 - 60, Align the missing-tool
exit status across the diagnostic script and documentation: update die() in
tools/linux-diag/lzt-netdiag (57-60) to use the selected status, make
check_tool() in tools/linux-diag/lzt-netdiag (84-88) consistently return that
status, and document the same status in tools/linux-diag/README.md (82-89).
| printf "\n=== Gateway reachability (5 pings) ===\n" | ||
| gw="$(ip route show default 2>/dev/null | awk '/default/ {print $3; exit}')" | ||
| if [ -n "$gw" ]; then | ||
| ping -c 5 -W 2 "$gw" 2>&1 | tail -4 |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Declare and handle the host-side ping dependency.
tools/linux-diag/lzt-netdiag#L142-L145: checkpingand report unavailable/unreachable without aborting the diagnostic.tools/linux-diag/README.md#L101-L106: list the required host package or explicitly document the supported prerequisite.
📍 Affects 2 files
tools/linux-diag/lzt-netdiag#L142-L145(this comment)tools/linux-diag/README.md#L101-L106
🤖 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 `@tools/linux-diag/lzt-netdiag` around lines 142 - 145, Update the gateway
reachability block in lzt-netdiag to detect whether the host-side ping command
is available, report it as unavailable when missing, and continue the diagnostic
without aborting; otherwise preserve the existing unreachable/reachability
output. In tools/linux-diag/README.md lines 101-106, document the required host
package or explicitly state the supported ping prerequisite.
| # 3. Drop this directory on the host | ||
| install -m 0755 lzt-netdiag ~/.local/bin/lzt-netdiag |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Create the install destination first.
install -m does not create ~/.local/bin; setup fails on hosts where that directory is absent. Add mkdir -p ~/.local/bin or use install -Dm0755.
🤖 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 `@tools/linux-diag/README.md` around lines 47 - 48, Update the installation
instructions near the lzt-netdiag install command to create ~/.local/bin before
installing, using either mkdir -p or install’s directory-creation option, while
preserving the existing 0755 permissions and destination.
- Scope preflight (ensure_container_running + check_tool) to only the four network-tool subcommands (st, i3, mtr, trace). 'help', 'host', and 'version' no longer require the distrobox exports; 'host' is purely local sysfs/iproute2. - ensure_container_running: filter distrobox list output by CONTAINER_NAME first, then check its Up status. The previous awk-based 'any container is Up' shortcut silently passed when another distrobox was running but ours was not. - Use mapfile -t for wireless interfaces (was read -ra <<< which only consumes the first line of the subshell output). - Add die_missing_tool with exit 127 to match the documented exit code for missing host exports; die() with exit 1 is reserved for argument/container errors. - 'host' gateway reachability: guard the ping command with command -v; previously a missing iputils-ping would have aborted the whole 'host' run under set -e. - Setup instructions: add 'traceroute' to pacman -S in both the script header and README so the export block doesn't 404. Verified: bash -n, shellcheck clean, host subcommand still prints wlp3s0 + gateway pings, version reports all 4 versions + container, --help extracts doc block, unknown subcommand still exits 1.
Summary
Adds
tools/linux-diag/lzt-netdiag, a thin bash dispatcher over four networkdiagnostic tools that are not packaged for Debian Forky upstream
(
speedtest-cli,iperf3,mtr,traceroute). They run inside an ArchLinux distrobox (
arch-loust) and are exported back to host PATH viadistrobox-export --bin.Why a dispatcher instead of calling the wrappers directly?
distrobox enter arch-loust -- speedtest-cli --simplelzt-netdiag st --simpleiw dev,ip routelzt-netdiag hostSubcommands
stspeedtest-clii3iperf3mtrmtrtracetraceroutehostversion-h,--help,help, no argsWhy is this in NetBoozt?
The NetBoozt platform targets Windows users, but the build & maintain
workflow runs on Debian. When validating a release that claims "improved
connection-resilience on lossy networks", we need to reproduce typical
home-network pathologies — packet loss, MTU black holes, slow DNS,
asymmetric bandwidth — without polluting the host distro with Arch-only
packages. The dispatcher pattern lets the maintainer reproduce field issues
deterministically while keeping the host clean.
Files
tools/linux-diag/lzt-netdiagset -euo pipefail)tools/linux-diag/README.md.gitignore!tools/linux-diag/Verification
bash -n→ SYNTAX OKshellcheck→ ALL CLEAN (SC2086 resolved viaread -ra wl_arr)lzt-netdiag --help→ extracts doc block via sed, exit 0lzt-netdiag host→ prints NICs (wlp3s0 UP 192.168.1.67, enp2s0 DOWN, 6 docker bridges)lzt-netdiag version→ speedtest-cli 2.1.3 / iperf 3.21 / mtr 0.96 / traceroute 2.1.6distrobox listconfirms containerarch-loust(Up 3 hours, docker.io/library/archlinux:latest)Setup (one-time)
distrobox create -i archlinux:latest -n arch-loust distrobox enter arch-loust -- sudo pacman -S speedtest-cli iperf3 mtr distrobox enter arch-loust -- distrobox-export \ --bin /usr/bin/speedtest-cli \ --bin /usr/bin/iperf3 \ --bin /usr/bin/mtr \ --bin /usr/bin/traceroute \ --export-path ~/.local/bin/ install -m 0755 tools/linux-diag/lzt-netdiag ~/.local/bin/lzt-netdiagOut of scope
CLI companion only. Wiring it into NetBoozt's Tauri UI (e.g. a new
"diagnostics" tab) would be a separate PR and a separate discussion.
Windows-targeted (
runs-on: windows-latest); this is for the maintainer'sDebian build host only.
Summary by CodeRabbit
New Features
lzt-netdiag, a network diagnostics tool supporting speed tests, throughput testing, route analysis, and traceroute.Documentation