Skip to content

chore: clean up lint findings in fork-authored code - #8

Merged
pokabookinflab merged 1 commit into
mainfrom
feature/ci-lint-cleanup
Jul 28, 2026
Merged

chore: clean up lint findings in fork-authored code#8
pokabookinflab merged 1 commit into
mainfrom
feature/ci-lint-cleanup

Conversation

@pokabookinflab

@pokabookinflab pokabookinflab commented Jul 28, 2026

Copy link
Copy Markdown

Summary

golangci-lint on main was reporting 24 issues, all in fork-authored files, and CI 'Check (ubuntu/macos-latest)' had been failing every run since the v1.0.0 integration. This PR takes it to 0 issues without any behavior change.

Fixes

category count files
unconvert 16 endpointspec, gemini_gcpvertexai, gemini_cachedcontents_gcpvertexai, imageedit_openai_openai, openai_speech_dashscope, their tests
gci import order 2 endpointspec_test, openai_speech_dashscope
testifylint (require.Empty) 1 endpointspec_test
gocritic offBy1 (strings.Index → strings.Cut) 1 server_test
gosec G602 slice bounds (annotated nolint; guard proven above) 1 imageedit_openai_openai
govet shadow 1 openai_speech_dashscope
revive unused-parameter 2 openai_speech_dashscope, its test

Verification

  • go tool -modfile=tools/go.mod golangci-lint run --build-tags==test_crdcel,test_controller,test_extproc,test_e2e ./...0 issues
  • go build ./... && go vet ./...
  • go test ./internal/translator/... ./internal/endpointspec/... ./internal/extproc/... -count=1

🤖 Generated with Claude Code

Summary by CodeRabbit

  • 버그 수정
    • Gemini 및 음성 번역 요청에서 모델 정보가 일관되게 처리되도록 개선했습니다.
    • Vertex AI 모델명 정규화와 모델 오버라이드 처리를 안정화했습니다.
    • 프로젝트 경로 및 모델 식별자 처리 시 잘못된 경로를 안전하게 건너뛰도록 수정했습니다.
    • 음성 응답의 오디오 URL 검증 및 multipart 요청 처리를 개선했습니다.

golangci-lint on main was reporting 24 issues, all in fork-authored files —
CI 'Check' had been failing every run since v1.0.0 integration. Categories:

- **unconvert (16)**: internalapi.ModelNameOverride / OriginalModel /
  RequestModel / ResponseModel are all `type X = string` *aliases*, so the
  wrapping conversions were no-ops. Removed them from endpointspec,
  gemini_gcpvertexai, gemini_cachedcontents_gcpvertexai, imageedit_openai_openai,
  and openai_speech_dashscope.
- **gci (2)**: import ordering in endpointspec_test and openai_speech_dashscope.
  Applied gci --fix.
- **testifylint (1)**: `require.Equal(t, "", model)` → `require.Empty(t, model)`.
- **gocritic offBy1 (1)**: `after[:strings.Index(after, ":")]` in
  server_test.go could panic on -1 if the `strings.Contains` guard were
  removed. Rewrote with `strings.Cut` — safer AND cleaner.
- **gosec G602 (1)**: `body[2:eol]` in imageedit_openai_openai's boundary
  extractor. The preceding `eol < 3` guard makes it safe; annotated with
  nolint + comment.
- **govet shadow (1)**: `if err := ...` inside a function returning `err`
  in openai_speech_dashscope's ResponseBody. Reused the outer `err`.
- **revive unused-parameter (2)**: `original`/`forceBodyMutation` in
  DashScope RequestBody, `url` in one test's fetcher stub. Renamed to `_`
  with a comment explaining why (shape always changes → always mutate).

No behavior changes. `go build`, `go vet`, and the affected test packages
all pass. `golangci-lint run` now reports 0 issues.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b064eef6-a029-477b-8cd9-6a81807fac2f

📥 Commits

Reviewing files that changed from the base of the PR and between 1511593 and 0500202.

📒 Files selected for processing (8)
  • internal/endpointspec/endpointspec.go
  • internal/endpointspec/endpointspec_test.go
  • internal/extproc/server_test.go
  • internal/translator/gemini_cachedcontents_gcpvertexai.go
  • internal/translator/gemini_gcpvertexai.go
  • internal/translator/imageedit_openai_openai.go
  • internal/translator/openai_speech_dashscope.go
  • internal/translator/openai_speech_dashscope_test.go

📝 Walkthrough

Walkthrough

Gemini와 Speech 번역기에서 모델 타입 형변환을 제거하고, 관련 엔드포인트·응답 테스트를 갱신했습니다. 이미지 편집 모델 오버라이드와 프로젝트 prefix 모델명 추출 로직도 정리했습니다.

Changes

모델 타입 전달 및 번역기 정리

Layer / File(s) Summary
Gemini 모델 전달 및 Vertex 경로 처리
internal/endpointspec/endpointspec.go, internal/translator/gemini_*.go, internal/endpointspec/endpointspec_test.go
Gemini 모델과 오버라이드 값을 직접 전달하고 Vertex 요청·응답 모델 처리를 단순화했으며 관련 테스트 비교를 갱신했습니다.
DashScope Speech 모델 및 응답 처리
internal/endpointspec/endpointspec.go, internal/translator/openai_speech_dashscope.go, internal/translator/openai_speech_dashscope_test.go
사용하지 않는 인자를 명시하고 모델 오버라이드 및 오류 변수 처리를 정리했으며 응답 모델 테스트를 갱신했습니다.
이미지 모델 오버라이드 및 prefix 추출 정리
internal/translator/imageedit_openai_openai.go, internal/extproc/server_test.go
이미지 모델 오버라이드의 형변환을 제거하고 multipart 경계 접근 주석을 추가했으며 prefix 모델명 추출을 strings.Cut 기반으로 변경했습니다.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • inflearn/ai-gateway#6: Alibaba DashScope Speech 번역기와 modelNameOverride 전달 로직에서 동일한 코드 경로를 다룹니다.

Poem

토끼가 톡톡 모델을 건네,
불필요한 탈것은 사라졌네.
Gemini도 Speech도 가볍게 달리고,
경로와 테스트 한층 또렷해,
깡충! 코드가 맑아졌네.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목이 fork-authored 코드의 lint 이슈 정리라는 변경의 핵심을 정확히 요약합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/ci-lint-cleanup

Comment @coderabbitai help to get the list of available commands.

@pokabookinflab
pokabookinflab merged commit b6e8a4e into main Jul 28, 2026
24 of 29 checks passed
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