Skip to content

feat(lint): fit the Go model rules on eval fixtures - #244

Merged
furedea merged 5 commits into
mainfrom
feat/fit-jev-rules-go
Nov 18, 2026
Merged

furedea merged 5 commits into
mainfrom
feat/fit-jev-rules-go

Conversation

@furedea-agent

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

Copy link
Copy Markdown
Contributor

Go の jev-lint 規則 13 件すべてに fixtures と baseline をそろえ,仮の閾値 0.5 を fitted midpoint に置き換えた.クラスが分かれなかった 3 規則は ask / criteria を書き直して再評価した.brief の追記に従い,昇格(severity: error)と go-style の文章削除はこの PR では行わず,候補を下に挙げる.

規則ごとの結果

eval は 3 passes.tp / fp / fn は fitted midpoint での値.

規則 fixtures (bad / clean) 閾値 最高の clean 最低の bad tp / fp / fn 備考
channel-closed-by-sender 4 / 4 0.52 0.30 0.73 4 / 0 / 0
command-query-naming 4 / 8 0.63 0.31 0.95 4 / 0 / 0 blind,inconclusive:
construction-separate-from-execution 2 / 3 0.6 0.24 0.95 2 / 0 / 0 criteria を書き直した
error-handled-once 4 / 3 0.37 0.06 0.67 4 / 0 / 0 レビューで再試行のケースを bad に付け直した,blind
error-message-names-operation 6 / 4 0.48 0.28 0.67 6 / 0 / 0 blind,inconclusive:
function-single-purpose 2 / 4 0.46 0.19 0.73 2 / 0 / 0 blind,inconclusive:
goroutine-has-termination-path 3 / 4 0.68 0.49 0.87 3 / 0 / 0 0.5 では clean が 0.02 差で揺れていた
known-defect-marker-names-removal 8 / 10 0.56 0.33 0.79 8 / 0 / 0 blind,inconclusive:
main-is-thin 2 / 3 0.54 0.18 0.89 2 / 0 / 0
no-comment-restating-code 3 / 4 0.54 0.12 0.97 3 / 0 / 0 blind,inconclusive:
no-exposed-mutable-collection 3 / 3 0.57 0.22 0.92 3 / 0 / 0 criteria を書き直した,blind
no-reaching-through-collaborators 3 / 3 0.5 0.16 0.83 3 / 0 / 0 criteria を書き直した,blind
panic-only-for-programmer-errors 4 / 4 0.68 0.44 0.91 4 / 0 / 0

閾値の根拠(最高の clean・最低の bad とそのケース)は各 rule.yml 先頭のコメントに書いた.

criteria を書き直した 3 規則(matcher は広いまま変えていない)

規則 書き直す前 書き直した内容 書き直した後
construction-separate-from-execution composition root を 0.93 で違反と判定(最低の bad は 0.95) 構築した協力者を 1 つの呼び出しに渡すだけの composition root を除外し,違反を同じ本体での業務ロジックに限定 clean 0.24,bad 0.95
no-exposed-mutable-collection JSON レコードの公開フィールドを 0.84(最低の bad は 0.87) 型がメソッドの裏に隠す非公開フィールドに限定し,DTO と直前に作った値を除外 clean 0.22,bad 0.92
no-reaching-through-collaborators 分離しない(clean は最大 0.72,bad は最小 0.58) 協力者を 2 つ以上たどって振る舞いを呼ぶ場合に限定し,自身の状態・値型・レコードを除外 clean 0.16,bad 0.83

昇格の候補(この PR では昇格しない)

ADR-0021 の条件は「conforming の例とリポジトリ自身のファイルで誤検出が無いこと」.13 規則とも fixtures での誤検出は 0 だが,このリポジトリに fixtures 以外の Go コードは無いため,後半の条件は確かめられていない.

規則 昇格したら消せる文章
channel-closed-by-sender agents/skills/go-style/references/concurrency.md:6 「The sender closes a channel, never the receiver; ...」
goroutine-has-termination-path concurrency.md:3 「Give every goroutine a defined owner and a termination path ...」
error-message-names-operation errors.md:3 「Wrap with the operation and subject ...」
error-handled-once errors.md:5 「Do not log and return the same error ...」
panic-only-for-programmer-errors errors.md:7 「Use panic only for programmer errors ...」
main-is-thin tooling.md:18 「Keep main thin ...」
known-defect-marker-names-removal go-style には該当する文章が無い(出典は python-style の xfail の文)

次の規則は全言語共通の agents/AGENTS.md の文から来ている.他言語のレーンもすべて昇格したときに,親セッションが消すかどうかを判断する.

規則 agents/AGENTS.md の文
command-query-naming 「Name one concept with one word; name command functions for their side effects and query functions for the value they return.」の後半
construction-separate-from-execution 「Separate object creation/configuration from execution logic.」
function-single-purpose 「Keep functions single-purpose at one abstraction level, with short variable lifetimes.」の前半
no-comment-restating-code 「Minimize comments and docstrings; ...」
no-exposed-mutable-collection 「Prefer Collection Objects ...; do not expose mutable raw collections」の後半
no-reaching-through-collaborators 「Prefer DRY, YAGNI, and Law of Demeter.」の Law of Demeter

検証

  • jev-lint eval --replay agents/hooks/lint/model-rules/go:13 suite すべて誤検出・見逃し 0,警告なし
  • jev-lint eval --dry-run:13 suite の subject 数とラベル数が一致.ラベルの行と ast-grep の matcher の行も全規則で照合済み
  • ast-grep scan --config agents/hooks/lint/sgconfig.yml(CI と同じ共有規則)を fixtures に実行:0 件.go_use_slog と go_mutex_field_documented に当たる書き方を判定内容を変えずに直した
  • uv run pytest(nix develop 内):6120 passed,2 skipped(レビュー対応後は tests/test_model_rule_files.py を再実行し 14 passed)
  • CI:all-green を含む全 check が pass(レビュー対応前の push)
  • pre-commit(ls-lint,commitlint ほか)通過

費用と Stop あたりの subject 数

測定 subject requests / calls 費用
1 回目の eval --accept(13 suite,3 passes) 105 × 3 87 calls 約 0.0062 USD
2 回目の eval --accept(書き直した 3 suite) 17 × 3 18 calls 約 0.0012 USD
このブランチの差分を Stop の review として dry-run(Go 規則,--base origin/main) 212 31 requests 約 0.0043 USD
  • Stop の測定対象は,新しい Go のファイル 21 件と関数約 75 個.変更した関数 1 個あたり約 2.8 subject なので,上限 250 は 1 回の Stop で約 88 関数の変更に当たる.
  • このブランチは,1 回の Stop としてはかなり大きな Go の変更.それでも上限と 90 秒の予算に収まるので,Go については 250 は妥当.
  • 測定はこのブランチ 1 件だけ(実際の Go プロジェクトのセッションは測っていない).

レビュー対応

指摘 対応
suite テストが glob した expect.yml と自分自身を比べており,suite の無い Go 規則を検出できない(claude-review,P2) 期待する集合を言語ごとに固定(Go は全規則,Rust は最初の 3 規則).expect.yml を退避すると失敗することを確認
error-handled-once の Retry は最後のエラーをログに書いて返すので違反なのに clean と付けており,閾値を 0.85 まで押し上げている(codex-review,P2) bad に付け直し,replay で閾値を 0.37 に当てはめ直した(追加のリクエストなし)

Limits

  • blind の 8 規則は,境界のケースが無いため劣化を検出できない.fixtures は各規則 5〜18 件と少なく,較正とは言えない.
  • 昇格の条件のうち「リポジトリ自身のファイルで誤検出が無い」は,このリポジトリに Go のコードが無いため確かめていない.
範囲と前提
  • 範囲:agents/hooks/lint/model-rules/go/,および tests/test_model_rule_files.py(Go の全規則に suite を必須にし,package main を分けるための violating_<case>.go という fixture 名を許した)
  • 範囲外:昇格,agents/AGENTS.md と go-style の文章の削除,hook のコード,jev-lint 本体,他言語の規則
  • fix(lint): address review findings deferred from the #74 migration PRs #196 の jev-lint verification notes に Go の項目は無かった
  • モデルの呼び出しは,ユーザーが自分の端末で eval --accept を 2 回実行した(鍵はエージェントのセッションに渡していない)

Refs #220

🤖 Generated with Claude Code

furedea and others added 3 commits November 18, 2026 15:38
Ten Go jev-lint rules had no fixtures, so their cutoff could not be
measured. Each now has violating and conforming examples, including
boundary cases that look like a violation but conform, and an
expect.yml whose labelled lines match the rule's subjects.

Refs #220

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Go rules ran at the provisional 0.5. Each now uses jev-lint's fitted
midpoint from its accepted eval baseline, with the scores behind it in a
comment. Suites whose fixtures sit far from the cutoff on both sides
declare `inconclusive:`, as replay asks. All rules stay advisory.

The suite test now expects a suite for every rule that has fixtures, and
allows a `_<case>` suffix on fixture names for Go `package main` files.

Refs #220

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… separate

construction-separate-from-execution scored a composition root as a
violation, no-exposed-mutable-collection scored an exported field of a
JSON record as one, and no-reaching-through-collaborators did not
separate its classes at all. The criteria now exclude a composition
root, a plain data struct, and chains over the receiver's own state or
value types. After a new eval every class separates, and each rule uses
its fitted midpoint. The matchers are unchanged.

Refs #220

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@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-18T07:02:04.347093Z f8f3ee6 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.

Comment thread tests/test_model_rule_files.py Resolved
@github-actions

Copy link
Copy Markdown

Review summary (read-only; jev-lint is not installed in this environment, so I did not run eval --replay or the pytest suite).

Checked

  • The fixture line numbers in expect.yml for channel-closed-by-sender, main-is-thin, panic-only-for-programmer-errors, goroutine-has-termination-path and error-handled-once point at the intended close, panic and func main lines. I did not check the other eight rules.
  • Each threshold equals the midpoint of the highest clean and lowest bad scores quoted in the PR table. I checked all 13.
  • The rule.yml changes are limited to threshold, comments, criteria and ask text. I saw no matcher changes, so the selection counts in test_go_rules_select_the_functions_they_ask_about should be unaffected.

Findings

  • P2 tests/test_model_rule_files.py:223: the eval-suite test now derives the expected rule set from the expect.yml files on disk, so it no longer catches a rule that has no suite.

Non-blocking notes (no inline comment, since they are judgment calls)

  • error-handled-once has only a 0.12 margin on each side at threshold 0.85. Fixture sets are small (2–4 bad cases), and three criteria were rewritten after the fixtures were scored. The thresholds are fitted to the same fixtures they are judged on. The inconclusive blind suites mean --replay will not flag drift for those rules.
  • The rewritten no-exposed-mutable-collection criteria now exempt exported fields of plain data structs. That narrows what the rule flags. It is advisory, so I judged it acceptable.

No P0 or P1 issues found.

@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: 006d693d44

ℹ️ 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 2 commits November 18, 2026 15:57
The suite test compared the suites with the expect.yml files it had just
globbed, so a Go rule without a suite failed nothing. Every Go rule must
now ship one; Rust keeps its first three until its rules get suites.

Refs #220

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The retry fixture logs its last attempt's error and returns it wrapped,
which is what error-handled-once reports, yet it was labelled clean and
pushed the fitted cutoff up to 0.85. Labelled bad, the classes separate
at 0.37; the baseline is re-scored by replay without new requests.

Refs #220

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@furedea

furedea commented Nov 18, 2026

Copy link
Copy Markdown
Owner

@codex review

@github-actions

Copy link
Copy Markdown

Review summary: I found no correctness, security or test-coverage problems worth blocking on.

What I checked:

  • tests/test_model_rule_files.py: the fixture-kind check (removesuffix("_test").split("_")[0]) accepts violating_<case>.go and conforming_<case>.go. The Go suite check now derives the expected rule ids from */rule.yml, so all 13 Go rules must ship both fixture kinds.
  • main-is-thin and construction-separate-from-execution: every line in expect.yml points at the intended func line in its fixture.
  • The PR description reports a clean eval --replay, a matching --dry-run and a passing pytest run. I did not re-run them.

Not verified: the baseline.json scores come from model calls, so I can't reproduce them without a key. The PR already notes that the blind rules and error-handled-once (margin 0.12) are weak, so I'm not raising that again.

No inline comments.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: f8f3ee6dc7

ℹ️ 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 cf87c36 into main Nov 18, 2026
29 checks passed
@furedea
furedea deleted the feat/fit-jev-rules-go branch November 18, 2026 08:06
furedea-agent Bot pushed a commit that referenced this pull request Nov 19, 2026
… run

With the rules fitted in #240-#244, #201 alone plans 988 subjects, far
over the cap of 250. One uncached run of that diff sent all 60 planned
requests, answered every subject and took 3.41 s through op (0.97 s of
asking) for 0.025 USD, so 2000 holds twice it within the 90 s budget
and jev-lint's token burst. The ADR now also states the run's real time
limits: 90 s of the Stop and 60 s per child.

Refs #220

Co-Authored-By: Claude Opus 5.5 <[email protected]>
furedea added a commit that referenced this pull request Nov 19, 2026
## 概要

#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 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
furedea added a commit that referenced this pull request Nov 19, 2026
…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 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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 の Go の項目を origin/main で確かめ,残っていた Go
のモデル規則(jev-lint,助言)の見逃しを直し,ユーザー決定(2026-11-19)に従って go-style の
`t.Parallel()` の文を戻した.Jev 規則は昇格しない(ADR-0027).

Refs #196

## 項目ごとの状態

| 出典 | 項目 | 状態 |
| --- | --- | --- |
| #190 | `go_sealed_interface_sumtype_decl`:`// sumtype:decl` を受け入れる |
対応済み(obsolete.規則は #216 の時点で削除済み) |
| #190 | `go_error_no_capitalized_message`:import path・シャドー |
対応済み(obsolete.同上) |
| #190 | `go_context_param_named_ctx` / `go_no_context_in_struct`:import
path | 対応済み(#216.標準 `context` を別名なしで import したファイルに限定) |
| #190 | `go_use_slog`:import path,引数・receiver・名前付き戻り値のシャドー | 対応済み(#216)
|
| #190 | `go_use_slog`:ローカル変数のシャドー | 対応済み(#216 で規則の `Limits:`
に記録.スコープ解析が要る) |
| #190 | `go_iota_enum_typed`:`iota + 1` などの式 | 対応済み(#216 で `Limits:`
に記録.構文では enum と区別できない) |
| #190 | `go_no_generated_mocks`:`//go:generate` 経由,`// Code generated
by` ヘッダー | 対応済み(#216) |
| #190 | `go_no_context_in_struct`:`*context.Context` | 対応済み(#216) |
| #190 |
`error-handled-once`:`slog.Default().Error(...)`,`log.Default().Printf(...)`
| **修正** |
| #190 | `error-handled-once`:receiver 名が `log` / `logger`
以外(`l`,`audit`),receiver の `Output` | **修正** |
| #190 | `error-handled-once`:入れ子のクロージャのログで親関数も選ばれる |
**修正**(ログ呼び出しに最も近い関数だけを選ぶ) |
| #190 | `severity: error` を hook のブロックに結びつける |
対応済み(`static_rule_scan.py` が severity error を error として扱う) |
| #190 | model rule 5 件の fixtures・eval・baseline | 対応済み(#244 で Go の 13
規則を当てはめ) |
| #191 | Go `construction-separate-from-execution`:`client.New(...)` |
**修正**(`errors` / `uuid` / hash / container などの標準の `New` は除く) |
| #191 | Go `no-exposed-mutable-collection`:複数戻り値 `([]string, error)` |
**修正** |
| #191 | Go `no-exposed-mutable-collection`:名前付きの slice / map 型 |
**修正**(同じファイルで宣言した型に限る.別ファイルの型は Limits) |
| #191 | selector が広く Go の getter も選ぶ | 変更なし(#196 の方針でモデル規則の matcher
は広く取り,criteria で判定する) |
| #191 | Go `no-comment-restating-code`:関数直前の doc comment | misc レーン(4
言語まとめて直す「コメントの位置」の項目) |
| #191 | Go `no-reaching-through-collaborators`:プロパティ連鎖 | misc レーン(4
言語まとめて直す Demeter の項目) |
| #190 | go-style の `t.Parallel()` の文 | **修正**(ユーザー決定により文を戻した) |
| #216 | ローカルで失敗する
`test_go_rules_select_the_functions_they_ask_about`,`test_main_is_thin_selects_func_main_of_package_main`
| 対応済み(origin/main で通る) |
| #194 | `test_main_is_thin_selects_...` が `command-query-naming` に指摘される
| 対象外(Python の規則の判定.py レーン) |

## Limits(レビューで記録したもの)

matcher を直すと baseline がまた無効になり,この PR では eval を再実行しない(ユーザーの指示)ため,規則ファイルの
`Limits:` に記録した(6de1d32d).

-
`error-handled-once`:ログに似た呼び出しも選ぶ(`http.Error`,`cmd.Output()`,`c.Error(err)`,`s.t.Fatal(...)`).自分で実行するクロージャ内のログ(`defer
func() { log.Error(err) }()`)は親関数を選ばない.引数付きで派生したロガー(`slog.With("k",
v).Error(...)`,logrus の
`log.WithError(err).Error(...)`)を見逃す(**見逃し**.後続).
-
`construction-separate-from-execution`:`log.New`,`slog.New`,`zap.New`,メソッドの
`tmpl.New("x")` も選ぶ.
- `no-exposed-mutable-collection`:`(Items, error)` や名前付きの `(items
Items)` など括弧で書いた結果リスト内の名前付き型と,別ファイルで宣言した型を見逃す(**見逃し**.次に eval
を回すときに直す後続).`*[]T`,`chan []byte`,`func() []string` も選ぶ.

## 判断が要るもの

- go-style の文の扱い:#190 は template-go の golangci-lint が覆う文を `t.Parallel()`
以外にも削除した(`testifylint` の `require` / `assert`,`usetesting` の
`t.TempDir()` / `t.Setenv()` など).ユーザー決定の方針(template でしか有効でない linter
の規則は文を残す)をこれらにも当てはめて戻すかを決めてほしい.この PR では明示された `t.Parallel()` だけを戻した.

## 検証

- `uv run pytest tests/test_model_rule_files.py`:選択のテスト 3
件を先に足して失敗を確認し,matcher の修正後に通った.
- `uv run pytest tests/test_model_rule_files.py`:17 件通過(baseline の
replay を含む).
- `jev-lint eval --accept -r 3`(ユーザーが 2026-11-19 に実行):3 規則とも fp / fn
0.閾値を fitted midpoint に合わせた.`error-handled-once` 0.37 → 0.41(最高の clean
0.06,最低の bad 0.75),`construction-separate-from-execution` 0.6(0.24 /
0.96),`no-exposed-mutable-collection` 0.57 → 0.59(0.24 /
0.93).`error-handled-once` と `no-exposed-mutable-collection` は blind のまま
`inconclusive:` を残した.
- レビュー:Codex P2(zerolog の `log.Error().Err(err).Msg(...)` の見逃し)は
a25d8c9 で修正.P1(baseline の無効化)は c27cb73 で解消.

## 計画との差

なし.

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

---------

Co-authored-by: furedea <[email protected]>
Co-authored-by: Claude Opus 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