Repository navigation
test(rules): audit shared command prefixes for conflicts and redundancy - #98
Conversation
Add the P1 check of #73. The audit reads the shared prefixes with the strictest-decision-wins model both providers share and reports conflicts, ineffective entries, and redundant entries without rewriting any rule. Refs #73 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: No findings. I checked the three detection categories against the strictest-decision-wins model:
The unit tests cover each category in both directions (it fires, and it does not fire). Note: I couldn't run the tests in this environment, so this review is based on reading the code. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8fbea7eabb
ℹ️ 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".
| from tests.runtime import REPO_ROOT | ||
|
|
||
|
|
||
| RULES = json.loads((REPO_ROOT / "agents/command_permissions.json").read_text())["rules"] |
There was a problem hiding this comment.
Register the audit with related-test selection
When agents/command_permissions.json changes, the repository's changed-file verification is driven by .agents/hooks/rules/related_test_extensions.json; I checked the resulting selection plan, and it runs nine existing tests but not tests/test_prefix_rules.py. Consequently, the normal targeted verification skips all three assertions introduced here, allowing a conflicting or ineffective prefix to pass locally until the full CI suite runs. Add this test to that mapping and update its mapping expectation.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
修正しました(e1134be).agents/command_permissions.json の関連テストに tests/test_prefix_rules.py を追加し,tests/prefix_audit.py から両テストへの対応も登録しました.tests/test_related_test_extensions.py に対応の期待値を追加しています.
Register tests/test_prefix_rules.py as a related test of agents/command_permissions.json, and map the audit helper to its tests, so targeted verification no longer skips the P1 check. Refs #73 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
|
レビュー結果:指摘なし.
P0/P1: 0 件 |
|
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". |
…ns (#100) ## 概要 #73 の P4(guard が対応を謳う変形で禁止が効くこと)を Hypothesis で追加する.`Refs #73`.#98(P1)のマージ後に main へ付け替えた.#102・#104 がこの PR の上に積まれている(マージ順は #100 → #102 → #104). - 実ポリシーの deny prefix 130 件が,変形後も `forbidden` で deny になることを検査する(shell 系 5 件は `bash -c true` のように script を付けた代表形). - ask prefix は wrapper や script の内側で `allowed` が ask になり,直接なら allow(provider の判定)のままであることを検査する. - 変形は,クォート(単・二重・なし),`/usr/bin/` 付きパス,wrapper 10 種,`bash`・`sh`・`zsh` の `-c`,シェル組み込みの実行,先頭の `!` を最大 3 層まで組み合わせる. - `hypothesis` と `z3-solver` を test グループに追加した(`z3-solver` は P2・P3 用). | 検査 | 内容 | | ------------ | --------------------------------------------------------------------------- | | deny 性質 | 全変形で deny | | ask 性質 | 層があれば ask,なければ allow | | 壊したルール | deny / ask prefix を全部消したポリシーで各性質が赤になることを確認する 2 件 | ## 検証 - [x] `tests/hooks/test_guard_transformations.py` 183 件 pass(deny 125 件・ask 48 件を個別に,1 prefix あたり 12 例,`derandomize=True` で再現可能.prefix を 1 件だけ消したポリシーで赤になるテスト 10 件を含む) - [x] 関連テスト選択への登録と期待値の更新 - [x] ruff check / format,ty ## 発見と判断 - `bash -c`,`bash -lc`,`sh -c`,`zsh -c`,`zsh -lc` は deny prefix だが,script がない素の形では guard が先に ask を返す.deny にはならないが,安全側で止まる.script を付けた代表形で検査している. - 5 件以外に,素の形・変形のどちらでも #87 の抜け道によって落ちるものは見つからなかったため,`xfail` は使っていない.guard 本体は変更していない. - 依存は `uv add` が `>=` で入れた.repo の他の test 依存は `==` 固定のため,`==` に揃えるなら `uv lock` の再実行が必要(ユーザー作業). 計画:#73 (comment) 未対応のレビュー指摘(`sudo` と shell 層で deny 性質が自明に通る件):#107 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
概要
#73 の P1(prefix の全列挙検査)を追加する.P4・P2・P3 は依存追加待ちのため別 PR とし,本 PR は
Refs #73.現行の 456 件(allow 278 / ask 48 / deny 130)では conflict と ineffective は 0 件.redundant は Issue が予告した 7 組(
cargo fmt --checkなど).検証
tests/test_prefix_audit.py)tests/test_prefix_rules.py)計画との差
なし.計画:#73 (comment)
残り
uv add --group test hypothesisがユーザー実行待ちuv add --group test z3-solverがユーザー実行待ち🤖 Generated with Claude Code