Skip to content

Fix stray empty output on payload upload/delete CLI#322

Merged
maximelb merged 2 commits into
masterfrom
fix/payload-cli-empty-output
Jul 24, 2026
Merged

Fix stray empty output on payload upload/delete CLI#322
maximelb merged 2 commits into
masterfrom
fix/payload-cli-empty-output

Conversation

@maximelb

Copy link
Copy Markdown
Contributor

Summary

A customer reported two cosmetic output glitches in the v2 CLI payload commands (both operations actually succeeded):

  1. payload upload printed a stray b'' after the confirmation line.
  2. payload delete printed an empty Field / Value table after the confirmation line.

Root cause

Both commands print a friendly confirmation and then pass the raw SDK return value to _output(), but for these two verbs that value is empty/meaningless:

  • Payloads.upload() returns the storage backend's PUT response body, which is empty bytes (b'') on a successful upload. In a TTY this echoed b''; in non-TTY (JSON) mode it actually raised TypeError: Type is not JSON serializable: bytes.
  • Payloads.delete() returns the API's empty DELETE response body ({}), which the table formatter renders as a bare Field / Value header.

Fix

Only render the SDK return value when it actually carries content (if data:), so the confirmation line stands alone. No functional change to upload/delete behavior.

Tests

Added TestPayloadCommands regression tests reproducing both reported cases (the delete test forces --output table to match the customer's TTY scenario). Both new tests fail on master and pass with this change; full test_cli_commands.py + test_sdk_payloads.py suite (60 tests) passes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01C6ug17pCvjJYLveQv6iz81

`limacharlie payload upload` echoed a stray `b''` and `payload delete`
rendered an empty "Field / Value" table on top of the human-readable
confirmation line. Both commands were passing an empty SDK return value
to _output():

- upload() returns the storage backend's PUT response body, which is
  empty bytes (b'') on success.
- delete() returns the API's empty response body ({}) on success.

Only render the SDK return value when it actually carries content, so the
confirmation line ("Payload 'X' uploaded/deleted.") stands alone. Adds
regression tests reproducing both reported cases.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C6ug17pCvjJYLveQv6iz81
lcbill
lcbill previously approved these changes Jul 24, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C6ug17pCvjJYLveQv6iz81
@maximelb
maximelb enabled auto-merge (squash) July 24, 2026 16:27
@maximelb
maximelb merged commit 22b34fa into master Jul 24, 2026
5 checks passed
@maximelb
maximelb deleted the fix/payload-cli-empty-output branch July 24, 2026 16:28
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