Skip to content

fix: Don't print response in -o hex --json#553

Merged
lwshang merged 3 commits into
mainfrom
spofford/fix-hex
May 14, 2026
Merged

fix: Don't print response in -o hex --json#553
lwshang merged 3 commits into
mainfrom
spofford/fix-hex

Conversation

@adamspofford-dfinity
Copy link
Copy Markdown
Contributor

No description provided.

@adamspofford-dfinity adamspofford-dfinity requested a review from a team as a code owner May 13, 2026 22:39
lwshang
lwshang previously approved these changes May 13, 2026
Each output-mode arm previously forked on `--json`, duplicating the
"decode and stash vs. decode and print" logic. The recent `-o hex --json`
double-printing bug was a direct consequence — easy to forget one of the
`if !args.json` guards.

Split the flow into a `decode_response` step that returns a `Decoded`
enum (Candid / Text / Bytes) and a single emission step that forks on
`--json` exactly once. Semantics are unchanged: `-o` still controls
decoding strictness, `--json` still controls envelope vs. human output,
and the two remain orthogonal. The write-vs-decode error reconciliation
in JSON mode is preserved.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@lwshang lwshang enabled auto-merge (squash) May 14, 2026 13:43
@lwshang lwshang merged commit fab1ad6 into main May 14, 2026
219 of 232 checks passed
@lwshang lwshang deleted the spofford/fix-hex branch May 14, 2026 16:07
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