fix(scripts): verify.sh parts가 게이트 명령의 args를 넘긴다
문제: `scripts/verify.sh parts <ID>`는 게이트의 명령을 하나씩 돌리면서 config/ci/gates.json 명령의 `script`만 읽고 `args`를 버린다. 그래서 FE-GATE-009의 `review:a11y-manual -- --format-only`가 인자 없이 돌아 release 증거를 찾다가 rc=1이 되고, production 게이트의 `drill:runbook -- FE-RB-00N --release-root …` 여섯 개도 다른 명령이 된다. ci:gate(run-ci-gate.ts)는 `pnpm <script> ...args`로 돌려 영향이 없다. desktop 측정에서 parts만 009를 실패로 냈다. 고른 방법: 계약을 읽는 python이 필드를 \x1f로, args를 \x1e로 나눠 내보내고 bash가 배열로 받아 `corepack pnpm -s <script> ...args`로 돌린다. 탭 구분은 빈 expectedExitCode 칸이 이어지는 탭과 합쳐져 다음 칸이 밀리므로 쓰지 않았다. 위험·한계: args 안에 \x1e·\x1f가 들어가면 잘못 나뉜다. 지금 계약에는 없다. 검증(노트북): python3 -m unittest discover -s scripts/tests 통과. 새 시험은 args가 있는 게이트 7개 모두에서 수정 전 실패, 수정 뒤 통과.
This commit is contained in:
@@ -51,6 +51,24 @@ class StagePlanTest(unittest.TestCase):
|
||||
self.assertEqual([line.split(": ", 1)[1] for line in result.stdout.splitlines()],
|
||||
[f"corepack pnpm -s {scripts[c]}" for c in gate["commandIds"]])
|
||||
|
||||
def test_parts_passes_each_command_its_arguments_as_ci_gate_does(self) -> None:
|
||||
# run-ci-gate.ts runs `pnpm <script> ...args`. Without the args FE-GATE-009's
|
||||
# `review:a11y-manual -- --format-only` checked the release evidence instead and failed.
|
||||
contract = gates()
|
||||
commands = {c["id"]: c for c in contract["commands"]}
|
||||
with_args = [g for g in contract["gates"]
|
||||
if any(commands[c].get("args") for c in g["commandIds"])]
|
||||
self.assertTrue(with_args, "the contract has no command with arguments to check")
|
||||
for gate in with_args:
|
||||
with self.subTest(gate=gate["id"]):
|
||||
result = sh([str(VERIFY), "parts", gate["id"], "--dry-run"], cwd=REPO)
|
||||
expected = []
|
||||
for command_id in gate["commandIds"]:
|
||||
command = commands[command_id]
|
||||
words = ["corepack", "pnpm", "-s", command["script"], *command.get("args", [])]
|
||||
expected.append(" ".join(words))
|
||||
self.assertEqual([line.split(": ", 1)[1] for line in result.stdout.splitlines()], expected)
|
||||
|
||||
def test_arguments_after_the_separator_go_to_the_one_script_or_command_as_given(self) -> None:
|
||||
result = sh([str(VERIFY), "script", "test:sample-removal", "--dry-run", "--", "--feature=invoice-feature"],
|
||||
cwd=REPO)
|
||||
|
||||
Reference in New Issue
Block a user