Skip to content

fix(cli): correct empty request body examples and flags - #69

Open
TristanSpeakEasy wants to merge 5 commits into
mainfrom
fix/cli-empty-request-body
Open

TristanSpeakEasy wants to merge 5 commits into
mainfrom
fix/cli-empty-request-body

Conversation

@TristanSpeakEasy

@TristanSpeakEasy TristanSpeakEasy commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Why

An optional empty-object request body could suppress a valid parameter example in compact help, or add an invented JSON payload in full help. Mixed parameter/body operations also registered a redundant whole-body flag alongside --body.

What changed

  • Omit invented payloads for unexpanded optional or nullable bodies without usable examples, and use '{}' for required empty JSON/form bodies.
  • Remove redundant metadata for empty JSON/form body wrappers only when the operation already provides --body. Share that field filter with --usage and whole-body flag lookup so neither advertises a removed flag.
  • Preserve required empty-body validation through --body or stdin, rejecting omission and JSON null. Keep existing flags for empty non-body classes, nullable/optional wrappers, maps, unions, and body-only operations. Wrapped bodies retain help wording for their individual JSON flag.
  • Align generated test arguments with registered flags, add focused generation and runtime regressions, update the CLI maintainer README, and add a CLI changeset.
  • Regenerate the tracked review CLI fixture and its checksums so the generated-output consistency check passes.

Testing

  • go test ./pkg/generate/snapshots -run '^TestSnapCLIEmptyBodyExamplesAndFlags$' -count=1, including wrapped nullable+optional bodies in both help styles
  • TARGET=review make test-cli (541 tests, two existing skips; also passed in CI at f679fb23)
  • TARGET=primary make test-cli (1,449 tests)
  • make check-template-cli
  • npm run format
  • golangci-lint run --timeout=5m ./pkg/generate/snapshots/...
  • Manual compact/full help, --usage, and dry runs: required mixed/body-only inputs send {}, required mixed bodies reject omission, optional bodies can be omitted, and unwrapped mixed empty JSON bodies expose only --body.
  • TARGET=review make build-cli, including compilation, staticcheck, and integrity validation
  • Rebuilt the committed fixture and ran ./scripts/check-generated-diff.sh: no repository changes
  • git diff --check
  • make lint does not pass locally: inherited -trimpath breaks permission generation. With GOFLAGS cleared, lint instead reports a gofmt issue in unchanged templates/perms.go. No permission-file changes are included.

The full SDK suites passed before the latest help-only change, which passed the focused regression, template, formatting, and lint checks. The fixture-only follow-up changes no generator logic. CI on the latest commit is pending.

Public-safety check

  • This change contains no credentials, customer documents, private repository URLs, private filesystem paths, or unredacted private logs.
  • Title, body, comments, and commit messages name no customers or customer-derived identifiers, private paths or trackers, or workflow provenance, and are understandable without private context (.claude/skills/public-repo-communication/SKILL.md).
  • Generated fixtures and review SDK changes are public-safe.
  • I reviewed git diff --check.

@TristanSpeakEasy
TristanSpeakEasy requested a review from a team as a code owner October 2, 2026 06:48
@TristanSpeakEasy TristanSpeakEasy added the bug Something isn't working label Oct 2, 2026
@TristanSpeakEasy

Copy link
Copy Markdown
Member Author

@cubic-dev-ai

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 2, 2026

Copy link
Copy Markdown

@cubic-dev-ai

@TristanSpeakEasy I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 7 files

Shadow auto-approve: would not auto-approve because issues were found.
Tip: instead of fixing issues one by one fix them all with cubic

Re-trigger cubic

Comment thread templates/templates/cli/includes/metadata.ts Outdated
Comment thread templates/templates/cli/includes/metadata.ts
Comment thread templates/templates/cli/includes/metadata.ts Outdated
Comment thread templates/templates/cli/README.md Outdated
Comment thread pkg/generate/snapshots/cli_empty_body_go_test.go
Comment thread templates/templates/cli/includes/descriptions.ts Outdated
Comment thread templates/templates/cli/includes/utils.ts Outdated
Comment thread pkg/generate/snapshots/cli_empty_body_go_test.go

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 11 files (changes from recent commits).

Shadow auto-approve: would not auto-approve because issues were found.

Fix all with cubic | Re-trigger cubic

Comment thread templates/templates/cli/includes/metadata.ts Outdated
Comment thread pkg/generate/snapshots/cli_empty_body_go_test.go Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 3 files (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Shadow auto-approve: would auto-approve. Fixes CLI generation for empty request bodies: omits invented help payloads, drops redundant body flags for mixed JSON/form bodies, and enforces required empty bodies, all covered by focused regression and unit tests.

Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 16 files (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Shadow auto-approve: would auto-approve. Corrects CLI generation for empty request bodies: omits invented payloads, drops redundant empty-body flags, and enforces required empty bodies, all covered by focused update snapshots, runtime regression tests, and aligned generated CLI fixtures.

Re-trigger cubic

@TristanSpeakEasy

Copy link
Copy Markdown
Member Author

Merged main in 59d4ddb without rewriting history. The only conflict was the generated CLI checksum file; regenerated the review CLI from the merged templates and verified checksum integrity.

Validation after the merge:

  • Focused empty-body snapshot regression
  • Review CLI generation, compilation and staticcheck
  • Review runtime suite: 589 tests, two existing skips
  • CLI template type-check and focused snapshot-package lint
  • git diff --check

The primary suite and full repository lint were not rerun for this generated-checksum conflict. The previously documented local permissions-generation/lint limitation is unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant