[quality] worker.ts scheduled(), queue consumer and deferViaQueue run under no test (unit excludes the file; miniflare suite only drives fetch())

クローズ
#629 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

関連するプルリクエストがすでにマージされています。

  • #630 @hivecommons-hive による — マージ済み

評価

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

調査の方向性

Start with __tests__/worker/worker.test.ts, src/server/worker.ts, and the existing Miniflare setup. Add coverage for scheduled(), the queue retry path, and deferred delivery as described in the issue, fixing the fake GitHub request log so concurrent config probes are retained. Done when the tests verify cron enqueueing and consumption, retry behavior, and the deferred run applying the missing label; linked pull request #630 is already open.

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

説明

agent/quality needs-kind stage/040-covered-by-pr testing

Finding

src/server/worker.ts — the Cloudflare Worker entry added in #615 — is left out of the unit coverage run (vitest.config.mjs:21) on the stated premise that "its behaviour is tested there" (__tests__/worker, via miniflare), and the bundle run (vitest.e2e-coverage.config.mjs) excludes src/server/** too. So the src/server/** 100 % per-path gate never looks at this file, and the miniflare suite is the only thing standing behind it.

That suite (__tests__/worker/worker.test.ts) has four cases: /healthz, a bad signature, /close through the pull request lock Durable Object, and redelivery dedupe — all through fetch(). Nothing drives:

  • scheduled() (worker.ts:122-132): the cron trigger that lists installations and enqueues one schedule message per live installation;
  • queue() (worker.ts:134-166): the consumer for both message kinds — schedule (filter to one installation, runScheduledJobs) and deferred (handleDelivery → resumeDeferred) — and its ack() / retry() arms;
  • deferViaQueue (worker.ts:72-80): what platform().defer() does on Workers, i.e. the grace-period path of require-matching-label ending in resumeRequiredLabels (src/plugins/requireMatchingLabel.ts:126).

Evidence (main@ed3bb42, run 40978258545): artifact coverage-ed3bb42… (unit lcov.info) has no SF: record for src/server/worker.ts; artifact coverage-e2e-ed3bb42… has none for any src/server/** file. grep -n "scheduled\|queue\|defer" __tests__/worker/worker.test.ts matches only the Miniflare binding declarations. Priority 1 under the lane's rules: covered by neither suite, and the exclusion comment promises coverage the suite did not provide.

Recommendation

Extend __tests__/worker/worker.test.ts — the fake GitHub, the Miniflare options and three cases — so the Worker is tested as deployed:

  • scheduled() via Miniflare's unsafeTriggerHandlers + GET /cdn-cgi/handler/scheduled: one message per live installation (suspended skipped, two repositories → one message), consumer runs the cron jobs for each unarchived repository under the installation token
  • queue() retry arm via mf.getQueueProducer('PROW_QUEUE'): a schedule message whose run throws (installations listing 500s) is re-delivered, not acknowledged
  • deferViaQueue → delayed deferred message → resumeDeferred: a pull_request opened with grace_period_duration: 1s stops at defer() and the resumed run applies the missing label

The fake GitHub's request log must stop being a single read-modify-write KV key: the org- and repo-tier config probes run concurrently and one of them is lost, which hides exactly the request the deferred case needs to see.

Priority

  • Impact: high — the queue consumer and cron trigger are the App's only non-webhook entry points and are exercised by nothing
  • Effort: low — one test file, no src/ change

Filed by quality agent (hold-gated mode)


🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: 202bce4

— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88

主要言語
TypeScript
スター
132
フォーク
24
平均マージ
1日 9時間
マージ済み PR(30日)
228

環境構築

はじめの一歩

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

似ている issue

TypeScript の issue をもっと見る

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

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