Two @tanstack/db tests time out under CPU load because a cold module import counts against the 5 s default timeout
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 82/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- testing
調査の方向性
packages/db/tests/mutation-id.test.ts と packages/db/tests/collection-idle-cleanup.test.ts を読み、その後 packages/db からこの2つのファイルを対象とする Vitest コマンドを CPU 負荷下で実行し、タイムアウトを確認します。各テストが Collection のモジュールグラフをどのようにインポートし、セットアップをどのように処理しているかを確認してください。idle-cleanup の scheduler は、その polyfill をインポートする前にインストールする必要があります。両方のテストが assertions を弱めることなく、負荷下でも安定してパスすれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Two @tanstack/db tests fail with Test timed out in 5000ms when the machine is busy. They pass when the suite runs alone.
Tests
packages/db/tests/mutation-id.test.ts>mutation ids > do not draw random values during module evaluationpackages/db/tests/collection-idle-cleanup.test.ts>cancels a rescheduled idle cleanup when a subscriber returns
Reproduction
Run the two files while other test processes load the CPU. I ran them while four other vitest run processes ran the full @tanstack/db suite on an 18-core machine:
cd packages/db
npx vitest run tests/mutation-id.test.ts tests/collection-idle-cleanup.test.ts
Result over four runs:
| Run | mutation-id |
collection-idle-cleanup |
|---|---|---|
| 1 | timed out (5005 ms) | timed out (5014 ms) |
| 2 | timed out (5003 ms) | timed out (5004 ms) |
| 3 | timed out (5004 ms) | timed out (5004 ms) |
| 4 | timed out (5004 ms) | passed |
Without the other processes, the full suite passes (285 files, 13,816 tests).
Probable cause
Each test starts with a cold dynamic import() of the Collection module graph inside the test body:
mutation-id.test.tscallsvi.resetModules()and then imports../src/collection/index.jsand../src/local-only.js.collection-idle-cleanup.test.tsimports../src/collection/index.jsand../src/utils/browser-polyfills.js, because it must install its idle scheduler before the polyfill module loads.
The transform and load of that graph count against the test's 5000 ms default timeout. Under CPU load, the import alone can use the full budget. The work after the import takes a few milliseconds, plus an 80 ms wait in the idle-cleanup test.
I did not measure the import time separately, so this cause is probable, not proven.
Effect
- A slow or shared CI runner can fail these tests for no product reason.
- Tools that run the suite in parallel, such as mutation sweeps, record false failures. Both tests made a mutation sweep report every mutant as killed.
Possible fixes
- Give each test an explicit timeout that covers a cold import, for example
30_000. - Or move the import out of the timed test body where the test's isolation requirement allows it. The idle-cleanup test needs its scheduler installed before the polyfill module loads, so its import must stay after that setup.
- 主要言語
- TypeScript
- スター
- 4k
- フォーク
- 277
- 平均マージ
- 17時間 33分
- マージ済み PR(30日)
- 227
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
TanStack/db のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
Electric: scoped move-in snapshots can prematurely resolve awaitTxId and remove optimistic rowsオープン
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 1〜2日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 1〜2日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
bug require-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
expressjs/expressjs.com#2549 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
umami-software/umami#4686 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
[Bug]: Device screenshot fails with 500 on iPhone Duo (Xcode 27.2): serve-sim calls simctl without --display対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
pingdotgg/t3code#24900 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
inu-appcenter/UNIDorm-web#411 ·
メンテナーはふだん 1 日以内に返信
-
🐛 bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 2 日以内に返信