Skip to content

feat: auto-generate deprecation warnings from YAML config#941

Open
chaptersix wants to merge 9 commits into
temporalio:mainfrom
chaptersix:feat/auto-deprecation-warning
Open

feat: auto-generate deprecation warnings from YAML config#941
chaptersix wants to merge 9 commits into
temporalio:mainfrom
chaptersix:feat/auto-deprecation-warning

Conversation

@chaptersix
Copy link
Copy Markdown
Contributor

@chaptersix chaptersix commented Feb 6, 2026

Related issues

Closes #673

What changed?

Auto-generate deprecation warnings from a deprecated: true YAML flag instead of manually writing CAUTION boxes in command descriptions. Deprecation warnings are also printed to stderr at runtime so users see them when invoking deprecated commands, without breaking JSON output.

Before

Deprecation required manually adding a CAUTION box to the description and (Deprecated) to the summary:

- name: temporal task-queue get-build-id-reachability
  summary: Show Build ID availability (Deprecated)
  description: |
    ` `` 
    +-----------------------------------------------------------------------------+
    | CAUTION: This command is deprecated and will be removed in a later release. |
    +-----------------------------------------------------------------------------+
    ` ``

    Show if a given Build ID can be used for new, existing, or closed Workflows...

No runtime warning was shown when invoking the command.

After

Set deprecated: true and optionally deprecation-message. The CAUTION box, (Deprecated) summary suffix, and stderr runtime warning are all auto-generated:

- name: temporal task-queue get-build-id-reachability
  deprecated: true
  description: |
    Show if a given Build ID can be used for new, existing, or closed Workflows...

- name: temporal task-queue versioning
  deprecated: true
  deprecation-message: This API has been deprecated by Worker Deployment.
  description: |
    Provides commands to add, list, remove, or replace...

Runtime stderr output:

$ temporal task-queue get-build-id-reachability --task-queue foo --build-id bar
warning: this command is deprecated and will be removed in a later release
...

JSON output is not affected (warning goes to stderr only):

$ temporal task-queue get-build-ids -o json --task-queue foo 2>/dev/null
[{"buildIds":["1.0"],"defaultForSet":"1.0","isDefaultSet":true}]

Checklist

Stability

  • Breaking changes are marked with 💥 in the PR title and release notes
  • Changes to JSON output (-o json / -o jsonl) are treated as breaking changes

Design

  • This feature does not depend on Cloud-only APIs or behavior (it works against an OSS server)

Help text (see style guide at the top of commands.yaml)

  • Summaries use sentence case and have no trailing period
  • Long descriptions end with a period and include at least one example invocation

Behavior

  • Results go to stdout; errors and warnings go to stderr
  • Error messages are lowercase with no trailing punctuation

Tests

  • Added functional test(s) (SharedServerSuite)
  • Added unit test(s) (func TestXxx) where applicable

Manual tests

Setup

temporal server start-dev --headless

Happy path -- stderr warning on deprecated command

$ temporal task-queue get-build-ids \
    --task-queue YourTaskQueue
warning: this command is deprecated and will be removed in a later release
...

Happy path -- JSON output not polluted

$ temporal task-queue get-build-ids \
    -o json \
    --task-queue YourTaskQueue 2>/dev/null
[...]

Happy path -- help text shows CAUTION box

$ temporal task-queue get-build-id-reachability --help
+-----------------------------------------------------------------------------+
| CAUTION: This command is deprecated and will be removed in a later release. |
+-----------------------------------------------------------------------------+

Show if a given Build ID can be used for new, existing, or closed Workflows...

Happy path -- custom deprecation message

$ temporal task-queue versioning --help
+-------------------------------------------------------------+
| CAUTION: This API has been deprecated by Worker Deployment. |
+-------------------------------------------------------------+
...

Add `deprecated: true` and optional `deprecation-message` fields to
command YAML config. When set, the generator auto-prepends a CAUTION
box to the command description, removing the need to manually add
deprecation warnings.
@chaptersix chaptersix requested review from a team as code owners February 6, 2026 22:59
@chaptersix chaptersix marked this pull request as draft February 7, 2026 01:26
@chaptersix chaptersix marked this pull request as ready for review April 8, 2026 22:40
@chaptersix chaptersix requested a review from a team as a code owner April 8, 2026 22:40
@chaptersix chaptersix requested a review from dandavison April 9, 2026 14:43
Comment thread internal/temporalcli/commands.yaml
Comment thread internal/commandsgen/code.go
Comment thread internal/temporalcli/commands.yaml
@fretz12
Copy link
Copy Markdown

fretz12 commented May 21, 2026

Nice cleanup! I love how deprecation is defined as a YAML flag now.

Store deprecation message in command annotations and print it to stderr
in PersistentPreRunE, so users see the warning when running deprecated
commands without breaking JSON output.
Migrate all remaining commands with manual CAUTION boxes to use the
`deprecated: true` YAML field. Auto-append "(Deprecated)" to the summary
in code gen so authors don't need to add it manually.
Follow PR template convention: stderr messages are lowercase with no
trailing punctuation. CAUTION box in help text retains original casing.
Add functional tests for stderr deprecation warnings in both text and
JSON output modes.
@chaptersix chaptersix changed the title feat: auto-generate deprecation warning box from YAML config feat: auto-generate deprecation warnings from YAML config May 31, 2026
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.

Set a "deprecated:true" flag for CLI command generation YAML

2 participants