fix(scripts)!: .env 무시 규칙과 문서 참조 검사, verify --on 원격 준비의 정리와 자동 gc를 고친다 #108
Open
donghyeon.kang
wants to merge 6 commits from
fix/verify-remote-prep-env-rules into main
pull from: fix/verify-remote-prep-env-rules
merge into: :main
:main
:fix/verify-remote-prep-env-rules
:fix/notification-template-refusal-carriers
:fix/in-process-lock-per-key
:fix/notification-secret-key-id-purpose
:fix/draft12-chunked-create-body
:fix/notification-admin-refusal-carriers
:fix/notification-lookup-hmac-rotation-guard
:fix/repository-contract-wrapper-input
:test/web-graceful-shutdown-inflight
:fix/notification-idempotency-conflict-carrier
:fix/compose-contract-verdict-false-pass
:fix/lock-handle-idempotent-close
:fix/core-redrive-missing-attempt-and-lease-field
:fix/verify-remote-stdin
:test/lock-contract-bounded-waits
:fix/verify-remote-log-header
:test/lease-value-bounds
:refactor/ratelimit-shared-bounds
:test/objectstorage-production-client-timeouts
:fix/verify-junit-summary
:fix/env-contract-nested-placeholder
:fix/notification-eligibility-and-redrive
:fix/httpclient-docs-field-match
:test/fileserver-admin-access-checks
:fix/gitignore-nested-env
:fix/check-docs-reference-rules
:fix/hooks-n5-verify-sh-n6-records
:fix/hooks-verify-sh-and-record-body
:test/compose-contract-verdict
:test/fileserver-precondition-and-policy-wiring
:ci/nfs-nightly-host-check-and-pin
:test/notification-worker-behavior
:test/mongo-tls-lane-handshake-refusal
:test/compose-smoke-judgements
:test/notification-admin-guards-cancel-branches
:claude/links-dns-probe
:docs/ledger-fixed-by-49-50
:claude/be-main-red2-minio-2
:claude/be-main-red2-compose
:claude/be-main-red2-minio
:claude/r9-b-claim-tx
:claude/w2-be-ci-perf-4
:claude/r9-review-record
:claude/r9-c-tests-build
:claude/r9-c-docs-body
:claude/r9-c-contracts
:claude/r9-compose-ops
:claude/r9-public-surface
:claude/r9-stale-names
:claude/r9-tx-timeouts
:claude/r9-env-keys
:claude/r9-arch-rules
:claude/w2-be-ci-perf-2
:claude/w2-be-ci-perf-2-wip
:claude/redteam-be-fixes-main
:claude/w2-be-ci-perf-e89fe7
:claude/redteam-be-fixes
:claude/t2a-backend-ci-451e3b
:claude/x3-messaging-library-1aa3fa
:claude/x2-grpc-library-43dd09
:claude/h3-backend-harness-34fc23
:claude/v1-vuln-fix-e089b9
:claude/i2-docs-merge-02df15
:claude/d2c-ops-docs-1-c22c9f
:claude/d2a-entry-docs-12a342
:claude/d2b-src-adr-d46d23
:claude/d2d-ops-docs-2-e40938
:claude/i1-layout-docs-merge-217f1e
:refactor/maturity-review-2026-11
:claude/t1-backend-layout-46973e
:claude/d1-docs-system-fd4a0f
:claude/integration-r9-f1bc5c
:claude/r9-g1-inbound-456713
:claude/r9-g3-migration-7ce36d
:claude/r9-g2-stomp-interceptor-f5675d
:claude/r9-g4-idempotency-c669be
:claude/manual-gap-fix-2-9b0fe2
:claude/r8-review-a-3851a7
:claude/integration-r8-a4196a
:claude/r8-f1-transport-errors-b21ebf
:claude/r8-f5-small-fixes-f40412
:claude/r8-f3-persistence-9e8157
:claude/r8-f2-arch-rules-60140e
:claude/r8-f4-idempotency-3a6a0f
:claude/manual-gap-fix-1-824a41
:claude/t4-2-manual-history-ids-9ac57c
:claude/t1-r10-review-d0ecc6
:claude/integration-r7
:claude/t5-idempotency-operation-id-9bd973
:claude/t3-error-codes-loglevel-fcf427
:claude/t1-baseline-7d623a
:claude/t2-circuit-breaker-2ff8df
:claude/t4-manual-history-ids-51889f
:claude/b3-docs-work-34a1dd
:claude/perf-assertions-fail-closed-c09414
:claude/improvement-manual-6ae516
:refactor/review-followup
6
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
0061b39ba7 |
Merge branch 'main' into fix/verify-remote-prep-env-rules
pr / done (pull_request) Successful in 2m11s
|
||
|
|
9b34d2a728 |
fix(verify): 원격 fetch와 worktree add를 잠금 안으로 옮기고 gc를 fetch 안에서 끝낸다
문제: 앞 커밋 fb7f2ab80은 원격 준비의 fetch와 worktree add에 `-c gc.auto=0`을 주어, 자동 gc가 만드는 중인 worktree를 읽고 실패하는 것을 막았다. 그런데 desktop 공용 checkout은 verify와 `docs/work/operate.md` 4.1절 손 절차로만 쓰고 둘 다 gc를 끄므로, 그 checkout에서 자동 gc가 도는 길이 사실상 없어진다. 23:35에 읽기만 해서 본 그 checkout은 loose 9379개·pack 52개로 자동 기준(6700개·50개)을 넘었고, gc·maintenance 설정과 예약이 없다. 고른 방법: fetch와 worktree add를 잠금(fd 9의 flock) 뒤로 옮기고 `gc.auto=0`을 뺀다. 다른 실행은 잠금에서 기다리므로 그 gc와 겹치지 않는다. 같은 실행 안의 겹침은 fetch에 `-c gc.autoDetach=false`를 주어 막는다. 자동 gc는 기본으로 fetch가 돌아온 뒤에도 뒤에서 돌아 바로 다음 worktree add와 겹치기 때문이다. client가 끊긴 실행이 지난 로그를 바꾸지 않게 하는 쓰기(「잠금을 얻었다」)는 준비 뒤, 로그를 바꾸기 바로 앞으로 옮겼다. 잠금 이름·대기 방식과 0055의 정리 순서는 그대로다. 손 절차도 같은 잠금과 옵션으로 fetch·worktree add를 한다. 버린 안: fb7f2ab80의 `-c gc.auto=0`(위 문제). review가 2026-11-23 23:2x에 이 안으로 판정했다. 위험·한계: 겹친 실행이 fetch부터 기다리고, 트리 해시가 다른 patch도 잠금을 얻은 뒤에야 실패한다. autoDetach=false인 gc는 gc.log를 보지 않고 돌며, 끝나면 git이 gc.log를 지운다. 그래서 병합 뒤 desktop 첫 실행은 11-24 08:32를 기다리지 않고 쌓인 object를 잠금 안에서 gc한다(desktop /tmp 사본에서 4.18초, pack 52→2, loose 0). 그 뒤 최근(2주 안) 도달 못 하는 loose가 다시 기준을 넘고 pack이 50 아래이면 실행마다 증분 gc(노트북 사본 0.2초)가 돌고 `warning: There are too many unreachable loose objects`가 찍힌다. pack이 50을 넘으면 전체 repack이 그 loose를 cruft pack으로 거둔다. verify 밖에서 잠금 없이 띄운 gc는 여전히 겹칠 수 있다. 검증: `test_verify_remote.py`의 0065 사례를 셋으로 바꿨다. fetch와 worktree add가 잠금을 쥔 채 돈다. fetch가 gc.auto를 끄지 않고 gc.autoDetach=false로 돈다. 잠금 안 fetch 중 client가 끊긴 실행은 rc 4로 끝나고 지난 로그와 worktree를 남기지 않는다. 앞 둘은 고치기 전( |
||
|
|
5f1aba02c4 |
fix(gitignore): .env 폴더 안 파일을 되살리는 법을 적고 문서 검사 시험에 그 경로를 더한다
문제: 첫 리뷰 Low 둘. `.gitignore` 주석은 `.env`로 시작하는 폴더도
무시된다고 하면서 되살리는 법으로 파일의 정확한 경로만 든다. 그런데
부모 폴더가 무시되면 git은 그 안 파일을 되살리지 못한다:
`!/compose/.env.d/sample.conf`를 더해도 rc=0(무시)이고 `git add -A`가
말없이 뺀다. 새 문서 검사 시험은 `.env*` 폴더 안 파일 경로를 넣지
않아, `names_env_file`을 마지막 마디만 보게 좁혀도 통과한다.
고른 방법: 주석에 그런 파일은 폴더(`!/compose/.env.d/`)로만 되살아나고
그러면 폴더 안 `.env*` 이름 밖의 파일이 모두 추적된다고 적는다. 시험의
없는 경로에 `compose/.env.d/app.conf`를 더한다.
위험·한계: 규칙 줄은 바뀌지 않는다(주석만).
검증: 임시 repo에서 `!/compose/.env.d/sample.conf`는 rc=0·`add -A` 0개,
`!/compose/.env.d/`는 sample.conf rc=1·`add -A` 1개, 폴더 안
`.env.local`과 다른 폴더의 `.env.sample`은 rc=0 그대로. 시험은 마지막
마디만 보는 변이와 고치기 전 `check-docs.py`(
|
||
|
|
fb7f2ab80a |
fix(verify): 원격 fetch와 worktree add가 자동 gc를 띄우지 않게 한다
문제: 원격 스크립트는 desktop 공용 checkout에서 `git fetch`와 `git worktree add`를 잠금 밖에서 한다. fetch가 띄운 자동 gc는 뒤에서 계속 돌며 모든 worktree의 HEAD를 읽는데, 이 실행이나 겹친 실행이 만드는 중인 worktree를 만나면 `fatal: bad object worktrees/verify-…/HEAD`로 실패하고 `.git/gc.log`를 남긴다. gc.log가 있는 동안(`gc.logExpiry` 기본 1일) 자동 gc는 막히고 그 뒤 실행 로그마다 같은 경고가 찍혀 진짜 실패와 헷갈린다. fetch의 rc는 바뀌지 않아 게이트 판정은 틀리지 않는다. 고른 방법: fetch와 worktree add에 `-c gc.auto=0`을 준다. 값은 자식 git에도 넘어가 fetch가 띄우는 `maintenance run --auto`가 gc를 건너뛴다. 잠금 순서와 대기 방식, 0055가 정한 정리 순서는 그대로다. 손으로 하는 절차 (`docs/work/operate.md` 4.1절)의 같은 두 명령도 맞췄다. 버린 안: 둘을 잠금 안으로 옮김. 자동 gc는 기본으로 뒤에서 도니 같은 실행의 fetch가 띄운 gc가 바로 다음 worktree add와 여전히 겹치고, 겹친 실행이 준비 단계부터 줄을 서며, 트리가 다른 patch가 잠금을 기다린 뒤에야 실패한다. 위험·한계: verify의 fetch는 더는 desktop checkout의 자동 gc를 띄우지 않는다. 그 checkout에서 다른 명령이 gc를 띄우지 않으면 pack과 loose object가 쌓인다(정리는 이 변경 밖이다). verify 밖의 명령(사람이 한 fetch 등)이 띄운 gc는 여전히 만드는 중인 worktree와 겹칠 수 있다. desktop의 지금 gc.log는 지우지 않았다(11-24 08:32 뒤 저절로 풀린다). 검증: `test_verify_remote.py`에 원격 쪽 git을 가짜로 바꿔 fetch·worktree add마다 그 명령이 보는 gc.auto와 잠금 상태를 적는 사례를 더했다. 고치기 전 [fetch False, worktree add False]로 실패, 고친 뒤 통과. 한쪽씩 옵션을 빼는 변이 둘에서 실패한다. git 2.43(노트북·desktop 같음) 실험: 자동 gc 조건(pack 2개 > autoPackLimit 1)을 넘기는 fetch가 옵션 없이 `git gc`를 띄워 pack을 1개로 합치고, `-c gc.auto=0`이면 띄우지 않아 2개로 남는다. `scripts/verify.sh docs` rc=0(시험 381). Refs: REV-BE-0065 |
||
|
|
0facd86249 |
fix(scripts): verify.sh --on 원격 준비가 실패해도 보낸 patch와 임시 폴더를 지운다
문제: `run_remote`는 patch를 원격 `/tmp/<id>.patch`로 먼저 보낸다. 그것을 지우는 trap은 checkout으로 cd, `git fetch`, `mktemp -d`, `git worktree add`를 지난 뒤에야 걸린다. 그 넷 중 하나가 실패하면 rc 4로 끝나고 정리가 돌지 않아, 커밋 안 된 변경이 든 patch(worktree add 실패면 빈 임시 폴더도)가 desktop `/tmp`에 쌓인다. 고른 방법: 정리 함수와 trap을 원격 script 맨 앞, 첫 실패 지점(cd) 앞에 둔다. 정리는 patch를 먼저 지우고, worktree를 만든 뒤에만(`added`) `worktree remove --force`를 하고, worktree가 되기 전의 `mktemp` 폴더는 남아 있고 빈 때만 `rmdir`한다(worktree add가 중간에 실패하면 git이 그 폴더를 지운다). `mktemp -d` 실패도 rc 4로 끝낸다. 버린 안: 실패 줄마다 정리 명령을 붙임(새 실패 지점이 생기면 또 빠진다). 위험·한계: patch를 보내는 ssh 자체가 끊기거나 `bash -s` 연결이 실패하면 원격에서 아무것도 돌지 않으니 patch는 남는다(이 변경으로 고칠 수 없다). 트리 비교, 잠금, 단계 rc 전달은 그대로다. 검증: `scripts/tests/test_verify_remote.py`에 checkout 없음·fetch 실패· worktree add 실패(어느 branch에도 없는 기준)·패치 얹기 실패·통과 다섯 사례를 더했다. 고치기 전 앞 셋은 patch(worktree add는 임시 폴더도)가 남아 실패했고, 뒤 둘은 통과했다. 고친 뒤 다섯 모두 rc 4·0 그대로 통과한다. trap을 원래 자리(worktree add 뒤)로 옮기는 변이에서 앞 셋이, `rmdir`를 빼는 변이에서 worktree add 실패 사례가 실패한다. Refs: REV-BE-0055 |
||
|
|
e6318da2c5 |
fix(gitignore): .claude/ 아래 env 예시 이름도 무시하고 없는 env 경로를 문서에서 잡는다
문제: `.env*` 블록이 `.claude/*` 뒤에 있어 `!**/.env.example`과 `!**/.env.local.example`이 `.claude/*`를 이긴다. 그래서 `.claude/.env.example`, `.claude/.env.local.example`과 그 이름 폴더 안 파일이 `git add -A`에 올라간다. 블록 주석은 smoke wrapper가 `.env.lane`을 쓴다고 하지만 지금 wrapper는 지우기만 하고, 규칙이 `.env`로 시작하는 모든 이름을 말없이 뺀다는 것과 새 예시를 어떻게 되살리는지는 말하지 않는다. 문서 참조 검사는 무시되는 경로를 건너뛰므로 없는 `src/.env`, `compose/.env.lane.example`을 적은 문서와 registry 행이 통과한다. 고른 방법: 블록을 `.claude/*` 앞으로 옮기고 규칙 세 줄은 그대로 둔다. 주석은 옛 wrapper가 남긴 파일, 실제 범위(`.envrc`·`.env_x`도), `add -A`가 말없이 뺌, 블록 아래 루트부터 적은 정확한 경로로만 되살림을 적는다. `check-docs.py`는 `.env`로 시작하는 마디가 있는 대상을 무시 경로 건너뛰기에서 뺀다. 빌드가 만드는 build/ 출력과 달리 없는 env 파일은 아무것도 만들어 주지 않는다. 버린 안: `**/.env*`를 좁힘(`.envrc`·`.env-local`·`.env_prod`가 열린다), `!**/.env*.example`(비밀 예시 이름이 모든 폴더에서 열린다). 위험·한계: 무시 범위는 그대로다. `.claude/skills/` 같은 되살린 폴더 안의 예시 이름은 여전히 추적된다(예시는 어느 폴더에서든 계약이다). 실제 env 파일 내용은 읽지 않았다. 검증: 가짜 repo의 `git check-ignore --no-index -q`에서 `.claude/` 셋이 고치기 전 rc=1, 뒤 rc=0. `.env`·`src/.env`·`src/.env.local`·`.env.lane`은 rc=0, 예시 넷과 `.claude/skills/d/.env.example`은 rc=1 그대로, 추적 파일 전체 `--stdin` rc=1. 새 시험은 고치기 전 실패, 예외를 빼거나 모두 검사하는 변이에서 실패, 고친 뒤 통과. `check-docs.py --only reference` rc=0(걸림 0). Refs: REV-BE-0052 |