Modernize GraphQLComponent: bug fixes, type safety, hardening, and docs (v6.1.0) #116
Open
tlivings wants to merge 5 commits intoExpediaGroup:masterfrom
Open
Modernize GraphQLComponent: bug fixes, type safety, hardening, and docs (v6.1.0) #116tlivings wants to merge 5 commits intoExpediaGroup:masterfrom
tlivings wants to merge 5 commits intoExpediaGroup:masterfrom
Conversation
…mprovements, and cleanup - Add private modifiers and proper nullable types for _schema/_transformedSchema - Add disposed state tracking with _assertNotDisposed guards on all public getters - Stop mutating imported components' federation flag (breaking behavioral fix) - Change context.use() to return unsubscribe function instead of chaining - Add middleware validation, context/transforms config validation - Memoize only Query resolvers (not Mutation) to prevent stale mutation results - Cache imported component data source injectors to avoid per-request recreation - Replace destructive while/shift with for-of in transformSchema - Add invalidateSchema() for schema rebuild support - Enable noImplicitAny, add type annotations throughout src and tests - Add new test files for dispose, error handling, schema invalidation - Fix prepublish -> prepublishOnly, add prettier/husky config, sort devDeps Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Round 1 fixes (all 156 tests passing): - Fix TS compilation error in stitchSchemas resolver cast - Fix undefined types wrapping to [] instead of [undefined] - Consolidate dual context-building paths into single flow - Add data source name collision warnings - Add typeof guard on Query resolvers in bindResolvers - Stable memoization cache key with sorted keys - Cache Proxy method wrappers to reduce GC pressure - Simplify mocks condition check - Skip mergeTypeDefs for single non-federation type Project setup: - Add AGENTS.md with project-specific agent instructions - Add CLAUDE.md symlink to AGENTS.md - Remove .cursor/rules/ (content extracted to AGENTS.md) - Add .continue-here.md with 16 remaining hardening items Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Bugs fixed: - Transform loop no longer breaks on falsy (null/0/false) return values - Federation setter now invalidates cached schema - Context function checks dispose state on each call - stableStringify handles circular references via try/catch fallback - Data source empty string name no longer falls through to constructor name - Namespace 'dataSources' rejected in validation to prevent shadow - Import injector defaults to [] when component omits dataSources Hardening: - Circular self-import detection in constructor - Middleware array snapshot before iteration prevents mutation during loop - Added "types" and "exports" fields to package.json Tests: middleware errors, namespace collision, subscription binding, middleware unsubscribe, concurrent context calls, custom IGraphQLComponent without dataSources, falsy transforms, federation invalidation, circular import guard, stableStringify with contextValue. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove prettier: devDependency, format script, .prettierrc, .npmignore entry - Fix else/catch placement to new line (4 occurrences) - Add missing semicolons on type definitions and statements (7 occurrences) - Remove trailing whitespace (4 occurrences) - Fix double space in class declaration - Convert arrow functions to function declarations where this is not needed - Update AGENTS.md: remove prettier reference, update function style rule - Remove .continue-here.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
empty data source names, namespace shadowing prevention, and missing import injector defaults
noImplicitAny, add private modifiers, dispose guards on all public getters, propernullable types, middleware/config validation
middleware array snapshot prevents mutation during iteration, circular self-import detection, cached Proxy method wrappers for
reduced GC pressure
federation invalidation, circular imports, and more (all 156 tests passing)
Test plan
npm test— all 156 tests passnpm run build— clean TypeScript compilation