Skip to content

[fix][cli] Correct admin command documentation generation - #26649

Merged
nodece merged 2 commits into
apache:masterfrom
lhotari:lh-fix-admin-doc-generation
Sep 20, 2026
Merged

nodece merged 2 commits into
apache:masterfrom
lhotari:lh-fix-admin-doc-generation

Conversation

@lhotari

@lhotari lhotari commented Sep 19, 2026

Copy link
Copy Markdown
Member

Motivation

pulsar-admin documents generate brokers prints the entire growing document after each subcommand. This produces 13 progressively longer copies of the brokers documentation and repeated entries in the reference site's sidebar. Generating multiple modules also repeats earlier modules.

The generator reads options from the command group instead of each subcommand, so generated reference pages omit actual command flags such as --primary, --secondary, and --unload-scope.

Modifications

  • Print the completed document once through the command's configured output writer.
  • Generate option tables from each subcommand's visible options, include initialized defaults, and keep table column counts consistent, including the functions language-support column.
  • Deduplicate command aliases by canonical name and reset that tracking between invocations.
  • Add five regression tests covering single and multiple modules, aliases, all-module generation, repeated invocations, and option table contents.

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and was verified locally with:

./gradlew :pulsar-client-tools:test --tests org.apache.pulsar.admin.cli.TestCmdGenerateDocument -PtestRetryCount=0 -PtestFailFast=false quickCheck
./gradlew spotlessCheck checkstyleMain checkstyleTest

All five tests and the checks passed. The regression tests reproduced duplicate headings before the fix. Also generated all 21 admin command groups using the updated CLI: each document has one top-level heading, retains its subcommands, and has consistent option table columns. Checked the rendered brokers reference page in a local site preview.

Does this pull request potentially affect one of the following parts:

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

lhotari and others added 2 commits September 19, 2026 05:36
Print generated documentation once, use each subcommand’s visible options and defaults, and keep option tables consistent. Reset alias tracking between invocations and cover single, multiple, and repeated generation with regression tests.

Assisted-by: Codex
@nodece
nodece merged commit e11185b into apache:master Sep 20, 2026
81 of 83 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants