fix(compose): 계약 검사의 판정을 시험 있는 스크립트로 옮기고 빈 입력 통과를 막는다 #82

Merged
donghyeon.kang merged 2 commits from test/compose-contract-verdict into main 2026-11-21 16:54:24 +00:00
Owner

무엇을, 왜

scripts/verify-compose-profile-contracts.sh(prCheck의 verifyComposeProfiles)는 compose lane마다 docker compose config를 렌더하고 계약 src/bootstrap/app/compose-lanes/compose-profile-contracts.json과 비교하는 게이트다. 판정 열 가지가 셸 안의 jq라 시험이 없었고, 고장 난 입력을 넣으면 넷이 통과한다(아래 RED).

  • 계약의 lanes가 비면 반복이 돌지 않고 「all 0 lanes match」로 끝난다.
  • persistence-jpa를 켠 lane에 expectedPersistenceVendor가 없어도 통과한다. smoke는 보고된 vendor를 그 칸과 비교하니 그 lane은 매번 실패한다.
  • heap dump 경로(/var/tmp/heap)는 짧은 tmpfs: 목록의 같은 항목만 비교한다. 위 디렉터리의 tmpfs(/var/tmp)나 long syntax type: tmpfs volume은 통과한다.
  • Redis 계정을 이름 그대로가 아니라 정규식(grep -E "^user ${user} on")으로 찾아 .이 아무 글자와 맞는다. ca.skeleton-application을 가리키는 lane이 ca-skeleton-application 줄로 통과한다(앱은 없는 계정으로 접속해 WRONGPASS).

이 PR은 REV-BE-0016의 compose contract 쪽이다(smoke 쪽은 #77). 판정을 scripts/compose-contract-verdict.py로 옮기고 scripts/tests/에서 고장 난 입력으로 시험한다.

고른 방법과 버린 대안

  • 셸은 docker만 부른다. version으로 Compose 하한을 먼저 보고, lanes가 준 lane별 인자로 config --services와 config --format json을 돌려 출력과 rc를 한 디렉터리에 쓴다. rc는 조건 밖에서 || status=$?로 읽는다. 그다음 judge가 그 디렉터리를 읽어 rc로 답한다.
  • 판정은 위 넷을 실패로 보고, 파일 없는 lane, 겹치는 id, smoke가 읽는 목록이 없거나 그 목록에 이름이 아닌 원소가 든 lane, 셸이 렌더 기록을 남기지 않은 lane도 실패로 본다. jq와 다른 곳은 「위험과 영향」에 적었다. 루프 안 docker 호출의 stdin은 /dev/null이라 lane 목록을 먹지 않는다.
  • scripts/tests/test_compose_contract_verdict.py(56개): 판정마다 고장 난 입력과 정상 입력, 그리고 셸을 가짜 docker로 돌려 lane 인자·rc 기록·판정 rc를 본다. prCheck의 testDocumentChecks가 돌린다. 루트 build.gradle:204-209 주석은 PR 단계 Exec 태스크마다 시험 파일을 적어 사실과 맞춘다.
  • 버린 안: 모델 JSON의 service key로 config --services를 대신하기(렌더를 한 번 줄이지만 지금 lane 결과와 같은지 따로 보여야 해서 두 호출을 그대로 둔다). bats(desktop과 runner 둘 다 새 도구).

위험과 영향

  • 셸이 jq 대신 python3를 요구한다. prCheck(testDocumentChecks)와 nightly smoke(#77의 compose-smoke-verdict.py)가 이미 python3를 쓰는 자리라 새 도구는 없다.
  • 판정이 jq와 다른 곳은 위 넷 말고도 있다(리뷰어의 가짜 docker 비교 23개 입력을 이 트리로 다시 돌린 결과, 14개가 다름).
    • main 통과 → 이제 실패: 같은 사용자를 두 줄에서 켠 ACL(Redis가 거절), 값이 null·false인 realm의 _ key, 최상위 값이 둘인 realm, LANE_ID 꼴이 아닌 id, 빈 springRuntime, files가 없는 lane(main은 jq 오류를 내고 rc 0), 이름이 아닌 목록 원소(composeProfiles: [null] 등), 읽을 수 없는 Compose 버전(dev).
    • main 실패 → 이제 통과: ACL 줄의 겹친 공백과 CRLF, 끝에 /가 붙은 bind target, 로캘에 따라 달라지던 service 정렬, list 꼴 environment(main은 jq 오류 rc 5), target 없는 volume, 파일 하나로 bind mount한 ACL.
    • Redis가 ACL 줄의 \r와 겹친 공백을 받아들인다는 것은 acl.c를 열어 보지 않은 판단이다. 지금 lane의 ACL 파일은 LF·한 칸이라 결과가 같다.
  • 실제 계약 18 lane의 출력 줄은 main과 이 트리에서 같다(검증).

검증

탐침은 desktop 공유 잠금(flock /tmp/claude-gates/heavy.lock) 아래 detached worktree 둘(main b2bfb9bbf0, 그 위에 이 PR 패치)에서 bash scripts/verify-compose-profile-contracts.sh를 변이마다 돌렸다. 스크립트는 노트 be-lane-g/g2b-probe.sh(1차)·g2b-probe2.sh(2차), 변이는 g2b-mut2.py. docker compose 5.3.0. 변이: L0 lanes: [] / V0 local-jpa의 expectedPersistenceVendor 삭제 / H1 compose.yaml app tmpfs에 /var/tmp / H2 long syntax type: tmpfs volume /var/tmp / U1 local-redis 참조를 secret://ca.skeleton-application@…로 / 대조 P1 비밀번호 *, X1 off-local services에 postgres, X2 비밀번호 wrong-example, X3 tmpfs /var/tmp/heap 정확히.

  • RED(main b2bfb9bb, 로그 desktop ~/lane-g-g2b-logs/r-*.log, U1·P1은 ~/lane-g-g2b-logs2/)
    • 변이 없음 r0: rc=0, 「all 18 lanes match」.
    • L0: rc=0, 「all 0 lanes match」. 빈틈.
    • V0: rc=0, 「all 18 lanes match」. 빈틈.
    • H1: rc=0, 「all 18 lanes match」. 빈틈.
    • H2: rc=0, 「all 18 lanes match」. 빈틈.
    • U1: rc=0, 「all 18 lanes match」. 빈틈(없는 계정 이름이 정규식으로 맞음).
    • 대조 P1·X2: rc=1, 「REDIS_LANE_APPLICATION_PASSWORD is not the password … gives ca-skeleton-application」. X1: rc=1, 「services are [app], the contract says [app,postgres]」. X3: rc=1, 16 lane 「app mounts the heap dump path /var/tmp/heap as a tmpfs」.
  • GREEN(이 PR 트리 a5c1f14688, 로그 desktop ~/lane-g-g2b-logs2/g*.log)
    • 변이 없음 g0: rc=0, 「all 18 lanes match」. main과 이 트리의 lane 줄 18줄이 같다(diff 없음).
    • L0: rc=1, 「the contract declares no lanes, so nothing would be checked」.
    • V0: rc=1, 「local-jpa: … no expectedPersistenceVendor with persistence-jpa on」.
    • H1: rc=1, 16 lane 「app mounts /var/tmp as a tmpfs, which holds the heap dump path /var/tmp/heap」(dev overlay가 tmpfs를 !override하는 off-dev·shared-infra-dev는 그 tmpfs를 렌더하지 않아 빠진다). H2: rc=1, 18 lane 같은 문구.
    • U1: rc=1, 「local-redis: APP_REDIS_AUTHENTICATION_CREDENTIAL_REFERENCE names ca.skeleton-application, which compose/redis/acl/lane-fixture-accounts.acl does not enable」.
    • P1·X1·X2·X3: rc=1, main과 같은 lane과 사유.
    • smoke가 이 스크립트를 부르는 자리: bash scripts/run-compose-runtime-smoke.sh --lane off-local rc=0, 「== off-local: passed」, 계약 로그 「all 18 lanes match」.
  • 노트북: python3 -m unittest discover -s scripts/tests 275개 통과. 변이 23개(노트 be-lane-g/g2b-mutate.py 14·g2b-mutate2.py 9: 판정 되돌림, judge_lane의 판정 하나 빼기, realm 판정 빼기, 두 렌더 rc || true, docker stdin, judge 호출 삭제·|| true, version 실패 무시, profile 인자 빼기) 모두 새 시험이 실패한다.
  • verify(깨끗한 detached worktree, head 474bd0462c, 첫 줄 「트리 a5c1f14688ce(HEAD 트리와 같음)」)
    • desktop scripts/verify.sh leaf :app-bootstrap --no-cache --log g2b-leaf: rc=0, tests=334 failures=0 errors=0 skipped=5, FROM-CACHE 0, 로그 ~/g2b-leaf-logs/leaf.log.
    • desktop scripts/verify.sh pr --no-cache --log g2b-pr: rc=0, tests=7347 failures=0 errors=0 skipped=35, FROM-CACHE 0, 로그 ~/g2b-pr-logs/pr.log. 새 시험은 prCheck의 testDocumentChecks에서 돈다.
    • 노트북 scripts/verify.sh docs: rc=0.
  • 돌리지 않은 것: nightly의 compose matrix 전체(--matrix). 이 PR은 smoke가 부르는 계약 스크립트의 rc·출력 줄만 바꾸고, 그 자리는 off-local 한 lane으로 확인했다.

리뷰 반영

종류 B, 리뷰 1회(reviewer, 렌즈 be-build-ci·be-testing, 세션 기본 모델). 발견 Medium 1·Low 3, 모두 반영. 확인 리뷰 0회(Medium 반영은 변이로 증명).

  • Medium: judge_lane의 판정 다섯(role·report·redis·memory·heap)과 realm 판정을 잇는 줄, 셸의 json 렌더 rc를 지워도 시험이 통과했다 → CommandLineTest에 판정마다 그것 하나로만 실패하는 lane을 main으로 돌리는 시험과 realm 시험, 셸 시험에 json 렌더만 rc 1인 경우를 더했다. 변이 J1~J6·S1이 이제 실패한다.
  • Low: strings()가 목록의 이름 아닌 원소를 버려 main이 실패시키던 계약(expectedCapabilitiesOn: [null] 등)을 통과시켰다 → lane_shape가 여섯 목록의 원소를 본다. 변이 E1.
  • Low: 커밋의 「jq와 다른 곳은 위뿐」이 사실과 달랐다 → 비교를 다시 돌려 「위험과 영향」과 커밋에 목록을 적었다.
  • Low: 시험 이름(bind mount)과 입력(named volume)이 달랐다 → volume·bind 둘을 subTest로.
  • 리뷰어가 확인하지 못한 것으로 둔 stdin: 루프 안 docker compose가 lane 목록(stdin)을 읽을 수 있었다 → 두 호출의 stdin을 /dev/null로, 가짜 docker가 stdin을 다 읽게 해 시험이 지킨다. 변이 S2.
  • 리뷰 앞 정정(desktop 탐침 대조): 앞 인계가 RED 후보로 둔 P1(비밀번호 *)은 main도 잡는다. " >${value} "가 따옴표 안이라 glob이 아니다. P1은 대조로 내리고, 실제 빈틈인 사용자 이름 정규식(U1)을 RED로 올렸다. 커밋·docstring·시험 주석의 잘못된 주장도 고쳤다.

리뷰어가 볼 곳

  • scripts/compose-contract-verdict.py — judge의 판정 열 가지, redis_authentication, heap_dump.
  • scripts/verify-compose-profile-contracts.sh — lane 루프의 rc 기록과 judge 호출.
  • scripts/tests/test_compose_contract_verdict.py — ContractScriptTest(가짜 docker로 셸 전체).

넘길 것

  • diff 밖(리뷰): build.gradle:232 testDocumentChecks의 description이 아직 「(document checker, hooks, ledger)」라 바로 위 주석(scripts/tests 전부)과 맞지 않는다. 문서 불일치 Low.

관련

  • Refs: REV-BE-0016(compose contract 쪽). 앞: #77(smoke 쪽).
## 무엇을, 왜 `scripts/verify-compose-profile-contracts.sh`(prCheck의 `verifyComposeProfiles`)는 compose lane마다 `docker compose config`를 렌더하고 계약 `src/bootstrap/app/compose-lanes/compose-profile-contracts.json`과 비교하는 게이트다. 판정 열 가지가 셸 안의 jq라 시험이 없었고, 고장 난 입력을 넣으면 넷이 통과한다(아래 RED). - 계약의 `lanes`가 비면 반복이 돌지 않고 「all 0 lanes match」로 끝난다. - persistence-jpa를 켠 lane에 `expectedPersistenceVendor`가 없어도 통과한다. smoke는 보고된 vendor를 그 칸과 비교하니 그 lane은 매번 실패한다. - heap dump 경로(`/var/tmp/heap`)는 짧은 `tmpfs:` 목록의 같은 항목만 비교한다. 위 디렉터리의 tmpfs(`/var/tmp`)나 long syntax `type: tmpfs` volume은 통과한다. - Redis 계정을 이름 그대로가 아니라 정규식(`grep -E "^user ${user} on"`)으로 찾아 `.`이 아무 글자와 맞는다. `ca.skeleton-application`을 가리키는 lane이 `ca-skeleton-application` 줄로 통과한다(앱은 없는 계정으로 접속해 WRONGPASS). 이 PR은 REV-BE-0016의 compose contract 쪽이다(smoke 쪽은 #77). 판정을 `scripts/compose-contract-verdict.py`로 옮기고 `scripts/tests/`에서 고장 난 입력으로 시험한다. ## 고른 방법과 버린 대안 - 셸은 docker만 부른다. `version`으로 Compose 하한을 먼저 보고, `lanes`가 준 lane별 인자로 `config --services`와 `config --format json`을 돌려 출력과 rc를 한 디렉터리에 쓴다. rc는 조건 밖에서 `|| status=$?`로 읽는다. 그다음 `judge`가 그 디렉터리를 읽어 rc로 답한다. - 판정은 위 넷을 실패로 보고, 파일 없는 lane, 겹치는 id, smoke가 읽는 목록이 없거나 그 목록에 이름이 아닌 원소가 든 lane, 셸이 렌더 기록을 남기지 않은 lane도 실패로 본다. jq와 다른 곳은 「위험과 영향」에 적었다. 루프 안 docker 호출의 stdin은 `/dev/null`이라 lane 목록을 먹지 않는다. - `scripts/tests/test_compose_contract_verdict.py`(56개): 판정마다 고장 난 입력과 정상 입력, 그리고 셸을 가짜 docker로 돌려 lane 인자·rc 기록·판정 rc를 본다. prCheck의 `testDocumentChecks`가 돌린다. 루트 `build.gradle:204-209` 주석은 PR 단계 Exec 태스크마다 시험 파일을 적어 사실과 맞춘다. - 버린 안: 모델 JSON의 service key로 `config --services`를 대신하기(렌더를 한 번 줄이지만 지금 lane 결과와 같은지 따로 보여야 해서 두 호출을 그대로 둔다). bats(desktop과 runner 둘 다 새 도구). ## 위험과 영향 - 셸이 jq 대신 python3를 요구한다. prCheck(`testDocumentChecks`)와 nightly smoke(#77의 `compose-smoke-verdict.py`)가 이미 python3를 쓰는 자리라 새 도구는 없다. - 판정이 jq와 다른 곳은 위 넷 말고도 있다(리뷰어의 가짜 docker 비교 23개 입력을 이 트리로 다시 돌린 결과, 14개가 다름). - main 통과 → 이제 실패: 같은 사용자를 두 줄에서 켠 ACL(Redis가 거절), 값이 null·false인 realm의 `_` key, 최상위 값이 둘인 realm, LANE_ID 꼴이 아닌 id, 빈 `springRuntime`, `files`가 없는 lane(main은 jq 오류를 내고 rc 0), 이름이 아닌 목록 원소(`composeProfiles: [null]` 등), 읽을 수 없는 Compose 버전(`dev`). - main 실패 → 이제 통과: ACL 줄의 겹친 공백과 CRLF, 끝에 `/`가 붙은 bind target, 로캘에 따라 달라지던 service 정렬, list 꼴 environment(main은 jq 오류 rc 5), target 없는 volume, 파일 하나로 bind mount한 ACL. - Redis가 ACL 줄의 `\r`와 겹친 공백을 받아들인다는 것은 `acl.c`를 열어 보지 않은 판단이다. 지금 lane의 ACL 파일은 LF·한 칸이라 결과가 같다. - 실제 계약 18 lane의 출력 줄은 main과 이 트리에서 같다(검증). ## 검증 탐침은 desktop 공유 잠금(`flock /tmp/claude-gates/heavy.lock`) 아래 detached worktree 둘(main b2bfb9bbf019da0a1f68314b4365a66996beb7b3, 그 위에 이 PR 패치)에서 `bash scripts/verify-compose-profile-contracts.sh`를 변이마다 돌렸다. 스크립트는 노트 `be-lane-g/g2b-probe.sh`(1차)·`g2b-probe2.sh`(2차), 변이는 `g2b-mut2.py`. docker compose 5.3.0. 변이: L0 `lanes: []` / V0 local-jpa의 `expectedPersistenceVendor` 삭제 / H1 compose.yaml app tmpfs에 `/var/tmp` / H2 long syntax `type: tmpfs` volume `/var/tmp` / U1 local-redis 참조를 `secret://ca.skeleton-application@…`로 / 대조 P1 비밀번호 `*`, X1 off-local services에 postgres, X2 비밀번호 `wrong-example`, X3 tmpfs `/var/tmp/heap` 정확히. - RED(main b2bfb9bb, 로그 desktop `~/lane-g-g2b-logs/r-*.log`, U1·P1은 `~/lane-g-g2b-logs2/`) - 변이 없음 r0: rc=0, 「all 18 lanes match」. - L0: rc=0, 「all 0 lanes match」. 빈틈. - V0: rc=0, 「all 18 lanes match」. 빈틈. - H1: rc=0, 「all 18 lanes match」. 빈틈. - H2: rc=0, 「all 18 lanes match」. 빈틈. - U1: rc=0, 「all 18 lanes match」. 빈틈(없는 계정 이름이 정규식으로 맞음). - 대조 P1·X2: rc=1, 「REDIS_LANE_APPLICATION_PASSWORD is not the password … gives ca-skeleton-application」. X1: rc=1, 「services are [app], the contract says [app,postgres]」. X3: rc=1, 16 lane 「app mounts the heap dump path /var/tmp/heap as a tmpfs」. - GREEN(이 PR 트리 a5c1f14688ce0423f6881a7db759c193b6b8afab, 로그 desktop `~/lane-g-g2b-logs2/g*.log`) - 변이 없음 g0: rc=0, 「all 18 lanes match」. main과 이 트리의 lane 줄 18줄이 같다(`diff` 없음). - L0: rc=1, 「the contract declares no lanes, so nothing would be checked」. - V0: rc=1, 「local-jpa: … no expectedPersistenceVendor with persistence-jpa on」. - H1: rc=1, 16 lane 「app mounts /var/tmp as a tmpfs, which holds the heap dump path /var/tmp/heap」(dev overlay가 tmpfs를 `!override`하는 off-dev·shared-infra-dev는 그 tmpfs를 렌더하지 않아 빠진다). H2: rc=1, 18 lane 같은 문구. - U1: rc=1, 「local-redis: APP_REDIS_AUTHENTICATION_CREDENTIAL_REFERENCE names ca.skeleton-application, which compose/redis/acl/lane-fixture-accounts.acl does not enable」. - P1·X1·X2·X3: rc=1, main과 같은 lane과 사유. - smoke가 이 스크립트를 부르는 자리: `bash scripts/run-compose-runtime-smoke.sh --lane off-local` rc=0, 「== off-local: passed」, 계약 로그 「all 18 lanes match」. - 노트북: `python3 -m unittest discover -s scripts/tests` 275개 통과. 변이 23개(노트 `be-lane-g/g2b-mutate.py` 14·`g2b-mutate2.py` 9: 판정 되돌림, `judge_lane`의 판정 하나 빼기, realm 판정 빼기, 두 렌더 rc `|| true`, docker stdin, judge 호출 삭제·`|| true`, version 실패 무시, profile 인자 빼기) 모두 새 시험이 실패한다. - verify(깨끗한 detached worktree, head 474bd0462c937f2faf0f0a0f5d30e812100f9c6b, 첫 줄 「트리 a5c1f14688ce(HEAD 트리와 같음)」) - desktop `scripts/verify.sh leaf :app-bootstrap --no-cache --log g2b-leaf`: rc=0, tests=334 failures=0 errors=0 skipped=5, FROM-CACHE 0, 로그 `~/g2b-leaf-logs/leaf.log`. - desktop `scripts/verify.sh pr --no-cache --log g2b-pr`: rc=0, tests=7347 failures=0 errors=0 skipped=35, FROM-CACHE 0, 로그 `~/g2b-pr-logs/pr.log`. 새 시험은 `prCheck`의 `testDocumentChecks`에서 돈다. - 노트북 `scripts/verify.sh docs`: rc=0. - 돌리지 않은 것: nightly의 compose matrix 전체(`--matrix`). 이 PR은 smoke가 부르는 계약 스크립트의 rc·출력 줄만 바꾸고, 그 자리는 off-local 한 lane으로 확인했다. ## 리뷰 반영 종류 B, 리뷰 1회(reviewer, 렌즈 be-build-ci·be-testing, 세션 기본 모델). 발견 Medium 1·Low 3, 모두 반영. 확인 리뷰 0회(Medium 반영은 변이로 증명). - Medium: `judge_lane`의 판정 다섯(role·report·redis·memory·heap)과 realm 판정을 잇는 줄, 셸의 json 렌더 rc를 지워도 시험이 통과했다 → `CommandLineTest`에 판정마다 그것 하나로만 실패하는 lane을 `main`으로 돌리는 시험과 realm 시험, 셸 시험에 json 렌더만 rc 1인 경우를 더했다. 변이 J1~J6·S1이 이제 실패한다. - Low: `strings()`가 목록의 이름 아닌 원소를 버려 main이 실패시키던 계약(`expectedCapabilitiesOn: [null]` 등)을 통과시켰다 → `lane_shape`가 여섯 목록의 원소를 본다. 변이 E1. - Low: 커밋의 「jq와 다른 곳은 위뿐」이 사실과 달랐다 → 비교를 다시 돌려 「위험과 영향」과 커밋에 목록을 적었다. - Low: 시험 이름(bind mount)과 입력(named volume)이 달랐다 → volume·bind 둘을 subTest로. - 리뷰어가 확인하지 못한 것으로 둔 stdin: 루프 안 `docker compose`가 lane 목록(stdin)을 읽을 수 있었다 → 두 호출의 stdin을 `/dev/null`로, 가짜 docker가 stdin을 다 읽게 해 시험이 지킨다. 변이 S2. - 리뷰 앞 정정(desktop 탐침 대조): 앞 인계가 RED 후보로 둔 P1(비밀번호 `*`)은 main도 잡는다. `" >${value} "`가 따옴표 안이라 glob이 아니다. P1은 대조로 내리고, 실제 빈틈인 사용자 이름 정규식(U1)을 RED로 올렸다. 커밋·docstring·시험 주석의 잘못된 주장도 고쳤다. ## 리뷰어가 볼 곳 - `scripts/compose-contract-verdict.py` — `judge`의 판정 열 가지, `redis_authentication`, `heap_dump`. - `scripts/verify-compose-profile-contracts.sh` — lane 루프의 rc 기록과 `judge` 호출. - `scripts/tests/test_compose_contract_verdict.py` — `ContractScriptTest`(가짜 docker로 셸 전체). ## 넘길 것 - diff 밖(리뷰): `build.gradle:232` `testDocumentChecks`의 description이 아직 「(document checker, hooks, ledger)」라 바로 위 주석(scripts/tests 전부)과 맞지 않는다. 문서 불일치 Low. ## 관련 - Refs: REV-BE-0016(compose contract 쪽). 앞: #77(smoke 쪽).
donghyeon.kang added 1 commit 2026-11-21 16:29:08 +00:00
scripts/verify-compose-profile-contracts.sh는 prCheck의 게이트인데 판정
열 가지가 셸 안의 jq라 시험이 없다. 고장 난 입력을 넣어 보면 넷이 통과한다.
- 계약의 lanes가 비면 lane 반복이 돌지 않고 "all 0 lanes match"로 끝난다.
- persistence-jpa를 켠 lane에 expectedPersistenceVendor가 없으면 통과한다.
  smoke는 보고된 vendor를 그 칸과 비교하니 그 lane은 매번 실패한다.
- heap dump 경로는 짧은 `tmpfs:` 목록의 같은 항목만 비교한다. 위 디렉터리의
  tmpfs(/var/tmp)나 long syntax `type: tmpfs` volume은 통과한다.
- Redis 계정을 이름 그대로가 아니라 정규식으로 찾아 `.`이 아무 글자와 맞는다.
  `ca.skeleton-application`을 가리키는 lane이 `ca-skeleton-application` 줄로
  통과한다.

판정을 scripts/compose-contract-verdict.py로 옮긴다. 셸은 docker만 부른다.
`version`으로 Compose 하한을 먼저 보고, `lanes`가 준 lane별 인자로
`config --services`와 `config --format json`을 돌려 출력과 rc를 파일에 쓴다.
rc는 조건 밖에서 읽는다. 그다음 `judge`가 그 디렉터리를 읽는다. 판정은 위
넷을 실패로 보고, 파일 없는 lane, 겹치는 id, smoke가 읽는 목록이 없거나 그
목록에 이름이 아닌 원소가 든 lane, 셸이 렌더 기록을 남기지 않은 lane도 실패로
본다. docker 호출의 stdin은 /dev/null이라 lane 목록을 먹지 않는다.
scripts/tests/test_compose_contract_verdict.py가 판정마다 고장 난 입력과 정상
입력을 보고, 셸을 가짜 docker로 돌려 lane 인자·rc 기록·판정 rc를 본다.
prCheck의 testDocumentChecks가 돌린다. 루트 build.gradle의 주석은 PR 단계
Exec 태스크마다 시험 파일을 적어 사실과 맞춘다.

버린 안: 모델 JSON의 service key로 `config --services`를 대신하기. 렌더를
한 번 줄이지만 지금 lane 결과와 같은지 따로 보여야 해서 두 호출을 그대로 둔다.
bats는 desktop과 runner 둘 다에 새 도구를 깔아야 한다.

위험·한계: 판정이 jq와 다른 곳은 위 넷 말고도 있다. main이 통과시키고 이제
실패로 보는 것: 같은 사용자를 두 줄에서 켠 ACL(Redis가 거절한다), 값이
null·false인 realm의 `_` key, 최상위 값이 둘인 realm, LANE_ID 꼴이 아닌 id,
빈 springRuntime, `files`가 없는 lane, 이름이 아닌 목록 원소, 읽을 수 없는
Compose 버전. main이 실패시키고 이제 통과하는 것: ACL 줄의 겹친 공백과 CRLF,
끝에 `/`가 붙은 bind target, 로캘에 따라 달라지던 service 정렬, list 꼴
environment, 파일 하나로 bind mount한 ACL(target이 --aclfile 경로와 같음).
Redis가 ACL 줄의 `\r`와 겹친 공백을 받아들인다는 것은 acl.c를 열어 보지 않은
판단이다. 실제 계약 18 lane에서는 main과 이 트리의 출력 줄이 같다(PR 본문).

검증: 노트북 `python3 -m unittest discover -s scripts/tests` 275개 통과. 판정의
빈 lane 거절·vendor 검사·heap 상위 tmpfs·long syntax tmpfs·비밀번호 글자 비교·
정확한 service 집합·사용자 이름 비교·렌더 기록 없음·파일 없는 lane·목록 원소
검사를 되돌리거나, judge_lane에서 판정 하나를 빼거나 realm 판정을 빼거나, 셸의
두 렌더 rc를 `|| true`로 삼키거나, docker가 stdin을 읽게 두거나, judge 호출을
지우거나 `|| true`로 바꾸거나, version 실패를 무시하거나, profile 인자를 빼면
새 시험이 실패한다(변이 23개 모두). desktop RED·GREEN과 prCheck 결과는 PR
본문에 있다.

Refs: REV-BE-0016
donghyeon.kang added 1 commit 2026-11-21 16:35:43 +00:00
Merge branch 'main' into test/compose-contract-verdict
pr / done (pull_request) Successful in 2m10s
358d8b1cc2
donghyeon.kang merged commit 484264cb08 into main 2026-11-21 16:54:24 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: donghyeon.kang/clean-architecture-backend-template#82