Repository navigation
Fix contract leaf type checking and policy dispatch - #49
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a66d2651b1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| else if (isCaseClass(tpe)) StructShape(fieldsOf(tpe)) | ||
| else if (isSupportedLeaf(tpe)) PrimitiveShape(TypeShape.simpleName(tpe.show)) | ||
| else unsupportedLeaf(tpe) |
There was a problem hiding this comment.
Respect custom encoders when checking leaf types
When a model contains a UUID, domain enum, or another non-whitelisted leaf but has a valid implicit DataEncoder[A], materializing SchemaConforms now aborts here (and in the Scala 2 counterpart) before the typed sink can be built. Encoding is extensible through DataEncoder.instance and sinks require an encoder for the whole A, so membership in this fixed leaf list neither proves nor disproves that a sink can encode the model; this rejects otherwise valid pipelines. Preserve unknown leaves as opaque shapes or base this validation on actual encoder evidence instead.
Useful? React with 👍 / 👎.
The contract macros read any unknown type as an opaque primitive, so a type no sink can encode passed the check and failed at write time, and a policy written as the case object type was compared under default rules instead of the requested ones. A policy is now resolved to one field matching, one name casing and one tolerance, positional drift is reported as the fields that are missing or extra rather than only a field count, a mismatch between an optional and a required type reports what the producer actually has, and a Scala 2 field type keeps its type arguments and its optionality.