Document that JSON format for persistent workers should always return fields
#27,151 建立於 2025年10月4日
倉庫指標
- Star
- (25,384 star)
- PR 合併指標
- (平均合併 22天 20小時) (30 天內合併 77 個 PR)
描述
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