refactor(core): per-build schema composer; delete the config-keyed schema cache - #213
Merged
Conversation
…hema cache
The schema LRU cached a GraphQLSchema keyed on an MD5 of the
stringified config while its resolvers closed over the content of
whichever build populated the entry — same config + changed content
returned stale reads: a correctness bug dressed as an optimization.
The query-executor change already removed the filter hot path that
was its only plausible performance justification. Deleting it also
deletes its support structure: the useSchemaCache bypass option (and
liveSchema's live-mode workaround), the validation-before-cache
ordering caveat, the __demoCacheBust hack in the nextjs example, and
the orphaned anyToString hashing helper. Rationale recorded in
docs/isolated-schema-factory.md.
generateSchema now builds on a per-build `new SchemaComposer()`. The
naive fix — passing { schemaComposer } to composeWithJson — would
have shipped a bug: graphql-compose-json's nested-object branch calls
createTC without forwarding options, so nested types (e.g. Post__content,
nested frontmatter) still landed on the process-global composer. New
internal composeCollection.ts replicates ObjectParser semantics (same
branch order, same TypeName_FieldName naming — existing snapshots are
the parity oracle) while threading the per-build composer through
every recursion. schemaComposer.clear() is gone.
base.test.ts dispositions: tests 1–8 unchanged; the cache-ordering
test keeps its byte-identical setup and assertions under the truthful
name "revalidates duplicate IDs when rebuilding with the same
config"; one new provider-level test locks the stale-read regression
the cache used to cause. ava.config.js stays at concurrency 1 —
raising it is a deliberate follow-up, as is dropping the now-unused
graphql-compose-json and lru-cache deps.
Test plan: 4 new schema-generation AVA tests (isolated sequential
builds, same-config content change, nested-type isolation between
builds, global-composer hygiene) + 1 new provider test; validation
snapshots unchanged; manual demo check of the example watch script
re-rendering edits without the hack. Full suite: pnpm verify (293 AVA
+ 52 vitest).
Co-authored-by: Cursor <cursoragent@cursor.com>
Change-Id: I676c4789f14217ee2b74e5dd323f682bc74d5a27
Collaborator
Author
|
This pull request is part of a Mergify stack:
|
This was referenced Jul 17, 2026
Merged
Collaborator
Author
|
@Mergifyio queue |
Contributor
Merge Queue Status
This pull request spent 38 minutes 22 seconds in the queue, including 3 minutes 45 seconds running CI. Required conditions to merge
|
Base automatically changed from
stack/tonyketcham/feat/unified-watch-effort-graph/unified-watch-coordinator-behind-one-seam-two--92f7ac79
to
main
July 18, 2026 09:10
…graph/per-build-schema-composer-delete-config-keyed--676c4789
tonyketcham
deleted the
stack/tonyketcham/feat/unified-watch-effort-graph/per-build-schema-composer-delete-config-keyed--676c4789
branch
July 18, 2026 09:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The schema LRU cached a GraphQLSchema keyed on an MD5 of the
stringified config while its resolvers closed over the content of
whichever build populated the entry — same config + changed content
returned stale reads: a correctness bug dressed as an optimization.
The query-executor change already removed the filter hot path that
was its only plausible performance justification. Deleting it also
deletes its support structure: the useSchemaCache bypass option (and
liveSchema's live-mode workaround), the validation-before-cache
ordering caveat, the __demoCacheBust hack in the nextjs example, and
the orphaned anyToString hashing helper. Rationale recorded in
docs/isolated-schema-factory.md.
generateSchema now builds on a per-build
new SchemaComposer(). Thenaive fix — passing { schemaComposer } to composeWithJson — would
have shipped a bug: graphql-compose-json's nested-object branch calls
createTC without forwarding options, so nested types (e.g. Post__content,
nested frontmatter) still landed on the process-global composer. New
internal composeCollection.ts replicates ObjectParser semantics (same
branch order, same TypeName_FieldName naming — existing snapshots are
the parity oracle) while threading the per-build composer through
every recursion. schemaComposer.clear() is gone.
base.test.ts dispositions: tests 1–8 unchanged; the cache-ordering
test keeps its byte-identical setup and assertions under the truthful
name "revalidates duplicate IDs when rebuilding with the same
config"; one new provider-level test locks the stale-read regression
the cache used to cause. ava.config.js stays at concurrency 1 —
raising it is a deliberate follow-up, as is dropping the now-unused
graphql-compose-json and lru-cache deps.
Test plan: 4 new schema-generation AVA tests (isolated sequential
builds, same-config content change, nested-type isolation between
builds, global-composer hygiene) + 1 new provider test; validation
snapshots unchanged; manual demo check of the example watch script
re-rendering edits without the hack. Full suite: pnpm verify (293 AVA
Co-authored-by: Cursor cursoragent@cursor.com
Depends-On: #212