Provide environment information
Not environment-specific: found in the webapp source at main @ c2b7a72 and reproduced with the webapp's own Vitest suite (macOS arm64, pnpm).
Describe the bug
The webapp refuses to start with API_RATE_LIMIT_METRICS_BUCKET_SECONDS=15, although the schema's own rule says 15 is valid.
In apps/webapp/app/env.server.ts:777-785:
API_RATE_LIMIT_METRICS_BUCKET_SECONDS: z.coerce.number().int().positive()
.multipleOf(10)
.refine((seconds) => 60 % seconds === 0 || seconds % 60 === 0, {
message: "must divide or be a multiple of 60 so buckets align to minute boundaries",
})
The refine accepts any divisor or multiple of 60, which is the alignment the metrics aggregator needs. .multipleOf(10) runs first, though, and rejects the minute-aligned divisors 15 (and 1–6, 12). Environment parsing fails at startup with a Zod "multiple of 10" error.
Expected: 15 (and 120) parse, 7 is still rejected.
Reproduction repo
N/A (schema test against this repo, below)
To reproduce
- Set
API_RATE_LIMIT_METRICS_BUCKET_SECONDS=15 and start the webapp. Env validation fails.
- Or, as a test: parse
"15" with the schema entry above. It fails with Number must be a multiple of 10.
Additional information
A fix is ready on the breken-ai/trigger.dev fork (breken/fix-rate-limit-metrics-bucket-validation):
- It drops the contradictory
.multipleOf(10) and moves the schema into app/utils/apiRateLimitMetricsBucketSecondsSchema.ts, so it can be tested.
- The regression test asserts
15 and 120 parse and 7 fails. It's red on main and green with the fix.
- Env + new schema tests: 19 passed. oxfmt, oxlint and webapp typecheck are clean.
I'll open it as a draft PR with fixes #<this> once the account is vouched.
Prepared with AI assistance (Claude) from the breken-ai account.
Provide environment information
Not environment-specific: found in the webapp source at
main@ c2b7a72 and reproduced with the webapp's own Vitest suite (macOS arm64, pnpm).Describe the bug
The webapp refuses to start with
API_RATE_LIMIT_METRICS_BUCKET_SECONDS=15, although the schema's own rule says 15 is valid.In
apps/webapp/app/env.server.ts:777-785:The
refineaccepts any divisor or multiple of 60, which is the alignment the metrics aggregator needs..multipleOf(10)runs first, though, and rejects the minute-aligned divisors 15 (and 1–6, 12). Environment parsing fails at startup with a Zod "multiple of 10" error.Expected:
15(and120) parse,7is still rejected.Reproduction repo
N/A (schema test against this repo, below)
To reproduce
API_RATE_LIMIT_METRICS_BUCKET_SECONDS=15and start the webapp. Env validation fails."15"with the schema entry above. It fails withNumber must be a multiple of 10.Additional information
A fix is ready on the
breken-ai/trigger.devfork (breken/fix-rate-limit-metrics-bucket-validation):.multipleOf(10)and moves the schema intoapp/utils/apiRateLimitMetricsBucketSecondsSchema.ts, so it can be tested.15and120parse and7fails. It's red on main and green with the fix.I'll open it as a draft PR with
fixes #<this>once the account is vouched.Prepared with AI assistance (Claude) from the breken-ai account.