Repository navigation
fix(env): parse boolean flags instead of coercing them - #1245
Open
emanuelbenavile wants to merge 1 commit into
Open
emanuelbenavile wants to merge 1 commit into
emanuelbenavile wants to merge 1 commit into
Conversation
z.coerce.boolean() runs Boolean(value), so any non-empty string is true: REDIS_DISABLE=false disables Redis and HIDE_TRPC_LOGS=false hides tRPC logs. z.stringbool() reads true/false, 1/0, yes/no, on/off, y/n and enabled/disabled, case insensitive. Unset or empty values keep their current defaults because createEnv runs with emptyStringAsUndefined. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
@EmanuXBe is attempting to deploy a commit to the Merit Systems Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
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.
REDIS_DISABLEandHIDE_TRPC_LOGSusez.coerce.boolean(), which runsBoolean(value). Any non-empty string becomestrue, so:REDIS_DISABLE=falsedisables RedisHIDE_TRPC_LOGS=falsehides tRPC logsThe cache benchmark in #1196 ran into this: its
REDIS_DISABLEoverride had to be an empty string to mean "enabled".This switches both to
z.stringbool()from Zod 4, which acceptstrue/false,1/0,yes/no,on/off,y/nandenabled/disabled, case insensitive.Unchanged: an unset or empty variable still falls back to the current default, because
createEnvruns withemptyStringAsUndefined: true.Behavior change: a value outside that list, such as
REDIS_DISABLE=maybe, now fails env validation at boot instead of silently meaningtrue.Checked:
pnpm checkpasses (format, oxlint, knip, publish check, and types for every package) except@x402scan/apptypes, which fail on currentmainwithout this change:src/app/(app)/(home)/resources/register/_components/form.tsx(930,23): Type 'string' is not assignable to type 'UrlObject | RouteImpl<string>'.🤖 Generated with Claude Code