fix(core): include extended env vars when skipValidation is true#408
Open
tmrp wants to merge 1 commit into
Open
fix(core): include extended env vars when skipValidation is true#408tmrp wants to merge 1 commit into
tmrp wants to merge 1 commit into
Conversation
When `skipValidation: true`, `createEnv` was returning `runtimeEnv` directly, silently discarding variables contributed via `extends`. Fix by hoisting the `extendedObj` reduction above the skip guard and merging it with `runtimeEnv` before the early return, matching the behaviour of the normal validation path (runtimeEnv takes precedence). Adds three regression tests in smoke-zod4.test.ts covering: - single preset vars are accessible - runtimeEnv values override preset values - multiple preset vars are all accessible
|
@tmrp is attempting to deploy a commit to the t3-oss Team on Vercel. A member of the Team first needs to authorize it. |
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.
Problem
When
createEnvis called withskipValidation: true, it returnedruntimeEnvdirectly via an early return, silently dropping all variables contributed by theextendsarray. This meant that any preset env vars (e.g. fromuploadthing()or a shared base env) wereundefinedat runtime whenever validation was skipped.Fix
Hoist
extendedObjabove the skip guard and returnObject.assign(extendedObj, runtimeEnv)instead of bareruntimeEnv. This matches the merge order of the normal validation path, soruntimeEnvvalues continue to take precedence over preset values.Tests
Three regression tests added to
smoke-zod4.test.ts:skipValidation: trueruntimeEnvvalues override extended preset values (precedence preserved)