process: prevent newline-escaped Gitea comments via helper + guard (#372) #378
Reference in New Issue
Block a user
Delete Branch "feature/issue-372-comment-newline-guard"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Linked Issue
Summary
scripts/tea_comment.sh\\ntext onlydocs/workflow.md: add mandatory troubleshooting pattern for commentsdocs/commands.md: addComment Newline Escapingfailure/solution sectionscripts/validate_governance_assets.pynow requiresscripts/tea_comment.shmention in workflow/commands docsComment Newline Escapingsection token in commands doctests/test_validate_governance_assets.pyValidation
python3 scripts/validate_governance_assets.pypython3 scripts/validate_docs_sync.pypytest -q tests/test_validate_governance_assets.pyPR 리뷰 (Claude Code)
전체 판정: ⚠️ 조건부 승인 — 아래 2개 지적 사항 확인 필요
[BLOCK] Closes #372 범위 부적절
이 PR이 해결하는 문제는 코멘트 줄바꿈 이스케이핑입니다.
#372의 Acceptance Criteria는 다음이었습니다:
이 PR은 3개 모두 충족하지 않습니다.
새
must_contain토큰을 추가해 governance 강제를 일부 강화하긴 했으나, 이는 newline escaping 이슈를 문서에서 없애지 못하도록 막는 것이지 #372가 요구하는 validator 강제력 강화(타임존/traceability/READ-ONLY fail-fast)와 직접 연결되지 않습니다.권장 처리:
Closes #372→References #372로 변경하고 #372는 별도로 남겨 두거나, 이 PR이 해결하는 문제를 별도 이슈로 소급 등록 후 Closes를 그 이슈로 연결하는 방향을 권장합니다.[WARN] 신규 governance check에 대한 테스트 미추가
validate_governance_assets.py에 추가된 두must_contain토큰(scripts/tea_comment.sh,Comment Newline Escaping)이 테스트로 커버되지 않습니다.기존 테스트(
test_validate_governance_assets.py)는tmp_path로 파일을 mock해must_contain동작을 검증하는 패턴을 이미 사용 중이므로 동일 방식으로 추가 가능합니다.tea_comment.sh자체(빈 본문 guard, escaped-newline guard, stdin 경로)에 대한 테스트도 없습니다. 스크립트 테스트는 선택적이지만, guard 로직은 이 PR의 핵심 안전 장치이므로 커버 있는 게 바람직합니다.긍정적 사항
tea_comment.sh스크립트 구조는 양호합니다.set -euo pipefail, stdin 지원, 빈 본문 체크, escaped-newline guard 모두 적절합니다.[[ "$BODY" == *"\\n"* ]] && [[ "$BODY" != *$'\n'* ]]은 파일 기반 입력을 전제할 때 false positive 위험이 낮고 의도에 부합합니다.must_contain으로 문서에서 사라지지 않도록 고정한 접근이 올바른 방향입니다.리뷰 반영했습니다.
Closes #372->References #372로 PR 본문 수정 완료tests/test_validate_governance_assets.pyscripts/tea_comment.sh) 검증 테스트Comment Newline Escaping,scripts/tea_comment.sh) 검증 테스트추가 검증:
pytest -q tests/test_validate_governance_assets.py(14 passed)python3 scripts/validate_governance_assets.pypython3 scripts/validate_docs_sync.py추가 리뷰 (Claude Code)
이전 지적 반영 현황
Closes #372→References #372[WARN] 테스트가 happy path만 검증 — guard 퇴행을 감지 못함
추가된 두 테스트 모두 토큰이 있을 때
errors == []인지만 확인합니다.must_contain의 핵심 역할은 토큰이 없으면 error를 추가하는 것인데,지금 테스트 구조에서는 나중에
validate_governance_assets.py에서scripts/tea_comment.sh또는Comment Newline Escaping토큰을 실수로 제거해도테스트가 통과합니다. 즉 이 PR이 추가한 guard가 사라져도 CI가 잡지 못합니다.
필요한 것은 unhappy path 케이스입니다:
나머지 사항
코드/docs 변경은 이전과 동일하며 문제 없습니다.
추가 리뷰 반영했습니다.
test_must_contain_fails_when_workflow_missing_newline_helper_tokentest_must_contain_fails_when_commands_missing_newline_section_token검증:
pytest -q tests/test_validate_governance_assets.py(16 passed)python3 scripts/validate_governance_assets.pypython3 scripts/validate_docs_sync.py최종 리뷰 (Claude Code)
이전 지적 전체 반영 확인
Closes #372→References #372판정: ✅ LGTM
추가된 4개 테스트 구조가 올바릅니다.
test_must_contain_fails_when_workflow_missing_newline_helper_token: workflow.md에scripts/tea_comment.sh누락 시 errors에 포함 확인test_must_contain_fails_when_commands_missing_newline_section_token: commands.md에Comment Newline Escaping누락 시 errors에 포함 확인이제 나중에
validate_governance_assets.py에서 해당 토큰이 제거되면 CI가 즉시 감지합니다. guard가 조용히 사라지는 퇴행이 방지됩니다.