Skip to content

fix(cli): surface contract read failures in gitt issues list#1358

Open
carlos4s wants to merge 1 commit into
entrius:testfrom
carlos4s:fix/surface-contract-read-failures
Open

fix(cli): surface contract read failures in gitt issues list#1358
carlos4s wants to merge 1 commit into
entrius:testfrom
carlos4s:fix/surface-contract-read-failures

Conversation

@carlos4s
Copy link
Copy Markdown
Contributor

@carlos4s carlos4s commented May 24, 2026

Summary

gitt issues list used to treat contract-read failures as an empty issue list. When the RPC/contract read failed, the helper returned [], so the command emitted success: true, issue_count: 0, and exited 0.

This PR makes contract-read failures explicit:

  • gitt issues list --json now emits success: false with error.type == "read_failed" and exits 1.
  • Human mode now prints the read error and exits 1.
  • A reachable contract with zero issues still returns success: true, issue_count: 0, issues: [], and exits 0.
  • Missing substrateinterface now returns error.type == "missing_dependency" and keeps the Install with: uv sync hint.

The fix also lets deeper contract-info / packed-storage read failures propagate instead of being silently converted to [] / None.

fetch_issue_from_contract, used by gitt issues submissions --id ..., now also surfaces contract-read failures instead of turning them into the misleading Issue ID <N> not found on-chain. message.

Related Issues

Closes #1357

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other

Before / After

JSON mode before

$ uv run gitt issues list --rpc-url ws://127.0.0.1:1 --contract 5GrwvaEF5zXb26Fz9rcQpDWS2Tw7Rn3myGUFcLDN7Jxxpx12 --json
Network: custom • Contract: 5GrwvaEF5zXb...xxpx12
Error reading from contract: [Errno 111] Connection refused
{
  "success": true,
  "issue_count": 0,
  "issues": []
}
$ echo $?
0

JSON mode after

$ uv run gitt issues list --rpc-url ws://127.0.0.1:1 --contract 5GrwvaEF5zXb26Fz9rcQpDWS2Tw7Rn3myGUFcLDN7Jxxpx12 --json
Network: custom • Contract: 5GrwvaEF5zXb...xxpx12
{"success": false, "error": {"type": "read_failed", "message": "Error reading from contract: [Errno 111] Connection refused"}}
$ echo $?
1

Human mode after

$ uv run gitt issues list --rpc-url ws://127.0.0.1:1 --contract 5GrwvaEF5zXb26Fz9rcQpDWS2Tw7Rn3myGUFcLDN7Jxxpx12
Network: custom • Contract: 5GrwvaEF5zXb...xxpx12

✗ Error reading from contract: [Errno 111] Connection refused

$ echo $?
1

Testing

Added regression tests for:

  • JSON contract-read failure returns success: false and exits non-zero.
  • Human contract-read failure exits non-zero and does not print No issues found.
  • Empty reachable contract still succeeds with issue_count: 0.
  • Deeper storage-read failure propagates as read_failed.
  • Missing dependency keeps the uv sync install hint.
  • gitt issues submissions --json surfaces contract-read failure as success: false instead of issue not found.

Commands run:

uv run pytest tests/cli/test_issues_list_json.py -q
uv run pytest tests/cli/test_issues_list_json.py tests/cli/test_issue_submission.py -q
uv run pytest tests/ -q
uv run ruff check gittensor/ tests/
uv run ruff format --check gittensor/ tests/
uv run pyright gittensor/cli/issue_commands/helpers.py gittensor/cli/issue_commands/view.py tests/cli/test_issues_list_json.py
uv run pre-commit run --hook-stage pre-push --files <changed files>

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Tests added/updated

@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label May 24, 2026
@carlos4s carlos4s force-pushed the fix/surface-contract-read-failures branch from 3d721af to b7b77d7 Compare May 24, 2026 23:40
@carlos4s carlos4s force-pushed the fix/surface-contract-read-failures branch from b7b77d7 to 3c2e662 Compare May 24, 2026 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] gitt issues list exits 0 with success=true when contract read fails

1 participant