[quality] getArgumentLabels and anyLabelMatches have no production caller — only their unit tests keep them covered

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

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

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

  • #421 @mrbobbytables による — マージ済み

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
55/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
github-actions, node.js, typescript
領域
testing, tooling

調査の方向性

Read src/utils/labeling.ts and src/utils/labelMatch.ts, then check their corresponding tests in __tests__/utils/labeling.test.ts and __tests__/utils/labelMatch.test.ts. The issue recommends removing the unused exports and their test blocks; run npm run build && npm run pack and verify the dist drift gate passes. The issue says this production-source change is for a maintainer, so it is not a first-timer task.

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

説明

agent/quality hive/hosted-available-lke648397-260827-5q9t kind/cleanup quality testing

Finding

Two exported helpers in src/utils/ have no production caller. The only code that invokes them is their own unit test, so they count toward the 100 % unit line coverage on main @ 3fc21f2 while nothing the action ships ever runs them:

export defined last production caller only remaining caller
getArgumentLabels(octokit, context, arg) src/utils/labeling.ts:47-60 src/labels/prefixed.ts, removed in #137 (78b07b0) when the prefixed commands switched to getLabelConfig __tests__/utils/labeling.test.ts
anyLabelMatches(patterns, labels) src/utils/labelMatch.ts:46-48 none — added already exported-but-uncalled in #154 (f5d7bc3) __tests__/utils/labelMatch.test.ts

Evidence:

  • grep -rn "getArgumentLabels\|anyLabelMatches" src/ → only the two definitions.
  • git log -S"getArgumentLabels(" -- src → 78b07b0 deletes the import and call in prefixed.ts and keeps the export; git log -S"anyLabelMatches" -- src __tests__ → a single commit, f5d7bc3, introducing export and test together.
  • npm run test:coverage:e2e on a scratch branch = origin/main (3fc21f2) + the heads of all 44 open hold-gated bundle PRs (#230…#365, 48 files / 430 tests pass): 96.4 % statements; both functions have 0 hits (labeling.ts 52–59, labelMatch.ts 47 remain uncovered). Every other residual line in that run is a defensive throw on a malformed payload, a test-only reset*Cache() export, or already claimed by one of those PRs.
  • Both still ship: grep -n "getArgumentLabels\|anyLabelMatches" dist/index.js → dist/index.js:41388, dist/index.js:43239 (ncc does not tree-shake them).

Why it matters for the test suite rather than just tidiness: the unit report cannot distinguish "covered because it runs in the bundle" from "covered because a test calls it", so these two keep a green line over code that would silently rot — getArgumentLabels still throws the pre-#137 yaml malformed, expected '<arg>' top level key message that no user can reach.

Recommendation

One PR, one deliverable (deleting both exports and their test blocks is a single mechanical change; npm run pack to drop them from dist/):

  • remove getArgumentLabels from src/utils/labeling.ts and its describe block in __tests__/utils/labeling.test.ts
  • remove anyLabelMatches from src/utils/labelMatch.ts and its tests in __tests__/utils/labelMatch.test.ts (or wire it into matchesAnyLabel-style call sites if a consumer was intended in #154)
  • npm run build && npm run pack so the dist/ drift gate passes

This touches production source, so it is not a PR this lane opens; it is filed for a maintainer. Related, but deliberately not in this issue because it is a design choice rather than dead code: repoHasOwners/defaultBranch (src/utils/owners.ts:282-284, 348-359) are reachable only when a pull_request payload lacks base.ref (approve.ts:504, tide.ts:543), so they too have 0 e2e hits.

Priority

  • Impact: low
  • Effort: low

🐝 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 を短くまとめたダイジェスト。