Repository navigation
feat(lint): fit the Rust model rules to eval fixtures - #241
Conversation
|
@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 of #241 (read-only). I found no P0–P3 issues, so there are no inline comments. What I checked:
What I couldn't check:
One thing to keep in mind, not a defect: the widened matcher in |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! 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". |
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>
bcd326e to
54a4c39
Compare
|
@codex review |
|
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:
What I couldn't do:
Note for later, not a blocker:
🤖 Generated with Claude Code |
|
Codex Review: Didn't find any major issues. Hooray! 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". |
🤖 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>
#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>
概要
#220 の Rust 分.Rust の jev-lint 規則 14 件すべてに eval の fixtures と baseline を揃え,cutoff を jev-lint の fitted midpoint に置き換えた.分離しなかった規則は ask / criteria を書き直した.規則はすべて advisory のままで(ADR-0027),style skill の文章も消していない.
変更
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 件増える.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 が狭かった).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 を作るようにした.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で求めた(モデル呼び出しなし).command-query-namingconstruction-separate-from-executionconversion-and-query-names-follow-rust-conventiondomain-states-are-enumserror-message-names-operationfilesystem-code-keeps-paths-and-symlinks-safefunction-single-purposeknown-defect-marker-names-removalno-comment-restating-codeno-exposed-mutable-collectionno-reaching-through-collaboratorspaths-are-joined-not-formattedpublic-types-protect-invariantsserde-types-follow-config-conventions「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で数えた(キー不要).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).検証
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.eval --accept(14 suites)約 0.0089 USD.合計約 0.024 USD.Limits
gapsを全 Rust fixtures にかけると(criteria を書き直す前),command-query-namingとerror-message-names-operationで,他の規則の fixtures に cutoff の直下(余白 0.01,0.04)の subject があった.docs/DESIGN.mdの「Five cutoffs are fitted …」の段落は古くなった.全言語で共有している文書なので,全レーンが終わった後に親で更新してほしい.tests/test_model_rule_files.pyの 1 か所で,main のSUITE_RULE_IDSに寄せて解消した.cutoff と baseline は変えていない.Refs #220
🤖 Generated with Claude Code