fix: calculate costs for abstract fields without double counting - #1521
Conversation
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThis PR replaces integer list-size tracking with TypeNameStats (Size + per-typename counts). The resolver records per-path TypeNameStats, Context exposes TypeNameStats, cost computation uses TypeNameStats for actual multipliers, call sites are updated, and tests are re-baselined. ChangesTypeNameStats Migration
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
This PR fixes how costs for abstract types are calculated. Especially for fragments used on abstract types. For example, for actual costs, instead of summing each type of the union, engine sums only costs for types actually seen in the returned results. For estimated costs, instead of summing all the implementing nodes of abstract types, we just pick the implementing type with the maximum cost and add that to the costs of fields selected on the abstract type itself. I had to recalculate and verify numbers in tests. Unfortunately, this fix is not final. There is unfinished work with how the cost of the field itself is selected. Right now we pick the maximum weight across implementing types and dataSources independently from children costs selection. This concerns the estimation the most. The better approach would be to be tie this process with the selection of the type with maximum cost.
f831874 to
d4a6742
Compare
…-list-types-charge-all-items
…-list-types-charge-all-items
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@claude review once |
There was a problem hiding this comment.
Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.
Once credits are available, comment @claude review on this pull request to trigger a review.
…-list-types-charge-all-items
🤖 I have created a release *beep* *boop* --- ## [2.4.3](v2.4.2...v2.4.3) (2026-06-05) ### Bug Fixes * calculate costs for abstract fields without double counting ([#1521](#1521)) ([4175a9e](4175a9e)) * **jsonschema:** align nullability with JSON Schema 2020-12 ([#1518](#1518)) ([6fcdf8c](6fcdf8c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: wundergraph-bot[bot] <285992168+wundergraph-bot[bot]@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- ## [1.15.5](execution/v1.15.4...execution/v1.15.5) (2026-06-08) ### Bug Fixes * calculate costs for abstract fields without double counting ([#1521](#1521)) ([4175a9e](4175a9e)) * fallback to abstract name if no __typename was sent ([#1527](#1527)) ([2548d5a](2548d5a)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: wundergraph-bot[bot] <285992168+wundergraph-bot[bot]@users.noreply.github.com>
This PR fixes how costs for abstract types are calculated. Especially for fragments used on abstract types.
For example, for actual costs, instead of summing each type of the union, engine sums only costs for types actually seen in the returned results.
For estimated costs, instead of summing all the implementing nodes of abstract types, we just pick the implementing type with the maximum cost and add that to the costs of fields selected on the abstract type itself.
I had to recalculate and verify numbers in tests.
Unfortunately, this fix is not final. There is unfinished work with how the cost of the field itself is selected. Right now we pick the maximum weight across implementing types and dataSources independently from children costs selection. This concerns the estimation the most. The better approach would be to be tie this process with the selection of the type with maximum cost.