Files
clean-architecture-backend-…/.gitignore
DongHyeonka 3917dc0174
pr / done (pull_request) Successful in 2m2s
build(app-bootstrap): test가 ApprovalTests 스크립트를 GitHub에서 내려받지 않는다
:app-bootstrap:test가 EnvelopeContractTest를 돌리면 ApprovalTests 31.0.0이
GitHub 저장소 ApprovalTests.CommonScripts의 main 브랜치에서 approve_all.py와
remove_abandoned_files.py를 받아 leaf 폴더 .approval_tests_temp/에 실행 권한으로
쓴다(LoggingUtils.downloadScriptIfMissing, 3초 시한, 실패는 삼킨다). 시험이 바깥
네트워크에 기대고, 고정되지 않은 내용이 실행 파일로 소스 폴더에 남는다. 또 실패한
승인 비교가 시험 소스의 approved/ 폴더 안에 남기는 *.received.* 파일을 Git이 무시하지
않아 git add -A로 커밋될 수 있다.

app-bootstrap의 모든 Test 태스크(tasks.withType(Test).configureEach)에 환경 변수
APPROVALTESTS_DISABLE_SCRIPT_DOWNLOADS=1을 준다. 라이브러리가 내려받기를 끄는 길은 이
환경 변수 하나다(시스템 속성·PackageSettings 칸이 없다). test만이 아니라 모두에 주는
이유: tag lane 셋(documentContractTest·repositoryContractTest·publicPathSnapshotTest)이
같은 test source set의 클래스를 고르고, architectureTest의 실행 classpath에도
ApprovalTests가 있다. 환경 변수는 Test 태스크의 캐시 입력이 아니라(@Internal) 캐시 키는
그대로다.

루트 .gitignore는 Java 소스 폴더 아래의 received 파일만 무시한다
(src/**/src/*/java/**/*.received.*). 다른 곳의 fixture 이름(예: test/resources 아래
payment.received.json 같은 이름)은 가리지 않는다. approved 스냅숏은 매개변수가 이름에
".received."를 넣어도 무시하지 않는다(!src/**/src/*/java/**/*.approved.*).

버린 대안:
- 프로젝트 폴더(APPROVALTESTS_PROJECT_DIRECTORY)를 build/ 아래로 옮기고, 스냅숏 소스
  찾기를 ContractSnapshots.verify로 바꾸기: 라이브러리는 같은 폴더를 시험 소스를 찾는
  뿌리로도 쓴다. 파생 서비스가 Approvals.verify를 직접 부르는 새 시험을 쓰면 스냅숏을
  못 찾고 실패한다. 남는 폴더(.gitignore와 로그 둘)는 저장소 파일 트리 입력이 이미
  빼고(**/.approval_tests_temp/**), 라이브러리가 그 안에 쓰는 .gitignore(*)로 Git도
  무시한다.
- test 태스크에만 환경 변수: 같은 클래스를 고르는 tag lane에는 닿지 않는다.
- .gitignore에 *.received.* 한 줄: 저장소 어디서든 이름에 ".received."가 든 fixture를
  가린다.

위험·한계:
- 라이브러리는 스크립트가 없을 때만 받는다. 이미 시험을 돌린 checkout에는 받아 둔 두
  .py가 .approval_tests_temp/를 지울 때까지 남는다.
- Gradle 설정 없이 IDE의 JUnit runner로 돌리면 여전히 내려받는다.
- 매개변수가 이름에 ".approved."를 넣은 received 파일은 무시되지 않고 git status에
  보인다(approved 스냅숏을 가리지 않는 쪽을 골랐다).

검증(desktop, 기준 442712ee = main):
- 탐침(docker --network none / bridge, 빈 캐시): main 트리 3bd57d82는 offline
  :app-bootstrap:test rc=0, online --rerun 뒤 leaf .approval_tests_temp/에
  approve_all.py·remove_abandoned_files.py(mode 744)가 생기고, 스냅숏 한 줄을 바꿔
  실패시키면 received 파일이 git status에 ?? 로 보인다. 이 트리 7aac4cee는 offline rc=0,
  online --rerun 뒤 .py가 없고 폴더에는 .gitignore와 로그 둘만, git status --porcelain이
  비어 있다. 실패시키면 git status에는 바꾼 approved 파일만 보인다. 설정 단계에서 leaf의
  Test 태스크 여덟 모두 환경 변수가 1이다(main은 모두 null).
- 깨끗한 worktree(트리 7aac4cee): scripts/verify.sh pr --no-cache rc=0(530 executed,
  FROM-CACHE 0, 시험 7,269 실패 0), scripts/verify.sh main --no-cache rc=0(바깥 446
  executed·FROM-CACHE 0, 시험 1,980 실패 0).
2026-11-20 15:25:22 +09:00

50 lines
1.8 KiB
Plaintext

.vscode/
src/**/bin/
# Gradle and IDE output. The wrapper jar is the one binary the build needs from the tree.
.gradle/
build/
!gradle/wrapper/gradle-wrapper.jar
.idea/
*.iml
.project
.classpath
.settings/
# jqwik property-test runtime state
.jqwik-database
# ApprovalTests writes <test>.received.<ext> next to each <test>.approved.<ext> snapshot, under the
# test's source folder, when it compares and deletes it when they match; a failed comparison leaves
# it behind. Approve by copying it over the approved file, never by committing it. Only Java source
# folders: fixtures elsewhere may carry ".received." in their names. An approved snapshot is never
# ignored, even when a test parameter puts ".received." into its name; in turn a received file whose
# parameter puts ".approved." into its name shows up in `git status`.
src/**/src/*/java/**/*.received.*
!src/**/src/*/java/**/*.approved.*
.DS_Store
# Local Claude Code state (worktrees, settings.local.json, notes) stays out. The shared project
# settings, path rules, skills and subagent definitions are committed: everyone who opens the repository gets them (CLAUDE.md).
.claude/*
!.claude/settings.json
!.claude/rules/
!.claude/agents/
!.claude/skills/
# Operator input, not a build input. The examples beside it are the tracked contract;
# verifyEnvKeys reads the registry, the profile YAMLs and .env.example, never a real one.
/.env*
!/.env.example
!/.env.local.example
# Written per run by the runtime-smoke wrapper; never committed.
/.env.lane
# bootRun's file log when APP_LOG_FILE_ENABLED=true: APP_LOG_FILE_PATH is relative to the repository root.
/logs/
# Local tool output (graphify knowledge graph, Playwright MCP snapshots).
graphify-out/
.playwright-mcp/
# Python bytecode from running scripts/ checks; never committed.
__pycache__/
*.pyc