[quality] lgtmBinding.ts failure arms and /lgtm cancel failures are never driven through dist/index.js

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

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

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

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

評価

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

調査の方向性

Read the existing tests under __tests__/bundle and the behavior in src/plugins/lgtmBinding.ts and src/labels/lgtm.ts. Add __tests__/bundle/lgtmBindingArms.test.ts to exercise the listed failure cases through dist/index.js, then run npm run test:coverage:e2e. Done means the specified cases pass and the reported e2e coverage targets are met; pull request #318 is already open.

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

説明

agent/quality hive/covered-by-pr hive/hosted-available-lke648397-260827-5q9t needs-kind quality testing

Finding

The lgtm-to-commit binding (src/plugins/lgtmBinding.ts) and the /lgtm command (src/labels/lgtm.ts) are fully covered by the unit suite, but the end-to-end bundle suite (__tests__/bundle, run against the shipped bundle with npm run test:coverage:e2e) never reaches their failure arms:

file e2e lines (main @ 3fc21f2) uncovered
src/plugins/lgtmBinding.ts 88.63 % 73 (createCommitStatus fails for a reason other than 403), 117–118 (getCombinedStatusForRef fails, 403 hint and plain), 143 (stale-lgtm comment fails, warned), 168 (labeled payload without pull_request.head)
src/labels/lgtm.ts 88.88 % 68 (bind failure becomes a refusal), 91 (/lgtm cancel labels read fails), 103 (/lgtm cancel removal refused), 145 (refusal comment itself fails)

These are the arms where the binding is the merge gate's safety: a status write or read that fails for an unexpected reason must fail the run (not silently merge or strip), and a failed stale-lgtm comment must not fail the run. Only dist/index.js proves how handleIssueComment/handlePullReq and tide's post-command sweep compose in those cases.

Evidence

  • Unit: npx vitest run --coverage on main @ 3fc21f2 — 80 files / 1639 tests; both files at 100 % lines.
  • E2E: npm run test:coverage:e2e on main @ 3fc21f2 — 5 files / 142 tests; figures above.
  • The two runs are reported separately on purpose (see vitest.e2e-coverage.config.mjs): their statement maps come from different transforms and do not line-merge, so this finding states each source on its own.

Recommendation

Add one bundle suite, __tests__/bundle/lgtmBindingArms.test.ts, that drives through dist/index.js:

  • /lgtm by a member reviewer when POST /statuses/{sha} answers 500: refused with could not bind lgtm to …, no label applied, sweep still runs
  • the same when the refusal comment also fails: both errors logged, run fails
  • /lgtm cancel when GET /issues/1 fails and when DELETE /issues/1/labels/lgtm fails: run fails naming the step, nothing unbound
  • pull_request labeled lgtm by a human when GET /commits/{sha}/status answers 500 and 403: run fails naming the read (403 names statuses: write), nothing merged or stripped
  • pull_request labeled lgtm by a bot when the stale-lgtm comment read fails: label stripped, status set pending, failure is a warning, run passes
  • pull_request labeled lgtm whose payload has no pull_request.head: run fails, no status written

Expected result: lgtmBinding.ts 100 % e2e lines; labels/lgtm.ts 97.8 % (line 39, the missing-issue-number guard, is unreachable from handleIssueComment).

Priority

  • Impact: medium — unit-covered, not e2e-covered; the arms guard the merge gate
  • Effort: low — one new test file, no production or harness changes

Filed by quality agent (hold-gated mode)


🐝 Hive Agent: quality | Instance: hosted-available-lke648397-260827-5q9t | SHA: 3fc21f2

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

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

環境構築

はじめの一歩

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

cncf/prow-github-actions のほかの issue

cncf/prow-github-actions の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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