Skip to content

feat: Phase 6 — 클라이언트 사이드 Validation, --from 자동선택, 빌드 인프라#2

Merged
Palbahngmiyine merged 2 commits intomainfrom
feat/phase-6-validation-infra
Apr 8, 2026
Merged

feat: Phase 6 — 클라이언트 사이드 Validation, --from 자동선택, 빌드 인프라#2
Palbahngmiyine merged 2 commits intomainfrom
feat/phase-6-validation-infra

Conversation

@Palbahngmiyine
Copy link
Copy Markdown
Member

Summary

  • PRD 2.3.7 클라이언트 사이드 메시지 Validation 구현 (pkg/validation/ 신규 패키지, 21개 파일)
    • 텍스트 길이 함수 (EUC-KR/유니코드/UTF-16), 전화번호 정규화/검증, Auto-Type Detection
    • SMS/LMS/MMS/ATA/BMS(8개 타입)/RCS(4개 서브타입) 타입별 Validator
    • --skip-validation, --strict 플래그, 검증 에러 테이블 출력
  • PRD 2.4.4 --from 자동 선택: resolveFrom() — senderid API 조회 → 0/1/2+ 분기
  • User-Agent HTTP 헤더: solactl/{version} ({os}/{arch})
  • CSV 배치 진행 카운터: [1/10] 100건 발송 중...
  • 빌드 인프라: .goreleaser.yaml (6 platform), Makefile
  • 5라운드 반복 코드 리뷰 → 19건 이슈 발견/수정 → 0건 잔여

Test plan

  • go test ./... -race -count=1 — 전체 858개 테스트 통과
  • go test ./pkg/validation/... -race -count=1 — validation 패키지 단독 통과
  • 기존 310개 테스트 회귀 없음 확인
  • fuzz 테스트 포함 (textlen, phone, validate)
  • 동시성 테스트 포함 (ValidateMessages_Concurrent)
  • 경계값 테스트 (SMS 90바이트, LMS 2000바이트, ATA 1000자, BMS 76/1300자, RCS 100/1300/2600자)
  • 5라운드 codex review 수렴 (Round 5: "No material findings")

🤖 Generated with Claude Code

PRD 2.3.7에 명시된 클라이언트 사이드 메시지 Validation과 추가 기능을 구현합니다.

주요 변경사항:

**pkg/validation/ 신규 패키지 (21개 파일)**
- 텍스트 길이 함수: GetTextLength (EUC-KR), GetRealTextLength (유니코드), GetJSStringLength (UTF-16)
- 전화번호 정규화/검증: NormalizePhone, ParsePhone (+82 한국 국가코드 지원)
- Auto-Type Detection: SMS/LMS/MMS/ATA/BMS/RCS 자동 감지
- 타입별 Validator: SMS(≤90B), LMS(≤2000B), MMS(imageId 필수), ATA(≤1000자),
  BMS 8개 타입, RCS 4개 서브타입
- 통합 진입점: ValidateMessages() + --skip-validation/--strict 플래그
- 경계값/fuzz/동시성 테스트 포함

**--from 자동 선택 (PRD 2.4.4)**
- resolveFrom(): senderid API 조회 → 0개 에러, 1개 자동선택, 2+ 목록 표시
- SMS/LMS/MMS/RCS 서브커맨드에 적용, flag 검증 후 호출

**추가 기능**
- User-Agent HTTP 헤더: solactl/{version} ({os}/{arch})
- CSV 배치 진행 카운터: [1/10] 100건 발송 중...
- LMS/MMS 메시지에 Type 필드 명시 설정
- context 만료 시 retry 즉시 탈출

**빌드 인프라**
- .goreleaser.yaml: darwin/linux/windows × amd64/arm64
- Makefile: build, test, test-race, lint, fuzz, clean

**테스트 품질 보강**
- t.Cleanup 추가 (types, apierror, version, semver 테스트)
- partial success+failure 배치 테스트
- resetSendFlags에 skip-validation/strict 추가
- 5라운드 반복 코드 리뷰 → 19건 이슈 발견/수정 → 0건 잔여

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces comprehensive client-side validation for the solactl CLI, covering phone normalization, message type auto-detection, and specific constraints for SMS, LMS, MMS, AlimTalk, BMS, and RCS. Key enhancements include automatic sender ID resolution, User-Agent header integration, and the addition of a Makefile and GoReleaser configuration. Feedback focuses on improving the robustness of phone normalization against leading whitespace, ensuring informational messages are sent to stderr to avoid corrupting stdout JSON streams, using 1-based indexing for user-facing error messages, and correcting a logic discrepancy in BMS button type validation.

Comment thread cmd/send.go Outdated
Comment thread pkg/validation/phone.go Outdated
Comment thread cmd/send.go Outdated
Comment thread pkg/validation/common.go Outdated
Comment thread pkg/validation/validate_bms.go Outdated
- stdout/stderr 분리: 정보성 메시지(검증 오류, 배치 진행, 발신번호 자동선택)를
  errOut()으로 라우팅하여 --json 출력 오염 방지
- errWriter 추상화 도입 (outWriter 패턴과 동일) 및 테스트 인프라 구축
- NormalizePhone: i==0 → b.Len()==0 수정으로 "(+82)" 등 선행 문자 뒤 '+' 보존
- 사용자 노출 인덱스 0-based → 1-based 통일 (send.go, common.go, errors.go)
- BMS_COMMERCE 빈 buttonType 허용 제거
- extractCountryCode doc comment 오류 수정
- configure_show.go 경고 메시지 stderr 전환
- stderr 캡처 테스트, 메시지 내용 검증 테스트, stdout 음성 검증 추가

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Palbahngmiyine Palbahngmiyine merged commit a60fb88 into main Apr 8, 2026
@Palbahngmiyine Palbahngmiyine deleted the feat/phase-6-validation-infra branch April 16, 2026 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant