Repository navigation
feat(cli): list wallets in every organization with --all-orgs - #74
Merged
thebrandonlucas merged 1 commit intoOct 21, 2026
Merged
Conversation
The API lists wallets one organization at a time, and each organization needs its own token, so `wallets list --all-orgs` lists the browser login's organizations, then exchanges a token and reads the wallets for each, four at a time. The results merge into one list, and each wallet gains `organization_id` and `organization_name`, which the table shows. An API key belongs to one organization, so it is refused with a hint, and `--org` or `--env` cannot be combined with the flag. When some organizations fail, the others' wallets are written and the command then fails with the first failure's exit code, naming each failed organization in `error.detail.failed_organizations`. When all fail, nothing is written, and when they all fail the same way, as for a revoked login, that error is reported with its own hint and detail. Closes #34
thebrandonlucas
force-pushed
the
feat/cli-wallets-all-orgs
branch
from
October 21, 2026 17:42
70c5aa0 to
24cd775
Compare
thebrandonlucas
marked this pull request as ready for review
October 21, 2026 17:52
tee8z
previously approved these changes
Oct 21, 2026
tee8z
left a comment
Contributor
There was a problem hiding this comment.
Approved 24cd775 against feat/cli-invoice-wallet-shortlist (#73 ed53d14). The changes requested on #73 still block this stack.
- The parallel reads are safe:
AuthService::exchangeis a stateless token exchange that neither refreshes nor writes anything, andresolvehas already refreshed the login once.buffered(4)keeps the organization order, somerge'szippairs each result with its organization. - An API key is refused before any request.
--organd--envconflict at parse time, and the picker asks nothing. - On partial failure, the wallets that were read are written, and then the first failure's kind sets the exit code. When every organization fails, nothing is written. When they all fail the same way, as with a revoked login, that error keeps its own hint and
credential_problemdetail. - Each organization's error has already been redacted by
Api::send, sofailed_organizationsexposes no secret.
Nonblocking: COLUMNS puts organization_name in every table, not only this listing. That has no effect today, because no other listing returns the field.
Validation on this head, in nix develop: cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings, cargo machete --with-metadata, cargo test --locked (129 unit, 112 integration) and python3 scripts/check-coverage.py passed. CRAP: 596 measured functions, none at or above 20, highest wait_for_payment at 19.60; 162 functions were unmeasured. CI is green.
thebrandonlucas
force-pushed
the
feat/cli-wallets-all-orgs
branch
2 times, most recently
from
October 21, 2026 19:31
b73454e to
ce71c69
Compare
thebrandonlucas
changed the base branch from
feat/cli-invoice-wallet-shortlist
to
fix/cli-shortlist-env-flags
October 21, 2026 19:32
tee8z
approved these changes
Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack
One stack, merged bottom up:
master)wallets list --all-orgs(base fix(cli): name each candidate's environment when --env is not given #77)Problem
An agent that needs a wallet across organizations had to loop over
organizations listand runwallets list --orgonce per organization (#34). The backend will not add a cross-organization endpoint (voltagecloud/backend#2296, closed: most users are in one organization, and the CLI can combine the results itself).Behavior
voltage wallets list --all-orgslists the wallets in every organization the browser login can see, as one list.flowchart LR L[resolve login once] --> O[GET /users/current<br/>organizations] O --> P{for each organization,<br/>4 at a time} P --> X[token exchange<br/>audience = org] X --> W[GET /organizations/ID/wallets<br/>with the command's filters] W --> M[merge in organization order,<br/>add organization_id + organization_name]organization_idandorganization_name. The table gets anORGANIZATION NAMEcolumn, added to the preferred columns aftername.--queryoverrides (for example,--inactive true) apply in each organization. Profile andVOLTAGE_ORGANIZATION_IDscope is ignored, and--orgor--envis a usage error (clapconflicts_with_all).--org IDor--account NAME.Listing wallets in N organizations...line. The parallel exchanges and reads run quietly, so their progress lines cannot interleave.Partial failure (decision): write the partial results, then fail. The wallets from the organizations that answered go to stdout as usual. The command then exits with the first failure's code (for example, 3 for a 403), with the message
Could not list wallets in K of N organizations: NAME (ID), ...anderror.detail.failed_organizations: [{organization_id, name, message, hint?}]. A script that checks the exit code never mistakes a partial list for a complete one, and a person still sees what could be listed. When every organization fails, nothing is written to stdout. If they all fail the same way (same kind and message), that error is returned unchanged with its own hint and detail. For example, a revoked login keepscredential_problem: login_expiredand thevoltage login --account NAMEhint. Otherwise each organization is listed and the hint points tovoltage auth status. Eachfailed_organizationsentry also carries the failure's owndetail.The parallel exchanges go through
Resolver::organization_token, whichexchangenow also uses.account_authtakes theTerminal, so--all-orgspasses a quiet one, with no duplicated auth-service setup.Closes #34 (together with #73).
Checks
voltage-pr-reviewself-review against feat(cli): name the wallets that could pay a BOLT11 invoice #73's head, with the Rust style checklist.login_expirederror itself, exit 3), no organizations (empty list, no API calls), API key refusal,--org/--envconflicts, and the picker asking nothing. Unit tests cover the organization parsing, the merge for pages and non-object items, and the error construction.nix develop:cargo fmt --check,cargo clippy --locked --all-targets -- -D warnings,cargo machete --with-metadata,cargo test --locked, andpython3 scripts/check-coverage.pyall pass.ff8b488: 0 violations. The highest score is 19.60 forwait_for_payment(unchanged).cli.rsendpointrose from 17 to 18 at 100% coverage, because of the new flag branch.