Skip to content

refactor(core): per-build schema composer; delete the config-keyed schema cache - #213

Merged
tonyketcham merged 2 commits into
mainfrom
stack/tonyketcham/feat/unified-watch-effort-graph/per-build-schema-composer-delete-config-keyed--676c4789
Jul 18, 2026
Merged

tonyketcham merged 2 commits into
mainfrom
stack/tonyketcham/feat/unified-watch-effort-graph/per-build-schema-composer-delete-config-keyed--676c4789

Conversation

@tonyketcham

Copy link
Copy Markdown
Collaborator

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

Depends-On: #212

…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
@tonyketcham

tonyketcham commented Jul 17, 2026 •

Copy link
Copy Markdown
Collaborator Author

This pull request is part of a Mergify stack:

# Pull Request Link
1 docs(effort-graph): add Effort Graph glossary and ADRs 0001-0007 #205
2 feat(core,cli): unified watch with incremental reindex and live schema swap #206
3 feat(effort-graph): journaled semantic writer for the Effort Graph #207
4 refactor(config): loadConfig returns an initialized LoadedFlatbreadConfig #208
5 refactor(core): single Record-production module owns file→Record and path classification #209
6 refactor(effort-graph): per-mutate snapshot + Decision lifecycle module #210
7 refactor(core): collection query executor owns filter/sort/paging with copy-on-output #211
8 refactor(core,cli): unified watch coordinator behind one seam, two adapters #212
9 refactor(core): per-build schema composer; delete the config-keyed schema cache #213 👈
10 feat(effort-graph,flatbread): committed-generation bridge completes the ADR-0003/0004 contract #214
11 chore(core): drop unused graphql-compose-json and lru-cache dependencies #215
12 test: raise AVA concurrency now that the global-composer pin is obsolete #216
13 docs(agents): define orchestrator-executor operating model #217

@tonyketcham

Copy link
Copy Markdown
Collaborator Author

@Mergifyio queue

@mergify

mergify Bot commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-07-18 08:36 UTC · Rule: owner-bypass · triggered by @tonyketcham with the @mergifyio queue command
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-07-18 09:14 UTC · at cf51c6cc213ba9e8da65970df5ebc306e78f6a61

This pull request spent 38 minutes 22 seconds in the queue, including 3 minutes 45 seconds running CI.

Required conditions to merge
  • author = tonyketcham
  • check-success = build (20.x, ubuntu-latest)
  • check-success = build (22.x, ubuntu-latest)
  • check-success = integration-nextjs (20.x, macos-latest)
  • check-success = integration-nextjs (20.x, ubuntu-latest)
  • check-success = integration-nextjs (20.x, windows-latest)
  • check-success = integration-nextjs (22.x, macos-latest)
  • check-success = integration-nextjs (22.x, ubuntu-latest)
  • check-success = integration-nextjs (22.x, windows-latest)
  • check-success = integration-sveltekit (20.x, macos-latest)
  • check-success = integration-sveltekit (20.x, ubuntu-latest)
  • check-success = integration-sveltekit (20.x, windows-latest)
  • check-success = integration-sveltekit (22.x, macos-latest)
  • check-success = integration-sveltekit (22.x, ubuntu-latest)
  • check-success = integration-sveltekit (22.x, windows-latest)
  • check-success = lint (20.x, ubuntu-latest)
  • check-success = lint (22.x, ubuntu-latest)
  • check-success = test (20.x, ubuntu-latest)
  • check-success = test (22.x, ubuntu-latest)
  • depends-on = FlatbreadLabs/flatbread#212 [⛓️ refactor(core,cli): unified watch coordinator behind one seam, two adapters #212]

@mergify mergify Bot added the queued label Jul 18, 2026
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
tonyketcham merged commit dbe96b3 into main Jul 18, 2026
19 checks passed
@tonyketcham
tonyketcham deleted the stack/tonyketcham/feat/unified-watch-effort-graph/per-build-schema-composer-delete-config-keyed--676c4789 branch July 18, 2026 09:15
@mergify mergify Bot removed the queued label Jul 18, 2026
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