Wrapper API 는 contract 묶임; 뒤 모델은 아님
AI 서비스는 CI 에서 test 할 layer 두 개:
- API layer — request/response shape, status code, auth, rate limit. 정통 contract test.
- Model layer — 의미 / 행동 정확성. Eval 스타일 test.
첫 layer 는 downstream consumer 가 의존하는 것; 안정해야 함. 둘째 layer 는 합의된 범위 내에서 변동 허용.
API contract test
- OpenAPI / Pydantic schema — 모든 response 가 문서화된 shape 에 검증.
- Status code matrix — 빈 입력 → 400; unauthorized → 401; rate limit → 429; happy path → 200.
- Streaming 프로토콜 — SSE / WebSocket 에 event 유형, chunk 구분자, 종료 event 단언.
- 하위 호환성 — 필드 추가될 때 옛 클라이언트 동작 유지; deprecation 창 없이 필드 제거 절대 금지.
모델 mocking
API contract test 는 밑 모델 mock. 실제 모델 호출은 느리고 비싸고 비결정적. Schema 매치하는 canned response 반환하는 가짜 adapter 주입. Eval layer (별도 job) 가 실제 모델 동작 처리.