Skip to content

cli: migrate accesspass, resource, and leaf verbs to async#3786

Merged
juan-malbeclabs merged 2 commits into
mainfrom
jo/cli-accesspass-resource-leaves-async
May 29, 2026
Merged

cli: migrate accesspass, resource, and leaf verbs to async#3786
juan-malbeclabs merged 2 commits into
mainfrom
jo/cli-accesspass-resource-leaves-async

Conversation

@juan-malbeclabs
Copy link
Copy Markdown
Contributor

Summary

  • 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 `pub async fn execute(self, ctx, client, out)` signature.
  • Small leaf verbs (`address`, `balance`, `init`, `migrate`, `keygen`) adopt `require!` and `print_signature` where applicable. Larger and 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` stdin parameter is preserved; `_ctx` is inserted after `self`.
  • `config get`/`set` tests gain a per-file `block_on` shim and `cli_context_default_for_tests()` import so the existing sync `#[test]` bodies can still drive the now-async `execute`.
  • Forward `&ctx` and `.await` every accesspass, resource, and leaf arm in the serviceability dispatcher, the `doublezero` binary, and `controlplane/doublezero-admin`.

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

Related RFC: RFC-20 CLI standardization.

Testing Verification

  • All 345 unit tests in `doublezero-serviceability-cli` pass without assertion changes; the `Signature:` lines, table layouts, JSON output, and `config get`/`set` text output match the pre-refactor strings byte-for-byte.
  • `make rust-lint` clean across all 9 clippy invocations with `-Dclippy::all -Dwarnings`.

@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-tenant-permission-async branch from 9041a53 to 34ba4d8 Compare May 28, 2026 19:28
@juan-malbeclabs juan-malbeclabs force-pushed the jo/cli-accesspass-resource-leaves-async branch from d39c02e to 8867305 Compare May 28, 2026 19:33
@juan-malbeclabs juan-malbeclabs force-pushed the jo/cli-tenant-permission-async branch 2 times, most recently from 5ebd7de to 24012de Compare May 28, 2026 20:40
@juan-malbeclabs juan-malbeclabs force-pushed the jo/cli-accesspass-resource-leaves-async branch from 8867305 to cba3a76 Compare May 28, 2026 20:40
@juan-malbeclabs juan-malbeclabs force-pushed the jo/cli-tenant-permission-async branch from 24012de to f24a7ec Compare May 28, 2026 21:13
@juan-malbeclabs juan-malbeclabs force-pushed the jo/cli-accesspass-resource-leaves-async branch from cba3a76 to 7f7b7d8 Compare May 28, 2026 21:17
Base automatically changed from jo/cli-tenant-permission-async to main May 29, 2026 15:06
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
@juan-malbeclabs juan-malbeclabs enabled auto-merge (squash) May 29, 2026 15:21
@juan-malbeclabs juan-malbeclabs merged commit 566d470 into main May 29, 2026
33 checks passed
@juan-malbeclabs juan-malbeclabs deleted the jo/cli-accesspass-resource-leaves-async branch May 29, 2026 15:38
juan-malbeclabs added a commit that referenced this pull request May 29, 2026
)

## 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](#3786) →
[#3785](#3785) →
[#3784](#3784) →
[#3783](#3783) →
[#3782](#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](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 (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.
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