Repository navigation
feat(cli): name the next step after an accepted receive or quote - #62
Conversation
0df238a to
d4a558b
Compare
thebrandonlucas
left a comment
There was a problem hiding this comment.
Cicero review of d4a558b (base: #61 a149b80)
No blocking findings. Checked:
next_step(src/api.rs:888) runs only on a 202 in human output.--quietis honored throughTerminal::notice. The integration test covers table,--quiet, JSON, the quote case and the no-hint send. Thehint:prefix matchesoutput.rs:323.TargetFlags(src/cli.rs:316):required_unless_presentplusconflicts_withgive exactly one ID.command().debug_assert()(src/cli.rs:1280) passes, so the hidden--iddoes not clash with any command's own--id. The flag, positional, both, and neither cases are tested.
Nit: the CHANGELOG advertises a hidden flag
CHANGELOG.md:17 says every command with a resource ID "also takes it as --id ID". The flag is hide = true (src/cli.rs:323), so --help never shows it. Either is fine: keep it hidden and drop or soften the CHANGELOG line ("--id ID is accepted where a positional ID is expected"), or unhide it. Your choice; not blocking.
Note, no change needed
A receive whose outcome is recovered through reconcile_payment gets no hint, because the recovered response is a 200 read, not a 202. That read already returns the payment, so this is fine.
Checks on d4a558b
- Gate in
nix develop: fmt, clippy, machete, tests (108 unit, 93 integration) and coverage pass. The tree is clean afterwards. - CRAP: 0 of 520 measured functions at or above 20. The highest is
wait_for_paymentat 19.60;next_stepandTargetFlags::idare below that. - Not run: CodeRabbit status.
d4a558b to
72954c8
Compare
thebrandonlucas
left a comment
There was a problem hiding this comment.
Review at 72954c8 (Aurelius). The next-step hint is correct: it shows only for a 202 in human output, respects --quiet through Terminal::notice, and is skipped on the wait path and for a send. The tests cover each case.
Low: src/cli.rs:317: making resource_id an Option with required_unless_present changes every get usage line from <QUOTE_ID> to [QUOTE_ID]. voltage quotes get -h now shows Usage: voltage quotes get [OPTIONS] [QUOTE_ID], as if the ID were optional, and --id is hidden. The new CHANGELOG line ("Help still shows only the argument") doesn't cover this. Fix: I tried #[group(required = true, multiple = false)] on TargetFlags, without required_unless_present or conflicts_with. The usage becomes <QUOTE_ID|--id <ID>>, and "both" still fails with exit 2. That shows --id, so unhide it at the same time, or keep it hidden and accept the [QUOTE_ID] usage. Either way, add a help assertion so the usage line is pinned.
Checks:
- Gate on
d4a558b: fmt, clippy, machete, tests (108 unit, 93 integration) and coverage pass. - CRAP on
d4a558b: 0 functions at or above 20. The highest iswait_for_paymentat 19.60. 72954c8changes onlyCHANGELOG.mdandtroubleshooting.mdfromd4a558b. SignedG blu@blu.cx.
72954c8 to
cf3f0cc
Compare
thebrandonlucas
left a comment
There was a problem hiding this comment.
Re-review at cf3f0cc (Aurelius). My low finding is fixed. TargetFlags is a required group, --id is visible, and a test pins Usage: voltage quotes get [OPTIONS] <QUOTE_ID|--id <ID>> and the error when neither ID is given. The CHANGELOG matches. No findings remain.
Checks on cf3f0cc: fmt, clippy, machete, tests (108 unit, 93 integration) and coverage pass, and the tree is clean. Signed G blu@blu.cx.
thebrandonlucas
left a comment
There was a problem hiding this comment.
Re-review at cf3f0cc. This is not an approval. I found no new problems.
TargetFlagsis#[group(required = true, multiple = false)], and--idis visible. The test pinsUsage: voltage quotes get [OPTIONS] <QUOTE_ID|--id <ID>>and the error when neither ID is passed. Passing both still exits 2.- The CHANGELOG line matches the new behavior.
docs/commands.mdis still current:check-coverage.pypasses.
Checks on cf3f0cc:
- Gate in
nix develop: fmt, clippy, machete, tests (108 unit, 93 integration) and coverage pass, and the tree is clean afterwards. - CRAP, run with the rustup toolchain: 0 of 520 measured functions are at or above 20. The highest is
wait_for_paymentat 19.60.
tee8z
left a comment
There was a problem hiding this comment.
Reviewed at cf3f0cc. CRAP on this head: 0 of 520 functions at or above 20, highest wait_for_payment at 19.60. One thing I'd fix before merge (inline on next_step), plus nits:
docs/commands.md("IDs are positional; enclosing scope uses flags", pinned inscripts/check-coverage.py) anddocs/guides/login-and-profiles.md("Resource IDs are positional") still describe IDs as positional only. Please mention--id ID.next_step'slet id = id?;early return has no test. It is reachable, for example withquotes create --dataand a body withoutid. AGENTS.md asks for a test of each new early return.- The description reports the checks on
d4a558b. That commit is gone after the force-push and differed from the head (--idhidden, group not required). Please report them on the head. - The PR description ends with a "Generated with Claude Code" line; AGENTS.md says to leave tool attribution out of PR descriptions.
tee8z
left a comment
There was a problem hiding this comment.
Requesting changes on cf3f0cc. The existing scope finding remains unresolved: next_step emits a bare payments get or quotes get command. With scope supplied through flags or a profile, copying that command loses the organization/environment and credential selection. Carry the effective scope into the command, or explicitly require the same scope options.
Add a behavior test for the new missing-resource-ID early return. Update the generated command reference and login guide to describe --id ID.
Validation: cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings, cargo machete --with-metadata, cargo test --locked, and python3 scripts/check-coverage.py passed. CRAP: 520 measured functions, zero violations, highest wait_for_payment 19.60; 139 test functions unmeasured.
c1dc498 to
cc73897
Compare
|
@tee8z Both reviews are addressed in
|
tee8z
left a comment
There was a problem hiding this comment.
Approved 908b529 against fix/cli-usd-quote-guidance (#61 641003e). My change request on cf3f0cc is resolved in cc73897:
- Scope:
next_stepnow names the effective scope as flags throughscope_flags, for examplevoltage payments get ID --org ORG --env ENV --account NAME.Scope.accountis filled from--accountor from the profile, so a profile-selected login carries over. A picker-filled--orgor--envcarries over too. With--accountgiven,VOLTAGE_API_KEYis ignored, just as with--profile. Without an account, the copied command picks the sameVOLTAGE_API_KEYor sole saved credential. The account name is quoted for the shell. - Early return: the integration test now runs
quotes create --datawith a body that has noid, and checks that no hint is printed. - Docs:
docs/commands.md, the line inscripts/check-coverage.pythat pins it, andlogin-and-profiles.mdnow describe--id ID.
Nonblocking: the hint does not carry --api-url, --auth-url or --config-dir when the command used them.
Validation on this head, in nix develop: cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings, cargo machete --with-metadata, cargo test --locked (110 unit, 93 integration) and python3 scripts/check-coverage.py passed. CRAP: 525 measured functions, none at or above 20, highest wait_for_payment at 19.60; 139 functions were unmeasured. CI is green.
An accepted payments receive or quotes create returns no body, so human output now names the command that shows the invoice, address, or quote, with the --org, --env, and --account that the command used. --quiet and machine-readable output leave the hint out, and so does a request body without an ID. A command that takes a resource ID also takes it as --id, as quotes create and payments send do, and rejects both at once. Closes #52 Closes #36
The wallet picker listed only a name and an ID, so a USD wallet looked like a BTC wallet. Each wallet now shows its currency between the two when all of its balances report the same one, and typing the currency filters on it. A wallet with no balance currency, or with balances that disagree, shows only its name and ID. Closes #50
* feat(cli): show each wallet's currency in the picker The wallet picker listed only a name and an ID, so a USD wallet looked like a BTC wallet. Each wallet now shows its currency between the two when all of its balances report the same one, and typing the currency filters on it. A wallet with no balance currency, or with balances that disagree, shows only its name and ID. Closes #50 * fix(scripts): build, then run the command after a leading --build `scripts/voltage-staging --build login ...` passed `--build` to the binary, which rejected it. A leading `--build` in either wrapper now builds and then runs the remaining arguments, if any. The wrapper still refuses `--config-dir`, `--api-url` and `--auth-url` before it builds, and a failed build exits with cargo's status without running the command. Closes #37.
908b529 to
0b6e476
Compare
Stack 2 of 6. Base:
fix/cli-usd-quote-guidance(#61). Next:feat/cli-picker-currency.Closes #52, closes #36.
Problem
payments receivewithout--waitprinted onlyaccepted <id>. The 202 response has no body, so nothing said how to see the invoice or address.quotes create --idbutquotes get QUOTE_ID#36:quotes get --id IDwas rejected, thoughquotes create --idandpayments send --idtake the ID as a flag. An acceptedquotes createdid not say how to read the quote.Behavior
payments receive, accepted, human outputaccepted <id>hint: Show the invoice or address with \voltage payments get ID --org ORG --env ENV`, or pass --wait ready next time (--qr or --copy for a BOLT11 invoice).`quotes create, accepted, human outputaccepted <id>hint: Show the quote with \voltage quotes get ID --org ORG --env ENV` once it is ready.`payments send,--quiet,--output json, or a--databody without anidquotes get --id ID(any command with a positional resource ID)quotes get ID--idcannot be used withThe hint's command carries the effective scope as flags:
--org, each--env, and--account NAMEwhen an account is selected, quoted for the shell. These flags win over a profile and overVOLTAGE_*variables, so the pasted command reaches the same organization, environment, and credential however the original command chose them.The ID and
--idform a required group, so the usage line shows<QUOTE_ID|--id <ID>>and a test pins it.docs/commands.md(withscripts/check-coverage.py) andlogin-and-profiles.mdmention--id ID. The CLI still does not wait by default (option 2 in #52).Checks
On head
908b529(this PR's commit iscc73897; the squashed #64 and #65 commits sit on top, unchanged):nix develop:cargo fmt --check,cargo clippy --locked --all-targets -- -D warnings,cargo machete --with-metadata,cargo test --locked(110 unit, 93 integration), andpython3 scripts/check-coverage.py.--org/--env.scope_flags_name_the_effective_scope: a quoted account, and an empty scope.--quiet, JSON output, an accepted send, or aquotes create --databody without anid, which is thelet id = id?;early return.--idonquotes get, both IDs at once, neither ID, and the-husage line.wait_for_paymentat 19.60, unchanged from master.next_stepis 3.00 andscope_flagsis 1.00.voltage-pr-reviewand the Rust style checklist.G blu@blu.cx, with no trailers.