Skip to content

PILOT-65: fix pilotctl --json version to emit JSON#363

Closed
hank-pilot wants to merge 1 commit into
mainfrom
hank/pilot65-json-version
Closed

PILOT-65: fix pilotctl --json version to emit JSON#363
hank-pilot wants to merge 1 commit into
mainfrom
hank/pilot65-json-version

Conversation

@hank-pilot

Copy link
Copy Markdown
Collaborator

Fix

pilotctl --json version was returning plaintext (v1.12.4) instead of JSON.

Root cause: The version dispatch case called fmt.Println(version) unconditionally, ignoring the --json flag.

Fix: Replace fmt.Println(version) with output(version) which respects the jsonOutput flag and emits the standard {"status":"ok","data":"v1.12.4"} envelope when --json is set.

Before:

$ pilotctl --json version
v1.12.4

After:

$ pilotctl --json version
{"status":"ok","data":"v1.12.4"}

Found by PILOT-65 Phase 1 functional test runner (44/45 tests passing; this was the sole failure).

The global --json flag was being ignored by the version command,
which unconditionally wrote fmt.Println(version) to stdout.

Fix: use output(version) which respects the jsonOutput flag and
emits the standard {"status":"ok","data":"v1.12.4"} envelope
when --json is set.

Found by PILOT-65 Phase 1 functional test runner (44/45 passing).
@hank-pilot hank-pilot requested a review from TeoSlayer as a code owner July 9, 2026 05:10
@hank-pilot

Copy link
Copy Markdown
Collaborator Author

Closing — the command is intentionally exempt from --json wrapping per project design (verified by existing TestCLIVersionFlagIgnored test). Phase 1 finding was a false positive — pilotctl --json version returning bare text is correct behavior.

@hank-pilot hank-pilot closed this Jul 9, 2026
@hank-pilot hank-pilot deleted the hank/pilot65-json-version branch July 9, 2026 05:16
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