bazelbuild/bazel

Document that JSON format for persistent workers should always return fields

Open

#27.151 geöffnet am 4. Okt. 2025

Auf GitHub ansehen
 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)Java (4.465 Forks)batch import
P3help wantedteam-Documentationteam-Remote-Exectype: documentation (cleanup)

Repository-Metriken

Stars
 (25.384 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 22T 20h) (77 gemergte PRs in 30 T)

Beschreibung

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