Commit 354190e
authored
daemon-cli: move multicast transport verbs into daemon-cli crate (#4037)
## Summary of Changes
* Move the multicast transport verbs (`multicast
subscribe`/`unsubscribe`/`publish`/`unpublish`) from the `doublezero`
binary into the `doublezero-daemon-cli` crate per
[RFC-20](https://github.com/malbeclabs/doublezero/blob/main/rfcs/rfc20-cli-standardization.md)
— PR 7 of the daemon-cli extraction stack (parent:
malbeclabs/infra#1458).
* The verbs use the RFC-20 execute signature (`CliContext` + generic
`DaemonClient` + `LedgerClient` + writer) but are **not**
`DaemonCommand` variants — the binary's `MulticastCommands` enum nests
them so `doublezero multicast <verb>` invocations are unchanged. Onchain
`multicast group` CRUD still routes to the serviceability crate.
* Delete the binary's `command/helpers.rs` and the
`servicecontroller.rs` remnant (these verbs were their last users; the
crate's `resolve_client_ip`/`DaemonClient` survive), and drop the
now-orphaned deps (`hyper` stack, `chrono`, `indicatif`) from the
binary. Dedupe `init_spinner` into the crate's `helpers.rs` (was copied
verbatim in connect/disconnect/multicast).
* Behavior parity: message text, skip semantics, role-carry flags,
warning conditions, per-group failure aggregation, and exit codes are
unchanged. Informational lines now route through the stdout writer
instead of the stderr spinner, matching the connect/disconnect
migrations.
* Fixes malbeclabs/infra#1493
## Testing Verification
* All 21 binary unit tests ported to the crate and strengthened: they
now exercise the full `execute` path through `MockDaemonClient` (the old
tests bypassed IP resolution via `execute_inner`) and assert rendered
writer output. Added `unsubscribe_errors_when_daemon_has_no_client_ip`
and a publish partial-failure aggregation test (one group fails onchain
→ remaining groups still attempted, aggregated non-zero exit).
* CLI surface verified with the built binary: `doublezero multicast
--help` shows the same five subcommands, `multicast subscribe --help`
unchanged, and no transport verb leaks to the top level.
* Checked e2e usages (`e2e/main_test.go`, `multicast_register_test.go`):
they assert exit codes only, so the stderr→stdout message move is safe.
* Four independent reviews (architecture, security, and two style/domain
reviewers) found no critical/high issues; the `init_spinner` dedup and
publish failure test came out of them.
## Follow-ups (pre-existing behavior deliberately preserved for parity)
* The four verbs skip `check_requirements()`/`check_daemon` preflights
that `connect`/`disconnect` run — a missing keypair or env mismatch
surfaces mid-loop instead of upfront.
* `finish_update` prints the "✅ Updated." line even when every per-group
call failed (exit code is still non-zero).
* Duplicate group args (`subscribe g g`) issue the onchain update twice;
multiple multicast users on one IP are picked in HashMap order.1 parent 66f7811 commit 354190e
14 files changed
Lines changed: 537 additions & 721 deletions
File tree
- client/doublezero
- src
- cli
- command
- crates/doublezero-daemon-cli/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | 24 | | |
32 | 25 | | |
33 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
11 | 17 | | |
12 | 18 | | |
13 | 19 | | |
14 | 20 | | |
15 | 21 | | |
16 | 22 | | |
17 | 23 | | |
18 | | - | |
| 24 | + | |
19 | 25 | | |
20 | 26 | | |
21 | | - | |
| 27 | + | |
22 | 28 | | |
23 | 29 | | |
24 | | - | |
| 30 | + | |
25 | 31 | | |
26 | 32 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
| 33 | + | |
56 | 34 | | |
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | 5 | | |
9 | 6 | | |
| 7 | + | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
| |||
20 | 18 | | |
21 | 19 | | |
22 | 20 | | |
23 | | - | |
24 | 21 | | |
25 | 22 | | |
26 | 23 | | |
| |||
266 | 263 | | |
267 | 264 | | |
268 | 265 | | |
269 | | - | |
270 | 266 | | |
271 | 267 | | |
272 | 268 | | |
| |||
447 | 443 | | |
448 | 444 | | |
449 | 445 | | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
456 | 476 | | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
| 477 | + | |
462 | 478 | | |
463 | 479 | | |
464 | 480 | | |
| |||
0 commit comments