From 7fa825e57a9de059bf8c6b53814712c37c3806da Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Fri, 13 Nov 2026 04:47:20 +0900 Subject: [PATCH] =?UTF-8?q?fix(scripts):=20verify.sh=20parts=EA=B0=80=20?= =?UTF-8?q?=EC=9D=8C=EC=84=B1=20fixture=EC=9D=98=20=EC=A7=84=EB=8B=A8=20?= =?UTF-8?q?=EB=AC=B8=EA=B5=AC=EA=B9=8C=EC=A7=80=20=EB=B3=B8=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 문제: `scripts/verify.sh parts `는 expect=fail 명령(검사기의 음성 fixture)을 종료 코드만으로 판정한다. `ci:gate`(run-ci-gate.ts의 classifyGateStepResult)는 정해진 종료 코드와 정해진 진단 문구 (`expectedDiagnosticId`)가 둘 다 있어야 통과시킨다. 그래서 검사기가 깨져 엉뚱한 원인으로 exit 1(TypeError 등)을 내도 parts는 그 음성 fixture를 통과로 센다. 문서가 검사기를 고친 뒤 `parts FE-GATE-029`를 돌리라고 하는 바로 그 경로다. args를 버리던 앞 절반은 79a225b6(#19)이 고쳤다. 고른 방법: 계약에서 `expectedDiagnosticId`를 함께 읽고, expect=fail 명령의 출력을 따로 잡아(`STEP_CAPTURE`) 진단 문구가 있는지 본다. 판정은 classifyGateStepResult와 같은 규칙(종료 코드가 같고, 출력에 문구가 들어 있음)이다. 어긋나면 무엇이 어긋났는지 한 줄을 stderr에 낸다. 위험·한계: 문구가 빈 음성 fixture는 예전처럼 종료 코드만 본다(ci:gate도 빈 문구는 늘 맞는다). 시스템 컨테이너 접두어가 붙은 게이트는 래퍼 출력까지 함께 잡는다. 검증: scripts/tests/test_verify.py에 가짜 corepack 시험을 더했다. 음성 fixture가 맞는 종료 코드에 엉뚱한 문구를 내면 parts FE-GATE-029가 rc=1이어야 하는데, 고치기 전 rc=0으로 실패했다(RED). 고친 뒤 9개 시험 통과. desktop 실제 검사기로 `scripts/verify.sh parts FE-GATE-029` rc=0(음성 fixture 9개가 등록된 문구를 냄), 로그 /tmp/claude-gates/w2fe2-gd01/. `scripts/verify.sh docs` OK. Refs: 1112/08-01 (GD-01) --- docs/work/reference/gates.md | 2 +- scripts/tests/test_verify.py | 39 +++++++++++++++++++++++++++++++++++ scripts/verify.sh | 40 ++++++++++++++++++++++++++++-------- 3 files changed, 72 insertions(+), 9 deletions(-) diff --git a/docs/work/reference/gates.md b/docs/work/reference/gates.md index a5b17d32..811a6b8f 100644 --- a/docs/work/reference/gates.md +++ b/docs/work/reference/gates.md @@ -23,7 +23,7 @@ scripts/verify.sh <단계> [대상…] [--on here|<호스트>] [--log <이름>] | `docs` | 작업 매뉴얼 검사(`scripts/check-work-docs.py`)와 장부 형식 | 여기(노트북) | | `hooks` | repo 훅·검사기·장부 시험(`python3 -m unittest discover -s scripts/tests`) | 여기 | | `gate …` | 게이트마다 `corepack pnpm ci:gate `, CI env로 | desktop | -| `parts ` | 그 게이트의 명령(`commandIds`)을 하나씩 끝까지. 음성 fixture(`expect: fail`)는 정해진 종료 코드면 통과 | desktop | +| `parts ` | 그 게이트의 명령(`commandIds`)을 `args`와 함께 하나씩 끝까지. 음성 fixture(`expect: fail`)는 `ci:gate`처럼 정해진 종료 코드와 정해진 진단 문구(`expectedDiagnosticId`)가 둘 다 있어야 통과 | desktop | | `script <이름>… [-- 인자…]` | package script를 하나씩(예: `verify:documentation`). `--` 뒤 인자는 script가 하나일 때만 넘긴다(예: `scripts/verify.sh script test:sample-removal -- --feature=`) | desktop | | `exec -- <명령…>` | 명령 하나. 한 테스트 파일(`node scripts/run-vitest.ts run <파일>`)이나 package script가 아닌 node 스크립트 | desktop | | stage id | `config/ci/gates.json` `stages`의 그 단계 `gateIds` 전부 | desktop | diff --git a/scripts/tests/test_verify.py b/scripts/tests/test_verify.py index 4395627a..d22d4924 100644 --- a/scripts/tests/test_verify.py +++ b/scripts/tests/test_verify.py @@ -90,6 +90,45 @@ class StagePlanTest(unittest.TestCase): expected.append(" ".join(words)) self.assertEqual([line.split(": ", 1)[1] for line in result.stdout.splitlines()], expected) + def test_parts_passes_a_negative_fixture_only_with_its_registered_diagnostic(self) -> None: + # run-ci-gate.ts passes an expect=fail command only when it exits with its code and prints its + # diagnostic. parts saw the exit code alone, so a checker broken into an unrelated exit 1 (a + # TypeError) still counted as its negative fixture passing. + contract = gates() + commands = {c["id"]: c for c in contract["commands"]} + gate = next(g for g in contract["gates"] if g["id"] == "FE-GATE-029") + negatives = [commands[c] for c in gate["commandIds"] if commands[c].get("expect") == "fail"] + self.assertTrue(any(c.get("expectedDiagnosticId") for c in negatives)) + with tempfile.TemporaryDirectory() as tmp: + fake = Path(tmp) / "corepack" + # Answers `corepack pnpm -s