Skip to content

feat(lint): fit the Rust model rules to eval fixtures - #241

Merged
furedea merged 3 commits into
mainfrom
feat/fit-jev-rules-rust
Nov 19, 2026
Merged

furedea merged 3 commits into
mainfrom
feat/fit-jev-rules-rust

Conversation

@furedea-agent

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

Copy link
Copy Markdown
Contributor

概要

#220 の Rust 分.Rust の jev-lint 規則 14 件すべてに eval の fixtures と baseline を揃え,cutoff を jev-lint の fitted midpoint に置き換えた.分離しなかった規則は ask / criteria を書き直した.規則はすべて advisory のままで(ADR-0027),style skill の文章も消していない.

変更

  • fixtures がなかった 11 規則に fixtures/violating.rs・fixtures/conforming.rs(clean は criteria の false 側に寄せた境界例)と expect.yml を追加した.
  • no-reaching-through-collaborators:matcher の $A.$B.$C.$D($$$) はフィールドの連鎖しか選ばず,self.session.connection().pool().acquire() のようなメソッド連鎖の違反例 5 件をどれも選んでいなかった.中間がメソッド呼び出しの 3 形も選ぶよう広げた(fix(lint): address review findings deferred from the #74 migration PRs #196 の「matcher は広め」).agent-harness の大型 PR では subject が 30〜55 件増える.
  • 1 回目の eval で分離しなかった 5 規則の criteria を書き直した:construction-separate-from-execution(composition root を誤検出していた,0.89),no-exposed-mutable-collection(clean 4 件すべてを誤検出していた,0.69〜0.96;struct 定義が見えるよう state: located に変更),serde-types-follow-config-conventions(命名の混在を見逃していた,0.19),domain-states-are-enums,filesystem-code-keeps-paths-and-symlinks-safe(gap が狭かった).
  • Rust の criteria だけを変えた 2 規則(construction-…,no-exposed-…)は,jev-lint の drift 警告に従い divergent: で理由を宣言した.
  • 各 rule.yml に cutoff の根拠(ケース数,clean の最高値,violation の最低値,baseline の日付)をコメントで書いた.
  • tests/test_model_rule_files.py:main の SUITE_RULE_IDS で Rust も Go と同じく全規則(None)に eval スイートを求める.
  • tests/test_agents_md_model_rules.py:この PR で全 74 規則に baseline が揃い,実ディレクトリでは tier が 1 つになる.「tier に分けても subject が減らない」というテストが自分自身と比べるだけになるので,一時コピーで Python の baseline を外して 2 tier を作るようにした.
  • 1 回目の eval でできた last.json を誤ってコミットしていたので,消した.

cutoff の fit

baseline は 2026-11-18,3 passes.値は 3 passes を通じた最高・最低.tp / fp / fn は新しい cutoff での値で,保存した baseline から jev-lint eval --replay agents/hooks/lint/model-rules/rust で求めた(モデル呼び出しなし).

規則 bad / clean clean の最高 bad の最低 cutoff(旧 → 新) tp / fp / fn 備考
command-query-naming 4 / 6 0.53 0.84 0.68 → 0.69 4 / 0 / 0
construction-separate-from-execution 5 / 5 0.36 0.88 0.5 → 0.62 5 / 0 / 0 blind
conversion-and-query-names-follow-rust-convention 6 / 7 0.10 0.46 0.5 → 0.28 6 / 0 / 0 0.5 では violating.rs:29 を 3 pass 中 2 回見逃していた
domain-states-are-enums 5 / 5 0.27 0.88 0.5 → 0.57 5 / 0 / 0 blind
error-message-names-operation 8 / 7 0.15 0.56 0.5 → 0.36 8 / 0 / 0
filesystem-code-keeps-paths-and-symlinks-safe 4 / 6 0.20 0.85 0.5 → 0.53 4 / 0 / 0 blind
function-single-purpose 4 / 5 0.25 0.71 0.5 → 0.48 4 / 0 / 0
known-defect-marker-names-removal 6 / 5 0.16 0.58 0.36 → 0.37 6 / 0 / 0
no-comment-restating-code 5 / 5 0.22 0.93 0.5 → 0.58 5 / 0 / 0 blind
no-exposed-mutable-collection 4 / 4 0.06 0.96 0.5 → 0.51 4 / 0 / 0 blind
no-reaching-through-collaborators 5 / 5 0.46 0.78 0.5 → 0.62 5 / 0 / 0
paths-are-joined-not-formatted 5 / 5 0.14 0.96 0.5 → 0.55 5 / 0 / 0 blind
public-types-protect-invariants 5 / 5 0.24 0.83 0.5 → 0.53 5 / 0 / 0 blind
serde-types-follow-config-conventions 4 / 5 0.18 0.24 0.5 → 0.21 4 / 0 / 0 unstable

「blind」は fixtures が境界から遠すぎて劣化を検出できないという replay の判定で,「unstable」は最も弱い違反の pass ごとの揺れが cutoff との余白より大きいという判定.どちらも各 rule.yml に inconclusive: で理由を宣言した.

昇格しない

ADR-0027(#250)により,model-judged の規則は gate(severity: error)にせず,すべて advisory のままにする.この PR でもどの規則も昇格しておらず,昇格の計画もない.規則の文章は AGENTS.md と style skill に残す.

Stop あたりの subject 数と費用

agent-harness(Rust)の直近 60 PR を jev-lint review --dry-run で数えた(キー不要).

  • Rust 規則だけの subject 数は中央値 6,p90 219,最大 667.
  • fix(hooks): raise the model rules subject cap and keep cached findings under it #246 で上限(SUBJECT_CAP)が 250 から 2000 に上がる(数値は fix(hooks): raise the model rules subject cap and keep cached findings under it #246 の PR 本文による.この PR ではコードを変えていない).2000 では 60 PR のどれも上限を超えず,最大の 667 でも約 3 分の 1 に収まる.250 のままなら超えていたのは 4 件で,どれも大型のリファクタ PR だった(main の規則だけでも 612,596,571,406).
  • 1 subject あたり約 0.000025 USD なので,最大の 667 subject で約 0.017 USD,上限いっぱいの 2000 で約 0.05 USD.60 PR 分の合計は 0.12 USD.
  • 1 回の Stop は 1 PR より小さいことが多いので,Rust 規則を足しても上限 2000 で足りると考える.

検証

  • jev-lint eval --replay agents/hooks/lint/model-rules:74 suite(s), all as shipped(origin/main 1721d17 に rebase 後).
  • jev-lint rules --no-config -R agents/hooks/lint/model-rules:74 rule(s) loaded, 0 error(s).Rust の drift 警告なし.
  • uv run pytest:rebase 後に全件実行し,test_the_tiers_together_plan_the_same_subjects_as_the_whole_directory の 1 件が上記の理由で落ちたので直した.直した後,tests/test_model_rule_files.py と tests/test_agents_md_model_rules.py は 19 passed.
  • モデル呼び出しの費用(ユーザーが実行,キーは guard によりエージェントから使えない):1 回目の eval(11 suites)0.0069 USD,gaps 0.0078 USD,eval --accept(14 suites)約 0.0089 USD.合計約 0.024 USD.

Limits

Refs #220

🤖 Generated with Claude Code

@furedea

furedea commented Nov 18, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 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-19T04:44:49.890043Z 54a4c39 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.

@github-actions

Copy link
Copy Markdown

Review of #241 (read-only). I found no P0–P3 issues, so there are no inline comments.

What I checked:

  • Fixture lines: the expect.yml line numbers for no-reaching-through-collaborators point at the first line of each function in both fixture files.
  • Rule and criteria changes: I read the widened matcher and the new cutoff comment in no-reaching-through-collaborators/rule.yml, and the ask/criteria text there. I did not read the other rule.yml diffs closely.
  • Test change: tests/test_model_rule_files.py now requires an eval suite for every Rust rule, using EVERY_RULE_EVALUATED.

What I couldn't check:

  • jev-lint isn't installed in this environment, so I did not run eval --replay or --dry-run. I did not check the baseline numbers or cutoffs against the fixtures. The existing replay test (test_every_saved_eval_baseline_still_scores_as_accepted) is what covers them.
  • I did not read most of the new fixtures or baselines.

One thing to keep in mind, not a defect: the widened matcher in no-reaching-through-collaborators also matches ordinary iterator and builder pipelines, because $A.$B($$$).$C($$$).$D($$$) selects any four-link method chain. The PR description already notes 30–55 more subjects on large PRs. Those cases rely on the false criteria, and the fixtures include them as clean cases.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: bcd326e211

ℹ️ 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 and others added 3 commits November 19, 2026 12:54
Add violating and conforming fixtures with expect.yml to the eleven Rust
rules that had none, rewrite the criteria of the five whose classes did
not separate in a first eval, send the whole file to
no-exposed-mutable-collection, let no-reaching-through-collaborators
select method chains, and set the error-message cutoff to its fitted
midpoint.

Refs #220

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Record a jev-lint eval baseline for each Rust rule and set each cutoff
to jev-lint's fitted midpoint, with the basis in the rule file. Rules
whose fixtures cannot see drift, or whose weakest violation is noisier
than its margin, declare why under `inconclusive:`. The two rules whose
Rust criteria now differ from the other languages declare `divergent:`.
Drop the eval scratch files committed by mistake. Every rule stays
advisory.

Refs #220

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… fitted

With the Rust baselines every shipped rule has one, so the real directory forms a single
tier and the check that splitting into tiers loses no subject compared one directory with
itself. The test now drops the Python baselines in a copy to keep two tiers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@furedea-agent
furedea-agent Bot force-pushed the feat/fit-jev-rules-rust branch from bcd326e to 54a4c39 Compare November 19, 2026 04:40
@furedea

furedea commented Nov 19, 2026

Copy link
Copy Markdown
Owner

@codex review

@github-actions

Copy link
Copy Markdown

Review summary (read-only, no inline findings): I found no P0 or P1 issues, and I didn't post any weaker findings.

What I checked:

  • The no-reaching-through-collaborators matcher now has four any patterns covering field and method mixes. All five violating fixtures are method chains, so the old field-only pattern would have missed them. The builder and iterator fixtures in conforming.rs also match the broader pattern. That is intended, because the criteria exempt them and they serve as boundary cases.
  • The test changes look sound. SUITE_RULE_IDS now requires an eval suite for every Rust rule. The tier test builds its two tiers from a temporary copy with the Python baselines removed, so it no longer compares the real directory with itself.
  • The cutoff comments match the PR table, for example 0.62 for no-reaching, with a clean maximum of 0.46 and a violation minimum of 0.78.

What I couldn't do:

  • I couldn't run pytest or jev-lint eval --replay in this environment, so the baselines and the 19 passing tests rest on the PR description.

Note for later, not a blocker:

  • serde-types-follow-config-conventions has a cutoff of 0.21 against a clean maximum of 0.18. The weakest violation scores 0.24 to 0.42 across passes, so the cutoff is only 0.03 above the highest clean score. The PR declares this as inconclusive and the rule stays advisory (ADR-0027), which is the right handling. More fixtures for the missing-default case would settle it.

🤖 Generated with Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 54a4c395d3

ℹ️ 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 3275ce2 into main Nov 19, 2026
29 checks passed
@furedea
furedea deleted the feat/fit-jev-rules-rust branch November 19, 2026 05:01
furedea pushed a commit that referenced this pull request Nov 19, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.3.0](v0.2.0...v0.3.0)
(2026-11-19)


### Features

* **lint:** fit the bash and yaml model rule cutoffs
([#243](#243))
([d5eab6b](d5eab6b))
* **lint:** fit the Go model rules on eval fixtures
([#244](#244))
([cf87c36](cf87c36))
* **lint:** fit the Rust model rules to eval fixtures
([#241](#241))
([3275ce2](3275ce2))
* **lint:** fit the TypeScript model rules on eval fixtures
([#242](#242))
([bb41bb7](bb41bb7))
* **lint:** make bash_local_underscore_prefix an error
([#251](#251))
([cd8c5b8](cd8c5b8))


### Bug Fixes

* **hooks:** let cleanup_worktrees remove worktrees left with only
regenerable outputs
([#235](#235))
([a25ce5b](a25ce5b))
* **hooks:** raise the model rules subject cap and keep cached findings
under it ([#246](#246))
([a451e93](a451e93))
* **hooks:** show each Stop model-rule finding once per session
([#252](#252))
([49cd6f9](49cd6f9))
* **hooks:** skip commits already on the default branch in model rules
([#247](#247))
([3df49a2](3df49a2))

---
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 20, 2026
#196 の Rust / TypeScript の項目(lane `rsts`)を片付ける.template の linter
だけが強制する文章を戻し,Jev の Rust / TS 規則の matcher を #196 で見逃した書き方まで広げ,新しい
baseline で cutoff を当て直した.規則はすべて advisory のまま(ADR-0027).

Refs #196

## 変更

| 区分 | 変更前 | 変更後 |
| --- | --- | --- |
| 文章 | template の lint が覆うとして削除 | template 以外のプロジェクト向けに戻す(ユーザー決定
2026-11-19) |
| Rust matcher | turbofish・構造体リテラル・`&'a mut`・`let` のクロージャ・trait
のメソッド宣言・block comment 後の serde 型・関数直前のコメント・呼び出しで終わらないフィールド連鎖を選ばない | 選ぶ |
| TS matcher | `ReadonlyArray`
などを選ぶ.戻り値型のないメソッド・関数直前のコメント・呼び出しで終わらないプロパティ連鎖を選ばない | `readonly` /
`Readonly*` は選ばない.残りは選ぶ |
| no-comment(Rust / TS) | `state: local`(直前のコメントがモデルに見えない) | `state:
located`,ask / criteria に「直前のコメント」を追加 |
| TS no-exposed | `state: local` | `state: located`(戻り値型がないときは field
の型をファイルから読む) |

## 項目ごとの状態

| 項目 | 状態 |
| --- | --- |
| rust-style `errors.md` の `unwrap_used` / `expect_used` /
`indexing_slicing`,`# Panics`(helper 経由を含む),`todo!` / `unimplemented!` |
修正(文章を戻した) |
| typescript-style `errors.md` の promise lint の 1 文 | 修正 |
| `tooling.md` の package-level guard,`types.md` の `to_owned()` と網羅的
`match`,`package_design.md` の `pub` | 修正(同じ方針で戻した) |
| `construction-separate-from-execution`:turbofish,構造体リテラル | 修正 |
| `no-exposed-mutable-collection`:Rust `&'a mut`,TS `Readonly*` の除外,TS
戻り値型の省略 | 修正 |
| `function-single-purpose`:Rust の `let` クロージャ | 修正 |
| `conversion-and-query-names-follow-rust-convention`:trait のメソッド宣言 | 修正
|
| `serde-types-follow-config-conventions`:block comment,複数行 derive |
修正(block comment)/済(複数行は既存の `(?s)`) |
| `no-comment-restating-code`:関数直前のコメント(Rust / TS 分) | 修正 |
| `no-reaching-through-collaborators`:呼び出しで終わらない連鎖(Rust / TS 分) | 修正 |
| `paths-are-joined-not-formatted`:raw string,`std::format!` /
`alloc::format!`,エスケープ,入れ子の `replace` の fixture | 修正(criteria も更新) |
| `public-types-protect-invariants`:tuple struct・スカラーの fixture | 済(#241)
|
| `domain-states-are-enums` の文章 | 修正(`types.md` の網羅的 `match` を戻した) |
| TS jev 規則 11
項目(`suite`,`it.concurrent`,`Date()`,`getRandomValues`,`pair` / `export
default` / `Promise.reject`,クラスのフィールド,`state: located` 各種,同名ヘルパー) |
済(#242) |
| `rs_no_mocking_library`:`automock`,`pub use`,グループ `use`,`cfg_attr` |
済(#216) |
| `rs_no_follow_links`:import 別名,途中で型を変える連鎖 | 済(#216 で `Limits` に記録) |
| `rs_fs_call_needs_context`,`rs_no_get_prefix`(`extern
"C"`,コメントを挟む属性),`ts_*` / `tsx_*` の ast-grep 規則すべて | 不要(規則を削除済み) |

## 検証

- [x] matcher テスト 12
件(`tests/test_model_rule_files.py::test_rule_selects_each_form_recorded_for_it`):実装前に
12 件失敗,実装後に通過
- [x] 変更した 11 suite の fixture で subject 数とラベル数が一致
- [x] `jev-lint eval --accept`(ユーザー実行,2026-11-19 11:35Z と no-comment 2
suite の 12:19Z).cutoff は fitted midpoint に合わせた
- [x] `jev-lint eval --replay`:74 suite すべて as shipped
- [x] `uv run pytest`:6184 passed,2 skipped

## cutoff

| 規則 | 旧 → 新 | 宣言 |
| --- | --- | --- |
| rust/construction-separate-from-execution | 0.62 → 0.63 | blind |
| rust/no-exposed-mutable-collection | 0.51 → 0.44 | blind |
| rust/function-single-purpose | 0.48 → 0.52 | |
| rust/conversion-and-query-names-follow-rust-convention | 0.28 → 0.29 |
|
| rust/serde-types-follow-config-conventions | 0.21 → 0.24 | unstable
を削除(stale) |
| rust/no-comment-restating-code | 0.58 → 0.56 | blind を削除(stale) |
| rust/no-reaching-through-collaborators | 0.62 → 0.63 | |
| rust/paths-are-joined-not-formatted | 0.55 → 0.75 | blind を削除(境界の例が
0.52) |
| typescript/no-exposed-mutable-collection | 0.93 |
unstable(`violating.ts:12` が 0.92〜0.96) |
| typescript/no-comment-restating-code | 0.53 → 0.54 | blind |
| typescript/no-reaching-through-collaborators | 0.65 → 0.69 | |

<details><summary>範囲・前提・制限</summary>

- 範囲:#196 の Rust / TS 項目と文章 2 件(lane brief の `rsts`).Go / Python /
共有ファイルは他の lane.#196 は閉じない.
- 文章の方針:template から作ったプロジェクトでだけ有効な linter が覆う規則は文章を残す(ユーザー決定
2026-11-19).#216 の「戻さない」はこれで置き換わる.
- 制限:TS no-exposed の cutoff は,criteria のプレーンなデータレコードの例外を絞って fit
し直すまで当てにできない(`inconclusive` に記録).`state: located` にした 3 規則は 1 subject
ごとにファイル全体を渡すので,入力 token が増える.
- レビューで出た制限(直さずに記録.再 fit には eval がもう 1 回要る):
- `rust/serde-types-follow-config-conventions`:`violating.rs:26` が
0.29〜0.43 と揺れる.cutoff 0.24 との差は平均で 0.14 で,jev-lint は `inconclusive:
Unstable` を stale として拒否する.
- `rust/no-comment-restating-code`:clean の doc
comment(`conforming.rs:30`,0.44〜0.50)と bad(0.62〜0.66)の間が狭い.`///`
の付いた関数もすべて subject になるので,公開 API の doc comment で誤検出がありうる.
- `typescript/no-exposed-mutable-collection`:戻り値型のない scalar の
getter(`getName() { return this.name; }`)も subject になり,ファイル全体を渡す.入力
token と誤検出が増えうる.
- 後続(見逃し):`rust/construction-separate-from-execution` は,型引数がネストした
turbofish(`ApiClient::<Wrapper<T>>::new`)と `ApiClient<Wrapper<T>>::new`
を選ばない.正規表現の `<[^>]*>` が内側の `>` で止まるため.次に Rust 規則を fit し直すときに AST 条件で直す.
- eval の費用:2 回で約 $0.0095(見積もり).
- Decisions needed:なし.

</details>

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

---------

Co-authored-by: furedea <132188853+furedea@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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