Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9dccb90. Configure here.
| case 0: | ||
| return unknown, nil | ||
| case 1: | ||
| return T(v[0]), nil |
There was a problem hiding this comment.
Single-byte slice parsing skips range validation
High Severity
The case []byte handler for single-byte slices returns T(v[0]) without validating the value against the enum's defined range. This differs from other numeric type handlers, which correctly check bounds and return an error for out-of-range values.
Reviewed by Cursor Bugbot for commit 9dccb90. Configure here.
| ), | ||
| g.Case(g.Lit(1)).Block( | ||
| ptrS.Clone().Op("=").Add(typeID.Clone().Call(g.Id("data").Index(g.Lit(0)))), | ||
| g.Return(g.Nil()), |
There was a problem hiding this comment.
Generated UnmarshalBinary accepts out-of-range byte values
High Severity
The UnmarshalBinary method, when handling single-byte input, directly casts the byte to the enum type. This bypasses the validation logic used by other unmarshalers, allowing invalid byte values to create invalid enum instances.
Reviewed by Cursor Bugbot for commit 9dccb90. Configure here.


Scope of changes
Adds the encoding.TextMarshaler and encoding.BinaryMarshaler interfaces.
Estimated PR Size:
Acceptance criteria
This PR will be merged without review.
Author checklist
Note
Medium Risk
Adds new generated
MarshalText/UnmarshalTextandMarshalBinary/UnmarshalBinarymethods and expands parsing of[]byteinputs, which can change serialization/deserialization behavior for existing enums.Overview
Generated enums now optionally implement encoding text and binary marshaling interfaces via new
MarshalText/UnmarshalTextandMarshalBinary/UnmarshalBinarymethods (gated byNoText/NoBinaryoptions).ParseFactoryis extended to handle[]byteinputs by treating multi-byte slices as strings and single-byte slices as numeric values, with corresponding unit test coverage added for byte and byte-slice cases.Reviewed by Cursor Bugbot for commit 9dccb90. Configure here.