Skip to content

feat(cli): add selected stream metadata - #88

Merged
ThomasRooney merged 3 commits into
mainfrom
fix/cli-stream-metadata
Oct 8, 2026
Merged

ThomasRooney merged 3 commits into
mainfrom
fix/cli-stream-metadata

Conversation

@ThomasRooney

@ThomasRooney ThomasRooney commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Why

A CLI that projects streamed text discards other event fields, including identifiers needed for a later request. A selected metadata field should remain available without changing the streamed stdout payload.

What changed

Add optional output.stream.metadata: {select, label} to declared intent and operation commands. Both fields are required nonempty strings; the selector uses existing singular-path and streaming-schema validation. Labels reject nonprintable characters.

The shared projector retains the latest nonempty string and reports it once on stderr after clean completion and successful stdout termination. Labels and values are safely escaped. The projector ignores missing or invalid metadata in successfully decoded events; normal typed SDK schema and decoding errors remain unchanged. Explicit rendering choices, raw responses, and machine mode suppress the advisory line; interrupted streams and stdout failures also suppress it.

Add neutral fixtures for single-route and dispatched intents, ordinary and promoted operations, parser diagnostics, runtime retention and failure cases. Keep the new fixtures in CLI-only overlays, with an optional target overlay hook for review generation. Update the CLI documentation, generated review SDK, and changeset.

The shared fixtures caused unrelated SDK golden changes and exposed an existing Python return-annotation mismatch for SSE-only responses. CLI overlays keep this target-specific coverage out of other SDK inputs.

Testing

  • The metadata regression failed before implementation because the manifest decoder rejected metadata.
  • go test ./internal/extensions -count=1 passed, including metadata validation, open-schema warnings, and escaped-pointer lowering.
  • TARGET=review make test-cli passed after fixture isolation: 609 tests, 2 skipped, plus usage checks.
  • TARGET=primary make test-cli passed: 1,714 tests, zero failures, exit 0. After moving the primary fixture into the CLI overlay, the assembled spec was semantically identical and regenerated jq and metadata tests passed.
  • Generated-command checks covered both dispatch routes, ordinary and promoted operations, output-mode suppression, retention, escaping, failed streams, and cancellation. Typed schema-invalid metadata preserved SDK errors and emitted no footer.
  • Python review generation and compilation passed, including mypy, pyright, and pylint. The shared review spec matches the base revision byte for byte; no non-CLI SDK goldens change.
  • make lint, make check-template-cli, npm run format, and go generate ./... passed. Lint used the CI-pinned golangci-lint v2.11.2 built with Go 1.26.8.
  • Source whitespace checks pass with only zSDKs/sdk-cli/.speakeasy/logs/naming.log excluded. That generated file retains canonical trailing whitespace and remains included in exact regeneration checks.

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; the sole exception is canonical trailing whitespace in the generated CLI naming log, described above.

@ThomasRooney
ThomasRooney requested a review from a team as a code owner October 7, 2026 15:41

@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 35 files

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

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread templates/templates/cli/README.md
Comment thread zSDKs/sdk-cli/internal/sdk/streammetadata.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.

0 issues found across 11 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. Adds optional output.stream.metadata to CLI generation, reporting a selected field on stderr after clean completion, with validation, templates, and CLI-target tests/docs. Bounded and optional; dismissed finding concerns schema-invalid events whose failure behavior is documented and accepted.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread templates/templates/cli/tests/primary/streammetadata_additional_test.go.stmpl 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 1 file (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. Adds optional CLI metadata reporting on stderr after successful generation, with validation and regression coverage.

View guided diff | Turn on auto-fix | Re-trigger cubic

@ThomasRooney
ThomasRooney force-pushed the fix/cli-stream-metadata branch from e2e4f17 to 95f5dde Compare October 7, 2026 23:22
@ThomasRooney
ThomasRooney added this pull request to the merge queue Oct 8, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 8, 2026
@ThomasRooney
ThomasRooney force-pushed the fix/cli-stream-metadata branch from 95f5dde to ac377a4 Compare October 8, 2026 21:11
@ThomasRooney
ThomasRooney added this pull request to the merge queue Oct 8, 2026
Merged via the queue into main with commit c970df5 Oct 8, 2026
240 checks passed
@ThomasRooney
ThomasRooney deleted the fix/cli-stream-metadata branch October 8, 2026 21:35
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants