You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONSTRUCTOR_UNION_FAILURE_INVENTORY.md
+16-9Lines changed: 16 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -125,15 +125,22 @@ Do not call the feature done until each item is:
125
125
126
126
## Open Items Under Active Audit
127
127
128
-
- Symmetry between constructor-form unions and named/declaration-form unions beyond the covered service/transform cases.
129
-
- Remaining edge cases for custom discriminator/value keys beyond the covered HTTP/OpenAPI example paths.
130
-
- Post-normalization identifier collisions in generated Go/OpenAPI helper names beyond the covered discriminator-name cases.
131
-
- Multipart and broader streaming/security-analysis behavior for constructor unions beyond the covered WebSocket and method-validation paths.
132
-
- Broader gRPC coverage beyond the covered unary and bidirectional-streaming smoke paths.
133
-
- Anonymous-union deduping and helper/type collisions across repeated use sites beyond the covered same-service repeated-use and collection-transform paths.
134
-
- Whether silent omission is the right upstream contract for ambiguous union examples, or whether the generator should preserve the raw example or raise a design-time error instead.
135
-
- Whether rejecting defaults on all unions is an intentional upstream contract change or constructor-union-specific behavior that widened unintentionally.
136
-
- Duplication of constructor-union naming/stability logic across DSL, expr finalization, and transport codegen, which increases drift risk.
128
+
-[ ]**Package-level constant collision in `KindConst` generation**: In `codegen/service/service_data.go`, `KindConst` is generated by concatenating `kindName` and `fieldName` without verifying the resulting name's uniqueness in the package scope. This can lead to collisions between different unions or other package-level identifiers (e.g., Union `Foo` with branch `KindBar` vs Union `FooKind` with branch `Bar`).
129
+
-[ ]**Ambiguous OpenAPI example matching in `objectExampleMatchScore`**: In `http/codegen/openapi/v3/example.go`, `objectExampleMatchScore` does not check for required fields. An empty object example `{}` will match any object branch with a score of 1, potentially leading to unintended ambiguity or silent omission of examples for unions where one branch has required fields and another does not.
130
+
-[ ]**Primitive type resolution in `OneOf` constructor string variants**: In `dsl/attribute.go`, `resolveOneOfVariantType` for string variants only checks for `UserType`. Passing primitive names like `"int"` or `"string"` results in a forward-reference to a non-existent `UserType`, failing later in validation instead of resolving to the built-in primitive types.
131
+
-[ ]**`InvalidOneOf` sentinel leaked to codegen**: The `InvalidOneOf` sentinel type used in `dsl/attribute.go` for failed `OneOf` declarations is not explicitly filtered or handled in service or transport codegen layers. While DSL evaluation errors should prevent codegen, a partial or ignored error state could lead to uncompilable or nonsensical code being generated for an "InvalidOneOf" type.
132
+
-[ ]**Duplicated naming/stability logic drift risk**: The logic for building `bases` and `stableKeys` for `UniqueStableNames` is duplicated between `expr/union_naming.go` (`DerivedUnionVariantNames`) and `codegen/types.go` (`UniqueUnionFieldNames`). This increases the risk of behavioral drift where DSL-time discriminator naming and codegen-time field naming become inconsistent over time.
133
+
-[ ]**Aggressive `strings.TrimRight` in OpenAPI `uniquify`**: In `http/codegen/openapi/v3/types.go`, the `uniquify` method uses `strings.TrimRight(n, "0123456789")` which is too aggressive if a type name naturally ends in a number (e.g., `IPv6` -> `IPv`). This can cause unexpected collisions or naming shifts when uniquifying such types.
134
+
-[ ] Symmetry between constructor-form unions and named/declaration-form unions beyond the covered service/transform cases.
135
+
-[ ] Remaining edge cases for custom discriminator/value keys beyond the covered HTTP/OpenAPI example paths.
136
+
-[ ] Post-normalization identifier collisions in generated Go/OpenAPI helper names beyond the covered discriminator-name cases.
137
+
-[ ] Multipart and broader streaming/security-analysis behavior for constructor unions beyond the covered WebSocket and method-validation paths.
138
+
-[ ] Broader gRPC coverage beyond the covered unary and bidirectional-streaming smoke paths.
139
+
-[ ] Anonymous-union deduping and helper/type collisions across repeated use sites beyond the covered same-service repeated-use and collection-transform paths.
140
+
-[ ] Whether silent omission is the right upstream contract for ambiguous union examples, or whether the generator should preserve the raw example or raise a design-time error instead.
141
+
-[ ] Whether rejecting defaults on all unions is an intentional upstream contract change or constructor-union-specific behavior that widened unintentionally.
142
+
-[ ] Duplication of constructor-union naming/stability logic across DSL, expr finalization, and transport codegen, which increases drift risk.
0 commit comments