fix(harness): 루프 검증으로 찾은 bash_guard 미탐 9건 수정 + 커밋 게이트 사유 정리
1회차(31건 중 미탐 8, 오탐 0) → 2회차(새 31건 중 미탐 1, 오탐 0) → 3회차 0/0 - 변수 확장($C compose up), eval, bash -lc 등 묶인 -c 플래그, python -c 안의 uvicorn.run 재귀 검사 - compose up|start|restart|run|exec 를 실행 파일명과 무관하게 deny - make dev|deploy|restart|install, scripts/(dev|deploy|restart|start*).sh deny - main 삭제 푸시(:main, --delete) deny, find <repo> -delete / -exec rm deny - 커밋 게이트 deny 사유는 FAILED/ERROR·요약 줄만(경고 잡음 제거) - 훅 테스트 106 passed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -53,6 +53,25 @@ TEST_URL = "postgresql+asyncpg://x:x@localhost/autostock_test"
|
||||
"rm -rf ./*",
|
||||
"sudo rm -fr /Users/commylife/myproject/java/workspace/auto-stock",
|
||||
"bash -c 'docker compose up'",
|
||||
"C=docker; $C compose up -d",
|
||||
"C=docker; ${C} compose restart",
|
||||
"python -c \"import uvicorn; uvicorn.run('app.main:app')\"",
|
||||
"cd backend && ../.venv/bin/python -c 'from app.main import app; import uvicorn; uvicorn.run(app)'",
|
||||
"eval 'docker compose up -d'",
|
||||
'bash -lc "cd backend && uvicorn app.main:app --port 8000"',
|
||||
"zsh -ic 'docker-compose up'",
|
||||
"sh -ec 'docker compose start'",
|
||||
"docker compose run --rm backend alembic upgrade head",
|
||||
"docker compose exec backend bash",
|
||||
"make up", "make dev", "make deploy", "make restart",
|
||||
"./scripts/dev.sh", "bash scripts/restart.sh", "./scripts/start_all.sh", "./scripts/deploy.sh",
|
||||
"git push origin :main",
|
||||
"find . -delete",
|
||||
"find backend -name '*.py' -delete",
|
||||
"find . -name x -exec rm -rf {} +",
|
||||
"find .git -delete",
|
||||
"git push origin --delete main",
|
||||
"git push --delete origin main",
|
||||
])
|
||||
def test_deny(cmd):
|
||||
d, reason = bash(cmd)
|
||||
@@ -76,6 +95,14 @@ def test_deny(cmd):
|
||||
"ssh -p 2082 nas 'docker compose up -d'",
|
||||
"cat <<'EOF'\ndocker compose up\nEOF",
|
||||
"alembic current",
|
||||
"docker compose ps",
|
||||
"find backend/__pycache__ -delete",
|
||||
"find node_modules -name '*.tmp' -delete",
|
||||
"find . -name '*.py'",
|
||||
"make help", "make logs", "make logs-backend", "make status",
|
||||
"bash .claude/scripts/deploy.sh --watch-only",
|
||||
"python -c 'print(1)'",
|
||||
"ssh nas 'docker compose run --rm backend alembic upgrade head'",
|
||||
])
|
||||
def test_allow(cmd):
|
||||
d, _ = bash(cmd)
|
||||
@@ -132,6 +159,15 @@ def test_commit_gate_fail_denies_with_tail(repo):
|
||||
assert out["permissionDecision"] == "deny" and "boom" in out["permissionDecisionReason"]
|
||||
|
||||
|
||||
def test_commit_gate_reason_filters_noise(repo):
|
||||
d, g = repo
|
||||
(d / "backend/a.py").write_text("x=5\n"); g("add", "backend/a.py")
|
||||
cmd = "for i in $(seq 1 40); do echo 'DeprecationWarning noise'; done; echo 'FAILED t.py::t - boom'; echo '1 failed, 3 passed in 0.1s'; exit 1"
|
||||
out = commit_hook(d, {"HARNESS_PYTEST_CMD": cmd})
|
||||
r = out["permissionDecisionReason"]
|
||||
assert "FAILED t.py::t" in r and "1 failed, 3 passed" in r and "DeprecationWarning" not in r
|
||||
|
||||
|
||||
def test_commit_gate_pass(repo):
|
||||
d, g = repo
|
||||
(d / "backend/a.py").write_text("x=2\n"); g("add", "backend/a.py")
|
||||
|
||||
Reference in New Issue
Block a user