Skip to content

Use the EmitDefaultValues field for the namespace capacity get command - #103

Open
khisakuni wants to merge 3 commits into
mainfrom
khisakuni/emit-default
Open

Use the EmitDefaultValues field for the namespace capacity get command#103
khisakuni wants to merge 3 commits into
mainfrom
khisakuni/emit-default

Conversation

@khisakuni

@khisakuni khisakuni commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

What was changed

Adds and wires up a EmitDefaultValues option when printing resources. Only the namespace capacity get command currently uses it.

Depends on temporalio/api-go#306

Why?

The namespace capacity get command has some fields that are useful to print when the response from the API has zero values. For example
before:

Namespace        my.namespace
  CurrentCapacity  {"onDemand":{},"latestRequest":{...}}
  ModeOptions      {"provisioned":{"validTruValues":[2,3,4,6,8,10,12],"maxAvailableTruValue":4},"onDemand":{"apsLimit":500}}
  Stats            {"aps":{}}

after:

Namespace        my.namespace
  HasLegacyLimits  false
  CurrentCapacity  {"onDemand":{},"latestRequest":{...}}
  ModeOptions      {"provisioned":{"validTruValues":[2,3,4,6,8,10,12],"maxAvailableTruValue":4},"onDemand":{"apsLimit":500}}
  Stats            {"aps":{"mean":0,"p90":0,"p99":0}}

The HasLegacyLimits is displayed and the Stats field is meaningful now.

Checklist

  1. Closes

  2. How was this tested:

  1. Any docs updates needed?

Note

Low Risk
Opt-in printer behavior change with default off, so existing command output is unchanged; only capacity get opts in. Shared printer plumbing is touched but behavior remains backward compatible.

Overview
Makes zero-valued fields visible in namespace capacity get output (e.g. HasLegacyLimits: false, zeroed stats), so capacity info is more useful when the API returns defaults.

Adds an opt-in EmitDefaultValues flag to the shared printer (PrintResourceOptions / StructuredOptions). When set, scalar defaults are printed in both text and JSON; unset pointer/message fields stay omitted. Only the capacity get command enables it today.

Also bumps go.temporal.io/api for CustomJSONMarshalOptions.EmitDefaultValues support, and extends test helpers accordingly.

Reviewed by Cursor Bugbot for commit 3251c8e. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 2a9b293. Configure here.

Comment thread go.mod Outdated
@khisakuni
khisakuni marked this pull request as ready for review August 12, 2026 00:34
@khisakuni
khisakuni requested a review from a team as a code owner August 12, 2026 00:34
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.

1 participant