Repository navigation
feat(lint): judge ADR rationale with Jev - #228
Conversation
Add the advisory rules adr-states-why and adr-options-are-real-alternatives with fixtures built from existing ADRs and synthetic defects, review them apart from the other rules, and give them only the ADRs under docs/adr/ that are new or whose body changed. The cutoffs are not fitted yet. Refs #169, Closes #227 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@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 (read-only, static; I couldn't run
The rest looks right:
The new tests cover selection and the committed ADR review. The uncommitted ADR review branch in 🤖 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: d0b78b5080
ℹ️ 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".
Add baseline.json for adr-states-why and adr-options-are-real-alternatives, keep the cutoff at 0.5, and declare the corpus blind in each rule.
|
@codex review |
Review summary (read-only)No blocking findings (P0/P1: 0).
Checked and found fine: ADR rules are left out of both tiers and are reviewed last, so the general rules keep their claim on the subject cap and I could not run the tests in this environment (command approval was denied). 🤖 Generated with Claude Code |
|
Codex Review: Didn't find any major issues. 🎉 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". |
The committed review judges base...HEAD, so an ADR's body must be compared between those revisions; the working tree belongs to the uncommitted review.
|
@codex review |
|
Automated review (read-only): no findings. What I checked:
I couldn't run the test suite in this environment, so this is based on reading the code only. 🤖 Generated with Claude Code |
|
Codex Review: Didn't find any major issues. What shall we delve into next? 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". |
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
|
@codex review |
Review summaryNo blocking findings (P0/P1: 0). What I checked:
Minor observations, not worth inline comments: a renamed ADR ( |
|
Codex Review: Didn't find any major issues. Swish! 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.2.0](v0.1.4...v0.2.0) (2026-11-18) ### Features * add adr-check command for MADR ADRs ([#225](#225)) ([138c542](138c542)) * **adr:** adopt the shared ADR checks ([#226](#226)) ([5c94a78](5c94a78)) * **hooks:** block edits on static rule errors and guard ast-grep-ignore ([#203](#203)) ([f5b3317](f5b3317)) * **hooks:** judge gh calls by effect through a policy table ([#201](#201)) ([db7226d](db7226d)) * **hooks:** keep ask prefixes only for widening authority and promotion ([#199](#199)) ([c3985f6](c3985f6)) * **hooks:** migrate TypeScript style rules to ast-grep and jev-lint checks ([#195](#195)) ([24d1a3e](24d1a3e)) * **lint:** flag Go packages under util and common with an error rule ([#202](#202)) ([de25e1d](de25e1d)) * **lint:** judge ADR rationale with Jev ([#228](#228)) ([cf1c0a3](cf1c0a3)) * **lint:** migrate agents/AGENTS.md rules to model rules and linters ([#191](#191)) ([9e3e37d](9e3e37d)) * **lint:** migrate bash-style and github-actions-style rules to checks ([#194](#194)) ([4e473ba](4e473ba)) * **lint:** migrate go-style rules to ast-grep and jev-lint rules ([#190](#190)) ([296ad84](296ad84)) * **lint:** migrate rust-style prose rules to checks ([#193](#193)) ([e184682](e184682)) ### Bug Fixes * **ci:** run the jev-lint model-rule tests in CI ([#218](#218)) ([1919b06](1919b06)) * **deps:** pin dependencies ([#221](#221)) ([5d083e4](5d083e4)) * **hooks:** deny git options that skip repository hooks ([#212](#212)) ([e10e5b6](e10e5b6)) * **hooks:** judge a cell turned into code from scratch and ignore attribute reasons ([#224](#224)) ([96fb561](96fb561)) * **lint:** close blocking ast-grep rule gaps recorded in [#196](#196) ([#216](#216)) ([fa31947](fa31947)) * **skills:** drop the agent-run verify step that protected records block ([#213](#213)) ([700244d](700244d)) --- 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>
## 概要 bash 6・yaml 4 の jev-lint 規則に fixtures と `expect.yml` を加え,`jev-lint eval` で測った fitted midpoint を cutoff にする.分離しなかった規則は ask / criteria を書き直した.昇格は無し(全規則 advisory のまま,skill の文も残す).判断してほしいのは下の「昇格しない理由」. ## 結果(3 passes,中央値) | 規則 | fixtures | tp / fp / fn | 最高の clean | 最低の bad | cutoff | 備考 | | --- | --- | --- | --- | --- | --- | --- | | `bash/strict-mode-header` | bad 4・clean 4 | 4 / 0 / 0 | 0.15 | 0.97 | 0.56 | blind(`inconclusive:`) | | `bash/usage-help-and-error-exits` | bad 4・clean 5 | 4 / 0 / 0 | 0.42 | 0.84 | 0.64 | | | `bash/function-variables-local-near-use` | bad 4・clean 5 | 4 / 0 / 0 | 0.18 | 0.80 | 0.49 | 書き直し・`located`・blind | | `bash/script-constants-readonly` | bad 3・clean 4 | 3 / 0 / 0 | 0.04 | 0.96 | 0.5 | 書き直し・`located`・blind | | `bash/working-directory-by-responsibility` | bad 3・clean 6 | 3 / 0 / 0 | 0.10 | 0.33 | 0.23 | 書き直し | | `bash/tracing-not-left-on-for-secrets` | bad 4・clean 6 | 3 / 0 / 1 | 0.17 | 0.13 | 0.5 | **分離しない**,Limit を記録 | | `yaml/cache-key-and-trust` | bad 4・clean 5 | 4 / 0 / 0 | 0.20 | 0.94 | 0.57 | blind | | `yaml/job-permissions-least-privilege` | bad 3・clean 5 | 3 / 0 / 0 | 0.36 | 0.92 | 0.64 | blind | | `yaml/workflow-concurrency` | bad 4・clean 4 | 4 / 0 / 0 | 0.03 | 0.76 | 0.4 | blind | | `yaml/workflow-default-shell` | bad 4・clean 5 | 4 / 0 / 0 | 0.35 | 0.87 | 0.62 | 書き直し・blind | 書き直しの内容(最初の eval で分離しなかったもの): | 規則 | 最初の eval | 原因と変更 | | --- | --- | --- | | `script-constants-readonly` | clean 4 件すべて 0.69〜0.77 | `state: local` では代入より後の行が見えない → `located`,criteria で「ファイル全体で名前を探す」と明記 | | `function-variables-local-near-use` | 文書化された出力変数を誤検出,`for` の変数を見逃し | 関数上のコメントが見えない → `located`,`for`・`read` 等の名前も個別に `local` が要ると明記 | | `workflow-default-shell` | `shell: sh` 等の bad 3 件を見逃し | ask が「shell が未設定」しか問うていなかった → 実効 shell を求めて pipefail の有無を問う | | `tracing-not-left-on-for-secrets` | 後で再び有効化するファイルの最初の `set -x` を誤検出 | 判定範囲を「この `set -x` から次の `set +x` まで」に限定 → 誤検出は消えたが,再有効化側の見逃しが残った | | `working-directory-by-responsibility` | `popd` の無い `pushd` を 0.23 で見逃し | criteria に明記 → 0.33 に上がったが余白は小さい | ## 昇格しない理由 - fixtures は各 7〜10 件で,ADR-0021 の「より大きな corpus で fit してから昇格」に届かない. - 今の Stop hook は `jev-lint review --fail-on error` の非 0 終了を「実行失敗」の通知として扱う(`model_rules_run.py` の `_Child.run`).`severity: error` にすると finding が block されず `exited with status 1` の notice になるので,昇格には hook 側の対応が先に要る. - したがって `bash-style` / `github-actions-style` の文は消していない.AGENTS.md から消せる文も無い. ## 検証 - [x] `jev-lint eval --accept`(ユーザー実行,2 回):上表のとおり.`tracing-not-left-on-for-secrets` 以外は全 fixture を正しく判定 - [x] `jev-lint eval --replay agents/hooks/lint/model-rules`:22 suite すべて as shipped - [x] `REQUIRE_JEV_LINT=1 uv run pytest tests/test_model_rule_files.py`:14 passed - [x] 各 `expect.yml` の行が matcher の subject 行と一致することを ast-grep で確認 - [x] lefthook(shfmt・shellcheck・ls-lint・commitlint)通過 ## 費用と subject 数 - eval:記録済み baseline の合計 $0.0078,上書きした最初の 5 suite の分(dry-run 見積もり約 $0.0027)を含め約 $0.011. - Stop 1 回の最悪ケース(このグループの規則を対象ファイル 32 件すべてに当てた `jev-lint check --dry-run -c none`):151 subjects,34 requests,約 $0.0057.上限 250 に収まる(内訳:`function-variables-local-near-use` 46,ADR 規則 各 26,`workflow-default-shell` 19).`located` への変更で bash 2 規則の 1 subject あたりの token は増える(dry-run で eval 1 回あたり +$0.0003 程度). <details><summary>範囲・前提・Limits</summary> - shell の fixtures は `.bash`:CI の shellcheck / shfmt は `*.sh` だけを対象にするため,意図した違反で CI が落ちない.jev-lint は `.bash` も Bash として選ぶ. - markdown の 2 規則は #228 で fit 済みのため変更なし.#196 の verification notes に bash / yaml / markdown 向けの項目は無い. - Limit:`tracing-not-left-on-for-secrets` は `set +x` の後で再び `set -x` を有効にしてから秘密を展開する場合を見逃す(0.13). - Limit:`working-directory-by-responsibility` の cutoff 0.23 は clean の最高 0.10 との余白が小さい. - Limit(レビュー指摘):`tracing-not-left-on-for-secrets` の matcher(`-[a-zA-Z]*x\b`)は `set -xe`・`set -euxo pipefail` を subject にしない.`-[a-zA-Z]*x[a-zA-Z]*` に広げると全 spelling を選ぶことを確認したが,matcher の変更は baseline を無効にし新しい eval が要るため,この PR では変えない.次の eval と同時に matcher を広げ,`set -euxo pipefail` の bad fixture を足す. - Limit(レビュー指摘):`model_rules_gate.rule_tiers()` は baseline の有無だけで tuned tier を決めるので,分離しない `tracing-not-left-on-for-secrets` も subject 上限を先に使う.baseline を外すと replay テストが落ちるため残す.全レーンの後はほぼ全規則が baseline を持ち tier の差は小さくなるが,tier の基準(分離したかどうか)は hook 側の課題. - Limit(レビュー指摘):`script-constants-readonly` は同じ変数をトップレベルで複数回代入するスクリプトで,最後の代入を定数違反と誤検出し得る(criteria が後続の変更しか見ない).criteria の変更も新しい eval が要るため,余分な指摘として記録だけする. - `docs/DESIGN.md` の「Five cutoffs are fitted ...」の文は他レーンと共有の記述なので触っていない.全レーン終了後に親で更新が要る. - jev-lint 本体,hook,他言語の規則は範囲外. </details> 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]>
概要
ADR の書き方の質を Jev で判定する advisory ルールを 2 つ追加し,Stop hook がそれらに渡す ADR を「新規または本文が変わったもの」に限る.
変更
agents/hooks/lint/model-rules/markdown/adr-states-why/とadr-options-are-real-alternatives/(rule.yml・fixtures/・expect.yml).subject は文書全体で,cutoff は開始値 0.5 のまま.model_rules_files.select()がsinceを受け取り,docs/adr/[0-9]*.mdのうち新規または front matter を除いた本文が変わったものをSelection.adrsに入れる.front matter だけの変更と ADR 以外の Markdown は入らない.model_rules_gate:adr-*のルールはrule_tiersから外し,Selection.adrsだけを渡す review を最後に追加する(jev-lint はTextルールをパスで絞れないため hook 側で絞る).docs/DESIGN.mdに説明を追加.agents/skills/adr/SKILL.mdは変更しない(promote 時に削除,ADR-0021).tests/hooks/test_model_rules_adrs.py,tests/test_model_rule_files.pyに--dry-runの 1 件.cutoff の fit
jev-lint eval --accept(3 passes,約 0.0024 USD)の結果.cutoff は既存ルールの慣例(fixtures が広い余白で分かれるなら 0.5 のまま,例:error-message-names-operation)に従い 0.5 を保つ.adr-states-whyadr-options-are-real-alternativesfixtures は 9〜10 件と少なく較正とは言えないため,ルールは advisory のままで,
adrskill の文も残す.replay は「境界の fixture が無く劣化を検出できない(blind)」と判定したので,各rule.ymlにinconclusive:で理由を宣言した.境界の fixture は今後の課題.範囲外として扱うもの
promote(blocking 化),skill の文の削除,CI での Jev 実行,ADR 以外の Markdown のルール,jev-lint 本体,他リポジトリの ADR 形式.
Closes #227
Refs #169
🤖 Generated with Claude Code