Repository navigation
Fix: test_usage_capture の偽の CLI に呼び出し元の環境変数を持ち込まない - #2136
Merged
Merged
Conversation
supervise の中で全体テストを走らせると、NDF_USAGE_SOURCE / NDF_USAGE_KIND が入ったまま test_runtime_specific_usage_shapes が「名乗りが無い」ことを確かめて落ちる。fixture の fake_clis で 4 つの NDF_USAGE_* を外す。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
takemi-ohama
commented
Oct 25, 2026
takemi-ohama
left a comment
Contributor
Author
There was a problem hiding this comment.
🤖 cross-review | round 1 | claude | APPROVE
指摘なし。偽の CLI の fixture で NDF_USAGE_SOURCE/KIND/PLAN/STEP を外す変更は、起動の共有処理が読む名乗りの環境変数(NDF_USAGE_DIR は conftest が一時ディレクトリへ向ける)を網羅しており、範囲も目的と一致する。
takemi-ohama
commented
Oct 25, 2026
takemi-ohama
left a comment
Contributor
Author
There was a problem hiding this comment.
🤖 cross-review | round 1 | claude-2 | APPROVE
指摘なし。fixture fake_clis で外す 4 つの NDF_USAGE_* は、本体が名乗りとして読む変数(lib/usage_capture.py:53-56)と一致しており、外し漏れは無い。
Contributor
Author
🔧 /ndf:fix サマリ | commit (なし)対応件数: critical=0 / major=0 / minor=0(合計 0 件) |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
スプリント m1914 の検査(PR #2133)の構造改善で、着手前の全体テストが
plugins/ndf/scripts/tests/test_usage_capture.py::test_runtime_specific_usage_shapesを既存失敗として記録した。即時修正の 4 条件(原因が分かっている・契約を壊さない・方針の範囲・revert 1 回で戻せる)を満たすため、その場で直す。原因
usage_capture.caller()は呼び出し元を引数か環境変数NDF_USAGE_SOURCE/NDF_USAGE_KIND/NDF_USAGE_PLAN/NDF_USAGE_STEPから読む。supervise のステップの中で pytest を走らせると、この値が入ったまま走るため、名乗りが無いことを確かめる上のテストが落ちる。CI では入っていないので通る。変更
fake_clisで 4 つのNDF_USAGE_*をmonkeypatch.delenvで外す(テストだけ。振る舞いは変えない)確かめたこと
NDF_USAGE_SOURCE=supervise NDF_USAGE_KIND=check uv run --frozen --project . --all-extras pytest -q plugins/ndf/scripts/tests/test_usage_capture.py→ 1 failed, 25 passedbash scripts/check-lint.sh -- plugins/ndf/scripts/tests/test_usage_capture.py違反なし🤖 Generated with Claude Code