fix(hooks): verify.sh를 읽거나 dry-run만 한 명령을 desktop 실행으로 세지 않는다

편집 훅 N5는 desktop에서만 확인되는 파일을 고친 뒤 desktop 실행이 없으면
턴 끝에 한 번 알린다. 그런데 명령 안에 `scripts/verify.sh` 글자만 있어도
뒤 낱말을 단계로 보고 실행으로 셌다. `sed -n 1,80p scripts/verify.sh && ls`,
`grep … scripts/verify.sh config/ci/gates.json`, `git log -- scripts/verify.sh
docs/work`, `scripts/verify.sh merge --dry-run`, 로그를 읽기만 하는
`ssh desktop 'cat …log | grep vitest'`가 모두 알림을 지웠다. README는 "돌린
명령"만 센다고 적는다.

고른 방법: 명령줄을 ;·&&·||·|·( 로 나눠 한 명령씩 본다. 앞의 VAR=값과
timeout·nohup 같은 감싸는 낱말을 건너뛴 첫 낱말이 verify.sh이고, 다음
낱말이 단계 이름 꼴이며 docs·hooks가 아니고, --dry-run·--on here가 없을
때만 센다. ssh는 원격 명령이 읽기 명령(cat·grep·tail 등)뿐이면 세지 않는다.
버린 대안: config/ci/gates.json의 stage id를 읽어 대조하기(시험 repo와 다른
checkout에서도 같은 목록을 읽어야 한다. exec·gate·script도 단계 자리에 온다).

위험·한계: 처음 보는 감싸는 낱말(예: `flock <파일> scripts/verify.sh`)은
실행으로 세지 않아 알림이 한 번 더 뜬다. 막지는 않는다.

검증: python3 -m unittest discover -s scripts/tests 74개 통과(노트북). 새 시험
다섯 경우가 고치기 전 코드에서 실패했다.

Refs: 1112/08-09
This commit is contained in:
DongHyeonka
2026-11-12 23:36:14 +09:00
parent 06ffafa25e
commit 8c887892e6
3 changed files with 71 additions and 11 deletions
+20
View File
@@ -234,6 +234,26 @@ class TurnEndNudgeTest(RepositoryTestCase):
self.bash(command)
self.assertIsNone(self.stop())
def test_reading_verify_sh_or_a_dry_run_does_not_count(self) -> None:
# 1112/08-09. Only a command that runs a desktop step clears the reminder.
for command in ("scripts/verify.sh merge --dry-run",
"sed -n 1,80p scripts/verify.sh && ls",
"grep -n foo scripts/verify.sh config/ci/gates.json",
"git log -- scripts/verify.sh docs/work",
"ssh desktop 'cat /tmp/claude-gates/x/FE-GATE-005.log | grep vitest'"):
with self.subTest(command=command):
self.edit("src/domain/order.ts", "export const a = 5;\n")
self.bash(command)
self.assertIsNotNone(self.stop())
def test_a_wrapped_desktop_step_counts(self) -> None:
for command in ("timeout 900 scripts/verify.sh exec --log x -- node scripts/run-vitest.ts run tests/unit/a.test.ts",
"VERIFY_SNAPSHOT=1 scripts/verify.sh merge --log r9"):
with self.subTest(command=command):
self.edit("src/domain/order.ts", "export const a = 6;\n")
self.bash(command)
self.assertIsNone(self.stop())
def test_laptop_commands_and_other_hosts_do_not_count(self) -> None:
for command in ("corepack pnpm lint", "ssh build-box 'corepack pnpm lint'", "scripts/verify.sh docs",
"scripts/verify.sh hooks", "scripts/verify.sh gate FE-GATE-005 --on here",