Skip to content

cli: migrate device, interface, link, and topology verbs to async#3787

Merged
juan-malbeclabs merged 5 commits into
mainfrom
jo/cli-device-link-async
May 29, 2026
Merged

cli: migrate device, interface, link, and topology verbs to async#3787
juan-malbeclabs merged 5 commits into
mainfrom
jo/cli-device-link-async

Conversation

@juan-malbeclabs
Copy link
Copy Markdown
Contributor

Summary

  • Flip all 11 `device` and `device interface` verbs and all 14 `link` and `topology` verbs to the RFC-20 `pub async fn execute(self, ctx, client, out)` signature.
  • Signature-only sweep. Verb bodies (including `--wait` polling via `poll_for_*_activated`, per-verb requirement checks, and `Signature:` writes) are unchanged. Helper adoption (`require!`, `render_collection`, `render_record`, `print_signature`) lands opportunistically in follow-ups; the `--wait` polling flow needs special handling there.
  • Test files gain a per-file `block_on` shim and `cli_context_default_for_tests()` import so the existing sync `#[test]` bodies can drive the now-async `execute`.
  • Forward `&ctx` and `.await` every device, interface, link, and topology arm in the serviceability dispatcher, the `doublezero` binary, and `controlplane/doublezero-admin`.

Stacked on top of #3786#3785#3784#3783#3782. Review and merge in order.

Note on size: this PR is mechanical sweep across 29 files (~700 LOC of net new code, mostly per-file `block_on` shims). It exceeds the usual 500-LOC budget because bundling these resources cuts down the PR count, per the project's preference for fewer, related PRs.

Related RFC: RFC-20 CLI standardization.

Testing Verification

  • All 345 unit tests in `doublezero-serviceability-cli` pass without assertion changes (92 in the migrated modules: device 46, link 29, topology 17).
  • `make rust-lint` clean across all 9 clippy invocations with `-Dclippy::all -Dwarnings`.
  • `cargo build -p doublezero -p doublezero-admin` clean — the binary and admin dispatchers compile against the new async signatures.

@juan-malbeclabs juan-malbeclabs force-pushed the jo/cli-accesspass-resource-leaves-async branch from a5cf590 to d39c02e Compare May 28, 2026 19:28
@juan-malbeclabs juan-malbeclabs force-pushed the jo/cli-device-link-async branch 2 times, most recently from 7146659 to a0a4b34 Compare May 28, 2026 19:33
@juan-malbeclabs juan-malbeclabs force-pushed the jo/cli-accesspass-resource-leaves-async branch 2 times, most recently from 8867305 to cba3a76 Compare May 28, 2026 20:40
@juan-malbeclabs juan-malbeclabs force-pushed the jo/cli-device-link-async branch from a0a4b34 to 03dd64b Compare May 28, 2026 20:40
@juan-malbeclabs juan-malbeclabs force-pushed the jo/cli-accesspass-resource-leaves-async branch from cba3a76 to 7f7b7d8 Compare May 28, 2026 21:17
@juan-malbeclabs juan-malbeclabs force-pushed the jo/cli-device-link-async branch from 03dd64b to 9a9618b Compare May 28, 2026 21:17
Flip all six accesspass verbs (set, close, list, get, user-balances,
fund), all six resource verbs (allocate, create, deallocate, get,
close, verify), and the eight leaf single-file verbs (address,
balance, init, migrate, keygen, export, config get, config set) to
the RFC-20 async fn execute(self, ctx, client, out) signature.

The five small leaf verbs (address, balance, init, migrate, keygen)
adopt require! and print_signature where applicable. The larger and
more idiosyncratic verbs (config get/set, export, all accesspass and
resource verbs) keep their existing bodies for now and only get the
signature flip; helper adoption lands opportunistically in follow-ups.

accesspass fund's bespoke R: BufRead signature is preserved; the
_ctx parameter is inserted after self. config get/set tests gain a
per-file block_on shim so the existing sync #[test] bodies can still
drive the now-async execute. The doublezero binary, admin, and the
serviceability dispatcher all forward ctx and await every accesspass,
resource, and leaf arm. All 345 unit tests pass byte-identically.
…erb tests

Drop the per-verb local block_on copies in favor of the
doublezero_cli_core::testing::block_on helper lifted in the
location PR, matching the location reference verb.
@juan-malbeclabs juan-malbeclabs force-pushed the jo/cli-accesspass-resource-leaves-async branch from 7f7b7d8 to 7b4c9bc Compare May 29, 2026 15:19
Flip all 11 device and device interface verbs (device create, update,
list, get, delete, set-health plus interface create, update, list,
get, delete) and all 14 link and topology verbs (link accept, delete,
wan-create, dzx-create, get, latency, list, set-health, update plus
topology assign-node-segments, clear, create, delete, list) to the
RFC-20 async fn execute(self, ctx, client, out) signature.

Signature-only sweep: verb bodies (including --wait polling via
poll_for_*_activated, per-verb requirement checks, and Signature
writes) are unchanged. Test files gain a per-file block_on shim and
cli_context_default_for_tests() import so the existing sync #[test]
bodies drive the now-async execute. The doublezero binary, admin, and
the serviceability dispatcher all forward ctx and await every device,
interface, link, and topology arm. All 345 unit tests pass byte-
identically (92 in the migrated modules: device 46, link 29, topology
17). Helper adoption lands opportunistically in follow-up PRs; the
--wait polling flow needs special handling there.
…ogy verb tests

Drop the per-verb local block_on copies in favor of the
doublezero_cli_core::testing::block_on helper lifted in the
location PR, matching the location reference verb.
@juan-malbeclabs juan-malbeclabs force-pushed the jo/cli-device-link-async branch from 9a9618b to 5026122 Compare May 29, 2026 15:34
Base automatically changed from jo/cli-accesspass-resource-leaves-async to main May 29, 2026 15:38
@juan-malbeclabs juan-malbeclabs enabled auto-merge (squash) May 29, 2026 15:50
@juan-malbeclabs juan-malbeclabs merged commit b3f34dc into main May 29, 2026
33 checks passed
@juan-malbeclabs juan-malbeclabs deleted the jo/cli-device-link-async branch May 29, 2026 15:58
juan-malbeclabs added a commit that referenced this pull request May 29, 2026
…to async (#3789)

## Summary

- Flip the 5 \`multicastgroup\` CRUD verbs, 6 \`multicastgroup
allowlist\` verbs (publisher + subscriber \`add\`/\`list\`/\`remove\`),
6 foundation/QA \`allowlist\` verbs, 8 \`user\` verbs (\`create\`,
\`create-subscribe\`, \`subscribe\`, \`request-ban\`, \`update\`,
\`list\`, \`get\`, \`delete\`), and 9 \`globalconfig\` verbs / sub-tree
verbs (\`get\`, \`set\`, \`set-version\`, \`airdrop\`, \`authority\`,
\`feature-flags\`) to the RFC-20 \`pub async fn execute(self, ctx,
client, out)\` signature.
- \`MulticastGroupCommands::execute\` itself flips from sync to async
and propagates \`ctx\` through its nested allowlist arms; the binary's
\`Multicast\` arm becomes \`args.command.execute(&ctx, &client, &mut
handle).await\` (single line).
- Signature-only sweep. Verb bodies (\`--wait\` polling in \`user
create-subscribe\`/\`subscribe\`, the bespoke \`multicastgroup update\`
re-fetch flow, all requirement checks, all output) are unchanged.
- Test files gain the per-file \`block_on\` shim and
\`cli_context_default_for_tests()\` import.
- Forward \`&ctx\` and \`.await\` every multicastgroup, allowlist, user,
and globalconfig arm in the serviceability dispatcher, the
\`doublezero\` binary, and \`controlplane/doublezero-admin\`.

**Stacked on top of
[#3787](#3787) → ... →
[#3782](#3782 Review
and merge in order; this is the last PR in the sequence — after it
merges, **every** serviceability verb is on the RFC-20 \`async fn
execute(self, ctx, client, out)\` contract.

Related RFC: [RFC-20 CLI
standardization](https://github.com/malbeclabs/doublezero/blob/main/rfcs/rfc20-cli-standardization.md).

## Testing Verification

- All 345 unit tests in \`doublezero-serviceability-cli\` pass without
assertion changes.
- \`make rust-lint\` clean across all 9 clippy invocations with
\`-Dclippy::all -Dwarnings\`.
- \`cargo build -p doublezero -p doublezero-admin\` clean — the binary
and admin dispatchers compile against the new async signatures
everywhere.
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.

2 participants