Skip to content

Commit 39c8055

Browse files
committed
fix(webapp): keep a blank debounce ceiling from failing startup validation
z.coerce turns an empty string into 0, so a deployment that templates the variable without a value would have failed the new positive check and refused to boot. Reuse the file's existing blank-normalising pattern so absent, empty and whitespace all mean no ceiling, while a value that is actually set still has to be greater than zero.
1 parent 61d77ea commit 39c8055

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

apps/webapp/app/env.server.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ const OptionalIntEnv = z.preprocess(
114114
z.coerce.number().int().optional()
115115
);
116116

117+
/** As {@link OptionalIntEnv}, but a value that is set must be greater than zero. */
118+
const OptionalPositiveIntEnv = z.preprocess(
119+
(v) => (typeof v === "string" && v.trim() === "" ? undefined : v),
120+
z.coerce.number().int().positive().optional()
121+
);
122+
117123
const EnvironmentSchema = z
118124
.object({
119125
NODE_ENV: z.union([z.literal("development"), z.literal("production"), z.literal("test")]),
@@ -1041,7 +1047,7 @@ const EnvironmentSchema = z
10411047
* bound. Setting this applies a ceiling to every debounced run that does not carry its own
10421048
* `maxDelay`, and any `delay` at or above it stops runs from being pushed at all.
10431049
*/
1044-
RUN_ENGINE_MAXIMUM_DEBOUNCE_DURATION_MS: z.coerce.number().int().positive().optional(),
1050+
RUN_ENGINE_MAXIMUM_DEBOUNCE_DURATION_MS: OptionalPositiveIntEnv,
10451051

10461052
/**
10471053
* Bucket size in milliseconds used to quantize the newly computed `delayUntil`

0 commit comments

Comments
 (0)