bazelbuild/bazel

Document that JSON format for persistent workers should always return fields

Open

#27,151 opened on Oct 4, 2025

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Java (4,465 forks)batch import
P3help wantedteam-Documentationteam-Remote-Exectype: documentation (cleanup)

Repository metrics

Stars
 (25,384 stars)
PR merge metrics
 (Avg merge 22d 20h) (77 merged PRs in 30d)

Description

Page link:

https://bazel.build/remote/creating

Problem description (include actual vs expected text, if applicable):

According to the protobuf JSON spec:

When generating JSON-encoded output from a protocol buffer, if a field supports presence, serializers must emit the field value if and only if the corresponding hasser would return true.

If the field doesn’t support field presence and has the default value (for example any empty repeated field) serializers should omit it from the output. An implementation may provide options to include fields with default values in the output.

I'm manually creating the response JSON to avoid a protobuf dependency. If I implement according to spec, a WorkResponse with exit code of 0, no output, etc. should be an empty JSON object because the fields are all their zero value. But if I do that, the Bazel build hangs. It seems like I need to skip that part of the spec and always serialize zero values. The documentation should clarify any requirements that are non-compliant with spec, so that the next developer doesn't spend 2 hours wondering why my persistent worker code isn't working 😢

Where do you see this issue? (include link to specific section of the page, if applicable)

No response

Any other information you'd like to share?

No response

Contributor guide