Skip to content

feat(hooks): add Go and Rust model rules with eval fixtures - #158

Merged
furedea merged 17 commits into
mainfrom
feat/74-model-rules-go-rust
Nov 11, 2026
Merged

furedea merged 17 commits into
mainfrom
feat/74-model-rules-go-rust

Conversation

@furedea-agent

@furedea-agent furedea-agent Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

概要

Stop で動くモデル判定に Go と Rust を足します(計画 のレーン C).M-05,M-21,M-60 を言語ごとに agents/hooks/lint/model-rules/{go,rust}/<id>/ へ置き,フックのコードは変えていません(ローダーは model-rules 配下を全部読む).

  • ルールの文章は原則だけを書きました.動詞の例や例外は足していません.
  • 違反の例と違反ではない例を fixtures/ に入れ,expect.yml で行ごとにラベルを付けました(1 ルールあたり違反 4 件,違反ではない例 2〜4 件を明示).
  • 応答の確認(jev-lint eval)はユーザーが実行し,結果とベースラインを下の「eval の結果」に書きました.

ルールの対応表

規則 ID 元の場所 元の規則 判定 実装 例のテスト 元の文章
M-05 command-query-naming (Go, Rust) agents/AGENTS.md Coding Guidelines 命令は副作用で,問い合わせは返す値で名付ける model model-rules/{go,rust}/command-query-naming/rule.yml(Go は function_declaration と method_declaration,Rust は function_item.テスト関数は対象外) fixtures/{violating,conforming}.{go,rs} と expect.yml 残す(昇格まで)
M-21 error-message-names-operation (Go, Rust) go-style/references/errors.md,rust-style/references/errors.md エラーは操作と対象を示す model model-rules/{go,rust}/error-message-names-operation/rule.yml(Go は errors.New / fmt.Errorf を含む関数,Rust は Err(...) / bail! / anyhow! / ensure! / .context(..) / .with_context(..) を含む関数) 同上 残す(昇格まで)
M-60 known-defect-marker-names-removal (Go, Rust) python-style/references/testing.md(xfail の規則) 既知の欠陥マーカーに除去条件の注釈を付ける model model-rules/{go,rust}/known-defect-marker-names-removal/rule.yml(Go は t.Skip / t.Skipf,Rust は #[ignore] / #[ignore = "..."]) 同上 残す(昇格まで)

M-60 は Go と Rust に xfail 相当の印がないため,既知の欠陥で飛ばしたテストをマーカーとみなします.飛ばす理由が欠陥でないとき(testing.Short(),Docker 不要など)は違反としません.Go と Rust のスタイルスキルに M-60 の文章はなく,元は Python の規則です.

決めたこと

  • M-05 の criteria."false" は,レーン B が目指す原則の形(はっきり「読むだけ」か「何かを変える」かを示す動詞だけが約束になる)で書きました.レーン B が Python と TypeScript を同じ形にするまで,jev-lint rules は M-05 の言語間のずれを警告します.
  • M-21 と M-60 は言語ごとに検出の形が違うため,divergent: に理由を書いて言語間の警告を消しました.
  • Rust の M-05 は,#[test] の後ろに #[ignore] やコメントが続く関数も外しています(jev-lint 同梱の fn-name-promises は直前の属性しか見ない).

確認

確認 結果
jev-lint rules --no-config -R agents/hooks/lint/model-rules 12 ルール,エラー 0(言語間のずれの警告は上記のとおり)
jev-lint review --dry-run --show-subjects(フィクスチャに対して) 各マッチャーが意図した関数と呼び出しだけを選ぶことを確認
jev-lint eval --dry-run --no-config <go> <rust> 6 スイートを認識.各 8〜11 対象
tests/test_model_rule_files.py に Go と Rust のマッチャーテストと eval スイートの構成テストを追加 10 件成功
uv run pytest 全体 4731 件成功,1 件スキップ
ruff check / ruff format / ty(pre-commit) 成功

eval の結果

jev-lint eval --no-config <go> <rust> の結果です.6 スイートすべてが fp 0,fn 0 で,保存したベースラインの再採点(jev-lint eval --replay,鍵なし)も 10 スイートすべて合格です.

スイート 違反 違反ではない例の最大スコア(cleanTop) カットオフ 備考
go/command-query-naming 全件検出 0.25(fitted 0.61) 0.5 のまま 取り直しで blind ではなくなった
go/error-message-names-operation 全件検出 0.26(fitted 0.61) 0.5 のまま inconclusive:
go/known-defect-marker-names-removal 全件検出 0.12(fitted 0.47) 0.5 のまま inconclusive:
rust/command-query-naming 全件検出 0.45(fitted 0.68) 0.68 に調整 安定したギャップ
rust/error-message-names-operation 全件検出 0.12(fitted 0.53) 0.5 のまま inconclusive:
rust/known-defect-marker-names-removal tp 6 0.14(fitted 0.36) 0.36 に調整 折り返した cfg_attr の違反が 0.53〜0.61
  • カットオフの調整:
    • rust/command-query-naming は,違反ではない例 conforming.rs:34 が 0.47 / 0.39 / 0.50 で,開始値 0.5 に当たります.
    • rust/known-defect-marker-names-removal は,一番低い違反(violating.rs:33)が 0.53〜0.61 で,開始値のばらつきの範囲内です.
    • どちらも fitted の値(0.68,0.36)に調整し,根拠をヘッダーに書きました.少数のフィクスチャへの当てはめなので,較正ではありません.
  • inconclusive::
    • 3 スイート(Go の M-21 と M-60,Rust の M-21)は,どのフィクスチャもカットオフから大きく離れており,ドリフトを検出できない(blind)と報告されます.
    • jev-lint が提供する宣言で,理由を rule.yml に書きました.
    • 境界のフィクスチャを足して宣言を外すのは後続です(Rust の M-21 が ok_or / map_err で作るエラーを選べない #164 のコメントに追記).
  • ベースライン: Go と Rust の 6 スイートの baseline.json をコミットしました.main のテスト test_every_saved_eval_baseline_still_scores_as_accepted が全スイートの保存済みベースラインを再採点するためです.リポジトリのルートから相対パスで取り直したので,パスは相対です(main の Python と TypeScript の 4 件も同じ方法で取り直しました.絶対パスが残らないことを test_no_saved_eval_baseline_records_an_absolute_path で確かめます).last.json はコミットしません.
  • 1 回目の eval: go/error-message-names-operation が fp 2,go/command-query-naming に不安定な 1 件がありました.原因はフィクスチャのラベルの曖昧さで,ルールの文章は変えず,フィクスチャを直しました.

計画からの変更

なし.

Refs #74

🤖 Generated with Claude Code

@furedea

furedea commented Nov 11, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T17:44:32.461267Z 513d912 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

Copy link
Copy Markdown

Review summary

No blocking findings (0 × P0/P1). The rules are advisory (warning only, never promoted to a gate) and the hook code is unchanged, so none of these can break the Stop hook. 4 × P2 and 1 × P3 are posted inline:

  • P2: Run / run in the command-query conforming fixtures (Go and Rust) violates the rule's own "true" criterion: an effect verb whose body only computes a value. The default clean label will make eval count correct answers as false positives.
  • P2: The Rust M-21 matcher misses .context() / .with_context(), which is how rust-style's errors.md tells you to attach messages.
  • P2: The Rust test exclusion regex: test also matches #[cfg(not(test))] / cfg_attr(test, …), so those production functions are silently left out of M-05.
  • P2: The Go M-60 regex misses t.SkipNow(), the bare skip with no message at all.
  • P3: The Rust forward conforming fixture does not compile (bail! in a function returning ParseIntError).

Not verified: jev-lint is not installed in the review environment, so tests/test_model_rule_files.py would skip here and the matcher counts were checked by reading only. As the PR says, jev-lint eval has not been run yet either.

@furedea

furedea commented Nov 11, 2026

Copy link
Copy Markdown
Owner

@codex review

@github-actions

Copy link
Copy Markdown

Review summary

No blocking findings (0 P0 or P1). One finding, posted inline:

  • P3: In rust/error-message-names-operation/rule.yml, the matcher misses path-qualified anyhow::bail! and anyhow::anyhow!. The anyhow::anyhow\( alternative in the call regex can never match.

What I checked:

  • Every expect.yml line number against its fixture file: all of them point at the intended function, t.Skip call or #[ignore] attribute.
  • The matchers. Go excludes Test, Benchmark, Fuzz and Example functions. In Rust, the follows/stopBy test exclusion skips functions with #[test] followed by other attributes or comments, and keeps #[cfg(not(test))] functions.
  • The new subject counts in tests/test_model_rule_files.py.
  • The fixtures: each import is used in its file.

Not verified: I didn't run jev-lint or ast-grep; neither is installed in this environment. The model-graded eval hasn't been run either, as the PR notes.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f1395cd622

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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

furedea commented Nov 11, 2026

Copy link
Copy Markdown
Owner

@codex review

@github-actions

Copy link
Copy Markdown

Review summary

No blocking findings (0 × P0/P1).

Checked:

  • Every expect.yml line label against its fixture. All 12 suites point at the intended function, call or attribute line.
  • The matchers:
    • Go test-name exclusion
    • Rust #[test] look-back through attributes and comments via follows + stopBy
    • Go errors.New/fmt.Errorf and Rust Err(/bail!/anyhow!/ensure!/.context(
    • t.Skip* and #[ignore]
  • The expected subject counts in the new test_model_rule_files.py cases, worked out by hand.

The new tests skip when jev-lint is not on PATH, as the existing ones do. I did not run them locally because jev-lint is not installed here.

Findings:

  • P3: the Go M-60 matcher misses the testify-suite form s.T().Skip(...) and also matches unrelated non-test x.Skip( calls (inline comment).

🤖 Generated with Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b6bfa95f76

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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

furedea commented Nov 11, 2026

Copy link
Copy Markdown
Owner

@codex review

@github-actions

Copy link
Copy Markdown

Review summary

No blocking findings, and no inline comments.

What I checked:

  • Matchers: the Go and Rust rule.yml matchers (function, method and test exclusions, the error builders errors.New, fmt.Errorf, Err(, bail!, anyhow!, ensure!, .context, and the markers Skip, Skipf, SkipNow and #[ignore]) agree with the selection counts in tests/test_model_rule_files.py.
  • Fixture labels: every line number in each expect.yml points at the function, t.Skip call or #[ignore] attribute it describes.
  • Repository lint: the new fixture file names pass .ls-lint.yml, and lefthook runs no Go or Rust tools on them.

Two things are untested:

  • jev-lint is not installed in CI, so every test in tests/test_model_rule_files.py is skipped there, the new Go and Rust tests included. As with the existing Python and TypeScript tests, they only run on a machine that has jev-lint.
  • The model's answers on the fixtures (jev-lint eval) still need the API key, as the PR description says.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7396789a99

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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

furedea commented Nov 11, 2026

Copy link
Copy Markdown
Owner

@codex review

@github-actions

Copy link
Copy Markdown

Review summary

No blocking findings (no P0/P1). The rules are additive and advisory, and the hook code is unchanged. Adding expect.yml files only changes the *.yml fingerprint in model_rules_gate.py, which is harmless. Fixture file names pass .ls-lint.yml.

P2

  • rust/known-defect-marker-names-removal/rule.yml:20: the cfg_attr regex can't match across lines, so a rustfmt-wrapped #[cfg_attr(..., ignore = "...")] is never selected. The multi-line clean fixture therefore doesn't test anything, and no unit test covers the multi-line form.
  • go/error-message-names-operation/expect.yml:9: Load is labelled bad, but it wraps an os.ReadFile error that already names the operation and the path. The rule's own false criterion counts that as clean, so the eval label is inconsistent.

Not verified here: jev-lint isn't installed in this environment, so I didn't run tests/test_model_rule_files.py or jev-lint eval. As the PR says, the eval with the model still has to be run.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 995efe3057

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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

furedea commented Nov 11, 2026

Copy link
Copy Markdown
Owner

@codex review

@github-actions

Copy link
Copy Markdown

Review summary

I reviewed the six new Go/Rust model rules, their fixtures and expect.yml labels, and the new tests in tests/test_model_rule_files.py.

Blocking findings: 0 (no P0 or P1).

  • P2: The cfg_attr regex in rust/known-defect-marker-names-removal/rule.yml cannot cross a newline. As a result, a #[cfg_attr(..., ignore = ...)] split across lines (rustfmt's usual layout) is never selected. The clean label on the multi-line fixture passes only because nothing is selected there.

What I checked:

  • Every expect.yml line number points to the line it is meant to (the function start, the t.Skip call or the #[ignore] attribute).
  • The Go matcher leaves out test, benchmark, fuzz and example functions correctly, and still selects methods whose names start with Test.
  • The Rust #[test] look-back skips over other attributes and comments without catching #[cfg(test)].

I could not run jev-lint here, so I did not run the dry-run tests or the evals. The PR body says the evals still need a key, and last.json snapshots are committed only for the Go rules.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 38d87d0790

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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-agent
furedea-agent Bot force-pushed the feat/74-model-rules-go-rust branch from 38d87d0 to 16a6e13 Compare November 11, 2026 14:52
@furedea-agent
furedea-agent Bot force-pushed the feat/74-model-rules-go-rust branch from de89bf1 to 3daefa8 Compare November 11, 2026 16:35
@furedea

furedea commented Nov 11, 2026

Copy link
Copy Markdown
Owner

@codex review

@github-actions

Copy link
Copy Markdown

Review summary

No blocking findings (P0: 0, P1: 0). No inline comments posted.

What I checked:

  • Matchers vs. tests: I traced every Go and Rust rule.yml matcher against GO_SOURCE / RUST_SOURCE in tests/test_model_rule_files.py. The expected subject counts (Go 5/1/3, Rust 6/3/3) follow from the rules. This includes the *testing.[TBF] test-function exclusion, the Rust follows + stopBy lookback through attributes and comments, and the cfg_attr(..., test) / cfg_attr(..., ignore) handling (a condition that merely names ignore or test is not matched).
  • Fixture labels: every expect.yml line number lands on the intended function, t.Skip* call, or #[ignore] / cfg_attr attribute in its fixture.
  • Fixture isolation: the new .go, _test.go and .rs fixtures are still excluded from Stop-hook language verification (check_selection.MODEL_RULE_FIXTURES — fnmatch's * also matches /) and from model review (model_rules_files.RULE_FIXTURES). The undefined Suite type in the Go fixture won't break any build. They also pass .ls-lint.yml.
  • Docs: the DESIGN.md / DESIGN_ja.md statement that five cutoffs are fitted matches the committed threshold: values (Python M-05 0.76, TS M-05 0.79, TS M-21 0.75, Rust M-05 0.68, Rust M-60 0.36).

Limitation: jev-lint was not available in the review environment, so I didn't run the new tests or the eval replay. These conclusions come from reading the code.

Considered but not raised as findings (known, documented trade-offs that cost only extra subjects, not wrong verdicts): the Go M-60 matcher selects any .Skip/.SkipNow receiver, and the Rust M-05 test exclusion doesn't cover #[test_case] or #[rstest].

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3daefa8a90

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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

furedea commented Nov 11, 2026

Copy link
Copy Markdown
Owner

@codex review

@github-actions

Copy link
Copy Markdown

Review summary

I found no P0–P3 problems I'd report. Blocking findings: 0.

What I checked:

  • Matchers. I traced the Go and Rust selectors by hand against the new GO_SOURCE and RUST_SOURCE in tests/test_model_rule_files.py. The counts in the tests come out the same:
    • Go: 5 / 1 / 3. Methods named Test* and suite methods are still included. Skip, SkipNow and s.T().Skip are all matched.
    • Rust: 6 / 3 / 3. The follows + stopBy walk over attributes and comments skips known_defect and the two cfg_attr tests. The cfg_attr(ignore, ..) and feature = "ignore" cases are correctly left out.
  • Rust regexes. The cfg_attr regexes in M-05 and M-60 match the condition-vs-attribute-list cases the comments describe. test_case and ignore_* don't match because of the \b boundaries.
  • Fixture line numbers. The lines in expect.yml point to the intended t.Skip / #[ignore] lines and the first lines of the functions.
  • Docs. The "five fitted cutoffs" claim in docs/DESIGN.md and docs/DESIGN_ja.md matches the threshold: values: Python M-05 0.76, TypeScript M-05 0.79, Rust M-05 0.68, TypeScript M-21 0.75, Rust M-60 0.36.
  • Baselines. The rewritten Python and TypeScript baselines now use repo-relative paths. The new test_no_saved_eval_baseline_records_an_absolute_path guards this.

Limitations:

  • jev-lint isn't installed on this runner, so I couldn't run the dry-run plans or eval --replay. I checked the matcher behaviour by reading the code only.
  • The known gaps are already documented in the rule headers, and they only add extra subjects for the model to judge; they never wrongly exclude code:
    • aliased testing, fmt or errors imports
    • errors built with ok_or or map_err
    • any .Skip( receiver

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 513d91274f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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

furedea commented Nov 11, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 513d91274f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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
furedea merged commit 9731488 into main Nov 11, 2026
44 of 46 checks passed
@furedea
furedea deleted the feat/74-model-rules-go-rust branch November 11, 2026 18:11
furedea added a commit that referenced this pull request Nov 12, 2026
…0 suites (#178)

## 概要

Go の `command-query-naming`(M-05)と
`known-defect-marker-names-removal`(M-60)に,違反に近い見た目の「本当に準拠している」境界フィクスチャを足し,`inconclusive:`
を外しました.残っていた `inconclusive:` はこの 2 つだけで,これで 3 スイートすべてが外れます(Rust M-21 と
Go M-21 は #158 / #175 で対応済み).

Closes #164

## 変更

| スイート | 追加した clean | 理由(ルールの基準に照らして) |
| ------------------------------------ | ------------------------- |
-------------------------------------------------------------------- |
| go/command-query-naming | `FindLargest` |
読み取りの名前で,ソートするのは自分のコピーだけ.引数は変えない |
| go/command-query-naming | `(*Review).Refresh` |
効果を示す名前で,ファイルを読むが,効果は自分のフィールドの置き換え |
| go/known-defect-marker-names-removal | `TestNeedsNewerToolchain` |
既知の不具合ではなく,ツールチェーンの不足による skip |
| go/known-defect-marker-names-removal | `TestUntilRelease` |
コメントが,修正を含むリリースを示している |
| go/known-defect-marker-names-removal | `TestPinnedTransport` |
削除条件が依存のバージョン更新 |
| go/known-defect-marker-names-removal | `TestUpstreamTicket` | 削除条件が外部
issue のクローズ |

ルール文(criteria)は変えていません.フィクスチャの `import` を 1 行足したため,既存 clean の行番号を +1
しました.

## 評価(user が実行した eval,`--no-config`)

| スイート | tp / fp / fn | cleanTop | fitted | 以前の cleanTop |
| ------------------------------------ | ------------ |
------------------------------- | ------ | --------------- |
| go/command-query-naming | 4 / 0 / 0 | 0.30 | 0.63 | 0.24 |
| go/known-defect-marker-names-removal | 8 / 0 / 0 |
0.27(`conforming_test.go:31`) | 0.56 | 0.24 |

- 新しい M-60 の clean は 0.03〜0.20 で,境界には届きませんでした.境界は既存の
`conforming_test.go:31` に依存しており,このケースのスコアの揺れ(spread)は 0.16 です.今後 replay
が blind と判定する場合は,この揺れが原因として疑われます.
- Go の M-05 の境界は,まだ端にあります.最高の clean は約 0.26 で,閾値からの余白は約 0.24 と,blind
と判定される 0.25 の線ぎりぎりです.新しい 2 件の clean(`FindLargest`,`Refresh`)は 0.07〜0.12
で境界には届いていません.なお,レビューの指摘を受けて,意図せず 0.40〜0.48 になっていた helper `reload` は
`Refresh` に inline しました.
- 新しい M-60 の clean を境界に当てるために,ルール文を曲げることはしていません.
- baseline の `last.json` は他のスイートと同様にコミットしていません.

## 検証

- `uv run --frozen pytest`:4718 passed,1 skipped
- `jev-lint eval --replay --no-config
agents/hooks/lint/model-rules/go`:3 スイートすべて「same decisions」

## #164 の受け入れ条件

- Rust M-21 の `ok_or` / `ok_or_else` / `map_err`,`cfg_attr` の属性ノード照合:PR
#175 など,先行 PR で完了
- 3 スイートの境界フィクスチャと `inconclusive:` の削除:この PR で完了

🤖 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>
furedea added a commit that referenced this pull request Nov 15, 2026
…#191)

Refs #74, Refs #196(`agents/AGENTS.md`
の言語非依存規則).計画:#74 (comment)

## 概要

`agents/AGENTS.md`(General / Development Workflow / Coding
Guidelines)の全規則を棚卸しし,最も安い判定手段に振り分けた.

- jev-lint model rule を 5 規則 × 4 言語(python / rust / go / typescript)= 20
件追加(`agents/hooks/lint/model-rules/<language>/<id>/rule.yml`,`threshold:
0.5`,`severity: warning`).ADR-0021 に従い,該当する文章は残す.fixture / eval /
baseline は deferred(未追加).
- 新しいプロジェクトは furedea/template-* からだけ作られるため,4 つの template(go / python /
rust / typescript)の main の `.ls-lint.yml`(ディレクトリは kebab-case,ファイルは
snake_case)と
`.commitlintrc.yml`(`@commitlint/config-conventional`,lefthook の
`commit-msg`)が覆う 3 行を `agents/AGENTS.md` から削除した.
- ast-grep 規則は 0 件.言語固有の `rules/<language>/`
は各言語レーンの領域のため触らず,候補を「後続」に記載.
- 追加テスト:`tests/test_agents_md_model_rules.py`(matcher が選ぶ関数を 4
言語で検証,`--dry-run` でキー・ネットワーク不要).
- 共有ファイルの変更(理由): `tests/test_model_rule_files.py` の `subjects_by_rule`
を既存 3 規則 ID に絞った.新規則が同じ sample の関数を選ぶため,既存の厳密なカウント比較が壊れるため.

## 文章と規則の対応表

| 規則 ID | 元の場所 | 元の規則(原文) | 判定 | 実装 | 例のテスト | 元の文章の扱い |
| -------------------------------------- | ------------------------ |
--------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| ---------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
| — | `agents/AGENTS.md:3` | Think in English, but generate responses in
Japanese | 文章のまま | — | — | 残す(エージェントの思考と応答言語はコードに現れない) |
| — | `agents/AGENTS.md:4` | Use "," and "." in Japanese | 文章のまま | — | —
| 残す(日本語の文章は対象外の言語.構文で判定できない) |
| `ls-lint` dir | `agents/AGENTS.md:5` | Directory names: Use hyphens
(-) | 既存 linter(template-go / python / rust / typescript の ls-lint
`.dir`) | 各 template の `.ls-lint.yml` | 既存 | 削除 |
| `ls-lint` file | `agents/AGENTS.md:6` | File names: Use underscores
(\_) | 既存 linter(template-* の ls-lint `.*` / `.md` など) | 各 template の
`.ls-lint.yml` | 既存 | 削除 |
| — | `agents/AGENTS.md:7` | Write documentation, code comments, and
commit messages in English for public repositories… | 文章のまま | — | — |
残す(言語は判定できるが,リポジトリが公開かどうかは文脈) |
| `commitlint` | `agents/AGENTS.md:8` | follow Conventional Commits
rules | 既存 linter(template-* の commitlint `config-conventional`,lefthook
`commit-msg`) | 各 template の `.commitlintrc.yml` | 既存 | 削除 |
| — | `agents/AGENTS.md:9` | Implement based on TSDD | 文章のまま | — | — |
残す(開発手順) |
| — | `agents/AGENTS.md:10` | Read web pages with web-fetch; `curl` only
for local servers… | 文章のまま(コマンドガードが別途強制) | — | — | 残す(hook の領域.規則
registry の対象外) |
| — | `agents/AGENTS.md:12-18` | Development Workflow(skill の順序) | 文章のまま
| — | — | 残す(手順) |
| — | `agents/AGENTS.md:22` | Existing project style takes precedence |
文章のまま | — | — | 残す(優先順位の宣言) |
| — | `:24` | Keep files focused: high-level code before lower-level
details… | 文章のまま | — | — | 残す(ファイル全体の構成判断で 1 関数から決まらない.言語レーンの
`max-lines` 系 linter が長さのみ覆う) |
| — | `:25` | Before writing new code, check existing code / stdlib… |
文章のまま | — | — | 残す(書く前の行動.コードに残らない) |
| `construction-separate-from-execution` | `:26` | Separate object
creation/configuration from execution logic | 動的(jev-lint,0.5) |
`model-rules/{python,rust,go,typescript}/construction-separate-from-execution/rule.yml`
| matcher: `tests/test_agents_md_model_rules.py`(fixture は deferred) |
残して併記 |
| — | `:27` | Keep classes and modules single-purpose, cohesive, loosely
coupled, minimally public | 文章のまま | — | — | 残す(モジュール間の依存は 1 関数・1
ファイルで判定できない.`function-single-purpose` が関数単位を一部覆う) |
| — | `:28` | Name classes by responsibility; order methods
public-to-private; use DTOs at boundaries | 文章のまま(一部 ast-grep 候補) | — |
— | 残す(クラス名の責務は意味判断.メソッド順序は ast-grep の `follows` / `precedes`
で書けるため後続候補) |
| — | `:29` | Keep domain enums and exception classes near their owner;
one exception per failure concept | 文章のまま | — | — | 残す(複数ファイルにまたがる配置判断)
|
| `function-single-purpose` | `:30` | Keep functions single-purpose at
one abstraction level, with short variable lifetimes and guard clauses
over nested conditionals | 動的(jev-lint,0.5)+既存 linter |
`model-rules/*/function-single-purpose/rule.yml`.入れ子は ruff
`PLR1702`(max-nested-blocks 2),clippy `excessive_nesting`,revive
`max-control-nesting`,oxlint `max-depth` | matcher 4 言語 | 残して併記(変数の生存期間と
guard clause は jev-lint 規則が直接問わない.ruff `RET505` などは後続) |
| — | `:31` | Extract a function when its name states intent; do not
split merely to shorten | 文章のまま | — | — | 残す(抽出すべきかは設計判断で yes/no にできない)
|
| 既存 linter | `:32` | Treat argument, nesting, and complexity limits as
design signals… | 既存 linter(数値上限)+文章のまま(対処方針) | ruff `PLR0913`(max-args
3)・`PLR1702`・`C901`(10),clippy
`too_many_arguments`(3)・`excessive_nesting`・`cognitive_complexity`,golangci
`revive:argument-limit`・`max-control-nesting`・`gocognit`・`gocyclo`,oxlint
`max-params`・`max-depth`・`complexity` | 既存 | 残す(上限は linter
が覆うが,「分割する・導出できる引数を落とす・名前付き型にまとめる」という対処と,匿名の dict / tuple / object
にまとめない指示は覆わない.後者は 1 関数から判定できる候補だが,dict / tuple は正当な利用が多く selector
で絞れないため文章のまま) |
| — | `:33` | Split duplicated logic, control structures, mixed
responsibilities, command/query behavior | 文章のまま(command/query は既存
`command-query-naming`) | — | — | 残す(重複はファイル横断.command/query は M-05 が覆う)
|
| `command-query-naming`(既存) | `:34` | Name one concept with one word;
name command functions for their side effects and query functions for
the value they return | 動的(既存 jev-lint M-05)+文章のまま |
`model-rules/*/command-query-naming/rule.yml` | 既存 | 残す(「1 概念 1
語」はリポジトリ横断) |
| — | `:35` | Let name length match scope size; units, trust/safety
attributes, boolean prefixes | 文章のまま | — | — |
残す(スコープと名前の釣り合いは構文では決まらない.boolean 接頭辞は型推論が必要で selector が絞れない.ruff `N`
は命名規約のみ) |
| `no-comment-restating-code` | `:36` | Minimize comments and
docstrings; use them for public APIs, TODOs, non-obvious constraints,
intent | 動的(jev-lint,0.5) |
`model-rules/*/no-comment-restating-code/rule.yml` | matcher 4 言語 |
残して併記(public API の docstring は ruff `D` / clippy / revive `exported`
が別に覆う) |
| `no-reaching-through-collaborators` | `:37`(Law of Demeter) | Prefer
DRY, YAGNI, and Law of Demeter | 動的(jev-lint,0.5,Demeter のみ) |
`model-rules/*/no-reaching-through-collaborators/rule.yml` | matcher 4
言語 | 残して併記(DRY は複数ファイル,YAGNI は要求との照合が必要で文章のまま) |
| — | `:38` | Apply SOLID pragmatically… | 文章のまま | — | — |
残す(設計原則.実用判断を含む) |
| — | `:39` | Separate policy from details; delay database / framework
decisions | 文章のまま | — | — | 残す(アーキテクチャ判断) |
| — | `:40` | Prefer Value Objects over raw primitives… | 文章のまま | — | —
| 残す(値の不変条件は使用箇所をまたいで決まる) |
| `no-exposed-mutable-collection` | `:41` | Prefer Collection Objects…;
do not expose mutable raw collections | 動的(jev-lint,0.5,後半のみ) |
`model-rules/*/no-exposed-mutable-collection/rule.yml` | matcher 4 言語 |
残して併記(Collection Object を使う方針は文章のまま) |
| — | `:42` | Use Entities only when stable identity matters | 文章のまま | —
| — | 残す(ドメイン判断) |
| — | `:43` | Use classification objects/enums when categories or state
transitions have domain rules | 文章のまま | — | — | 残す(ドメイン判断.clippy
`exhaustive` 系は網羅のみ) |
| — | `:44` | Parse raw input into constrained types once at the
boundary | 文章のまま | — | — | 残す(同じ値の再検証は呼び出し関係をまたぐ) |
| — | `:45` | Make invalid states unrepresentable; Result for expected
failures; handle sum types exhaustively | 文章のまま+既存 linter(網羅のみ) |
golangci `exhaustive`・`gochecksumtype`,rustc の `match` 網羅は既定 | 既存 |
残す(型設計と,テストが要る業務規則の線引きは判断.網羅検査の部分だけ linter が覆う) |

## 規則一覧(jev-lint)

5 規則とも `severity: warning`,`threshold: 0.5`,Stop
時の助言のみ(ADR-0021).selector は各言語の関数 / メソッド宣言(typescript は変数に束ねたアロー関数も含む).

| id | selector の絞り込み |
| -------------------------------------- |
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
| `function-single-purpose` | 変更された全ての関数(matcher
は意図的に広く取る.見逃しは黙って失敗し,無関係な 1 件は読むだけで安い.ユーザー判断で 30 行の絞り込みを削除) |
| `construction-separate-from-execution` | オブジェクト生成(python:
大文字始まりの呼び出し.`*Error` などは除外,typescript: `new`.`Map` / `Set` / `*Error`
などは除外,go: `NewX`,rust: `::new` など.標準の collection / smart pointer
は修飾パス込みで除外)を含む関数 |
| `no-reaching-through-collaborators` | `a.b.c.d(...)` 形の呼び出し連鎖を含む関数 |
| `no-comment-restating-code` | コメントを含む関数 |
| `no-exposed-mutable-collection` | python: `return self.X`,typescript:
`return this.X`,go: `return r.X`,rust: 戻り値型に `&mut` を含む関数 |

## 波 2: linter で有効化する規則

この PR の範囲では有効化する linter 規則は 0 件.候補(言語レーン側で扱う): ruff `RET505`(guard
clause,`:30`),method 順序の ast-grep(`:28`).

## ast-grep hit 数

ast-grep 規則を追加していないため 0 件(既存規則の scan は変更なし).

## 検証

- `nix develop --command uv run pytest tests/test_ast_grep_rules.py
tests/test_model_rule_files.py tests/test_agents_md_model_rules.py`: 通過
- `nix develop --command uv run pytest`(CI と同じ全体): 4873 passed, 1
skipped
- `jev-lint rules --no-config -R agents/hooks/lint/model-rules`: 0
error(既存 `command-query-naming` の言語間 drift 警告は変更前から)

## Stop の subject 上限(20 → 250)の測定

`jev-lint review --dry-run --json`(モデル呼び出しなし,ネットワークなし,全 model
rule,`--exclude "**/fixtures/**"`)を,この repository の merge 済み PR と本 PR
の差分に対して実行した.jev-lint は 1 ファイルを 1 リクエストにまとめ(最大 256 subject),リクエストは並列(既定
32)に走るため,所要時間はリクエスト数で決まる.

| 対象 | 差分 | subjects | requests | tokens | 推定 USD |
| ----------------------------- | -------------------- | -------- |
-------- | ------ | -------- |
| #175 | 21 files, +1074/-616 | 3 | 1 | 2,421 | 0.00010 |
| #158 | 37 files, +3667/-955 | 14 | 1 | 8,807 | 0.00037 |
| #187 | 5 files, +120/-16 | 26 | 4 | 15,760 | 0.00066 |
| 本 PR(`origin/main~2` 基準) | 29 files, +1127/-23 | 83 | 8 | 49,513 |
0.00208 |
| #170(最大) | 12 files, +242/-103 | 104 | 10 | 58,723 | 0.00247 |

- 1 subject あたり約 560 token,約 0.000024 USD.
- 所要時間:ネットワーク無しでは測れないため,この環境の記録済み Stop 実行 30
件(`~/.local/state/agent-harness/verification/*/*/results.json` の
`model_rules` レシート)を使った.1〜8 リクエストで 2.7〜7.9 秒(subject 数・judged
数にほぼ依存しない).90 秒の Stop 予算(`BUDGET_SECONDS`)に対し十分な余裕がある.
- 上限 250 は,測定した最大の session(104)の約 2.4 倍で,上限いっぱいでも約 0.006 USD /
Stop.スキップした subject は従来どおり報告する.
- 提案(未実装): 上限を単一の数でなく Stop の残り時間に比例させる案.今回は測定上 250
で時間・費用とも余裕があるため,実装しなかった.

## 後続

- fixture / eval / baseline
の追加(deferred.ユーザー指示で今回は対象外.`test_every_go_and_rust_rule_ships_an_eval_suite…`
は既存 3 規則のみを検査するため,追加分は検査されない)
- method 順序の ast-grep 規則(各言語レーン)
- 他レーンも `tests/test_model_rule_files.py` を編集する場合,`subjects_by_rule`
の変更が競合し得る

## レビュー上限により保留した指摘(#196 で対応)

- [x] `no-comment-restating-code` / `no-exposed-mutable-collection` の
selector が広い:コメントは TODO / lint・型・ビルドの directive を除き,Python の docstring
も選ぶ.公開コレクションは,python は public メソッドが `self._x` を返す場合,typescript と go
は戻り値型が配列 / map / slice の場合に絞った.
- [x] Go の `no-exposed-mutable-collection` がスカラー getter を選ぶ:go は戻り値型が
slice / map の関数だけ選ぶ.
- [x] Python の docstring を選ばない:関数先頭の docstring を selector に追加し,テストを追加した.
- [x] Stop の `SUBJECT_CAP`(20,ファイル単位)で規則が増えた分が漏れる:eval baseline
を持つ規則(調整済み)と持たない規則を 2 つの review(tier)に分け,調整済みの tier が先に cap を使う.未調整の規則が
cap を超えても,調整済みの規則の判定は落ちない.`model_rules_gate.rule_tiers`,`Review.rules`
を複数の `-R` に対応.テスト:`tests/hooks/test_model_rules_tiers.py`.既存の hook テストは
1 tier に固定(`install_fakes`).

## 追加の対応(#196)

- 後段の review が失敗しても先行 tier の指摘を保持し,その run はレシートを保存しない(次の Stop
で再試行).`Judgement.failed_reviews`.
- レシートの入力フィンガープリントに `baseline.json` の有無を含めた.
- Rust の `no-exposed-mutable-collection` は slice / 配列 / 標準 collection への
`&mut` に絞った.

## レビュー上限により保留した指摘(follow-up)

#196 の再レビューが 3 回に達したため,次は修正せず保留した(`Deferred to a follow-up Issue (review
limit).`).

- 後段の review が失敗し,先行 tier に指摘がある場合,レシートが無いので入力が同じでも毎ターン同じ指摘で block
する(通知済みの状態は保存し,未完了の tier だけ再試行する)
- 後段の review の失敗理由(`Prevented.reason`)が捨てられ,`incomplete`
としか表示されない.`skipped_files=1` も実際のファイル数でない(理由を `Judgement` に載せる)
- `_Changes.reviews` が作る 2 tier の順序(調整済み committed,調整済み uncommitted,未調整
committed,未調整 uncommitted)のテストが無い
- Python の `no-exposed-mutable-collection` が公開名のフィールド(`return
self.items`)を選ばない(#196 (comment))
- TypeScript の `no-exposed-mutable-collection`
が戻り値型を省略したメソッドを選ばない.`Readonly*` 型も選んでしまう(同上)
- Go の `no-exposed-mutable-collection` が複数戻り値(`([]string,
error)`)を選ばない.Rust の同規則が明示的ライフタイム付き(`&'a mut
Vec<T>`)を選ばない(#196 (comment))
- Go の `construction-separate-from-execution` が `package.New(...)`
形を選ばない.Go の `no-exposed-mutable-collection` が名前付き slice / map
戻り値型を選ばない.Go の `no-comment-restating-code` が関数直前の doc comment
を選ばない(#196 (comment))
- `no-comment-restating-code` が関数の直前の(兄弟の)コメントを選ばない.Go と TypeScript
で指摘され,Python と Rust も同じ構造で同じ穴がある.4
言語まとめて一度に直す(#196 (comment))
- `no-reaching-through-collaborators`
が呼び出しで終わらないプロパティ参照の連鎖(`order.customer.address.city`)を選ばない.TypeScript
で指摘され,他の 3 言語も同じ穴.4
言語まとめて一度に直す(#196 (comment))
- Rust の `construction-separate-from-execution` が turbofish
付き(`ApiClient::<Config>::new()`)を選ばない

## 文章の扱い(方針変更)

新しいプロジェクトは template-* からだけ作られるため,template の linter が完全に覆う文章は削除する.上の表の 3
行(`:5` `:6` `:8`)がそれに当たる.jev-lint 規則の文章は変更しない.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: furedea <[email protected]>
Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant