Feature/sma 85 migrate vote commands to rest api#132
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # src/node-control/service/src/http/config_handlers.rs
There was a problem hiding this comment.
Pull request overview
This PR migrates config-proposal voting functionality from local CLI config reads/writes into the nodectl service control-plane REST API, making the CLI a thin REST client and adding E2E coverage for the new endpoints.
Changes:
- Added voting REST endpoints (
/v1/voting/*) with role-appropriate auth and OpenAPI exposure. - Implemented voting DTOs + handlers backed by runtime config persistence (
update_and_save) and on-chain Config contract reads. - Updated
nodectl voteCLI to call the service API, plus docs/tests/E2E smoke checks for the new flows.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/node/tests/test_run_net_py/run_singlehost_nodectl.py | Adds phase-13 voting REST + CLI smoke checks and REST URL/token helpers. |
| src/node/tests/test_run_net_py/readme.md | Documents the single-host nodectl E2E script and the voting REST smoke checks. |
| src/node-control/service/src/http/http_server_task.rs | Registers voting routes (GET under nominator auth; POST/DELETE operator-only) and adds OpenAPI wiring/tests. |
| src/node-control/service/src/http/config_handlers.rs | Introduces voting DTOs and /v1/voting/* handlers (config snapshot, list/inspect proposals, tracked-list mutations). |
| src/node-control/service/src/http/config_handlers_tests.rs | Adds unit tests for voting config snapshot + tracked-list add/rm behavior (auth disabled). |
| src/node-control/service/src/http/auth_tests.rs | Adds auth coverage for voting endpoints (401/200/403 cases). |
| src/node-control/README.md | Updates CLI/docs to reflect nodectl vote as a REST client and documents the new endpoints and flags. |
| src/node-control/commands/src/commands/nodectl/vote_cmd.rs | Refactors vote subcommands to use shared REST client helpers and service URL/token resolution. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Keshoid
left a comment
There was a problem hiding this comment.
Solid PR overall — REST handlers mirror the existing CRUD shape, auth split is correct, and the smoke test covers the read paths. A handful of small simplifications and a couple of test gaps below; none blocking.
A single follow-up that addresses items 1, 2, 3, 4, 7, 9 (plus the operator-allowed auth test) should shave ~30–40 lines off the diff with no behavior change.
Summary
Migrates config-proposal voting to the nodectl control HTTP API: read endpoints for nominators (and operators), operator-only mutations for the tracked proposal list, persistence via update_and_save, and config_changed notifications. The nodectl vote CLI is now a thin REST client (shared URL, token, and config resolution with other REST commands).
Changes