Repository navigation
fix(hooks): keep model-rule eval fixtures out of Stop test verification - #160
Merged
Merged
Conversation
Fixtures under agents/hooks/lint/model-rules/<lang>/<id>/fixtures/ are jev-lint eval inputs and are never compiled, but Stop verification counted their .go/.rs/.ts/.py files as project sources and failed for a missing go.mod or Cargo.toml. language_plan now drops those paths before planning. The explicit test-mapping logic moves to explicit_targets.py so that check_selection.py stays under the file-length limit. Refs #74 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Owner
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Review summaryNo blocking or non-blocking findings.
blocking_findings: 0 |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
furedea
approved these changes
Nov 11, 2026
This was referenced Nov 11, 2026
furedea
added a commit
that referenced
this pull request
Nov 11, 2026
…l fixtures (#163) ## 概要 Stop で動くモデル判定(M-05,M-21)の誤検知を,原因ごとに 1 か所ずつ直しました.直し方は,例を eval の fixtures に入れ,ルールの文章には原則だけを書く形です. - fixtures と `expect.yml` を Python / TypeScript の M-05,M-21 に追加しました.実際に出た誤検知を「違反ではない例」に,本当の違反を「違反の例」に入れています. - M-05:`criteria."false"` を原則に書き直しました(はっきり「読むだけ」か「何かを変える」かを示す動詞だけが約束になり,それ以外の動詞は何も約束しません).動詞の例は増やしていません. - M-21:送る範囲(`state`)を `local` から `located` に変えました. - M-05 のカットオフを,fixtures で当てはめた値にしました(Python 0.76,TypeScript 0.79). - eval の baseline.json を保存しました.`jev-lint eval --replay` はモデルへの問い合わせなしで確認できます.この replay を pytest(`tests/test_model_rule_files.py`)で実行し,fixtures の行の移動やカットオフの変更で CI が失敗するようにしました. - fixtures を ruff,ty,vulture から除外しました(意図的な違反コードのため.vulture は絶対パスに一致するパターンにしています). Refs #74 計画:#74 (comment) ## 原因の分類と直し方 | 誤検知 | 原因 | 直した場所 | | ------------------------------------------------------------------- | -------------------------------------------------------------- | --------------------------------------- | | M-21 Python `provider_adapter.py` 付近(別関数が組んだメッセージ) | 文脈不足 | `state: located`(Python / TypeScript) | | M-21 `project_targets`(内側の raise を同じ関数で捕捉して包み直す) | 文脈不足 | 同上.eval の違反ではない例に追加 | | M-05 `_check_paths`,`Review.judge` | 定義が曖昧(「check」「judge」は読むとも変えるとも約束しない) | `criteria."false"` を原則に書き直し | | M-05 の違反の例と違反ではない例が重なる | カットオフ | `threshold` を当てはめ値に | | M-05 `load_port` | 現在の main に存在しないため対象外 | なし | ### M-21 の `state` の比較(Python の fixtures 8 件,3 回) | state | 偽陽性 | 見逃し | cleanTop | トークン(`--dry-run`) | 判断 | | ------- | ------ | ------ | -------- | ----------------------- | ---------------------------------------------------- | | local | 1 | 0 | 0.56 | 9,996 | 補助関数が見えず誤検知 | | located | 0 | 0 | 0.18 | 11,694 | 採用.誤検知が消え,違反との差が最も広い | | graph | 1 | 0 | 0.62 | 11,430 | 呼び出し関係だけではメッセージの中身が分からず誤検知 | located は 1 ケースあたり約 $0.0004 で,費用の差はわずかです. ## eval の記録(ラウンド 1〜4) | ラウンド | 変更 | M-05 Python | M-05 TypeScript | M-21 Python | M-21 TypeScript | | ---------- | ---------------------------------------------------- | ----------------------------------------- | ----------------------------------------- | --------------------------- | --------------------------- | | 1 baseline | 今のルール | tp 4 / fp 1 / cleanTop 0.52 | tp 4 / fp 0 / cleanTop 0.47 | tp 4 / fp 1 / cleanTop 0.56 | tp 4 / fp 1 / cleanTop 0.52 | | 2 | M-05 を原則のみに,M-21 を located | tp 4 / fp 2 / cleanTop 0.93 | tp 4 / fp 2 / cleanTop 0.94 | tp 4 / fp 0 / cleanTop 0.20 | tp 4 / fp 0 / cleanTop 0.14 | | 3 | M-05 に read / effect の定義を戻す | tp 4 / fp 1 / cleanTop 0.59 | tp 4 / fp 1 / cleanTop 0.63 | tp 4 / fp 0 / cleanTop 0.28 | tp 4 / fp 0 / cleanTop 0.14 | | 4 | M-05 の fixtures を違反 8・違反ではない例 8 に増やす | tp 8 / fp 2 / cleanTop 0.58 / fitted 0.76 | tp 8 / fp 2 / cleanTop 0.66 / fitted 0.79 | (変更なし) | (変更なし) | | 確定 | M-05 の threshold を 0.76 / 0.79 に | tp 8 / fp 0 / fn 0 | tp 8 / fp 0 / fn 0 | tp 4 / fp 0 / fn 0 | tp 4 / fp 0 / fn 0 | - ラウンド 2 は,原則だけに書き直した M-05 が悪化しました(記憶する query と,結果を返す command が再び誤検知).この 2 つは例外ではなく,read と effect の定義なので,定義として戻したのがラウンド 3 です. - 確定行は,ラウンド 4 の実測値(clean の最大 0.58 / 0.66,違反はすべてそれより上)を,当てはめた `threshold` で採点し直したものです(`jev-lint eval --accept-last` と `--replay`.モデルへの問い合わせなし). - M-05 の fixtures には,違反ではない例(平均の最大 0.58 / 0.66)と違反(平均の最小 0.91 / 0.90)の間に入る例がありません.そのため 0.62〜0.90(TypeScript は 0.68〜0.89)のどのカットオフでも eval の結果は同じで,0.6〜0.75 で採点される軽い違反は見逃される可能性があります(claude-review の指摘.ルールのヘッダに記載).境界に寄せた違反の fixture を足して当てはめ直すのは,次のラウンドの課題です. - Python M-21 のカットオフは 0.5 のままです(偽陽性 0,cleanTop 0.28). - TypeScript M-21:レビュー指摘で `projectTargets`(内側の throw を捕捉して包み直す)の fixture を足したところ,平均 0.50(3 回で 0.51 / 0.55 / 0.43)とカットオフ 0.5 に重なり,判定が揺れました.これはカットオフの問題として扱い,当てはめ値 0.75 にしました(違反 4 件は 0.95 以上).`--replay` で揺れ 0,4 スイートとも baseline どおりです. - 同じ fixture で TypeScript M-21 は境界から遠くなくなったため,先に付けた `inconclusive` は不要になり(`--replay` が stale として指摘),外しました.M-21 TypeScript の違反側の余裕は 0.20,違反ではない側は 0.25 で,まだ小さい部分は残ります. ## 規則の対応表(#74) | 規則 ID | 元の場所 | 元の規則 | 判定 | 実装 | 例のテスト | 元の文章 | | ---------------------------------- | --------------------------------- | --------------------------------------------------- | ---------------------------- | ------------------------------------------------------------------------------------------ | -------------------------------------------------------- | ------------ | | M-05 command-query-naming | `agents/AGENTS.md` | 名前は command には副作用を,query には返す値を表す | model(Python / TypeScript) | `agents/hooks/lint/model-rules/{python,typescript}/command-query-naming/rule.yml` | 同フォルダの `fixtures/` と `expect.yml`(各 16〜17 件) | 昇格まで残す | | M-21 error-message-names-operation | `agents/skills/python-style` ほか | エラーメッセージは何をしていて何に対してかを示す | model(Python / TypeScript) | `agents/hooks/lint/model-rules/{python,typescript}/error-message-names-operation/rule.yml` | 同フォルダの `fixtures/` と `expect.yml`(各 8〜9 件) | 昇格まで残す | 指摘は助言として返すだけで,止めません(ADR-0021 のまま). ## 検証 - `uv run pytest -n auto tests`:4738 件通過,1 件スキップ(リベース後) - `ruff check`,`ruff format --check`,`ty check`:通過(fixtures は除外) - `jev-lint rules -R agents/hooks/lint/model-rules`:6 件読み込み,エラー 0 - `jev-lint eval --replay agents/hooks/lint/model-rules`:4 スイートとも保存した baseline のとおり - モデルへの eval(ラウンド 1〜4)は利用者が実行しました.鍵はエージェントが読んでいません. ## 計画との差分 - 計画の「違反の例を今までどおり見つけられ,4 件の指摘が消える」は,M-21 は `state`,M-05 は原則とカットオフで満たしました. - 計画になかった追加:M-05 の fixtures の増加(カットオフを当てるため),baseline.json の保存,fixtures の ruff / ty / vulture 除外,TypeScript M-21 のカットオフ 0.75(`projectTargets` の fixture を追加した結果). - Stop 検証が fixtures を変更扱いして失敗する問題は,別 PR(#157,#160)で直りました. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
furedea
pushed a commit
that referenced
this pull request
Nov 12, 2026
🤖 I have created a release *beep* *boop* --- ## [0.1.2](v0.1.1...v0.1.2) (2026-11-12) ### Features * **hooks:** add Go and Rust model rules with eval fixtures ([#158](#158)) ([9731488](9731488)) * **hooks:** show model-rule timing and skip rule fixtures ([#157](#157)) ([d0c32ae](d0c32ae)) * **hooks:** show the model rules as one result line with cost ([#170](#170)) ([41b9033](41b9033)) ### Bug Fixes * **hooks:** allow a jq filter after read-only GraphQL queries ([#180](#180)) ([cfb80d8](cfb80d8)) * **hooks:** keep model-rule eval fixtures out of Stop test verification ([#160](#160)) ([a4f1c6c](a4f1c6c)) * **hooks:** read paths literally in every jev-lint child process ([#173](#173)) ([0d2c683](0d2c683)) * **hooks:** remove model-rule false positives with principles and eval fixtures ([#163](#163)) ([b07fc4e](b07fc4e)) * **hooks:** report one count per runner in the Stop test lines ([#177](#177)) ([0f36b82](0f36b82)) * **hooks:** take the model-rule cached count from the dry-run plan ([#167](#167)) ([c87fdfd](c87fdfd)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: furedea-release[bot] <353651101+furedea-release[bot]@users.noreply.github.com>
9 tasks done
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.
概要
Stop 時のテスト検証が
agents/hooks/lint/model-rules/<lang>/<id>/fixtures/配下の.go/.rs/.ts/.pyをプロジェクトのソースとして数え,go.modやCargo.tomlが無いために「Changed go sources require a project marker」で失敗していました.fixture は jev-lint の eval 入力でありコンパイルされません.変更
agents/hooks/lib/check_selection.py:language_planの入口でagents/hooks/lint/model-rules/*/fixtures/*に一致するパスを除外(全言語に一度で効く).tests/hooks/test_go_check_selection.py: 先に失敗するテストを追加(go / rust / typescript / python の fixture は計画に入らない,fixture 以外の隣接ファイルは従来どおりソース扱い).agents/hooks/lib/explicit_targets.py(新規):check_selection.pyが 503 行になり file-length 上限(500)を超えたため,行を詰めず責務で分割した.related_test_extensions.jsonの明示マッピング解決(project_targets/mapped_targets/target_language/strings/TARGET_LANGUAGES)を移しただけで挙動は同じ.project_targetsはdefaultdict(set)を返し,言語が未対応でも空集合になる.pyproject.tomlの py-modules とrelated_test_extensions.jsonに登録.判断
related_test_defaults.jsonは各エントリが言語ルールであることをload_defaultsが検証しており,全言語共通の除外を置く場所が無いため,定数MODEL_RULE_FIXTURESにした.agents/hooks/lib/model_rules_*.pyは触っていない(レーン A の範囲).検証
uv run --frozen pytest tests/hooks tests/test_related_test_extensions.py: 3731 passed, 1 skipped.ruff check対象 2 ファイル:通過.Refs #74
🤖 Generated with Claude Code