Skip to content

Conversation

@simonresch
Copy link
Contributor

@simonresch simonresch commented Oct 30, 2025

Adds mutator support for protobuf maps where the map value is a protobuf enum.

message TestProtobuf {
  enum Enum {
    Label1 = 0;
    Label2 = 1;
    Label3 = 2;
    Label4 = 3;
    Label5 = 4;
  }

  map<int32, Enum> map_field = 1;
}

@simonresch simonresch requested a review from Copilot October 30, 2025 13:03
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for protobuf maps where the value type is a protobuf enum. Previously, the code only handled map values that were messages, but now it recursively processes map value fields to support both enum and message types.

Key changes:

  • Refactored map field handling to recursively process the value field descriptor
  • Added test coverage for enum-valued maps in both proto2 and proto3
  • Updated expected test outputs to include the new enum map mutator representations

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/main/java/com/code_intelligence/jazzer/mutation/mutator/proto/BuilderMutatorFactory.java Refactored map field handling to recursively process value fields, supporting both enum and message map values
src/test/java/com/code_intelligence/jazzer/mutation/mutator/proto/proto3.proto Added EnumMapField3 test message with enum-valued map
src/test/java/com/code_intelligence/jazzer/mutation/mutator/proto/proto2.proto Added enum_map and message_map fields to TestProtobuf
src/test/java/com/code_intelligence/jazzer/mutation/mutator/StressTest.java Added test case for EnumMapField3 and updated expected mutator representations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@simonresch simonresch marked this pull request as ready for review October 30, 2025 13:16
Copy link
Contributor

@oetr oetr left a comment

Choose a reason for hiding this comment

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

LGTM! Nice use of recursion!
You can set the timeout="long" for the failing test. It is very sensitive to PRNG-related changes. In this case you added new fields to proto2 and changed the mutations that are always running with the same seed. You can also find a better seed, if you have time!

@simonresch simonresch force-pushed the CIF-1832-support-protobuf-enum-maps branch from 19f8bdd to ce72acf Compare October 30, 2025 17:26
@simonresch simonresch force-pushed the CIF-1832-support-protobuf-enum-maps branch from ce72acf to 22ec371 Compare October 30, 2025 17:32
@simonresch simonresch enabled auto-merge (rebase) October 30, 2025 17:33
@simonresch simonresch merged commit b8c05f4 into main Oct 30, 2025
9 checks passed
@simonresch simonresch deleted the CIF-1832-support-protobuf-enum-maps branch October 30, 2025 17:40
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.

3 participants