fix(grpc): preserve null values in protobuf Struct#578
Conversation
🧪 Code CoverageNo coverage changes. Generated by coverage-comment.yml |
There was a problem hiding this comment.
Code Review
This pull request fixes an issue with protobuf serialization where null values were not correctly preserved. It updates the wrap and unwrap functions in struct.ts and adds a test suite to verify the behavior. Feedback was provided noting that modifying generated files directly is a maintenance risk, and alternative approaches like post-generation scripts or patching were suggested.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Hi @MyPrototypeWhat, thank you for the fix. As you mentioned in the PR description we are working towards releasing stable 1.0.0 version of a2a-js sdk. Can you please rebase your current branch to epic/1.0 and fix it there directly also updating the base branch of this PR? |
4d4ff77 to
fd5501b
Compare
|
Done — I rebased the PR onto the current |
fd5501b to
46d37af
Compare
f447e4e
into
a2aproject:epic/1.0_breaking_changes
🤖 I have created a release *beep* *boop* --- ## [1.0.0](v1.0.0-beta.0...v1.0.0) (2026-07-22) `@a2a-js/sdk` is now generally available. This release promotes the v1.0 line to stable, implementing the full [A2A Protocol Specification v1.0](https://a2a-protocol.org/v1.0.0/specification/) across all three transports (JSON-RPC, HTTP+JSON/REST, gRPC), with opt-in v0.3 backward compatibility for staged migrations. Upgrading from `0.3.x`? See the [v0.3 → v1.0 migration guide](https://github.com/a2aproject/a2a-js/blob/v1.0.0/docs/migration-guide.md). Interoperating with peers still on v0.3? See the [end-user v0.3 compatibility guide](https://github.com/a2aproject/a2a-js/blob/v1.0.0/docs/compatibility-v0_3.md). ### ⚠ BREAKING CHANGES * unify A2AError hierarchy with transport specific subclasses ([#587](#587)) * **server:** replace individual properties with SendMessageRequest in RequestContext ([#581](#581)) ### Features * add state bag and ServerCallContextBuilder to ServerCallContext ([#364](#364)) ([477e394](477e394)) * export SSE wire-format helpers from public entry point ([#548](#548)) ([8bc21f5](8bc21f5)), closes [#547](#547) * **server:** expose SendMessageRequest metadata to AgentExecutor via RequestContext ([#564](#564)) ([a92f54e](a92f54e)) * **server:** replace individual properties with SendMessageRequest in RequestContext ([#581](#581)) ([7cd30de](7cd30de)) * unify A2AError hierarchy with transport specific subclasses ([#587](#587)) ([4806f8f](4806f8f)) ### Bug Fixes * **client:** bound SSE event size to prevent client-side memory exhaustion ([#582](#582)) ([e6e8ce9](e6e8ce9)) * **client:** cancel the SSE stream on teardown to avoid leaking connections ([#580](#580)) ([83269a5](83269a5)) * **grpc:** preserve null values in protobuf Struct ([#578](#578)) ([f447e4e](f447e4e)), closes [#576](#576) * resolve sdk compatibility bugs ([#568](#568)) ([b57f026](b57f026)) * **server:** await _handleProcessingError so blocking drains surface errors ([#579](#579)) ([5833652](5833652)) * support GET for resubscribe route ([#569](#569)) ([8dd43d1](8dd43d1)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: JakubWorek <jakubworek@google.com>
Summary
google.protobuf.Structwrappers preserve JavaScriptnullnullasgoogle.protobuf.NullValue.NULL_VALUEnullValuecase back to JavaScriptnullRoot cause
The generated
Value.wrap()implementation assigned the literal JavaScriptnullto a protobuf enum field.@bufbuild/protobufrequires an integer enum value, so gRPC serialization failed withinvalid int32: object.The reverse conversion also returned the enum value
0instead of restoring JSONnull. The newer ts-proto output corrects both directions sogoogle.protobuf.Structfields preserve JSON semantics across the gRPC wire.Impact
Tasks, messages, and other A2A gRPC payloads can now contain valid JSON
nullvalues in metadata or otherStruct-backed fields without crashing or changing them to0after deserialization.Target branch
This PR is rebased onto and directly targets
epic/1.0_breaking_changesfor the stable 1.0.0 SDK work.Generation note
The checked-in 1.0 bindings contain post-generation adjustments. A full
buf generatecurrently rewrites those bindings and adds unrelated generated files, so this PR refreshes only the affectedStructartifact together with the generator pin to keep the fix scoped.Validation
npm test— 66 files, 1,375 tests passednpm run test:edge— 49 files, 1,081 tests passed, 2 skippednpm run build— passednpm run test-build— passednpm run lint:ci— passed in GitHub ActionsFixes #576