Skip to content

Fix scalar overrides not applied without assertValid()#1886

Merged
spawnia merged 3 commits intomasterfrom
failing-test
Mar 29, 2026
Merged

Fix scalar overrides not applied without assertValid()#1886
spawnia merged 3 commits intomasterfrom
failing-test

Conversation

@ruudk
Copy link
Copy Markdown
Collaborator

@ruudk ruudk commented Mar 23, 2026

Summary

Schema::getType() fell back to global built-in scalar singletons without checking config->types for scalar overrides.
The override logic only ran inside getTypeMap(), which is triggered by assertValid().

Extracted scalar override detection into a lazy cached getScalarOverrides() method used by both getType() and getTypeMap(), so overrides work regardless of whether assertValid() was called.

Test plan

  • Existing test testTypesOverrideWorksWithTypeLoader now passes without assertValid()
  • Added testTypesOverrideWorksWithTypeLoaderAndAssertValid to cover the assertValid() + typeLoader path
  • Added testGetTypeReturnsScalarOverrideWithTypeLoader to verify getType() returns the override directly
  • Added testTypesOverrideWorksWithCallableTypesConfig for callable types config
  • Added testTypesOverrideWorksWithGeneratorTypesConfig for generator types config with subsequent assertValid()
  • Added testGetTypeThenAssertValidBothWorkWithTypeLoader to verify both code paths work in sequence

Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.50.

Benchmark suite Current: c32a6ba Previous: 6702705 Ratio
DeferredBench::benchManyNestedDeferreds 18.651 ms 12.17 ms 1.53

This comment was automatically generated by workflow using github-action-benchmark.

@ruudk
Copy link
Copy Markdown
Collaborator Author

ruudk commented Mar 29, 2026

@spawnia wdyt?

spawnia added 2 commits March 29, 2026 16:14
Schema::getType() fell back to global built-in scalar singletons
without checking config->types for scalar overrides. The override
logic only ran inside getTypeMap(), triggered by assertValid().

Extract scalar override detection into a lazy cached
getScalarOverrides() method used by both getType() and getTypeMap().

#1886

🤖 Generated with Claude Code
@spawnia spawnia changed the title Scalar overrides only works when schema->assertValid is called Fix scalar overrides not applied without assertValid() Mar 29, 2026
@spawnia spawnia marked this pull request as ready for review March 29, 2026 14:45
@spawnia
Copy link
Copy Markdown
Collaborator

spawnia commented Mar 29, 2026

Added a fix, ready to go from my perspective.

@ruudk
Copy link
Copy Markdown
Collaborator Author

ruudk commented Mar 29, 2026

Thanks. Let's try this out.

I hope we refactor the whole Type system one day so that this becomes easier.

@spawnia spawnia merged commit ebd6aff into master Mar 29, 2026
22 checks passed
@spawnia spawnia deleted the failing-test branch March 29, 2026 18:21
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