Skip to content

Conversation

@mstoykov
Copy link
Contributor

@mstoykov mstoykov commented Aug 24, 2025

What?

After #5017 turned out that k6 does not propagate the types it loads when making gRPC calls. This means that in many of the cases the globalTypes will be used, which will lead to errors.

This likely is not just around Any but is how it was reported.

This PR goes and propagates the types in each place where they will be marshaled/unmarshalled.
The added test is not perfect, but does catch the problem without needing #4981 which I would expect would've also caught this. As currently the server will load the prototypes in the global types and k6/net/grpc will load them in their local types. And then they will technically work.

Why?

This likely breaks loading grpc proto types for anything using Any, but likely more cases.

Checklist

  • I have performed a self-review of my code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests for my changes.
  • I have run linter and tests locally (make check) and all pass.

Checklist: Documentation (only for k6 maintainers and if relevant)

Please do not merge this PR until the following items are filled out.

  • I have added the correct milestone and labels to the PR.
  • I have updated the release notes: link
  • I have updated or added an issue to the k6-documentation: grafana/k6-docs#NUMBER if applicable
  • I have updated or added an issue to the TypeScript definitions: grafana/k6-DefinitelyTyped#NUMBER if applicable

Related PR(s)/Issue(s)

Fixes #5088

@mstoykov mstoykov requested a review from a team as a code owner August 24, 2025 09:30
@mstoykov mstoykov requested review from codebien and joanlopez and removed request for a team August 24, 2025 09:30
@mstoykov mstoykov changed the title POC fix for #5088 grpc: Fix usage of Any types after refactor on protobuf loading Aug 25, 2025
@mstoykov mstoykov added this to the v1.3.0 milestone Aug 25, 2025
Copy link
Contributor

@joanlopez joanlopez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, @mstoykov! Really appreciated, and apologies! 🙇🏻 💟

@mstoykov mstoykov merged commit a262a11 into master Aug 25, 2025
43 of 44 checks passed
@mstoykov mstoykov deleted the fix5088 branch August 25, 2025 14:14
mstoykov added a commit that referenced this pull request Aug 26, 2025
After #5017 turned out that k6 does not propagate the types it loads when making gRPC calls. This means that in many of the cases the globalTypes will be used, which will lead to errors.

This likely is not just around Any but is how it was reported.

This commit goes and propagates the types in each place where 
they will be marshaled/unmarshalled.

The added test is not perfect, but does catch the problem without
needing #4981 which I would expect would've also caught this.
As currently the server will load the prototypes in the global types
and k6/net/grpc will load them in their local types.
And then they will technically work.
mstoykov added a commit that referenced this pull request Aug 26, 2025
After #5017 turned out that k6 does not propagate the types it loads when making gRPC calls. This means that in many of the cases the globalTypes will be used, which will lead to errors.

This likely is not just around Any but is how it was reported.

This commit goes and propagates the types in each place where 
they will be marshaled/unmarshalled.

The added test is not perfect, but does catch the problem without
needing #4981 which I would expect would've also caught this.
As currently the server will load the prototypes in the global types
and k6/net/grpc will load them in their local types.
And then they will technically work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

anypb.Any proto messages support on invoke

3 participants