Skip to content

--format-json is inconsistent: silently ignored, bypassed by alternate forms, unreachable in three commands, over-advertised in --help #486

Open

Description

@IanFrelinger

--format-json is inconsistent across the CLI in four distinct ways. The round-3 hardening PR introduces a refusal contract (a command that cannot honour --format-json says so and exits non-zero rather than silently ignoring it); these are the gaps that remain around it.

  1. Silently ignored by most commands — exit 0 with prose on stdout, contradicting the refusal contract the same release introduces.
  2. Alternate option forms bypass the JSON path — --format-json=true, --format-json:true and response-file forms emit JSON but leave host logs on stdout, so the output does not parse, at exit 0.
  3. Unreachable implementations — DockerCommand, TestPortableCommand and TestMultiEnvCommand look up --format-json / --verbose with a predicate that can never match, so working JSON renderings are dead code.
  4. --help over-advertises — every command's help lists --format-json Emit machine-readable JSON, including the commands that now refuse it outright.

Related, lower severity: ashlar mesh with no subcommand exits 0, while every other command group exits 1.

The through-line is that "machine-readable" is only true if stdout carries the document and nothing else, on every command that claims the flag. Worth a single convention test that runs every command with --format-json and asserts stdout parses or the command refused.

Found by the round-3 CLI hunt lane bb-cli-contract (78 probes).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions