Skip to content

Replace legacy emitter with mutation pipeline and TypeGraph output#83

Merged
swatkatz merged 4 commits into
fionabronwen/graphql-alloy-foundation-v2from
fionabronwen/graphql-foundation-skeleton
Jun 9, 2026
Merged

Replace legacy emitter with mutation pipeline and TypeGraph output#83
swatkatz merged 4 commits into
fionabronwen/graphql-alloy-foundation-v2from
fionabronwen/graphql-foundation-skeleton

Conversation

@FionaBronwen

@FionaBronwen FionaBronwen commented Apr 21, 2026

Copy link
Copy Markdown

Summary

Replaces the legacy emitter infrastructure with the new mutation pipeline:

  • Deleted: graphql-emitter.ts, registry.ts, schema-emitter.ts, type-maps.ts, types.d.ts
  • New $onEmit: type-usage → mutation engine → buildTypeGraph → render (stub)
  • New schema-mutator.ts: walks namespace, mutates all types, produces a TypeGraph — no pre-classified buckets
  • Diagnostic: empty-schema warning when no operations exist

The renderer (future PR) walks typeGraph.globalNamespace and classifies types at render time using isInterface(), isOneOf(), typeUsage.getUsage().

Key design decisions

Test plan

  • 9 schema-mutator tests: mutated types in TypeGraph, unreachable filtering, nullable union skipping, wrapper model inclusion, array model exclusion
  • 210 total tests pass (201 existing + 9 new)
  • Emitter test verifies pipeline completes without errors (rendering TBD)
  • Type check clean

Stacked on #77.

🤖 Generated with Claude Code

@FionaBronwen
FionaBronwen force-pushed the fionabronwen/graphql-alloy-foundation-v2 branch from 8b51ca4 to 8f411e1 Compare April 21, 2026 16:24
@FionaBronwen
FionaBronwen force-pushed the fionabronwen/graphql-foundation-skeleton branch from afdf684 to ce78164 Compare April 21, 2026 16:25
@FionaBronwen FionaBronwen changed the title Fionabronwen/graphql foundation skeleton Replace legacy emitter with foundation skeleton and diagnostics Apr 21, 2026
@FionaBronwen
FionaBronwen force-pushed the fionabronwen/graphql-foundation-skeleton branch 4 times, most recently from 193c59a to 95f3757 Compare April 22, 2026 17:09
@FionaBronwen
FionaBronwen marked this pull request as ready for review April 22, 2026 17:14
@FionaBronwen
FionaBronwen force-pushed the fionabronwen/graphql-alloy-foundation-v2 branch from 8f411e1 to 5f26c25 Compare April 28, 2026 15:28
@FionaBronwen
FionaBronwen force-pushed the fionabronwen/graphql-foundation-skeleton branch 3 times, most recently from 97fc964 to 962b388 Compare May 1, 2026 15:33
@FionaBronwen
FionaBronwen force-pushed the fionabronwen/graphql-foundation-skeleton branch 2 times, most recently from f8eeedb to 73724f4 Compare June 3, 2026 19:59
@swatkatz
swatkatz force-pushed the fionabronwen/graphql-alloy-foundation-v2 branch 3 times, most recently from 3f74c91 to 21abccf Compare June 8, 2026 20:24
- Delete legacy emitter infrastructure (graphql-emitter.ts, registry.ts,
  schema-emitter.ts, type-maps.ts, types.d.ts)
- New $onEmit: type-usage → mutation engine → buildTypeGraph → render (stub)
- Add schema-mutator.ts: walks namespace, mutates all types via engine,
  produces TypeGraph. No pre-classified buckets — renderer classifies at
  render time using decorators and typeUsage.
- Add empty-schema diagnostic when no operations exist
- Emitter test updated to verify pipeline runs (rendering TBD)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@swatkatz
swatkatz force-pushed the fionabronwen/graphql-foundation-skeleton branch from 73724f4 to e26c0b4 Compare June 8, 2026 20:46
@swatkatz swatkatz changed the title Replace legacy emitter with foundation skeleton and diagnostics Replace legacy emitter with mutation pipeline and TypeGraph output Jun 8, 2026
Swati Kumar and others added 3 commits June 8, 2026 23:03
Tests verify:
- Mutated models/enums/scalars/unions/operations appear in TypeGraph
- Unreachable types are excluded when omitUnreachableTypes is true
- All declared types included when omitUnreachableTypes is false
- T | null unions are not registered in the TypeGraph
- Union wrapper models (scalar variants) are included
- Array models are skipped (they're list types, not object types)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The mutation engine already handles T | null unions correctly (replaces
with inner type). The pre-check was a premature optimization that added
code without benefit — engine.mutate() is cached.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Without this, navigateTypesInNamespace on the global namespace visits
built-in TypeSpec scalars (string, int32, etc.) from the TypeSpec
sub-namespace, adding them to the TypeGraph unnecessarily.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@FionaBronwen

Copy link
Copy Markdown
Author

@swatkatz Additions LGTM! thank youu!

@swatkatz swatkatz left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Since Fiona is the author, she can't officially approve this PR, so I am approving it on her behalf as I wrote the code, so it is fine to swap roles: https://pinterest.slack.com/archives/C08UD3MR5QT/p1781035408754549?thread_ts=1780928581.664069&cid=C08UD3MR5QT

@swatkatz
swatkatz merged commit 828594c into fionabronwen/graphql-alloy-foundation-v2 Jun 9, 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.

2 participants