Skip to content

fix(grpc): transport validation and error message - #1026

Open
malladinagarjuna2 wants to merge 2 commits into
a2aproject:mainfrom
malladinagarjuna2:fix-grpc-transport-validation-and-error-message
Open

fix(grpc): transport validation and error message#1026
malladinagarjuna2 wants to merge 2 commits into
a2aproject:mainfrom
malladinagarjuna2:fix-grpc-transport-validation-and-error-message

Conversation

@malladinagarjuna2

@malladinagarjuna2 malladinagarjuna2 commented Aug 8, 2026

Copy link
Copy Markdown

fixes #1014
GrpcTransport- getTaskPushNotificationConfiguration(): Replaced a manual IllegalArgumentException null check with checkNotNullParam("id", request.id()) for consistency with the validation used throughout the class.

  • subscribeToTask(): Fixed a copy-paste error in the error message prefix — it incorrectly read "Failed to subscribe task push notification config" and now reads "Failed to subscribe to task".

DataPart immutability (regression from #633)

PR #633 widened DataPart.data from Map<String, Object> to Object to support any JSON value (arrays, primitives), but in doing so dropped the data = Map.copyOf(data) defensive copy. As a result, callers could mutate the contents
of a DataPart after construction.

The widening itself is correct — the spec allows any JSON value — so the defensive copy is now applied based on the runtime type:

  • Map → CollectionCopies.unmodifiableShallowMap() (preserves null values, consistent with how metadata is already handled)
  • List → Collections.unmodifiableList(new ArrayList<>(list)) (preserves null elements)
  • Primitives / immutable values → stored as-isAlso corrected the DataPart Javadoc, which claimed data "supports null" while the constructor calls checkNotNullParam and throws on null. The null-value claim is removed from the
    class-level docs and both constructor @param tags.

Tests- Added5 tests in DataPartTest verifying:

  • Map/List data is defensively copied and immutable (mutation throws UnsupportedOperationException, later mutation of the original input has no effect)
  • Null values in data maps and null elements in data lists survive the copy - Primitives are stored as-is (same instance)
  • Full spec module test suite passes (142 tests).

@malladinagarjuna2

Copy link
Copy Markdown
Author

@kabir could you please verify

@malladinagarjuna2 malladinagarjuna2 changed the title fixed the transport validation and error message fix: transport validation and error message Aug 9, 2026
@malladinagarjuna2 malladinagarjuna2 changed the title fix: transport validation and error message fix(grpc): transport validation and error message Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: restore defensive copying of DataPart data

1 participant