Skip to content

feat: add support for the --all to proxy remove#834

Open
eureka928 wants to merge 10 commits intoopentensor:stagingfrom
eureka928:feat/proxy-remove-all-v2
Open

feat: add support for the --all to proxy remove#834
eureka928 wants to merge 10 commits intoopentensor:stagingfrom
eureka928:feat/proxy-remove-all-v2

Conversation

@eureka928
Copy link
Contributor

Summary

Refactor of #791, addressing reviewer feedback from @thewhaleking.

This PR adds the --all flag to btcli proxy remove so users can remove all proxies in a single operation. The two review comments on #791 have been addressed:

  1. Error on conflicting args instead of warning (comment): Providing --delegate together with --all now returns an error instead of silently ignoring the delegate.
  2. Combine into single function with a flag (comment): The separate remove_proxies() function has been merged into the existing remove_proxy() function using a remove_all: bool = False parameter, reducing code duplication.

Type of change

  • New feature (non-breaking)
  • Refactor (addresses code review feedback)

What's changed

File Change
`bittensor_cli/cli.py` Added `--all` flag to `proxy_remove` command; validation rejects conflicting `--delegate` + `--all`; routes `remove_all` flag to the unified function
`bittensor_cli/src/commands/proxy.py` Combined `remove_proxies()` into `remove_proxy()` with `remove_all` flag; branches prompt, call composition, and extrinsic based on the flag
`tests/e2e_tests/test_proxy.py` E2E tests: remove all proxies, validation errors, single proxy removal
`tests/unit_tests/test_cli.py` Unit tests: missing args error, conflicting args error, `--all` flag routing, single delegate routing

CLI validation flow

  1. Neither `--delegate` nor `--all` provided → error
  2. Both `--delegate` and `--all` provided → error
  3. `--all` only → calls `remove_proxy(..., remove_all=True)`
  4. `--delegate` only → calls `remove_proxy(..., remove_all=False)`

Usage

```bash

Remove a single proxy

btcli proxy remove --delegate 5GDel... --proxy-type Transfer --delay 0

Remove all proxies (requires typing "REMOVE" to confirm)

btcli proxy remove --all

Remove all proxies without prompt

btcli proxy remove --all --no-prompt
```

Testing

Unit tests

```
$ pytest tests/unit_tests/test_cli.py -v -k proxy
tests/unit_tests/test_cli.py::test_proxy_remove_requires_delegate_or_all PASSED
tests/unit_tests/test_cli.py::test_proxy_remove_requires_delegate_or_all_json PASSED
tests/unit_tests/test_cli.py::test_proxy_remove_with_all_and_delegate_errors PASSED
tests/unit_tests/test_cli.py::test_proxy_remove_with_all_flag PASSED
tests/unit_tests/test_cli.py::test_proxy_remove_with_delegate_calls_remove_proxy PASSED
```

Lint

```
$ ruff format --check bittensor_cli tests
All checks passed!
```

Checklist

Contribution by Gittensor, learn more at https://gittensor.io/

@eureka928 eureka928 changed the title refactor: combine remove_proxies into remove_proxy with remove_all flag feat: add support for the --all to proxy remove Feb 23, 2026
@eureka928
Copy link
Contributor Author

Hi @thewhaleking would you review my PR?
Thank you

@eureka928 eureka928 force-pushed the feat/proxy-remove-all-v2 branch from f576009 to 874e5e6 Compare February 23, 2026 15:45
@thewhaleking thewhaleking requested a review from a team February 23, 2026 15:51
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.

1 participant