verify: --redact-paths always widens to the full suite, with a misleading reason

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

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

@FredApps がすでに取り組んでいます。

2026年11月17日 から。

  • #276 @FredApps による — オープン

評価

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

調査の方向性

Start with the observe calls in packages/diffci-cli/src/client/verify.ts, then trace how selectedTests, proposedCommands, and executableSelection are handled in observe.ts and verify.ts. Reproduce the reported --changed --no-checks --redact-paths --json case and inspect the tests covering redacted selection. Done means selected verification stays targeted with redacted paths in the receipt, or any widening clearly reports its redaction cause; pull request #276 is already open.

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

説明

What went wrong?

diffci verify --redact-paths never runs a selected set of tests. Every redacted run widens to the full suite, and the reason it gives is misleading.

There are two parts:

  1. Every redacted run widens to the full suite. verifyChanged, verifyRange (and verifyScoped, through verifyChangedSnapshot) pass redactPaths to observe (packages/diffci-cli/src/client/verify.ts, the observe({...}) calls in verifyChangedSnapshot and verifyCommitRange). observe then returns selectedTests as sha256-12 digests (observe.ts, selectedTests.map(hashPath)), while proposedCommands still carry the real paths. executableSelection (verify.ts) matches the real command against the digests. unmatchedNodeTests therefore finds that no selected file matches, and the run falls back to the full test command. (For other runners, inferSelectedCommand receives digests in place of paths.)

  2. The reason is misleading. It reads as if the selection could not be expressed as a command:

    selected verification was not executable (node --test would not match 1 selected test file(s), such as 19e48d04740e); broadened to full verification
    

    The real cause is that the paths were redacted before planning. The digest in the message is not something the user can act on.

The documented purpose of --redact-paths is to keep file paths out of the report. Silently running the full suite on every redacted run defeats the purpose of verify's selection.

Question for maintainers: is the widening intended, for example as a deliberately conservative choice under redaction? Some code already turns features off under redaction on purpose (the coverage map and the first pass in executeWithPolicy, and the enforce global-risk fallback). If the widening is intended, the reason should still say that --redact-paths caused it.

DiffCI version

main at 40aa308

Command you ran

A repository with "test": "node --test", src/a.js and src/b.js, test/a.test.js and test/b.test.js (each test imports its own source), and an uncommitted change to src/a.js:

diffci verify --changed --no-checks --json
diffci verify --changed --no-checks --redact-paths --json
Environment

Linux, Node 24, npm.

Output

Without --redact-paths:

"selection": "selected",
"reason": "dependency impact",
"command": "node --test test/a.test.js",
"selected_tests": ["test/a.test.js"]

With --redact-paths:

"selection": "full",
"reason": "selected verification was not executable (node --test would not match 1 selected test file(s), such as 19e48d04740e); broadened to full verification",
"command": "npm test"
What you expected

With --redact-paths, the same selection should run (node --test test/a.test.js), and the receipt should carry digests in place of the paths (selected_tests: ["19e48d04740e"]). If widening under redaction is intended, the reason should say that the selection was widened because of --redact-paths.

主要言語
TypeScript
スター
0
フォーク
4
平均マージ
18時間 41分
マージ済み PR(30日)
48

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

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

DiffCI/core のほかの issue

DiffCI/core の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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