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
Tracking: Strawberry Shake fragment/codegen fixes from differential fuzzing
Consolidated tracker for a batch of Strawberry Shake code-generation findings, their fixes, related upstream issues, and verification against upstream vnext. Fix branches are based on main (which mirrors upstream ChilliCream/graphql-platform), so each PR is an isolated, upstream-style change.
How found: a differential codegen fuzzer (graphql-js validity oracle → real CSharpGenerator.Generate(...) → Roslyn-compile of the output). A finding = a spec-valid document that Strawberry Shake throws on, errors on, or emits non-compiling/wrong code for. Targets derived from stackworx/relay-extractor. Harness + write-up: branch test/strawberry-shake-codegen-fuzz (FINDINGS.md). Companion HotChocolate-validator findings: #6.
Status at a glance
Fixes shipped (each TDD-first: failing test → fix → PR)
fix(strawberryshake): resolve output type for composite field selected directly and via fragment #9 — a composite field selected directly + via a fragment threw InvalidOperationException: Could not find an output type for the specified field syntax. Root cause: FieldCollector merges duplicate selections in document order while FragmentHelper.CollectFields processes inline fragments first; they disagree on the canonical FieldNode and OperationModel.TryGetFieldResultType's reference-equality lookup misses. Fix registers the merged-away selection sets. 194 passed, no existing snapshot changed.
test(strawberry-shake): characterize shared-fragment model naming gap (#6873) #10 — same fragment across two operations generates divergent GetA_* / GetB_* models (only the fragment interface is shared). Full fix is large/risky (operation+path-keyed names, no cross-op registry, ~86 snapshots); ships a characterizing test + scope analysis instead, no production change.
fix(strawberryshake): degrade gracefully on unknown abstract type at runtime #12 — unknown union/interface __typename made the result builder throw new NotSupportedException(). Fix makes the per-__typename dispatch nullability-aware (degrade to null for nullable positions) across JsonResultBuilderGenerator*. 73 snapshots + 13 clients regenerated.
Merge-order note:#7 & #8 both touch FragmentHelper.cs (different methods); #11 & #12 both touch JsonResultBuilderGenerator* and regenerate large snapshot sets (47 and 73) — whichever of #11/#12 merges second needs its snapshots re-regenerated.
Ran every repro against the StrawberryShake vnext PR head (a724f9b282). vnext fixes none of the six (see the "In vnext ChilliCream#9977?" column and the full comment). Caveat: that is an early PR head; vnext may address some as it matures. As of that head, all fork PRs remain relevant.
Backlog — related open defects found in the upstream sweep (not yet addressed)
Tracking: Strawberry Shake fragment/codegen fixes from differential fuzzing
Consolidated tracker for a batch of Strawberry Shake code-generation findings, their fixes, related upstream issues, and verification against upstream vnext. Fix branches are based on
main(which mirrors upstreamChilliCream/graphql-platform), so each PR is an isolated, upstream-style change.How found: a differential codegen fuzzer (graphql-js validity oracle → real
CSharpGenerator.Generate(...)→ Roslyn-compile of the output). A finding = a spec-valid document that Strawberry Shake throws on, errors on, or emits non-compiling/wrong code for. Targets derived from stackworx/relay-extractor. Harness + write-up: branchtest/strawberry-shake-codegen-fuzz(FINDINGS.md). Companion HotChocolate-validator findings: #6.Status at a glance
Fixes shipped (each TDD-first: failing test → fix → PR)
__typenamethrows at runtimeSecond batch — duplicate-member family (shipped)
CS0128 'u'+ duplicateMapFilesFromType<T>)main→ regression guardVerified already-fixed on
main(no action needed)main; both aliases generate full per-implementation deserialization. Not related to PR fix(strawberryshake): preserve entity fields across differing selection sets (#8063) #11 (different code path). Recommend closing upstream as already-fixed (see comment).main(fixed by the type-system pipeline rework, e.g. Groundwork to align type systems. ChilliCream/graphql-platform#8247/Introduced new execution abstractions. ChilliCream/graphql-platform#8267, not a targeted commit). Issue still open upstream; PR test(strawberry-shake): regression guard for inheritance codegen (#5593) #15 adds a regression guard. Candidate to close as already-fixed.Detail (shipped fixes)
InvalidOperationException: Could not find an output type for the specified field syntax. Root cause:FieldCollectormerges duplicate selections in document order whileFragmentHelper.CollectFieldsprocesses inline fragments first; they disagree on the canonicalFieldNodeandOperationModel.TryGetFieldResultType's reference-equality lookup misses. Fix registers the merged-away selection sets. 194 passed, no existing snapshot changed....UF ...UFlisted the fragment interface twice (: IUF, IUF) → CS0528. Root cause:FragmentHelper.CreateImplementsadds the cached interface once per spread. Fix dedupes. 195 passed.default!by the JSON result builder. Fix hoists ctor args + merges preserved fields inJsonResultBuilderGenerator_UpdateEntity.cs. Aligns with upstream draft Adjust result builder to not return incomplete data from the entity store ChilliCream/graphql-platform#8595. 47 snapshots + 13 clients regenerated.FragmentHelper.CollectFieldsdidn't descend into named-fragment nodes with an abstract type condition. 14-line fix.GetA_*/GetB_*models (only the fragment interface is shared). Full fix is large/risky (operation+path-keyed names, no cross-op registry, ~86 snapshots); ships a characterizing test + scope analysis instead, no production change.__typenamemade the result builderthrow new NotSupportedException(). Fix makes the per-__typenamedispatch nullability-aware (degrade tonullfor nullable positions) acrossJsonResultBuilderGenerator*. 73 snapshots + 13 clients regenerated.Merge-order note: #7 & #8 both touch
FragmentHelper.cs(different methods); #11 & #12 both touchJsonResultBuilderGenerator*and regenerate large snapshot sets (47 and 73) — whichever of #11/#12 merges second needs its snapshots re-regenerated.vnext (ChilliCream#9977) verification
Ran every repro against the StrawberryShake vnext PR head (
a724f9b282). vnext fixes none of the six (see the "In vnext ChilliCream#9977?" column and the full comment). Caveat: that is an early PR head; vnext may address some as it matures. As of that head, all fork PRs remain relevant.Backlog — related open defects found in the upstream sweep (not yet addressed)
__typenameresult-type family (adjacent to Generated union type classes are empty with SS13.0.5 and .NET7 when using fragments ChilliCream/graphql-platform#5992/Unknown interface types in result list throws exception ChilliCream/graphql-platform#6415/Order of Inline Fragments Causes Missing Data ChilliCream/graphql-platform#8063): Build Error - Incompatible Type Conversion in Generated Code ChilliCream/graphql-platform#6743, Generation fails for interface types which has an id field ChilliCream/graphql-platform#6539, "Cannot convert error" in generated StrawberryShake code for implemented result types ChilliCream/graphql-platform#6292, Strawberry Shake: Runtime ArgumentNullException caused by possible code generation bug when mapping response into "Data" object ChilliCream/graphql-platform#5349.System.Objectmethod), Strawberry Shake generates random ">" character in function name leading to invalid generated code. ChilliCream/graphql-platform#7766 (stray">"in generated name).Findings 1 & 2 confirmed unreported upstream (exhaustive open+closed search). Full sweep: comment.
Checklist
__typename) — fixed, reviewmain, regression guard addedmain— Claude
🤖 Generated with Claude Code