Skip to content

fix: fallback to abstract name if no __typename was sent - #1527

Merged
ysmolski merged 5 commits into
masterfrom
yury/fix_handle_abstract_object_without_typename
Jun 8, 2026
Merged

fix: fallback to abstract name if no __typename was sent#1527
ysmolski merged 5 commits into
masterfrom
yury/fix_handle_abstract_object_without_typename

Conversation

@ysmolski

@ysmolski ysmolski commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Testing in cosmo revealed this issue.

@ysmolski
ysmolski requested a review from a team as a code owner June 5, 2026 15:38

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: efa067b6-38c1-4b17-9f56-028092977f99

📥 Commits

Reviewing files that changed from the base of the PR and between 9fa4c82 and 39d843d.

📒 Files selected for processing (1)
  • execution/engine/execution_engine_cost_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • execution/engine/execution_engine_cost_test.go

📝 Walkthrough

Walkthrough

recordObjectTypeStats now records type-name distribution statistics for abstract objects even when subgraphs omit __typename by falling back to the declared abstract type name; a regression test verifies cost accounting for an abstract field returned without __typename.

Changes

Type Stats Recording for Abstract Types

Layer / File(s) Summary
Type stats fallback to declared type name
v2/pkg/engine/resolve/resolvable.go
The early-return guard is narrowed to skip only when the object path is empty or the node is not abstract. When updating stats.TypeNames, the code uses obj.TypeName if the runtime typeName is nil, otherwise it uses the runtime __typename, before incrementing the distribution.
Regression test: abstract field without __typename
execution/engine/execution_engine_cost_test.go
Adds a subtest to TestExecutionEngine_Cost that returns an abstract hero without __typename, configures per-type weights for implementing types, and asserts both estimated and actual cost equal 13 for Query.hero.

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: falling back to abstract type name when __typename is missing from subgraph responses.
Description check ✅ Passed The description, though brief, is directly related to the changeset by referencing the issue discovered during testing that prompted the fix.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch yury/fix_handle_abstract_object_without_typename

Comment @coderabbitai help to get the list of available commands and usage tips.

@ysmolski
ysmolski merged commit 2548d5a into master Jun 8, 2026
10 checks passed
@ysmolski
ysmolski deleted the yury/fix_handle_abstract_object_without_typename branch June 8, 2026 09:44
ysmolski pushed a commit that referenced this pull request Jun 8, 2026
🤖 I have created a release *beep* *boop*
---


##
[2.4.4](v2.4.3...v2.4.4)
(2026-06-08)


### Bug Fixes

* fallback to abstract name if no __typename was sent
([#1527](#1527))
([2548d5a](2548d5a))
* **jsonschema:** root variables object is always a non-nullable
"object"
([#1528](#1528))
([8327b53](8327b53))

---
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>
ysmolski pushed a commit that referenced this pull request Jun 8, 2026
🤖 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants