Skip to content

[codex] Fix no-variable operations with provided variables#622

Merged
zth merged 3 commits into
masterfrom
repro/no-variable-mutation-provided-variable
May 20, 2026
Merged

[codex] Fix no-variable operations with provided variables#622
zth merged 3 commits into
masterfrom
repro/no-variable-mutation-provided-variable

Conversation

@zth

@zth zth commented May 20, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a regression test for a mutation that has no user-supplied variables but spreads a fragment with a Relay provided variable, then fixes the crash by normalizing converted operation variables before they are handed to Relay.

Root Cause

For operations whose variables type is unit, ReScript emits JavaScript undefined. Relay expects operation variables to be an object and reads from variables[def.name] before applying params.providedVariables, so a no-variable mutation with only provided variables crashes while creating the operation descriptor.

Changes

  • Added a mutation repro that spreads a provided-variable fragment.
  • Normalized converted operation variables through internal_cleanObjectFromUndefinedRaw before Relay calls.
  • Applied the normalization consistently across mutation, query, subscription, preload/load, retain, local payload, and refetch paths.

Validation

  • yarn build
  • yarn test --runTestsByPath __tests__/Test_mutation-tests.js --runInBand
  • yarn test:ci

@zth
zth marked this pull request as ready for review May 20, 2026 08:28
@zth

zth commented May 20, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@zth
zth merged commit a5a43ad into master May 20, 2026
6 checks passed
@zth
zth deleted the repro/no-variable-mutation-provided-variable branch May 20, 2026 08:34
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.

1 participant