bug: webapp rejects API_RATE_LIMIT_METRICS_BUCKET_SECONDS=15 although the schema says divisors of 60 are valid

オープン
#4,983 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

  • #4993 @StackedByAdit による — マージされずにクローズ

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
20/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
typescript
領域
backend

調査の方向性

まず apps/webapp/app/env.server.ts:777-785 に移動し、.multipleOf(10) が 15 を拒否する一方、refine が 60 の約数を許可することを確認する。最初のステップは、以前の修正がマージされなかった理由を見るため、クローズ済みの PR #4993 を確認することである。完了の条件は、"15" と "120" のパースが成功し、"7" は引き続き失敗し、webapp の Vitest env スイートがグーンのまま維持されることである。

索引モデルが issue の本文から書いたものです。

説明

Provide environment information

Not environment-specific: found in the webapp source at main @ c2b7a72180 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
  1. Set API_RATE_LIMIT_METRICS_BUCKET_SECONDS=15 and start the webapp. Env validation fails.
  2. 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.

主要言語
TypeScript
スター
16.5k
フォーク
1.5k
平均マージ
1日 15時間
マージ済み PR(30日)
17

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

triggerdotdev/trigger.dev のほかの issue

triggerdotdev/trigger.dev の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。