Skip to content

fix: return reflect.Value from Field.resolve to preserve Go interface - #764

Merged
pavelnikolov merged 4 commits into
graph-gophers:mainfrom
janisz:fix/issue-763-interface-method-index
Jul 2, 2026
Merged

fix: return reflect.Value from Field.resolve to preserve Go interface#764
pavelnikolov merged 4 commits into
graph-gophers:mainfrom
janisz:fix/issue-763-interface-method-index

Conversation

@janisz

@janisz janisz commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

janisz and others added 3 commits June 22, 2026 16:36
When a resolver method returns a Go interface and the concrete type has
extra exported methods, method indices computed at schema-build time
don't match at runtime because reflect.ValueOf(any) unwraps to the
concrete type.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… type (graph-gophers#763)

Field.resolve() returned any, which erases the Go interface type via
result.Interface(). When the concrete type has extra methods, method
indices computed against the interface at build time don't match the
concrete type at runtime, causing a reflect panic.

Returning reflect.Value instead avoids the type-erasing round-trip.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Rename test fixtures to include issue number (issue763ThingResolver,
  issue763ConcreteThingResolver) matching established convention
- Add comment on AaExtra explaining why it exists and why its name matters
- Use RunTest (singular) instead of RunTests for single test case

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pavelnikolov
pavelnikolov previously approved these changes Jul 2, 2026
Signed-off-by: Pavel Nikolov <me@pavelnikolov.net>
@pavelnikolov
pavelnikolov force-pushed the fix/issue-763-interface-method-index branch from 407cf10 to 4505fc3 Compare July 2, 2026 05:56
@pavelnikolov
pavelnikolov merged commit 60399cc into graph-gophers:main Jul 2, 2026
3 checks passed
@pavelnikolov

Copy link
Copy Markdown
Member

fixes: #763

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