Repository navigation
fix(ci): re-enable Go tests and fix compilation errors after ListModels signature change - #15862
Conversation
- Re-enable Prepare test resources and Test Go packages steps in CI. - Fix resource path race condition with GITHUB_RUN_ID. - Exclude /cli package from Go tests. - Fix ListModelResponse type mismatches in 16 model test files: strings.Join → joinModelNames helper, .Name field access, []string → []ListModelResponse return types. - Fix pre-existing model_test.go issues: missing GetProviderManager() calls, InitProviderManager signature, MaxTokens *int dereference, and broken relative path in readProviderConfig. - Add findRepoRoot() to make conf/all_models.json path resolution work from Go test CWD. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Caution Review failedPull request was closed or merged during review No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (28)
📝 WalkthroughWalkthroughThe PR refactors model provider tests to adapt to a ListModels API contract change. The workflow prepares external test resources and model.go implements repo-root-relative configuration loading. Test files are updated to assert against ListModelResponse objects using a unified joinModelNames() helper instead of comparing raw strings. ChangesModel Provider Test Refactoring
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #15862 +/- ##
=======================================
Coverage 93.16% 93.16%
=======================================
Files 10 10
Lines 717 717
Branches 118 118
=======================================
Hits 668 668
Misses 29 29
Partials 20 20 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
This PR re-enables the Go test steps in CI that were previously commented out, and fixes all compilation errors that have accumulated in
internal/entity/models/since theListModelsreturn type was changed from[]stringto[]ListModelResponse.Changes
CI (
.github/workflows/tests.yml)go test ./internal/...)/tmp/resource-${GITHUB_RUN_ID}instead of/tmp/resource/clipackage from Go tests (containsmainredeclarations)Test fixes (16 model provider test files)
All errors were caused by the upstream change from
[]stringto[]ListModelResponsein theListModelsinterface:joinModelNamestest helper to extract.Namefrom[]ListModelResponseslicesstrings.Join(models, ",")→joinModelNames(models, ",")(11 files)ids[i] != "..."→ids[i].Name != "..."(cometapi, mistral)got[i] != want[i]→got[i].Name != want[i](bedrock)[]stringreturn types →[]ListModelResponse(google)Pre-existing bugs in model_test.go
Bugs introduced by the upstream
entity/→entity/models/directory rename:pm := GetProviderManager()calls in 3 test functionsInitProviderManagersignature (_, err :=→err :=)MaxTokens*intdereference (6 comparisons)readProviderConfigrelative path (3 levels up instead of 2)model.go
findRepoRoot()to makeconf/all_models.jsonresolution work from any CWD, fixingTestSiliconFlowProviderConfigLoadsLatestProModelsTest validation
🤖 Generated with Claude Code