Skip to content

fix(scripts): preserve successful peer query exit status - #703

Merged
n13 merged 1 commit into
Quantus-Network:mainfrom
Kewe63:fix/query-peers-exit-status
Sep 19, 2026
Merged

n13 merged 1 commit into
Quantus-Network:mainfrom
Kewe63:fix/query-peers-exit-status

Conversation

@Kewe63

@Kewe63 Kewe63 commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #702.

Use arithmetic expansion assignments for the successful-host count and total peer count in scripts/query_peers.sh. Unlike standalone arithmetic commands, these assignments do not return failure when the expression evaluates to zero under set -e.

This prevents both the first successful query from terminating the script and a successful text-mode query with zero peers from triggering the same early-exit behavior. All-failed queries continue to return exit status 1.

Tests

  • python3 scripts/testing/test_query_peers.py — 6 tests passed, covering JSON/text output, zero peers, multiple hosts, partial success in both host orders, and all-failed queries.
  • The tests failed on the original script. After fixing only the success counter, the zero-peer text case still failed; fixing the total counter made the suite pass.
  • bash -n scripts/query_peers.sh — passed.
  • git diff --check — passed.

The regression suite runs the actual project script with only curl stubbed; bash and jq remain real dependencies. No live node or public network is used. Run the Python suite explicitly; it is not added to the Rust CI workflow.

Scope and risk

Two shell expressions changed, plus an offline regression test file. No node/runtime code, RPC protocol, or dependency changes. No full Rust build was needed or run for this shell-only fix.

AI assistance

AI assistance was used to investigate, implement, and test this change. Test results above come from actual local execution.

@n13

n13 commented Sep 19, 2026

Copy link
Copy Markdown
Collaborator

Ok sure ... our scripts really are dev tools, and rough

@n13 n13 added the bot-review label Sep 19, 2026

@n13 n13 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer model: GPT 5.6 Sol

APPROVE — the assignment-form arithmetic fixes both set -e exit paths without changing the intended counting behavior.

No blocking findings. success_count=$((success_count + 1)) cannot inherit the zero result status of the old post-increment command, and total_peers=$((total_peers + peer_count)) likewise keeps a valid zero-peer response from terminating text mode. The regression coverage exercises JSON/text success, zero peers, multiple hosts, both partial-failure orders, and the all-failed status.

Validation at a0c9c8c270d3d56d8948ebf5b4aabe115313a6eb:

  • python3 -B scripts/testing/test_query_peers.py — 6 tests passed.
  • bash -n scripts/query_peers.sh — passed.
  • git diff --check 662ef6d1dea8f3572776b8db9da1f57283744fd2...a0c9c8c270d3d56d8948ebf5b4aabe115313a6eb — passed.
  • GitHub format, dependency-cooldown, and Clippy/doc checks passed; the Linux and macOS build/test matrix jobs were still running at review time.

@n13 n13 removed the bot-review label Sep 19, 2026
@n13

n13 commented Sep 19, 2026

Copy link
Copy Markdown
Collaborator

Safe to merge - just the script bugfix

@n13
n13 merged commit 7fc3553 into Quantus-Network:main Sep 19, 2026
7 checks passed
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.

scripts/query_peers.sh exits 1 after a successful peer query

2 participants