주간 크레딧 요약 스크립트 일요일 가드 반영 확인
주간 크레딧 요약 스크립트 일요일 가드 반영 확인
결론
- 비일요일 날짜 인자 가드와 manifest target 불일치 가드, --force 우회, .bak 백업 코드가 canonical 스크립트에 반영된 것을 확인했다.
- 가드 테스트 5건 전부 통과(5 passed, exit 0).
- 이 기록은 cowork 반려 건(비일요일 날짜 인자 가드)과 ron 재기록 건을 실제 경로 기준으로 다시 적은 것이다. 이전 보고의 잘못된 경로(워크스페이스 하위 tests/, 워크스페이스 루트 스크립트)는 실존하지 않는 경로였다.
대상 파일 (실경로)
| 구분 | 절대경로 | 수정 시각 |
|---|---|---|
| 스크립트 | /Users/ron/knowledge-agent/400-reports/hermes-research-sales-engine/scripts/build_weekly_credit_house_summary.py | 2026-09-26 22:07 |
| 테스트 | /Users/ron/knowledge-agent/400-reports/hermes-research-sales-engine/tests/test_weekly_credit_house_summary_guard.py | 2026-09-26 22:06 |
- 호출 크론: job 5c45c26045be '주간 크레딧 리포트 요약본' (매주 일요일 09:00, 다음 실행 2026-09-27)
검증 1 — pytest (조회 2026-09-26 23:22:38 KST)
명령: cd /Users/ron/knowledge-agent/400-reports/hermes-research-sales-engine && python3 -m pytest tests/test_weekly_credit_house_summary_guard.py -q
결과: 5 passed in 0.28s, exit 0
테스트 목록 (/Users/ron/knowledge-agent/400-reports/hermes-research-sales-engine/tests/test_weekly_credit_house_summary_guard.py): - 53행 test_non_sunday_guard_and_cli_leave_files_untouched - 72행 test_sunday_build_writes_pdf_and_manifest - 84행 test_validation_failure_only_writes_failed_manifest - 104행 test_mismatched_manifest_requires_force_and_force_backs_up_both - 126행 test_force_allows_saturday
검증 2 — 가드 코드 위치 grep (조회 2026-09-26 23:22 KST)
명령: grep -n 'weekday() != 6|sys.exit(3)|--force|.bak' /Users/ron/knowledge-agent/400-reports/hermes-research-sales-engine/scripts/build_weekly_credit_house_summary.py
결과:
- 20행: 중단하며, 의도적 재생성은 --force로만 허용한다.
- 306행: if target.weekday() != 6 and not force: — 일요일 가드
- 309행: "reason": "일요일 날짜가 아님 ... --force 사용",
- 312행: sys.exit(3) — 비일요일 중단
- 334행: "reason": "기존 manifest의 target이 대상 날짜와 다름 ... --force 사용",
- 338행: sys.exit(3) — manifest target 불일치 중단
- 381행: backup_path = path.with_name(f"{path.name}.bak-{backup_suffix}") — 덮어쓰기 전 백업
- 395행: parser.add_argument("--force", action="store_true", help="일요일/manifest target 가드를 우회")
비실행 원칙
- 스크립트 본체는 실행하지 않았다(실행 시 PDF·근거목록 생성/덮어쓰기 위험). 확인은 테스트와 정적 grep으로만 했다.
관련
- [[weekly-credit-onepager-build]] · [[hermes-research-sales-engine]]