Repository navigation
Open
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "secret_boundary_guard.sh の GNU/BSD grep 間 ERE portability を改善する"
change_kind: codeParent Issue
なし(単独改善)
Parent Goal Ref
- Goal: なし(単独改善のため該当なし)
- Desired Destination: なし(単独改善のため該当なし)
Current Validated Scope
secret_boundary_guard.shの GNU/BSD grep ERE portability を改善する
Remaining Parent Gaps
なし
概要
secret_boundary_guard.sh の GNU/BSD grep 間の ERE portability を改善する。\s、\b、echo など、GNU/BSD grep または shell input の差異に弱い処理が残っている。
背景
secret_boundary_guard.sh では \s、\b、echo など、GNU/BSD grep または shell input の差異に弱い処理が残っている。
local secret leakage は GitHub branch protection では防げない local-only risk であるため、secret_boundary_guard のような local-only secret protection guard は維持する価値がある(#1782 の OWNER 敵対的レビュー、#1782 (comment) 参照)。
対象
secret_boundary_guard.sh- regex fixtures
Outcome
secret_boundary_guard.sh の GNU/BSD grep 間 ERE portability 問題(\s/\b/echo)が解消された状態。portability fixture test が追加され、全て成功する。
In Scope
portability
secret_boundary_guard.sh では最低限、次を実施する。
\sを[[:space:]]に置換\bWORD\bを portable な境界表現に置換echo "$COMMAND"をprintf '%s\n' "$COMMAND"に置換LC_ALL=Cを明示- tab、newline、separator、quoted text の fixture を追加
例:
(^|[^[:alnum:]_])WORD([^[:alnum:]_]|$)
この Issue で目標とするのは POSIX shell 全体への移植ではなく、GNU/BSD grep 間の ERE portability とする。
Out of Scope
- Bash script を POSIX
shcompatible と誤認させない - command string classifier の全面的な parser 再実装は必須としない
- Hook の並列実行 semantics 対応(documentation 修正・hookchain permutation/concurrent/negative-control/aggregate-decision test harness の追加): 元 Issue(旧 AC1〜AC8)の scope だったが、実装: CI test-lane current-state manifest と projection verifier を追加する #1782 の OWNER 敵対的レビューにより not_planned/reframe とした。理由は次の2点。(1) sibling Hook が並列実行され完了順が非決定的であること自体は Claude Code の現行公式仕様であり、リポジトリ側で恒久 test harness を新設して検証し続けるのは 導入: AIエージェント運用をminimal harnessへ縮退し、過剰なcontrol-planeを廃止する #1860 の Owner Decision(新しい enforcing checker/常設 harness を増やさない)と衝突する過剰投資である。(2) 旧 background の直列実行前提の記述(
secret → local_main → worktree)が指していたlocal_main_branch_guard/worktree_scope_guardは 調査: PreToolUse hook chain(local_main_branch_guard/worktree_scope_guard)の繰り返し誤ブロックを踏まえ無効化・縮小・現状維持の方針を決定する #1690 の Owner Decision により settings.json から既に削除されており、対象 Hook topology 自体が変わっている。今後この chain に新しい enforcing hook を追加する場合は、その Issue 自身の scope で並列 semantics 前提を明記すれば足りる。 - Hook topology 一致検証(旧 AC12、
check_hook_integrity.py): 上記と同じ理由で本 Issue のスコープ外とする。
Acceptance Criteria
- AC1:
secret_boundary_guard.shの\s、\b、echoの portability 問題が解消されている - AC2: tab、newline、quoted text を含む fixture が成功する
- AC3: Linux と BSD系 grep 相当環境で再現可能な test evidence がある
Verification Commands
# AC1
$ rg -c "echo .\$COMMAND." .claude/hooks/secret_boundary_guard.sh
# AC2
$ uv run --locked python3 -m pytest .claude/hooks/tests/test_secret_boundary_portability_fixtures.py
# AC3
$ rg -c "LC_ALL=C" .claude/hooks/secret_boundary_guard.shAllowed Paths
- .claude/hooks/secret_boundary_guard.sh
- .claude/hooks/tests/test_secret_boundary_contract.py
- .claude/hooks/tests/test_secret_boundary_multiedit.py
- .claude/hooks/tests/test_secret_boundary_portability_fixtures.py
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
なし
Required Design References
- docs/dev/hook-boundaries.md
Scope Delta(該当時のみ記載)
N/A
Delivery Rule
1 Issue = 1 PR を原則とする。worktree で作業し、Draft PR を既定とする。
Notes for Reviewer
- 2026-08-12、実装: CI test-lane current-state manifest と projection verifier を追加する #1782 の OWNER 敵対的レビュー(https://github.com/squne121/loop-protocol/issues/1782#issuecomment-5266277591)を反映し、本 Issue を reframe/split した。旧 scope のうち Hook 並列実行 semantics 対応(documentation・test harness、旧 AC1〜AC8・AC12)は Out of Scope に移動し、
secret_boundary_guard.shの grep ERE portability 改善(旧 AC9〜AC11、新 AC1〜AC3)のみを本 Issue の scope として維持する。判定理由: secret boundary のような local-only risk guard は GitHub branch protection で代替できず維持する価値がある一方、worktree/branch/task routing のような repository correctness enforcement(本 Issue が前提としていた並列実行 test harness の主対象だったlocal_main_branch_guard/worktree_scope_guard)は 調査: PreToolUse hook chain(local_main_branch_guard/worktree_scope_guard)の繰り返し誤ブロックを踏まえ無効化・縮小・現状維持の方針を決定する #1690 で既に無効化済みであるため、その chain 前提の test harness を新設する理由が消滅した。
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phasetriage-requiredNeeds owner triage for priority decision
Activity
[-]実装: Hook の並列実行 semantics に対応し secret boundary guard の portability を改善する[/-][+]実装: secret_boundary_guard の grep ERE portability を改善する[/+]squne121 commentedon Aug 12, 2026
本文改訂: reframe/split(#1782 敵対的レビュー反映)
#1782 の OWNER 敵対的レビュー(https://github.com/squne121/loop-protocol/issues/1782#issuecomment-5266277591)に基づき、本 Issue を reframe/split した。
secret_boundary_guard.shの GNU/BSD grep ERE portability 改善(local-only secret protection は GitHub branch protection で代替できないため価値がある)local_main_branch_guard/worktree_scope_guardは 調査: PreToolUse hook chain(local_main_branch_guard/worktree_scope_guard)の繰り返し誤ブロックを踏まえ無効化・縮小・現状維持の方針を決定する #1690 で既に settings.json から削除済みであり対象 topology が変わっている、の2点。Acceptance Criteria を旧12件から3件(portability 関連のみ)に narrowing し、Allowed Paths からも hookchain test harness ファイルを除去した。