chore: clean up review files and update log_safety_test

This commit is contained in:
toki 2026-07-06 15:45:56 +09:00
parent 0e93b615f6
commit d8fa80e7bc
4 changed files with 68 additions and 20 deletions

View file

@ -18,13 +18,13 @@ date=2026-07-06
> **[REVIEW AGENT ONLY]** 이 체크리스트는 코드리뷰 에이전트만 사용한다.
> 구현 에이전트는 이 섹션을 수정하거나 체크하지 않는다.
- [ ] `코드리뷰 결과`에 `PASS`, `WARN`, `FAIL` 중 하나의 판정을 append한다.
- [ ] 판정과 Required/Suggested/Nit 분류가 서로 일치한다.
- [ ] active `CODE_REVIEW-*-G??.md`를 archive 로그로 이동한다.
- [ ] active `PLAN-*-G??.md`를 archive 로그로 이동한다.
- [ ] `.gitignore`의 Agent-Ops 관리 block을 확인한다.
- [ ] PASS이면 `complete.log`를 작성하고 active `.md` 파일을 남기지 않는다.
- [ ] PASS split 작업이면 이동 후 빈 active parent 정리 여부를 확인한다.
- [x] `코드리뷰 결과`에 `PASS`, `WARN`, `FAIL` 중 하나의 판정을 append한다.
- [x] 판정과 Required/Suggested/Nit 분류가 서로 일치한다.
- [x] active `CODE_REVIEW-*-G??.md`를 archive 로그로 이동한다.
- [x] active `PLAN-*-G??.md`를 archive 로그로 이동한다.
- [x] `.gitignore`의 Agent-Ops 관리 block을 확인한다.
- [x] PASS이면 `complete.log`를 작성하고 active `.md` 파일을 남기지 않는다.
- [x] PASS split 작업이면 이동 후 빈 active parent 정리 여부를 확인한다. active parent에는 sibling 작업이 남아 있어 유지했다.
## 계획 대비 변경 사항
- 계획에 `log_safety_test.go` 또는 `기존 OpenAI 테스트 파일`에 회귀 테스트 추가가 명시되어 있어 새 파일 `apps/edge/internal/openai/log_safety_test.go`로 작성했다.
@ -79,4 +79,16 @@ $ rg --sort path -n 'zap\.(String|Any)\("(prompt|content|reasoning|source|delta)
Go 테스트 11개(기존 9개 + 새로 추가한 2개)가 모두 PASS했고, `rg` grep은 런타임 로그에 남은 preview zap field를 전혀 출력하지 않는다. 예상 결과와 일치.
## 코드리뷰 결과
_리뷰 에이전트가 append한다._
### 2026-07-06 리뷰 판정
- 종합 판정: PASS
- 차원별 평가:
- correctness: Pass — OpenAI-compatible input/output/stream 로그에서 prompt/content/reasoning/source/delta preview 필드가 제거됐고, 내용 대신 길이/count 중심 메타데이터가 남아 있다.
- completeness: Pass — 계획 범위의 `chat_handler.go`, `responses_handler.go`, `stream.go`, `types.go`, 회귀 테스트 추가가 모두 반영됐다.
- test coverage: Pass — 패키지 테스트와 zap preview field 정적 검색이 통과했다.
- API contract: Pass — HTTP 응답, service submit payload, stream SSE 출력 계약 변경은 없다.
- code quality: Pass — 사용되지 않는 `previewString` 제거와 로그 helper 필드 정리가 일관적이다. 리뷰 중 `log_safety_test.go`의 주석/EOF newline만 비동작 보정했다.
- implementation deviation: Pass — 새 테스트 파일 사용과 `previewString` 완전 제거는 계획의 허용 범위 안이다.
- verification trust: Pass — 리뷰어가 `go test -count=1 ./apps/edge/internal/openai` 및 preview field `rg` 검증을 재실행했다.
- 발견된 문제: 없음
- 다음 단계: PASS로 active plan/review를 로그화하고 `complete.log` 작성 후 task directory를 archive로 이동한다.

View file

@ -0,0 +1,37 @@
# Complete - review_followup_alignment/01_openai_log_preview_guard
## 완료 일시
2026-07-06
## 요약
OpenAI-compatible 로그 preview 제거 후속 작업을 1회 루프로 검토했고 최종 판정은 PASS다.
## 루프 이력
| Plan | Review | Verdict | 메모 |
|------|--------|---------|------|
| `plan_local_G04_0.log` | `code_review_local_G04_0.log` | PASS | prompt/content/reasoning/source/delta preview 필드 제거, 길이/count 메타데이터 유지, 회귀 검증 통과 |
## 구현/정리 내용
- `apps/edge/internal/openai/chat_handler.go`, `responses_handler.go`, `stream.go`의 OpenAI-compatible input/output/stream 로그에서 `*_preview` zap 필드를 제거했다.
- `prompt_len`, `content_len`, `reasoning_len`, `delta_len`, `source_len`, count/finish metadata 등 비내용 관측 필드는 유지했다.
- 사용처가 사라진 `previewString` helper를 제거했다.
- `apps/edge/internal/openai/log_safety_test.go`에 preview field 부재와 운영 메타데이터 유지 회귀 테스트를 추가했다.
- 리뷰 중 `apps/edge/internal/openai/log_safety_test.go`의 비동작 주석/EOF newline 정리를 반영했다.
## 최종 검증
- `go test -count=1 ./apps/edge/internal/openai` - PASS; `ok iop/apps/edge/internal/openai 1.609s`
- `rg --sort path -n 'zap\.(String|Any)\("(prompt|content|reasoning|source|delta)_preview"' apps/edge/internal/openai` - PASS; 출력 없음
- `rg --sort path -n 'previewString|_preview|prompt_preview|content_preview|reasoning_preview|source_preview|delta_preview' apps/edge/internal/openai -g '!log_safety_test.go'` - PASS; 출력 없음
## 잔여 Nit
- 없음
## 후속 작업
- 없음

View file

@ -167,14 +167,14 @@ func TestLogRetainsNonContentMetadata(t *testing.T) {
// Each log line type should carry at least some non-content metadata.
wantAnyFields := []string{
"message_count", // chat input
"prompt_len", // chat input / responses input
"content_len", // chat output / stream closed
"reasoning_len", // chat output / stream closed
"finish_reason", // chat output
"message_count", // chat input
"prompt_len", // chat input / responses input
"content_len", // chat output / stream closed
"reasoning_len", // chat output / stream closed
"finish_reason", // chat output
"tool_call_count", // chat output
"delta_len", // stream output chunk
"source_len", // stream suppressed
"delta_len", // stream output chunk
"source_len", // stream suppressed
}
// Check that each log line carried at least one operational (non-preview)
@ -253,10 +253,9 @@ func TestNoPreviewFieldsOnSensitiveValues(t *testing.T) {
}
}
// Ensure the test package compiles and the _preview zap field type
// would cause a compile error if someone adds zap.String("..._preview", ...)
// in the production code (the previewString function was removed from
// types.go because no production code calls it).
// Ensure the test package compiles after removing previewString. The rg-based
// verification command remains the authoritative guard against new _preview
// zap fields in production code.
func TestCompileTimeNoPreviewFields(t *testing.T) {
// This test intentionally empty — the rg-based check in the final
// verification command is the authoritative regression gate.
@ -281,4 +280,4 @@ func TestLogOpenAICompatStreamOutputNoDeltaPreview(t *testing.T) {
t.Errorf("logOpenAICompatStreamOutput unexpectedly emitted delta_preview")
}
}
}
}