fix(codegen): don't require runtime settings to generate the GraphQL schema#199
fix(codegen): don't require runtime settings to generate the GraphQL schema#199sudoBrandino wants to merge 1 commit into
Conversation
The gql-schema codegen imports the resolver graph, which constructs the core Settings object and throws without RIVEN_SETTING__* values. Set build-time placeholders so codegen runs without runtime settings, fixing the Docker build and verify jobs on a cold turbo cache.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe schema generation script now uses dynamic imports and initializes placeholder environment variables for required settings ( ChangesGraphQL Schema Generation Robustness
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Coverage Report for Riven
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||
codegen:gql-schemaimports the resolver graph to emitschema.graphql. Importing it eagerly constructs the coreSettingsobject, which parsesRIVEN_SETTING__*and throws aZodErrorwhendatabaseUrl/redisUrl/vfsMountPatharen't set.In practice the schema only generates on a turbo cache hit — any change that invalidates the codegen cache without runtime settings in the env (a clean CI checkout, a cold Docker build) fails the build.
Schema generation only needs the resolver types, not real settings values, so this sets harmless build-time placeholders before importing the graph (real values still come from the runtime env_file), with the imports made dynamic so they apply first. No runtime behaviour change.
Summary by CodeRabbit
Bug Fixes
Chores