Repository navigation
fix: show an empty GET response as no resource found (EMSR-2795) - #1036
Merged
Merged
Conversation
When a response has no body, the generated command handler prints
the last path parameter as the key. That fits a delete or a replace.
It does not fit a GET that returns 204, such as the default release
plan of an environment that has none, where the output looked like a
plan named after the environment.
A GET with no body now prints {} in JSON output and "No <resource>
found" in plaintext output. Other methods keep the key output.
Ticket: EMSR-2795.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
katc1004
marked this pull request as ready for review
November 16, 2026 20:33
katc1004
requested review from
a team and
ld-ahartmann
and removed request for
a team
November 16, 2026 20:33
joannerd
reviewed
Nov 16, 2026
joannerd
approved these changes
Nov 16, 2026
"No <resource> found" is not true for get-default, because the environment can have release plans and still have no default. "No <resource> returned" describes every empty GET. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ld-ahartmann
approved these changes
Nov 17, 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.
Summary
When a response has no body, the generated command handler prints
{"key": "<last path parameter>"}. The comment on that code says it assumes a delete or a replace, where the key is the resource the user acted on. The production spec now has a GET that returns 204 with no body:GET .../environments/{environmentKey}/default-release-planwhen the environment has no default release plan. With that spec (#1031),ldcli environment-release-plans-beta get-defaultprints{"key": "approvals"}for an environment with no default, which looks like a plan named after the environment. Bugbot and @joannerd flagged it on #1031.Changes
makeRequestkeeps the{"key": ...}fallback for every method except GET. A GET with no body now prints{}in JSON output andNo <resource> returnedin plaintext and markdown output, and exits 0, because the API reported success with nothing to return.code-refs replace-branchandfollow-flags replace-flag-follower, and they print the key they acted on today.No generated file changes. With the spec on
main, no GET returns an empty body, so this change is not visible until #1031 merges.Testing
Automated Tests
cmd/resources/empty_response_test.goruns four generated commands through the real handler with a mock client that returns an empty body: a GET in JSON mode, a GET in plaintext mode, a GET on a beta resource, and a DELETE. Without the fix, the three GET cases fail and the DELETE case passes.go test ./...andgolangci-lint runpass.Manual Tests
With #1031 checked out on top of this change, against catamorphic project
kathytest:Rollout
This is a change to one hand-written function with no effect on today's commands. It can merge before or after #1031. If it merges after,
get-defaultprints the wrong key until the next release.No feature flags. To roll back, revert the commit.
🤖 Generated with Claude Code
Note
Overview
Generated resource commands no longer treat an empty GET body as a synthetic
{"key": "<last path param>"}object.GET with a successful empty response now prints
{}in JSON mode orNo <resource> returnedin plaintext (resource name derived from the parent command, with-betastripped). DELETE and other non-GET methods with empty bodies still echo the last path parameter as{"key": ...}.Adds
empty_response_test.goto lock in JSON/plaintext GET behavior, beta resource naming in the message, and unchanged DELETE output.Reviewed by Cursor Bugbot for commit a546e8a. Bugbot is set up for automated code reviews on this repo. Configure here.
Related Jira issue: EMSR-2795: Release ldcli version with flag-release-plans-beta commands (generated from openapi)