Skip to content

smoke --json Output Inconsistencies #3

Description

@abhinavgautam01

Description

maxed smoke --json has inconsistent JSON output between its own success paths.

The no-connectors path emits compact JSON directly:

{"results":[]}

The connectors path emits pretty-printed JSON directly:

{
  "results": [...]
}

Both paths bypass the shared _emit_json() helper and omit a top-level ok field, even though smoke already tracks connector failures and uses that state to decide the exit code.

Evidence

In src/maxed_cli/cli.py:

  • no-connectors path uses typer.echo(json.dumps({"results": []}))
  • connectors path uses typer.echo(json.dumps({"results": results}, indent=2))
  • other wrapped command outputs generally use _emit_json(), which applies consistent indentation and sorted keys

Note: schema --json intentionally emits raw schema JSON and suite --json has its own wrapper shape, so this issue is specifically about making smoke --json internally consistent.

Impact

Machine consumers have to handle two formatting styles for smoke --json and they cannot read a top-level success flag. They must infer success from the exit code or inspect individual result entries.

Suggested Fix

Use _emit_json() consistently in both smoke --json success paths and include a top-level ok field:

_emit_json({"ok": True, "results": []})
_emit_json({"ok": failures == 0, "results": results})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions