temporalio / cli

Command-line interface for running Temporal Server and interacting with Workflows, Activities, Namespaces, and other parts of Temporal
https://docs.temporal.io/cli
MIT License
251 stars 36 forks source link

[Bug] Ensure stability of JSON output across builds #558

Open dandavison opened 4 months ago

dandavison commented 4 months ago

After some head-scratching regarding inconsistent whitespace in JSON output, @cretz determined that the problem was the deliberate injection of random whitespace here: https://github.com/protocolbuffers/protobuf-go/commit/582ab3de426ef0758666e018b422dd20390f7f26

(The random bool they use is constant within a build but random across builds)

We should ensure our JSON output is stable across builds.

The problem can be repro'd with temporal workflow show -w <wid> --event-details

cretz commented 4 months ago

Note that this is deterministic from build to build, so you have to recompile in differing ways to see the issue. The solution is likely to run any proto JSON result through json.Indent or json.Compact depending on which JSON formatting is desired.