Repository navigation
docs(adr): keep model-judged rules advisory and move blocking rules to static checks - #250
Conversation
…o static checks Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@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 summary (docs-only PR) No P0 or P1 findings. I found one P2, posted inline.
Checked and fine:
🤖 Generated with Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3bee41271a
ℹ️ 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".
…0027 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@codex review |
|
Review summary: no findings. This is a docs-only change: the new ADR-0027, a
🤖 Generated with Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2a8a153b44
ℹ️ 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".
…ADR-0027 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@codex review |
Review summaryDocs-only change: new ADR-0027, a
What I checked:
No tests are needed for a docs-only change. 🤖 Generated with Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b4cba64e31
ℹ️ 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".
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@codex review |
|
Review summary: no findings. This PR changes docs only: a new ADR-0027, a front-matter line in ADR-0021, and the matching DESIGN.md and DESIGN_ja.md paragraphs. I checked three things.
I did not run 🤖 Generated with Claude Code |
|
Codex Review: Didn't find any major issues. Nice work! 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". |
## 概要 #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 形も選ぶよう広げた(#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. - #246 で上限(`SUBJECT_CAP`)が 250 から 2000 に上がる(数値は #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 - fixtures は規則ごとに 8〜15 件で,較正とは言えない.blind の 8 規則には境界の fixture がない. - `gaps` を全 Rust fixtures にかけると(criteria を書き直す前),`command-query-naming` と `error-message-names-operation` で,他の規則の fixtures に cutoff の直下(余白 0.01,0.04)の subject があった. - #196 の 2 コメントには Rust の項目がなかった. - `docs/DESIGN.md` の「Five cutoffs are fitted …」の段落は古くなった.全言語で共有している文書なので,全レーンが終わった後に親で更新してほしい. - 計画からの逸脱:なし(昇格しないことは ADR-0027 の決定どおり). - rebase(#240,#242,#243,#244,#250 などの後)の衝突は `tests/test_model_rule_files.py` の 1 か所で,main の `SUITE_RULE_IDS` に寄せて解消した.cutoff と baseline は変えていない. Refs #220 🤖 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>
…s under it (#246) Stop 時の model rules の subject 上限 `SUBJECT_CAP` を,実測に基づいて 250 → 2000 に上げます. あわせて,cap が効くときにキャッシュ済みファイルの finding が落ちる不具合と,1 ファイルも cap に入らないと差分全体を送ってしまう不具合を直します. 当初含めていた「promote 済み rule(`severity: error`)で毎 Stop ブロックする gate」は,ADR-0027(#250)の決定に従って取り除きました. Refs #220 | 項目 | 変更前 | 変更後 | | --------------------------------------------------------------------- | ----------------------------------------------- | ------------------------------------------------------------------------------------------- | | `SUBJECT_CAP` | 250 | 2000 | | cap で他のファイルが外れるとき,全 subject がキャッシュ済みのファイル | judge から外れ,キャッシュ済み finding が消える | 費用 0 として必ず渡し,finding を報告する | | 1 ファイルも cap に入らず,一部がキャッシュ済み | 選択が空になり差分全体を送る(cap 超過) | 何も送らない(`0/N subjects` と報告) | | ADR-0021 の実行時間の記述 | 「A run has 60 seconds」 | Stop 内で最大 90 s(検証の使用分を差し引く),子プロセスごとに最大 60 s(planning は 20 s) | ## 検証 - [x] `uv run pytest`(全体): 6134 passed, 2 skipped(origin/main にリベース後) - [x] ruff check / ty: pass.lefthook pre-commit / commitlint: pass - [x] Red → Green: 全件キャッシュ済みファイルのテストは,実装前に「差分全体を送る」理由で失敗 - [x] Red → Green: 1 ファイルも cap に入らない場合のテストは,実装前に `op` が呼ばれて失敗 - [x] Red → Green: `test_the_subject_cap_holds_the_largest_measured_session_whole` を 988 subjects に更新すると,250 で失敗 - [x] CI: push 後の結果は下のチェック欄を参照 ## 計測(`SUBJECT_CAP` の根拠) - 条件:2026-11-18,`jev-lint` 0.7.0,model `jev-1.14.0`.#201 のマージコミット `db7226d0` を `--base 746cd48` で review.`-R agents/hooks/lint/model-rules`(#240–#244 後の全ルール,ADR ルールを含む),新規キャッシュ,concurrency は既定の 32,`op run` 経由 - 計画(dry-run): 988 subjects,60 requests,cached 0,約 $0.028 - 実測(**1 回のみ**のためばらつきは不明): real 3.41 s(user 2.70 s,sys 0.18 s),exit 0 - 記録ファイル(`--record`)との照合:送信は 60 requests で計画どおり.988 subjects すべてに回答があり(欠落 0),retried・rateLimited・splits はいずれも 0.問い合わせ区間の `wallMs` は 969 ms(リクエスト時間の合計は 20.2 s),入力 583,810 tokens,$0.0245 - 参考:同じ差分を全件キャッシュ済みで実行すると(ネットワークなし),3 回とも 0.17–0.18 s - 判断:2000 は #201 の 2 倍超を丸ごと収める.1 subject ≈ 590 tokens なので,cap いっぱいでは jev-lint の token burst(1.2M)の約 98% になり,超過分のペーシングは最大でも約 6 s.実測の 10 倍でも 90 s 予算の 70%(63 s)を大きく下回る.計測が 1 回だけなので,数値そのものではなく余裕幅で判断した <details> <summary>範囲・除外・経緯</summary> - 範囲:`agents/hooks/lib/model_rules_run.py`(`SUBJECT_CAP`,`_capped_plan`),ADR-0021 の amendment(cap と実行時間の記述),`docs/DESIGN.md` と `docs/DESIGN_ja.md`(cap の値と根拠),テスト(`test_model_rules.py`,`test_model_rules_report.py`,`test_model_rules_tiers.py`) - 取り除いたもの(ADR-0027): exit 1 を error finding の結果として読む処理,gating finding による毎 Stop ブロック,その文言・receipt・resume 項目,`test_model_rules_gate_findings.py`,ADR-0021 への gate の追記.revert コミット 676f15e で取り除き,squash 後の差分には残らない - 除外(ブリーフに従う): model rule の promote やブロック(ADR-0027),セッションごと 1 回の報告(#245/#252),ルールファイルと cutoff,他リポジトリ - キャッシュと cap: dry-run の batches は未キャッシュの subject だけを含むため,キャッシュ済み subject はもともと cap に数えられていなかった(変更不要) - batch の `file` と渡したパスの一致:実際の dry-run(#201 の差分,34 ファイル)で,全件完全一致することを確認した - #252 との関係:#252 は `model_rules_gate.py` を変更する.本 PR は同ファイルを変更しないため,競合はない - レビュー対応(rework 後の 1 回目): - P1(Claude)「gate 機能が差分にない」: 説明を差し替える前のレビューだった.gate は ADR-0027 に従って意図的に除いたもので,タイトルと本文は絞り込み済みと返信して resolve - P2(Codex)「設計書が 250 のまま」: 5891a33 で両方の設計書を 2000 と新しい根拠に更新 - P3(Claude summary,スレッドなし)「`paths` が空のレビューでは全件キャッシュ済みファイルが残らない」: `_Changes.reviews` は `sendable` が空でないときだけ `Review` を作り,常に明示的なパスを渡すため,現状では起きない(潜在のみ).修正はせず,ここに記録する - レビュー対応(rework 後の 2 回目,修正なし): P2「対象のないパスがあると `if not chosen` を通らず,対象のないファイルだけで `op run` が起動する.`judged` にもスキップ分のキャッシュが混ざる」.dry-run だけでは対象のないファイルと全件キャッシュ済みのファイルを区別できず,後者のキャッシュ済み finding を報告するにはその起動が必要.新たな問い合わせは 0 で,誤った finding も出ない.件数表示のずれは以前からのもので advisory に限られるため,ブリーフの基準に従い返信・resolve・記録にとどめた(Limits) - 前回レビューの P3「never paced に余裕がない」は,コメントと ADR の表現を「最大約 6 s のペーシング」に直して解消した </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>
概要
Jev(model rules)を「止める規則へ昇格させる」方針をやめ,常に advisory とする.止める必要がある規則は ast-grep など決定的な検査に移す.ADR-0021 の昇格の決定だけを新しい ADR-0027 で置き換える.
Closes #249
Refs #169
変更
docs/adr/0027_...mdを追加(MADR,status accepted,supersedes: [ADR-0021])partly-superseded-by: [ADR-0027]を追加(本文は変更なし)docs/DESIGN_ja.mdをdocs/DESIGN.mdに合わせたdocs/DESIGN.mdの "Model Rules at Stop" から昇格の記述を除き,ADR-0027 を参照決定
severity: errorは使わないAGENTS.md,style skill)は残す.昇格が無く,削除の契機がないため.静的検査や既存 linter に置き換えた規則の prose は ADR-0021 のとおり削除する範囲外(brief による)
hook のコード(#245,#246),規則ファイルと cutoff(規則ファイルのコメントにある "promoted" の文言を含む),ast-grep 規則(#248).#246 の「昇格した規則で Stop を block する」部分はこの決定で不要になる.
テスト
adr-check --base origin/main docs/adrが通る.レビュー指摘の扱い
docs/DESIGN_ja.mdが昇格まで prose を残すと書いたまま): 修正済み🤖 Generated with Claude Code