Skip to content

Preserve unaliasedPath and rawVariableValues in ResolveInfo - #2831

Open
officialasishkumar wants to merge 1 commit into
nuwave:masterfrom
officialasishkumar:preserve-resolve-info-properties
Open

officialasishkumar wants to merge 1 commit into
nuwave:masterfrom
officialasishkumar:preserve-resolve-info-properties

Conversation

@officialasishkumar

Copy link
Copy Markdown
Contributor

Resolves #2650

  • Added or updated tests
  • Documented user facing changes

Changes

Lighthouse wraps the ResolveInfo of webonyx/graphql-php in its own subclass before passing it to resolvers.
It only forwarded the constructor arguments of the first webonyx/graphql-php 15 release, so properties added later were reset to their defaults:

  • unaliasedPath (webonyx/graphql-php 15.12) was always []
  • rawVariableValues (webonyx/graphql-php 15.43) was always null

Both are now copied from the original ResolveInfo when they are set, so resolvers see the same values as in plain webonyx/graphql-php.

As discussed in the issue, this keeps supporting every webonyx/graphql-php ^15 release, with TODOs to pass the values to the parent constructor once a newer minimum is required.
Spreading named arguments conditionally needs PHP 8.1, so the values are assigned after the parent constructor instead.
The isset() guards are cheap, which matters because this runs for every resolved field.
On older webonyx/graphql-php versions the properties do not exist, so the guards skip them and the tests are skipped.
I checked PHPStan and the tests against webonyx/graphql-php 15.0.0, 15.12.0 and the latest release.

maxLookAheadFields (webonyx/graphql-php 15.50) is left out on purpose.
Lighthouse does not pass execution options to webonyx/graphql-php, so the original ResolveInfo always holds the default that the parent constructor sets anyway.

Breaking changes

None.

Changelog

Fixed

  • Preserve unaliasedPath and rawVariableValues of webonyx/graphql-php in the ResolveInfo passed to resolvers

Lighthouse wraps the `ResolveInfo` of webonyx/graphql-php in its own
subclass before passing it to resolvers, but only forwarded the
constructor arguments that existed in the first release of
webonyx/graphql-php 15. Properties added later were reset to their
defaults:

- `unaliasedPath` (webonyx/graphql-php 15.12) was always an empty array
- `rawVariableValues` (webonyx/graphql-php 15.43) was always null

Copy both from the original `ResolveInfo` when they are set, so they hold
the same values as in plain webonyx/graphql-php resolvers. Lighthouse
still supports every webonyx/graphql-php ^15 release and PHP 8.0, which
cannot spread named arguments conditionally, so the values are assigned
after calling the parent constructor. The `isset()` guards keep this
cheap, since it runs for every resolved field.

Resolves nuwave#2650
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-04T20:17:10.120944Z 0efe6bf PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@officialasishkumar

Copy link
Copy Markdown
Contributor Author

The failing PHPStan on ... and highest dependencies jobs are unrelated to this change.
phpstan/phpstan 2.4.0 was released after the last green run on master and reports 14 method.alreadyNarrowedType errors for assertInstanceOf() in DeferDBTest, PaginatedRelationLoaderTest and SubscriptionTest, which this PR does not touch.
I get the same errors when running PHPStan on master with the latest dependencies.
The runner then crashes while printing PHPStan's output, so those jobs have no logs.
PHPUnit, PHPStan with the lowest dependencies and the benchmarks pass.

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.

New unaliasedPath field in ResolveInfo is removed when constructing Lighthouse ResolveInfo

1 participant