slot 블록 보강 - 원복 restart 폴백과 슬롯 이름 허용목록 - #39
Conversation
- slot_switch 원복 경로가 reload 실패를 삼키면 상태 파일은 이전 슬롯인데 nginx 런타임은 새 슬롯을 가리키는 창이 남고, 그 사이 호출자가 새 슬롯 컨테이너를 정리하면 서빙이 끊긴다 (extractor#30 CodeRabbit 지적 수용). 전환과 같은 restart 폴백을 원복에도 적용 - restart 마저 실패하면 nginx 정지이므로 수동 기동만으로 상태 파일(이전 슬롯) 그대로 복귀한다 - 원복 시 별도 nginx -t 는 두지 않는다 - reload/restart 가 구성 검증을 내장하고, 원복 대상은 직전까지 서빙하던 구성이다 - slot_decide 출력은 eval 로 소비되는 계약이라 슬롯 이름 charset 을 [A-Za-z0-9_-] 허용목록으로 닫는다 (현 호출부는 고정 리터럴이지만 미래 호출부의 명령 주입 표면을 블록이 스스로 차단) - 테스트 2케이스 추가: 허용목록 밖 이름 거절, verify 실패 + reload 불가 시 restart 폴백으로 원복 반영
📝 WalkthroughWalkthrough슬롯 이름에 허용 문자 검증을 추가했다. Changes슬롯 전환 안정성
Estimated code review effort: 2 (Simple) | ~15 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
blocks/slot_switch.test.sh (1)
102-111: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win
reload및restart동시 실패 경로를 추가로 검증하세요.현재 테스트는
systemctl_reload_fail만 설정합니다. 따라서restart폴백 성공과 두 번의 호출만 검증하고,blocks/slot_switch.sh의 Line 66-68 분기는 실행하지 않습니다.systemctl_fail도 설정한 별도 케이스에서 종료 코드, 이전 상태 파일 유지,restore reload/restart FAILED오류 출력을 확인하세요.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@blocks/slot_switch.test.sh` around lines 102 - 111, Add a separate test case in the slot-switch test flow that enables both systemctl_reload_fail and systemctl_fail, then runs the failed verification rollback scenario. Assert exit code 1, preservation of the previous state file, and the expected “restore reload/restart FAILED” error output, covering the failure branch in blocks/slot_switch.sh.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@blocks/slot_switch.test.sh`:
- Around line 102-111: Add a separate test case in the slot-switch test flow
that enables both systemctl_reload_fail and systemctl_fail, then runs the failed
verification rollback scenario. Assert exit code 1, preservation of the previous
state file, and the expected “restore reload/restart FAILED” error output,
covering the failure branch in blocks/slot_switch.sh.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: cff7662e-5546-4ec9-97ba-bb3c193f006d
📒 Files selected for processing (4)
blocks/slot_decide.shblocks/slot_decide.test.shblocks/slot_switch.shblocks/slot_switch.test.sh
Situation
Action
Result
연관 이슈
Summary by CodeRabbit
버그 수정
테스트