Skip to content

moves all tests related to core to corresponding files#916

Merged
akshaydeo merged 1 commit intomainfrom
11-22-moves_all_tests_related_to_core_to_corresponding_files
Nov 25, 2025
Merged

moves all tests related to core to corresponding files#916
akshaydeo merged 1 commit intomainfrom
11-22-moves_all_tests_related_to_core_to_corresponding_files

Conversation

@akshaydeo
Copy link
Copy Markdown
Contributor

@akshaydeo akshaydeo commented Nov 22, 2025

Reorganize Core Provider Tests

This PR reorganizes the core provider tests by moving them from the tests/core-providers directory into the respective provider packages in core/providers. It also converts the interactive chatbot test from a standalone application to a proper Go test.

Changes

  • Moved provider-specific tests from tests/core-providers into their respective packages in core/providers
  • Renamed tests/core-providers/config to core/internal/testutil to better reflect its purpose
  • Moved test utility functions and scenarios to the new testutil package
  • Converted the interactive chatbot from tests/core-chatbot to a proper Go test in core/chatbot_test.go
  • Updated the Makefile to reflect the new test locations
  • Added a new test-chatbot target to the Makefile for running the interactive chatbot test

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (Next.js)
  • Docs

How to test

# Run all core tests
make test-core

# Run tests for a specific provider
make test-core PROVIDER=openai

# Run the interactive chatbot test
RUN_CHATBOT_TEST=1 make test-chatbot

Breaking changes

  • Yes
  • No

Checklist

  • I added/updated tests where appropriate
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 22, 2025

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added interactive chatbot integration tests with environment-based gating.
  • Tests

    • Reorganized test infrastructure and utilities for improved modularity.
    • Updated test execution paths and provider-specific test locations.
    • Removed governance plugin test suite.
  • Chores

    • Added testify testing library as direct dependency.
    • Restructured provider organization for better code maintainability.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

This PR refactors the test infrastructure by consolidating scattered test packages (scenarios, config, tests) into a unified core/internal/testutil package, restructures provider modules to use individual package namespaces instead of a consolidated providers package, and removes the governance test suite. Provider-specific tests are relocated and reorganized accordingly.

Changes

Cohort / File(s) Change Summary
Release & Build Configuration
.github/workflows/scripts/release-core.sh, Makefile
Updated test execution paths to run go test ./... directly from core directory; added new test-chatbot Makefile target for interactive chatbot integration tests with .env loading support; updated junit report file paths for provider and all-tests scenarios.
Go Module Dependencies
core/go.mod
Moved github.com/stretchr/testify from indirect to direct dependency block.
Provider Package Restructuring
core/providers/cerebras/cerebras.go, core/providers/groq/groq.go, core/providers/ollama/ollama.go, core/providers/openrouter/openrouter.go, core/providers/parasail/parasail.go, core/providers/sgl/sgl.go
Changed package declarations from package providers to individual provider-specific packages (e.g., package ollama, package groq).
Provider Constructor Updates
core/bifrost.go
Replaced consolidated providers.New*Provider imports and calls with per-provider imports and constructors (e.g., ollama.NewOllamaProvider instead of providers.NewOllamaProvider).
Chatbot Test Integration
core/chatbot_test.go
Changed package to bifrost_test; added TestChatbot(t *testing.T) wrapper that conditionally runs based on RUN_CHATBOT_TEST environment variable; renamed main() to runChatbot().
Test Utility Package Consolidation (Part 1)
core/internal/testutil/account.go, core/internal/testutil/setup.go, core/internal/testutil/automatic_function_calling.go, core/internal/testutil/chat_completion_stream.go, core/internal/testutil/complete_end_to_end.go, core/internal/testutil/cross_provider_scenarios.go, core/internal/testutil/embedding.go, core/internal/testutil/end_to_end_tool_calling.go, core/internal/testutil/error_parser.go, core/internal/testutil/image_base64.go, core/internal/testutil/image_url.go, core/internal/testutil/list_models.go
Changed package declarations from package scenarios or package config to package testutil; removed external config package imports; updated function signatures to use local ComprehensiveTestConfig type instead of config.ComprehensiveTestConfig.
Test Utility Package Consolidation (Part 2)
core/internal/testutil/multi_turn_conversation.go, core/internal/testutil/multiple_images.go, core/internal/testutil/multiple_tool_calls.go, core/internal/testutil/reasoning.go, core/internal/testutil/response_validation.go, core/internal/testutil/responses_stream.go, core/internal/testutil/simple_chat.go, core/internal/testutil/speech_synthesis.go, core/internal/testutil/speech_synthesis_stream.go, core/internal/testutil/test_retry_conditions.go, core/internal/testutil/test_retry_framework.go
Changed package declarations from package scenarios to package testutil; removed external config imports; updated function signatures to use local ComprehensiveTestConfig type; refactored validation logic in multi_turn_conversation.go to use retry framework.
Test Utility Package Consolidation (Part 3)
core/internal/testutil/tests.go, core/internal/testutil/text_completion.go, core/internal/testutil/text_completion_stream.go, core/internal/testutil/tool_calls.go, core/internal/testutil/tool_calls_streaming.go, core/internal/testutil/transcription.go, core/internal/testutil/transcription_stream.go, core/internal/testutil/utils.go, core/internal/testutil/validation_presets.go
Changed package declarations to testutil; removed config imports; updated function signatures for config type changes; renamed CreateSpeechInput to CreateSpeechRequest; promoted runAllComprehensiveTests to public RunAllComprehensiveTests; updated GetLionBase64Image to determine file path dynamically via runtime.Caller.
Cross-Provider Test Consolidation
core/internal/testutil/cross_provider_test.go
Changed package from tests to testutil; migrated ProviderConfig, CrossProviderTestConfig, ConversationSettings, TestSettings, MessageModality, and related constants from external scenarios package to local testutil package; updated all references to use local types.
Provider Test File Updates
core/providers/anthropic/anthropic_test.go, core/providers/azure/azure_test.go, core/providers/cerebras/cerebras_test.go, core/providers/cohere/cohere_test.go, core/providers/elevenlabs/elevenlabs_test.go, core/providers/gemini/gemini_test.go, core/providers/groq/groq_test.go, core/providers/mistral/mistral_test.go, core/providers/ollama/ollama_test.go, core/providers/openai/openai_test.go, core/providers/openrouter/openrouter_test.go, core/providers/parasail/parasail_test.go, core/providers/perplexity/perplexity_test.go, core/providers/sgl/sgl_test.go, core/providers/vertex/vertex_test.go
Changed package from tests to provider-specific test packages (e.g., anthropic_test); updated imports from tests/core-providers/config to core/internal/testutil; updated all function and type references to use testutil. namespace (e.g., testutil.SetupTest(), testutil.ComprehensiveTestConfig, testutil.RunAllComprehensiveTests).
Deprecated Test Modules
tests/core-chatbot/go.mod, tests/core-providers/README.md, tests/core-providers/go.mod, tests/core-providers/bedrock_test.go
Removed module files, documentation, and deprecated Bedrock test file; test code has been migrated or consolidated.
Governance Test Suite Removal
tests/governance/README.md, tests/governance/__init__.py, tests/governance/conftest.py, tests/governance/pytest.ini, tests/governance/requirements.txt, tests/governance/test_customers_crud.py, tests/governance/test_helpers.py, tests/governance/test_teams_crud.py, tests/governance/test_usage_tracking.py, tests/governance/test_virtual_keys_crud.py
Entirely removed Python-based governance plugin test suite including configuration, fixtures, test classes, and helper utilities.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

  • Multiple areas requiring detailed attention:
    • Provider package restructuring and import path consolidation in core/bifrost.go and all provider modules—verify all constructor calls use correct per-provider packages
    • Comprehensive test utility migration spanning 30+ files with consistent package and type signature changes—spot-check a few files to ensure consistency
    • Test framework refactoring with renamed and promoted functions (e.g., runAllComprehensiveTestsRunAllComprehensiveTests, CreateSpeechInputCreateSpeechRequest)—confirm all call sites updated
    • Dynamic file path resolution in core/internal/testutil/utils.go using runtime.Caller—verify correctness of path calculation
    • Governance test suite removal is large but straightforward; ensure no critical test coverage is lost elsewhere

Poem

🐰 Hop, hop! The tests now nest so neat,
With testutil home and providers sweet,
From scattered files to one clean place,
The code refactors with graceful pace!
No governance ghosts—just focused, clear,
New structure blooms as we venture here. 🌱

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 72.73% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change—moving tests related to core to corresponding provider-specific files in the core package structure.
Description check ✅ Passed The PR description comprehensively covers the refactoring scope, explains the rationale, includes all required sections, and provides clear testing instructions with proper formatting.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 11-22-moves_all_tests_related_to_core_to_corresponding_files

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

@github-actions
Copy link
Copy Markdown
Contributor

🧪 Test Suite Available

This PR can be tested by a repository admin.

Run tests for PR #916

Copy link
Copy Markdown
Contributor Author

akshaydeo commented Nov 22, 2025

@akshaydeo akshaydeo marked this pull request as ready for review November 22, 2025 18:24
@akshaydeo akshaydeo force-pushed the 11-22-moves_all_tests_related_to_core_to_corresponding_files branch 2 times, most recently from 0118051 to 456794c Compare November 22, 2025 18:42
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (5)
core/internal/testutil/speech_synthesis_stream.go (2)

275-276: Fix inconsistency between documented expectations and actual assertions.

The retry context documents "min_chunks": 3 and "min_total_bytes": 10000, but the actual test assertions expect strictly greater values (> 3 chunks and > 10000 bytes). This inconsistency can confuse developers reviewing test failures or understanding test requirements.

Apply this diff to align the documented expectations:

 				ExpectedBehavior: map[string]interface{}{
 					"generate_hd_streaming_audio": true,
 					"handle_long_text":            true,
-					"min_chunks":                  3,
-					"min_total_bytes":             10000,
+					"min_chunks":                  4,
+					"min_total_bytes":             10001,
 				},

Or adjust the assertions to match the documented expectations:

-			if chunkCount <= 3 {
-				t.Fatalf("HD model should produce more chunks for long text: got %d, expected > 3", chunkCount)
+			if chunkCount < 4 {
+				t.Fatalf("HD model should produce more chunks for long text: got %d, expected at least 4", chunkCount)
 			}
 
-			if totalBytes <= 10000 {
-				t.Fatalf("HD model should produce substantial audio data: got %d bytes, expected > 10000", totalBytes)
+			if totalBytes < 10001 {
+				t.Fatalf("HD model should produce substantial audio data: got %d bytes, expected at least 10001", totalBytes)
 			}

Also applies to: 334-340


218-219: Remove or relax the zero-latency fatal error checks in streaming response assertions.

Latency can legitimately be zero in Go when operations complete in sub-millisecond time (truncated by .Milliseconds()). For streaming responses, inter-chunk latency measurements will be near-zero for fast or cached operations. The current fatal error on lastTokenLatency == 0 (lines 217–219, 342–344, 449–451 in speech_synthesis_stream.go and similar in transcription_stream.go) is overly strict.

Consider:

  • Logging zero latency as a warning instead of failing
  • Validating latency only for specific latency-critical providers or scenarios
  • Documenting why zero latency would be invalid if it applies to your use case
core/internal/testutil/utils.go (1)

191-198: The web search results clarify Go's working directory behavior during testing. Let me verify if this function is used only in tests or also in production code:

Based on my research, I need to verify whether the calling files are test files. Let me check:

Based on my verification, the original review comment's concern is valid, though with an important nuance. When running go test, the working directory is set to the package directory, so the path "scenarios/media/lion_base64.txt" does resolve correctly when tests in core/internal/testutil/ run locally. However, there is a critical issue: when code is called from different locations (like from main.go vs from a test file), relative paths cause failures.

Since GetLionBase64Image is defined in utils.go (a non-test file), it can be imported and called by other packages with different working directories, making this relative path approach fragile. The function should either use Go 1.16's embed package to embed files in the binary, which works regardless of execution context, or employ a more robust path resolution method.

Fix the hardcoded relative path in GetLionBase64Image.

The path "scenarios/media/lion_base64.txt" works in tests but will break if this utility function is called from a different working directory. Use Go's embed package to bundle the file with the binary, or construct the path dynamically using runtime.Caller to locate it relative to the source file. This ensures the function works consistently regardless of where it's called from.

core/internal/testutil/account.go (1)

110-117: Inconsistent configuration for ProviderOpenAICustom (Groq vs OpenAI mismatch)

Across these sections, ProviderOpenAICustom appears to be intended as a Groq-backed, OpenAI-compatible provider, but the configuration is inconsistent:

  • Line 113 comment: // Use GROQ API key for OpenAI-compatible endpoint, but the code actually pulls OPENAI_API_KEY instead of GROQ_API_KEY.
  • Lines 294–303: BaseURL is set to https://api.openai.com, while the comment says “Higher retries for Groq (can be flaky)”.
  • Lines 781–784: AllProviderConfigs uses ChatModel: "llama-3.3-70b-versatile", which is a Groq-style model name, not an OpenAI one.

As written, this provider will:

  • Call the OpenAI base URL.
  • Use whatever is in OPENAI_API_KEY.
  • Request a Groq-specific model name.

That’s very likely to fail at runtime or at least be surprising to anyone configuring CI keys for Groq vs OpenAI.

Consider tightening this up in one of these directions:

  • If this is truly meant for Groq via an OpenAI-compatible endpoint:

    • Use a Groq-specific key env var (e.g., GROQ_API_KEY) and/or a dedicated OPENAI_CUSTOM_API_KEY.
    • Point BaseURL to the Groq OpenAI-compatible endpoint (or make it configurable via env, e.g., OPENAI_CUSTOM_BASE_URL).
    • Keep the llama model name as-is.
  • If this is now a generic “OpenAI custom” slot:

    • Update the comments to remove Groq references.
    • Use an OpenAI model name instead of llama-3.3-70b-versatile.
    • Optionally rename the provider constant if its intent has changed.

Right now the mix of comments, env vars, base URL, and model name is misleading and likely broken for the intended use.

Also applies to: 294-303, 781-808

core/internal/testutil/error_parser.go (1)

479-506: Fix GetRetryDelay bit-shift: shift count must be unsigned integer

The Go spec requires the right operand of a shift to have unsigned integer type. The expression 1 << (attempt - 1) will not compile because attempt is an int; the shift count must be unsigned.

Additionally, the code does not guard against attempt <= 0, which would produce invalid shift behavior.

Update line 499–502 to clamp attempt and cast the shift count to uint:

-	// Exponential backoff
-	delay := baseDelay * (1 << (attempt - 1)) // 2^(attempt-1)
+	// Ensure attempt is at least 1
+	if attempt < 1 {
+		attempt = 1
+	}
+
+	// Exponential backoff: 2^(attempt-1)
+	delay := baseDelay * (1 << uint(attempt-1))
🧹 Nitpick comments (13)
core/internal/testutil/list_models.go (1)

51-54: Unreachable code after t.Fatalf().

The continue statement on line 53 is unreachable because t.Fatalf() terminates the test immediately. While harmless, it can be removed for clarity.

Apply this diff to remove the unreachable code:

 		if model.ID == "" {
 			t.Fatalf("❌ Model at index %d has empty ID", i)
-			continue
 		}
core/internal/testutil/tool_calls_streaming.go (1)

233-377: Consider extracting the duplicate retry logic.

Both test scenarios (ChatCompletions and Responses API) implement nearly identical retry logic with maxAttempts=3. Consider extracting this pattern into a helper function that accepts the test logic as a callback to reduce the ~140 lines of code duplication and improve maintainability.

Example structure:

func runWithRetry(t *testing.T, maxAttempts int, testName string, testFn func() (bool, string)) {
    // Common retry logic here
}

Also applies to: 395-734

core/providers/groq/groq.go (1)

1-3: Update package comment to match the new package name.

The package comment references "Package providers" but the package declaration has been changed to package groq.

Apply this diff:

-// Package providers implements various LLM providers and their utility functions.
+// Package groq implements the Groq LLM provider.
 // This file contains the Groq provider implementation.
 package groq
core/providers/sgl/sgl.go (1)

1-3: Update package comment to match the new package name.

The package comment references "Package providers" but the package declaration has been changed to package sgl.

Apply this diff:

-// Package providers implements various LLM providers and their utility functions.
+// Package sgl implements the SGL LLM provider.
 // This file contains the SGL provider implementation.
 package sgl
core/providers/parasail/parasail.go (1)

1-3: Update package comment to match the new package name.

The package comment references "Package providers" but the package declaration has been changed to package parasail.

Apply this diff:

-// Package providers implements various LLM providers and their utility functions.
+// Package parasail implements the Parasail LLM provider.
 // This file contains the Parasail provider implementation.
 package parasail
core/providers/cerebras/cerebras.go (1)

1-3: Update package comment to match the new package name.

The package comment references "Package providers" but the package declaration has been changed to package cerebras.

Apply this diff:

-// Package providers implements various LLM providers and their utility functions.
+// Package cerebras implements the Cerebras LLM provider.
 // This file contains the Cerebras provider implementation.
 package cerebras
core/providers/ollama/ollama.go (1)

1-3: Update the package comment to match the new package name.

The package comment still says "Package providers" but the package is now ollama. This should be updated for consistency.

Apply this diff:

-// Package providers implements various LLM providers and their utility functions.
-// This file contains the Ollama provider implementation.
 package ollama
+
+// Package ollama implements the Ollama provider for Bifrost.
core/providers/openrouter/openrouter.go (1)

1-3: Update the package comment to match the new package name.

Similar to the Ollama provider, the package comment still references "Package providers" but should be updated to reflect the new openrouter package name.

Apply this diff:

-// Package providers implements various LLM providers and their utility functions.
-// This file contains the OpenRouter provider implementation.
 package openrouter
+
+// Package openrouter implements the OpenRouter provider for Bifrost.
core/internal/testutil/reasoning.go (1)

98-109: Reuse min helper to simplify log clipping logic

The log-clipping logic computes maxLen manually before slicing responsesContent, while a generic min(a, b int) helper already exists in this file. You could slightly simplify and de-duplicate by using the helper here (and similarly where other content is clipped, if any):

-			maxLen := 300
-			if len(responsesContent) < maxLen {
-				maxLen = len(responsesContent)
-			}
-			t.Logf("✅ Responses API reasoning result: %s", responsesContent[:maxLen])
+			maxLen := min(len(responsesContent), 300)
+			t.Logf("✅ Responses API reasoning result: %s", responsesContent[:maxLen])

This keeps the intent clear and centralizes the min logic.

Also applies to: 205-210

core/internal/testutil/speech_synthesis_stream.go (1)

247-250: Consider using fmt.Sprintf for clearer string formatting.

The current string replacement approach using strings.Replace with string(rune('0'+i%10)) is functional but less idiomatic and harder to understand at a glance.

Apply this diff for improved readability:

-			finalText := ""
-			for i := 1; i <= 20; i++ {
-				finalText += strings.Replace("This is sentence number %d in a very long text for testing streaming speech synthesis with the HD model. ", "%d", string(rune('0'+i%10)), -1)
-			}
+			var finalText strings.Builder
+			for i := 1; i <= 20; i++ {
+				finalText.WriteString(fmt.Sprintf("This is sentence number %d in a very long text for testing streaming speech synthesis with the HD model. ", i%10))
+			}

This also uses strings.Builder for more efficient string concatenation in the loop.

core/internal/testutil/error_parser.go (1)

379-414: Add t.Helper() and align AssertNoError behavior with test semantics

Both t.Fatalf (fatal) and t.Errorf (non-fatal) require t.Helper() to correctly skip frames in failure reporting so failures point to the actual test line, not these helpers.

RequireNoError at line 379: add t.Helper() at the start (fatal semantics are correct).

AssertNoError at line 397: add t.Helper() and change t.Fatalf to t.Errorf. While this function is currently unused in the codebase, fixing it prevents confusion: returning bool after t.Fatalf contradicts the intended non-fatal semantics of "assert".

core/internal/testutil/cross_provider_test.go (2)

9-20: Unconditional t.Skip makes all new cross‑provider logic unreachable

Both TestCrossProviderScenarios and TestCrossProviderConsistency call t.Skip and return before SetupTest and the subtests, so none of the new configuration or helpers will ever run, even when invoked via the new make targets. If these are intended as opt‑in integration tests, consider gating the skip on an env var (similar to the chatbot test) instead of hard‑skipping.

For example:

-import (
-	"testing"
-)
+import (
+	"os"
+	"testing"
+)
 
 func TestCrossProviderScenarios(t *testing.T) {
 	t.Parallel()
-	t.Skip("Skipping cross provider scenarios test")
-	return
+	if os.Getenv("RUN_CROSS_PROVIDER_TESTS") == "" {
+		t.Skip("Skipping cross provider scenarios test; set RUN_CROSS_PROVIDER_TESTS=1 to enable")
+	}

…and mirror the pattern in TestCrossProviderConsistency.

Also applies to: 113-124


80-96: Consider including reasoning modality in RequiredMessageTypes

ConversationSettings.RequiredMessageTypes currently lists text/tool/vision only. Some predefined scenarios in cross_provider_scenarios.go include ModalityReasoning steps; if the conversation driver or validation logic relies on RequiredMessageTypes to know which modalities to exercise, omitting reasoning could create a config/scenario mismatch.

You may want to include reasoning for completeness:

		ConversationSettings: ConversationSettings{
 			MaxMessages:                25,
 			ConversationGeneratorModel: "gpt-4o",
 			RequiredMessageTypes: []MessageModality{
 				ModalityText,
 				ModalityTool,
 				ModalityVision,
+				ModalityReasoning,
 			},
 		},

Please double‑check how RequiredMessageTypes is consumed to confirm whether this is needed.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d5d5f44 and 456794c.

⛔ Files ignored due to path filters (3)
  • core/go.sum is excluded by !**/*.sum
  • tests/core-chatbot/go.sum is excluded by !**/*.sum
  • tests/core-providers/go.sum is excluded by !**/*.sum
📒 Files selected for processing (73)
  • .github/workflows/scripts/release-core.sh (1 hunks)
  • Makefile (5 hunks)
  • core/bifrost.go (2 hunks)
  • core/chatbot_test.go (6 hunks)
  • core/go.mod (1 hunks)
  • core/internal/testutil/account.go (1 hunks)
  • core/internal/testutil/automatic_function_calling.go (1 hunks)
  • core/internal/testutil/chat_completion_stream.go (2 hunks)
  • core/internal/testutil/complete_end_to_end.go (1 hunks)
  • core/internal/testutil/cross_provider_scenarios.go (1 hunks)
  • core/internal/testutil/cross_provider_test.go (4 hunks)
  • core/internal/testutil/embedding.go (2 hunks)
  • core/internal/testutil/end_to_end_tool_calling.go (1 hunks)
  • core/internal/testutil/error_parser.go (1 hunks)
  • core/internal/testutil/image_base64.go (1 hunks)
  • core/internal/testutil/image_url.go (1 hunks)
  • core/internal/testutil/list_models.go (2 hunks)
  • core/internal/testutil/multi_turn_conversation.go (1 hunks)
  • core/internal/testutil/multiple_images.go (1 hunks)
  • core/internal/testutil/multiple_tool_calls.go (2 hunks)
  • core/internal/testutil/reasoning.go (1 hunks)
  • core/internal/testutil/response_validation.go (1 hunks)
  • core/internal/testutil/responses_stream.go (3 hunks)
  • core/internal/testutil/setup.go (1 hunks)
  • core/internal/testutil/simple_chat.go (1 hunks)
  • core/internal/testutil/speech_synthesis.go (2 hunks)
  • core/internal/testutil/speech_synthesis_stream.go (3 hunks)
  • core/internal/testutil/test_retry_conditions.go (1 hunks)
  • core/internal/testutil/test_retry_framework.go (2 hunks)
  • core/internal/testutil/tests.go (3 hunks)
  • core/internal/testutil/text_completion.go (1 hunks)
  • core/internal/testutil/text_completion_stream.go (2 hunks)
  • core/internal/testutil/tool_calls.go (2 hunks)
  • core/internal/testutil/tool_calls_streaming.go (2 hunks)
  • core/internal/testutil/transcription.go (4 hunks)
  • core/internal/testutil/transcription_stream.go (3 hunks)
  • core/internal/testutil/utils.go (1 hunks)
  • core/internal/testutil/validation_presets.go (2 hunks)
  • core/providers/anthropic/anthropic_test.go (3 hunks)
  • core/providers/azure/azure_test.go (4 hunks)
  • core/providers/bedrock/bedrock_test.go (4 hunks)
  • core/providers/cerebras/cerebras.go (1 hunks)
  • core/providers/cerebras/cerebras_test.go (4 hunks)
  • core/providers/cohere/cohere_test.go (3 hunks)
  • core/providers/elevenlabs/elevenlabs_test.go (3 hunks)
  • core/providers/gemini/gemini_test.go (4 hunks)
  • core/providers/groq/groq.go (1 hunks)
  • core/providers/groq/groq_test.go (4 hunks)
  • core/providers/mistral/mistral_test.go (3 hunks)
  • core/providers/ollama/ollama.go (1 hunks)
  • core/providers/ollama/ollama_test.go (3 hunks)
  • core/providers/openai/openai_test.go (4 hunks)
  • core/providers/openrouter/openrouter.go (1 hunks)
  • core/providers/openrouter/openrouter_test.go (3 hunks)
  • core/providers/parasail/parasail.go (1 hunks)
  • core/providers/parasail/parasail_test.go (3 hunks)
  • core/providers/perplexity/perplexity_test.go (3 hunks)
  • core/providers/sgl/sgl.go (1 hunks)
  • core/providers/sgl/sgl_test.go (3 hunks)
  • core/providers/vertex/vertex_test.go (3 hunks)
  • tests/core-chatbot/go.mod (0 hunks)
  • tests/core-providers/README.md (0 hunks)
  • tests/core-providers/go.mod (0 hunks)
  • tests/governance/README.md (0 hunks)
  • tests/governance/__init__.py (0 hunks)
  • tests/governance/conftest.py (0 hunks)
  • tests/governance/pytest.ini (0 hunks)
  • tests/governance/requirements.txt (0 hunks)
  • tests/governance/test_customers_crud.py (0 hunks)
  • tests/governance/test_helpers.py (0 hunks)
  • tests/governance/test_teams_crud.py (0 hunks)
  • tests/governance/test_usage_tracking.py (0 hunks)
  • tests/governance/test_virtual_keys_crud.py (0 hunks)
💤 Files with no reviewable changes (13)
  • tests/core-providers/README.md
  • tests/governance/test_helpers.py
  • tests/governance/test_virtual_keys_crud.py
  • tests/governance/requirements.txt
  • tests/core-chatbot/go.mod
  • tests/governance/pytest.ini
  • tests/governance/init.py
  • tests/governance/test_customers_crud.py
  • tests/governance/conftest.py
  • tests/governance/README.md
  • tests/governance/test_teams_crud.py
  • tests/core-providers/go.mod
  • tests/governance/test_usage_tracking.py
🧰 Additional context used
🧬 Code graph analysis (44)
core/internal/testutil/chat_completion_stream.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/tool_calls_streaming.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/test_retry_framework.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/multiple_tool_calls.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/validation_presets.go (2)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/response_validation.go (1)
  • ResponseExpectations (18-45)
core/internal/testutil/image_url.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/speech_synthesis.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/image_base64.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/tool_calls.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/transcription_stream.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/complete_end_to_end.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/bedrock/bedrock_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/cohere/cohere_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Cohere (39-39)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/groq/groq_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/end_to_end_tool_calling.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/simple_chat.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/responses_stream.go (3)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/schemas/responses.go (1)
  • ResponsesStreamResponseType (1351-1351)
core/schemas/bifrost.go (1)
  • BifrostStream (318-325)
core/internal/testutil/text_completion.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/bifrost.go (6)
core/providers/ollama/ollama.go (1)
  • NewOllamaProvider (28-60)
core/providers/groq/groq.go (1)
  • NewGroqProvider (27-58)
core/providers/sgl/sgl.go (1)
  • NewSGLProvider (28-60)
core/providers/parasail/parasail.go (1)
  • NewParasailProvider (27-53)
core/providers/cerebras/cerebras.go (1)
  • NewCerebrasProvider (27-53)
core/providers/openrouter/openrouter.go (1)
  • NewOpenRouterProvider (29-55)
core/providers/azure/azure_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/reasoning.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/mistral/mistral_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (2)
  • Mistral (41-41)
  • Fallback (128-131)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/anthropic/anthropic_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (2)
  • Anthropic (37-37)
  • Fallback (128-131)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/list_models.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/vertex/vertex_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Vertex (40-40)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/multiple_images.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/parasail/parasail_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Parasail (45-45)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/sgl/sgl_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • SGL (44-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/multi_turn_conversation.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/gemini/gemini_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/automatic_function_calling.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/cerebras/cerebras_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/cross_provider_test.go (2)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/cross_provider_scenarios.go (13)
  • ProviderConfig (45-53)
  • CrossProviderTestConfig (38-42)
  • ConversationSettings (56-60)
  • MessageModality (19-19)
  • ModalityText (22-22)
  • ModalityTool (23-23)
  • ModalityVision (24-24)
  • TestSettings (63-67)
  • ValidationModerate (33-33)
  • GetPredefinedScenarios (110-245)
  • RunCrossProviderScenarioTest (649-774)
  • ValidationLenient (34-34)
  • RunCrossProviderConsistencyTest (781-860)
core/internal/testutil/embedding.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/text_completion_stream.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/openrouter/openrouter_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • OpenRouter (49-49)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/perplexity/perplexity_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Perplexity (46-46)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/transcription.go (2)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/schemas/transcriptions.go (1)
  • BifrostTranscriptionResponse (16-26)
core/providers/elevenlabs/elevenlabs_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Elevenlabs (50-50)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/ollama/ollama_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Ollama (42-42)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/openai/openai_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/chatbot_test.go (1)
core/schemas/chatcompletions.go (1)
  • ChatParameters (154-183)
core/internal/testutil/speech_synthesis_stream.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/tests.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
🔇 Additional comments (71)
core/internal/testutil/simple_chat.go (1)

1-14: LGTM! Clean refactor of package structure.

The package rename to testutil and the removal of the external config import are consistent with the PR's objective to consolidate test utilities. The function signature correctly uses the local ComprehensiveTestConfig type that's now defined within the same package.

core/internal/testutil/responses_stream.go (2)

1-1: LGTM! Clean package reorganization.

The package rename from scenarios to testutil aligns well with the PR objectives to consolidate test utilities into core/internal/testutil.


17-17: LGTM! Function signatures correctly updated.

The function signatures have been properly updated to use the local ComprehensiveTestConfig type instead of the external config.ComprehensiveTestConfig. This successfully eliminates the dependency on the old config package while maintaining the same functionality.

Also applies to: 743-743

core/internal/testutil/list_models.go (3)

1-11: LGTM! Clean package refactor.

The package rename from scenarios to testutil and removal of the config import align well with the PR's objective to consolidate test utilities into core/internal/testutil.


14-14: Signature updated correctly.

The function signature change to use the local ComprehensiveTestConfig type is correct and aligns with the refactor objectives.


93-160: LGTM! Pagination test refactored correctly.

The function signature is updated correctly, and the pagination test logic remains comprehensive, covering page size limits, next page tokens, and cross-page model validation.

core/internal/testutil/tool_calls_streaming.go (2)

1-1: LGTM: Package rename aligns with refactor objectives.

The package rename from scenarios to testutil correctly reflects the consolidation of test utilities into the core/internal/testutil package as described in the PR objectives.


212-212: LGTM: Parameter type updated correctly.

The parameter type change from config.ComprehensiveTestConfig to ComprehensiveTestConfig is correct and aligns with the local type definition in the testutil package, eliminating the external config dependency.

core/internal/testutil/test_retry_conditions.go (1)

1-1: Package rename verified and approved.

Verification confirms all references to the old scenarios package have been successfully updated across the codebase. No lingering package declarations, import paths, or direct references remain. The new core/internal/testutil imports are correctly in place across all dependent test files.

core/go.mod (1)

14-14: LGTM: testify promoted to direct dependency.

This change correctly reflects that the testutil package now directly uses testify for test assertions and utilities.

core/providers/cohere/cohere_test.go (1)

1-54: LGTM: Test migration to testutil package.

The test file has been properly updated to use the centralized testutil package for test configuration and utilities. The package name cohere_test correctly follows Go conventions for external tests.

core/internal/testutil/setup.go (1)

1-4: LGTM: Package renamed with updated documentation.

The package has been cleanly renamed from config to testutil, and the documentation comment has been appropriately updated to reflect the new package name.

core/internal/testutil/text_completion.go (1)

1-14: LGTM: Function signature updated for testutil consolidation.

The function has been properly updated to use the ComprehensiveTestConfig type now defined within the testutil package, and the unnecessary import has been removed.

Makefile (2)

311-447: LGTM! Test path updates align with the new structure.

The Makefile correctly updates all test execution paths to reflect the migration from tests/core-providers to core/providers/$(PROVIDER). The directory navigation logic (cd commands and relative paths for junitfile) is accurate for the new hierarchy.


528-544: LGTM! Interactive chatbot test target is well-designed.

The new test-chatbot target properly:

  • Guards execution behind the RUN_CHATBOT_TEST environment variable
  • Loads environment variables from .env when available
  • Provides clear usage instructions
  • Runs from the correct directory (cd core)
.github/workflows/scripts/release-core.sh (1)

38-42: LGTM! Simplified test execution aligns with the refactor.

The updated test execution correctly runs all core tests from the core module root, which now includes the provider tests in core/providers/*/. This is a cleaner approach than the previous provider-specific traversal.

core/internal/testutil/text_completion_stream.go (1)

1-16: LGTM! Package migration is consistent.

The package rename to testutil and the updated function signature correctly reflect the migration from the external config package to the local testutil package. The use of the unqualified ComprehensiveTestConfig type is appropriate.

core/providers/groq/groq_test.go (1)

1-62: LGTM! Test migration follows best practices.

The test file correctly:

  • Uses the external test package groq_test (Go best practice)
  • Updates imports to core/internal/testutil
  • Migrates all test utility references to the new testutil package
  • Maintains consistent test configuration patterns
core/internal/testutil/chat_completion_stream.go (1)

1-16: LGTM! Consistent with the testutil migration.

The package rename and function signature updates align with the broader migration pattern, matching the approach used in other testutil files.

core/chatbot_test.go (2)

1-1: LGTM! Proper external test package.

Using bifrost_test as the package name follows Go testing best practices for external test packages.


830-947: LGTM! Well-designed test wrapper for interactive chatbot.

The conversion from a standalone application to a proper Go test is well-executed:

  • Renamed main() to runChatbot() to avoid entry point conflicts
  • Added TestChatbot() wrapper that properly guards interactive execution with RUN_CHATBOT_TEST environment variable
  • Provides a clear skip message with usage instructions
  • Maintains all interactive functionality while integrating into the test framework

This allows the chatbot to be run via RUN_CHATBOT_TEST=1 make test-chatbot as documented in the PR objectives.

core/providers/ollama/ollama_test.go (1)

1-52: LGTM! Clean refactoring to testutil package.

The migration from tests/core-providers/config to core/internal/testutil is executed correctly with all references properly updated. The package naming convention (ollama_test) follows Go best practices for external test packages.

core/providers/perplexity/perplexity_test.go (1)

1-51: LGTM! Consistent refactoring applied.

All references correctly migrated to testutil package following the same clean pattern as other provider tests.

core/providers/bedrock/bedrock_test.go (1)

1-58: LGTM! Refactoring correctly applied.

The Bedrock test follows the same migration pattern with all testutil references properly updated.

core/internal/testutil/automatic_function_calling.go (1)

1-183: LGTM! Package migration executed correctly.

The function signature update reflects that ComprehensiveTestConfig is now a local type within the testutil package, removing the external dependency on the config package. This consolidation improves the package structure.

core/internal/testutil/image_url.go (1)

1-156: LGTM! Consistent package migration.

Function signature correctly updated to use the local ComprehensiveTestConfig type.

core/internal/testutil/test_retry_framework.go (1)

1-978: LGTM! Function signature properly updated.

The GetTestRetryConfigForScenario function correctly uses the local ComprehensiveTestConfig type, completing the migration from the external config package.

core/internal/testutil/image_base64.go (1)

1-159: LGTM! Package migration complete.

Function signature correctly updated following the established refactoring pattern.

core/providers/parasail/parasail_test.go (1)

1-52: LGTM! Refactoring completed successfully.

The Parasail test correctly applies the migration pattern with all testutil references properly updated.

core/providers/gemini/gemini_test.go (1)

1-63: LGTM! Clean migration to testutil package.

The refactoring consistently updates all references from the old config package to the new testutil package. The package naming convention (gemini_test) properly separates test code from implementation, and all type references are correctly qualified with the testutil. prefix.

core/internal/testutil/transcription_stream.go (2)

1-18: LGTM! Package consolidation executed correctly.

The migration from scenarios to testutil package and the updated function signature to use the local ComprehensiveTestConfig type aligns with the PR's goal of centralizing test utilities. The change maintains the same functionality while improving the code organization.


299-299: Consistent signature update.

The function signature correctly uses the local ComprehensiveTestConfig type, matching the pattern applied to RunTranscriptionStreamTest above.

core/providers/anthropic/anthropic_test.go (1)

1-56: LGTM! Consistent refactoring applied.

The migration to the testutil package is properly executed with all type references and function calls correctly updated. The test logic remains unchanged while benefiting from the improved organizational structure.

core/providers/sgl/sgl_test.go (1)

1-53: LGTM! Refactoring applied consistently.

All references to test utilities have been properly migrated to the testutil package. The changes maintain test functionality while improving code organization.

core/providers/elevenlabs/elevenlabs_test.go (1)

1-56: LGTM! Successful migration to testutil.

The refactoring correctly updates all test utility references to use the centralized testutil package, maintaining consistency with the broader reorganization effort.

core/providers/openai/openai_test.go (1)

1-68: LGTM! Clean testutil migration.

All test infrastructure references have been properly updated to use the testutil package. The refactoring maintains test behavior while improving the organizational structure of the test suite.

core/internal/testutil/speech_synthesis.go (2)

1-16: LGTM! Package consolidation applied correctly.

The migration to the testutil package and updated function signature maintains functionality while centralizing test utilities as intended by this refactoring.


128-128: Consistent signature update.

The function signature properly uses the local ComprehensiveTestConfig type, matching the pattern applied throughout the testutil package.

core/providers/cerebras/cerebras_test.go (1)

1-57: LGTM! Refactoring completed successfully.

The migration to the testutil package is properly executed with all type references and function calls correctly updated. This completes the consistent refactoring pattern observed across all provider test files in this PR.

core/providers/azure/azure_test.go (1)

1-67: LGTM! Clean refactor to testutil package.

The migration from the old config package to the internal testutil package is consistent and correct. All references (SetupTest, ComprehensiveTestConfig, TestScenarios, RunAllComprehensiveTests) have been properly updated.

core/providers/vertex/vertex_test.go (1)

1-53: LGTM! Consistent with the testutil migration pattern.

The refactor follows the same clean pattern as the other provider tests, with all config package references properly replaced with testutil equivalents.

core/providers/openrouter/openrouter_test.go (1)

1-54: LGTM! Testutil migration applied consistently.

All references to the config package have been properly updated to use the internal testutil package, maintaining consistency with the other provider test files.

core/providers/mistral/mistral_test.go (1)

1-55: LGTM! Testutil package integration is correct.

The migration pattern is applied consistently, with all config package references properly replaced with the internal testutil package.

core/internal/testutil/transcription.go (1)

1-360: LGTM! Type references correctly updated for the testutil package.

The function signatures have been appropriately updated to use the unqualified ComprehensiveTestConfig type, which is now defined locally in the testutil package. The logic remains unchanged—this is a pure reference update to support the package consolidation.

core/internal/testutil/tests.go (1)

1-117: LGTM! Well-structured consolidation into testutil package.

The changes properly export the test runner function and update all type references to be local to the testutil package. The transition from qualified scenario function references (e.g., scenarios.RunTextCompletionTest) to unqualified references indicates these functions now reside in the same package, which aligns with the consolidation goal.

core/bifrost.go (2)

21-32: Explicit provider imports improve clarity.

The shift from a consolidated providers package import to individual provider imports (cerebras, groq, ollama, openrouter, parasail, sgl) makes dependencies more explicit and likely helps avoid import cycles now that tests are being moved into provider packages.


1309-1323: Constructor calls correctly updated for new import pattern.

All provider constructor calls have been properly updated to use the individual package prefixes (e.g., ollama.NewOllamaProvider instead of providers.NewOllamaProvider), consistent with the new import structure.

core/internal/testutil/reasoning.go (2)

1-1: Package rename to testutil is consistent with new layout

Using package testutil under core/internal/testutil aligns this helper with other shared test utilities and avoids the old scenarios-specific naming. No issues here.


14-119: RunReasoningTest config migration and wiring look solid

Using the local ComprehensiveTestConfig fits the new internal testutil structure, and the gating on Scenarios.Reasoning plus ReasoningModel == "" prevents misconfigured runs. Request construction (provider/model, reasoning params, fallbacks) and retry/expector wiring are coherent and defensive for a shared test helper.

core/internal/testutil/multi_turn_conversation.go (2)

1-1: LGTM! Package rename aligns with refactoring objectives.

The package rename from scenarios to testutil is consistent with the PR's goal of consolidating test utilities into core/internal/testutil.


15-15: Function signature correctly updated for type consolidation — verification complete.

The parameter type change from config.ComprehensiveTestConfig to ComprehensiveTestConfig is verified. The function is properly referenced in core/internal/testutil/tests.go:30 where it's added to a testScenarios slice of type TestScenarioFunc. The function signature matches the TestScenarioFunc type definition exactly, with all parameters using the consolidated ComprehensiveTestConfig type. No breaking changes detected.

core/internal/testutil/multiple_images.go (3)

1-12: LGTM: Package refactoring correctly implemented.

The package name change from scenarios to testutil and the removal of the external config import are consistent with the PR objective to consolidate test utilities into core/internal/testutil.


15-15: LGTM: Function signature correctly updated.

The function signature now uses the local ComprehensiveTestConfig type instead of the external config.ComprehensiveTestConfig, which is consistent with the refactoring to consolidate test utilities.


16-141: All dependencies verified—code is ready to merge.

The refactoring successfully maintains all required dependencies. All 7 helper functions and 3 types are correctly located in the core/internal/testutil/ package and are accessible to multiple_images.go within the same package scope:

  • Helper functions: GetLionBase64Image, GetTestRetryConfigForScenario, VisionExpectations, ModifyExpectationsForProvider, WithChatTestRetry, GetErrorMessage, GetChatContent ✓
  • Type definitions: TestRetryContext, ChatRetryConfig, ChatRetryCondition ✓
  • Constants: TestImageURL ✓

The code logic is unchanged and all dependencies are properly scoped, so compilation will succeed.

core/internal/testutil/speech_synthesis_stream.go (2)

1-1: LGTM! Package refactoring completed correctly.

The package name change from scenarios to testutil aligns with the PR objective of consolidating test utilities.


16-16: LGTM! Function signatures updated correctly.

The function signatures now use the locally defined ComprehensiveTestConfig type, which is consistent with the refactoring to remove external config package dependencies.

Also applies to: 229-229

core/internal/testutil/utils.go (1)

1-1: LGTM: Package rename aligns with the refactoring.

The package declaration change from scenarios to testutil is consistent with the PR's objective to reorganize test utilities into core/internal/testutil.

core/internal/testutil/account.go (1)

1-4: Package rename to testutil aligns with the new test utility layout

The package comment and declaration correctly reflect the new core/internal/testutil location and purpose, which matches the PR’s intent to centralize test utilities. No functional concerns from this rename; assuming imports have been updated, this looks good.

core/internal/testutil/error_parser.go (1)

1-1: Package rename to testutil looks consistent with the new test utilities layout

The package name aligns with the new core/internal/testutil namespace described in the PR, and keeps these helpers clearly scoped as internal test utilities. No issues from this change alone.

core/internal/testutil/embedding.go (1)

1-40: LGTM! Clean package refactoring.

The package name change to testutil and the update to use the local ComprehensiveTestConfig type are consistent with the PR's objective of consolidating test utilities.

core/internal/testutil/cross_provider_scenarios.go (1)

1-1: LGTM! Package refactoring complete.

The package declaration aligns with the broader test utility consolidation into core/internal/testutil.

core/internal/testutil/response_validation.go (1)

1-1: LGTM! Package naming updated correctly.

The package declaration is consistent with the testutil namespace migration.

core/internal/testutil/end_to_end_tool_calling.go (1)

1-15: LGTM! Function signature updated correctly.

The package name and function signature have been updated to use the local ComprehensiveTestConfig type, removing the dependency on the external config package.

core/internal/testutil/multiple_tool_calls.go (1)

1-23: LGTM! Refactoring applied consistently.

The package and function signature updates align with the migration to the testutil namespace and local type resolution.

core/internal/testutil/tool_calls.go (1)

1-17: LGTM! Type references updated correctly.

The removal of the config package qualifier and the package name change are consistent with the broader refactoring effort.

core/internal/testutil/complete_end_to_end.go (1)

1-15: LGTM! Package and signature refactoring complete.

The updates to the package declaration and function signature are consistent with moving test utilities into the testutil package.

core/internal/testutil/validation_presets.go (1)

1-219: LGTM! Final refactoring piece in place.

The package declaration and function signature updates complete the migration to the testutil package with local type resolution.

core/internal/testutil/cross_provider_test.go (4)

1-1: Package choice testutil is appropriate for white-box helpers

Using package testutil (instead of testutil_test) keeps these tests close to the shared helpers and types they exercise, which is appropriate for this internal test utility package.


22-77: Provider capability matrix for scenarios looks coherent

The providers := []ProviderConfig{...} definition covers the expected set of major providers with sensible modality/streaming flags (e.g., Groq without vision, Bedrock/Vertex marked non‑streaming). Centralizing this in testutil is a good fit for the cross‑provider scenario tests.


99-109: Subtest wiring for scenario runs is clear and symmetric

Iterating over GetPredefinedScenarios() and using subtests for Chat Completions vs Responses API via RunCrossProviderScenarioTest(..., false/true) gives a clean, DRY structure for exercising both APIs per scenario. No issues from a test structure standpoint.


125-137: Consistency test config is minimal and appropriate

The slimmer providers list and CrossProviderTestConfig with ValidationStrength: ValidationLenient for TestCrossProviderConsistency matches its purpose (sanity‑checking cross‑provider outputs rather than strict scenario fulfillment), and the two subtests correctly toggle the useResponsesAPI flag.

Also applies to: 141-146

@akshaydeo akshaydeo force-pushed the 11-22-moves_all_tests_related_to_core_to_corresponding_files branch from 456794c to 8291f6c Compare November 24, 2025 07:15
@akshaydeo akshaydeo changed the base branch from main to graphite-base/916 November 24, 2025 07:28
@akshaydeo akshaydeo force-pushed the 11-22-moves_all_tests_related_to_core_to_corresponding_files branch from 8291f6c to ff542b1 Compare November 24, 2025 07:28
@akshaydeo akshaydeo changed the base branch from graphite-base/916 to 11-24-feat_core_tests_retry_logic_enhancements November 24, 2025 07:28
@Pratham-Mishra04 Pratham-Mishra04 changed the base branch from 11-24-feat_core_tests_retry_logic_enhancements to graphite-base/916 November 24, 2025 07:32
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (12)
core/internal/testutil/multiple_images.go (1)

15-138: Signature switch to local ComprehensiveTestConfig is correct; consider deduping scenario name

Using the unqualified ComprehensiveTestConfig from core/internal/testutil matches the shared config struct and keeps this helper consistent with the rest of testutil. The test logic and retry wiring look sound.

If you want to reduce the risk of typos in the "MultipleImages" literal (used in t.Run, GetTestRetryConfigForScenario, ScenarioName, and WithChatTestRetry), you could introduce a local constant:

-func RunMultipleImagesTest(t *testing.T, client *bifrost.Bifrost, ctx context.Context, testConfig ComprehensiveTestConfig) {
+func RunMultipleImagesTest(t *testing.T, client *bifrost.Bifrost, ctx context.Context, testConfig ComprehensiveTestConfig) {
+	const scenarioName = "MultipleImages"
 	if !testConfig.Scenarios.MultipleImages {
 		t.Logf("Multiple images not supported for provider %s", testConfig.Provider)
 		return
 	}
 
-	t.Run("MultipleImages", func(t *testing.T) {
+	t.Run(scenarioName, func(t *testing.T) {
@@
-		retryConfig := GetTestRetryConfigForScenario("MultipleImages", testConfig)
+		retryConfig := GetTestRetryConfigForScenario(scenarioName, testConfig)
 		retryContext := TestRetryContext{
-			ScenarioName: "MultipleImages",
+			ScenarioName: scenarioName,
@@
-		response, bifrostError := WithChatTestRetry(t, chatRetryConfig, retryContext, expectations, "MultipleImages", func() (*schemas.BifrostChatResponse, *schemas.BifrostError) {
+		response, bifrostError := WithChatTestRetry(t, chatRetryConfig, retryContext, expectations, scenarioName, func() (*schemas.BifrostChatResponse, *schemas.BifrostError) {
 			return client.ChatCompletionRequest(ctx, request)
 		})
core/internal/testutil/simple_chat.go (1)

15-17: Prefer t.Skipf over log+return and remove unreachable final error check

Two small cleanups will make this helper more idiomatic and clearer:

  1. When SimpleChat is not supported, this should be marked as a skipped test rather than a silent pass:
-	if !testConfig.Scenarios.SimpleChat {
-		t.Logf("Simple chat not supported for provider %s", testConfig.Provider)
-		return
-	}
+	if !testConfig.Scenarios.SimpleChat {
+		t.Skipf("Simple chat not supported for provider %s", testConfig.Provider)
+	}
  1. The final if chatError != nil || responsesError != nil is unreachable because earlier t.Fatalf calls already exit on any non‑nil error:
-		// Fail test if either API failed
-		if chatError != nil || responsesError != nil {
-			t.Fatalf("❌ SimpleChat test failed - one or both APIs failed")
-		}
-
-		t.Logf("🎉 Both Chat Completions and Responses APIs passed SimpleChat test!")
+		t.Logf("🎉 Both Chat Completions and Responses APIs passed SimpleChat test!")

Also applies to: 145-147

core/providers/ollama/ollama.go (1)

1-3: Update the package comment to match the new package name.

The file header comment still references "Package providers" but the package declaration has been changed to package ollama. This inconsistency should be corrected.

Apply this diff:

-// Package providers implements various LLM providers and their utility functions.
-// This file contains the Ollama provider implementation.
+// Package ollama implements the Ollama LLM provider.
 package ollama
core/providers/parasail/parasail.go (1)

1-3: Update the package comment to match the new package name.

The file header comment still references "Package providers" but the package declaration has been changed to package parasail. This inconsistency should be corrected for documentation clarity.

Apply this diff:

-// Package providers implements various LLM providers and their utility functions.
-// This file contains the Parasail provider implementation.
+// Package parasail implements the Parasail LLM provider.
 package parasail
core/internal/testutil/utils.go (1)

7-8: GetLionBase64Image path resolution is more robust now

Deriving the base directory via runtime.Caller(0) and constructing scenarios/media/lion_base64.txt with filepath.Join removes dependence on the process working directory and is cross‑platform friendly. As a future nicety, you could embed this test asset with //go:embed to avoid runtime file I/O entirely, but the current approach is fine for tests.

Also applies to: 195-203

core/providers/sgl/sgl_test.go (1)

18-23: Harden teardown by deferring client.Shutdown()

Pattern around SetupTest and teardown looks correct, but you can make cleanup more robust against future early returns by deferring client.Shutdown() instead of calling it at the end:

-	client, ctx, cancel, err := testutil.SetupTest()
-	if err != nil {
-		t.Fatalf("Error initializing test setup: %v", err)
-	}
-	defer cancel()
+	client, ctx, cancel, err := testutil.SetupTest()
+	if err != nil {
+		t.Fatalf("Error initializing test setup: %v", err)
+	}
+	defer cancel()
+	defer client.Shutdown()
@@
-	t.Run("SGLTests", func(t *testing.T) {
-		testutil.RunAllComprehensiveTests(t, client, ctx, testConfig)
-	})
-	client.Shutdown()
+	t.Run("SGLTests", func(t *testing.T) {
+		testutil.RunAllComprehensiveTests(t, client, ctx, testConfig)
+	})

Please run the SGL tests once with this change to confirm behavior is unchanged.

Also applies to: 49-53

core/providers/anthropic/anthropic_test.go (1)

18-23: Align Anthropic teardown pattern with SGL suggestion

Setup and error handling look good. To keep teardown consistent and resilient (especially if this test grows), consider deferring client.Shutdown() here as well, following the SGL pattern:

client, ctx, cancel, err := testutil.SetupTest()
if err != nil {
	t.Fatalf("Error initializing test setup: %v", err)
}
defer cancel()
defer client.Shutdown()

t.Run("AnthropicTests", func(t *testing.T) {
	testutil.RunAllComprehensiveTests(t, client, ctx, testConfig)
})

Please re-run the Anthropic tests after this change to confirm no behavioral differences.

Also applies to: 52-56

core/providers/ollama/ollama_test.go (1)

18-23: Ollama teardown pattern mirrors other providers

The Ollama test follows the same setup/teardown pattern as SGL/Anthropic. To keep things consistent and safer against future early returns, consider deferring client.Shutdown() here as well (same pattern as in TestSGL):

client, ctx, cancel, err := testutil.SetupTest()
if err != nil {
	t.Fatalf("Error initializing test setup: %v", err)
}
defer cancel()
defer client.Shutdown()

Please run the Ollama tests after this change to verify everything still passes.

Also applies to: 48-52

core/providers/gemini/gemini_test.go (1)

18-23: Gemini test teardown can follow same deferred-shutdown pattern

Setup, error handling, and subtest structure are fine. For consistency with other providers and to future‑proof against early returns, you can also defer client.Shutdown() here:

client, ctx, cancel, err := testutil.SetupTest()
if err != nil {
	t.Fatalf("Error initializing test setup: %v", err)
}
defer cancel()
defer client.Shutdown()

t.Run("GeminiTests", func(t *testing.T) {
	testutil.RunAllComprehensiveTests(t, client, ctx, testConfig)
})

Please re-run the Gemini tests after applying this to confirm behavior.

Also applies to: 59-63

core/providers/elevenlabs/elevenlabs_test.go (1)

18-23: ElevenLabs test teardown matches pattern; consider deferring shutdown

As with the other providers, the ElevenLabs test’s use of SetupTest and RunAllComprehensiveTests looks solid. For uniformity and slightly safer cleanup, you could also use defer client.Shutdown() here instead of an explicit call at the end:

client, ctx, cancel, err := testutil.SetupTest()
if err != nil {
	t.Fatalf("Error initializing test setup: %v", err)
}
defer cancel()
defer client.Shutdown()

Please re-run the ElevenLabs tests after this change to ensure behavior stays the same.

Also applies to: 52-56

core/internal/testutil/cross_provider_test.go (2)

11-12: Remove unreachable return statement.

The return statement after t.Skip() is unreachable since t.Skip() internally calls SkipNow() which stops test execution immediately.

Apply this diff to clean up the code:

 	t.Parallel()
 	t.Skip("Skipping cross provider scenarios test")
-	return

115-116: Remove unreachable return statement.

Same issue as above—the return after t.Skip() is unreachable.

Apply this diff:

 	t.Parallel()
 	t.Skip("Skipping cross provider consistency test")
-	return
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 456794c and ff542b1.

⛔ Files ignored due to path filters (3)
  • core/go.sum is excluded by !**/*.sum
  • tests/core-chatbot/go.sum is excluded by !**/*.sum
  • tests/core-providers/go.sum is excluded by !**/*.sum
📒 Files selected for processing (73)
  • .github/workflows/scripts/release-core.sh (1 hunks)
  • Makefile (5 hunks)
  • core/bifrost.go (2 hunks)
  • core/chatbot_test.go (6 hunks)
  • core/go.mod (1 hunks)
  • core/internal/testutil/account.go (1 hunks)
  • core/internal/testutil/automatic_function_calling.go (2 hunks)
  • core/internal/testutil/chat_completion_stream.go (2 hunks)
  • core/internal/testutil/complete_end_to_end.go (1 hunks)
  • core/internal/testutil/cross_provider_scenarios.go (1 hunks)
  • core/internal/testutil/cross_provider_test.go (4 hunks)
  • core/internal/testutil/embedding.go (2 hunks)
  • core/internal/testutil/end_to_end_tool_calling.go (1 hunks)
  • core/internal/testutil/error_parser.go (1 hunks)
  • core/internal/testutil/image_base64.go (1 hunks)
  • core/internal/testutil/image_url.go (1 hunks)
  • core/internal/testutil/list_models.go (2 hunks)
  • core/internal/testutil/multi_turn_conversation.go (2 hunks)
  • core/internal/testutil/multiple_images.go (1 hunks)
  • core/internal/testutil/multiple_tool_calls.go (2 hunks)
  • core/internal/testutil/reasoning.go (1 hunks)
  • core/internal/testutil/response_validation.go (1 hunks)
  • core/internal/testutil/responses_stream.go (3 hunks)
  • core/internal/testutil/setup.go (1 hunks)
  • core/internal/testutil/simple_chat.go (1 hunks)
  • core/internal/testutil/speech_synthesis.go (2 hunks)
  • core/internal/testutil/speech_synthesis_stream.go (3 hunks)
  • core/internal/testutil/test_retry_conditions.go (1 hunks)
  • core/internal/testutil/test_retry_framework.go (2 hunks)
  • core/internal/testutil/tests.go (3 hunks)
  • core/internal/testutil/text_completion.go (1 hunks)
  • core/internal/testutil/text_completion_stream.go (2 hunks)
  • core/internal/testutil/tool_calls.go (2 hunks)
  • core/internal/testutil/tool_calls_streaming.go (2 hunks)
  • core/internal/testutil/transcription.go (4 hunks)
  • core/internal/testutil/transcription_stream.go (3 hunks)
  • core/internal/testutil/utils.go (2 hunks)
  • core/internal/testutil/validation_presets.go (2 hunks)
  • core/providers/anthropic/anthropic_test.go (3 hunks)
  • core/providers/azure/azure_test.go (4 hunks)
  • core/providers/bedrock/bedrock_test.go (4 hunks)
  • core/providers/cerebras/cerebras.go (1 hunks)
  • core/providers/cerebras/cerebras_test.go (4 hunks)
  • core/providers/cohere/cohere_test.go (3 hunks)
  • core/providers/elevenlabs/elevenlabs_test.go (3 hunks)
  • core/providers/gemini/gemini_test.go (4 hunks)
  • core/providers/groq/groq.go (1 hunks)
  • core/providers/groq/groq_test.go (4 hunks)
  • core/providers/mistral/mistral_test.go (3 hunks)
  • core/providers/ollama/ollama.go (1 hunks)
  • core/providers/ollama/ollama_test.go (3 hunks)
  • core/providers/openai/openai_test.go (4 hunks)
  • core/providers/openrouter/openrouter.go (1 hunks)
  • core/providers/openrouter/openrouter_test.go (3 hunks)
  • core/providers/parasail/parasail.go (1 hunks)
  • core/providers/parasail/parasail_test.go (3 hunks)
  • core/providers/perplexity/perplexity_test.go (3 hunks)
  • core/providers/sgl/sgl.go (1 hunks)
  • core/providers/sgl/sgl_test.go (3 hunks)
  • core/providers/vertex/vertex_test.go (3 hunks)
  • tests/core-chatbot/go.mod (0 hunks)
  • tests/core-providers/README.md (0 hunks)
  • tests/core-providers/go.mod (0 hunks)
  • tests/governance/README.md (0 hunks)
  • tests/governance/__init__.py (0 hunks)
  • tests/governance/conftest.py (0 hunks)
  • tests/governance/pytest.ini (0 hunks)
  • tests/governance/requirements.txt (0 hunks)
  • tests/governance/test_customers_crud.py (0 hunks)
  • tests/governance/test_helpers.py (0 hunks)
  • tests/governance/test_teams_crud.py (0 hunks)
  • tests/governance/test_usage_tracking.py (0 hunks)
  • tests/governance/test_virtual_keys_crud.py (0 hunks)
💤 Files with no reviewable changes (13)
  • tests/core-chatbot/go.mod
  • tests/governance/test_customers_crud.py
  • tests/governance/pytest.ini
  • tests/governance/init.py
  • tests/governance/README.md
  • tests/core-providers/go.mod
  • tests/governance/requirements.txt
  • tests/governance/test_virtual_keys_crud.py
  • tests/governance/conftest.py
  • tests/governance/test_teams_crud.py
  • tests/governance/test_helpers.py
  • tests/governance/test_usage_tracking.py
  • tests/core-providers/README.md
✅ Files skipped from review due to trivial changes (1)
  • core/providers/cerebras/cerebras.go
🚧 Files skipped from review as they are similar to previous changes (24)
  • core/internal/testutil/test_retry_conditions.go
  • core/providers/groq/groq_test.go
  • core/providers/perplexity/perplexity_test.go
  • core/internal/testutil/validation_presets.go
  • core/providers/groq/groq.go
  • core/internal/testutil/image_base64.go
  • core/go.mod
  • core/internal/testutil/multiple_tool_calls.go
  • core/internal/testutil/speech_synthesis.go
  • core/internal/testutil/speech_synthesis_stream.go
  • core/internal/testutil/text_completion.go
  • core/internal/testutil/embedding.go
  • core/providers/openrouter/openrouter.go
  • core/internal/testutil/list_models.go
  • core/providers/sgl/sgl.go
  • core/providers/cerebras/cerebras_test.go
  • core/internal/testutil/tool_calls_streaming.go
  • core/internal/testutil/response_validation.go
  • core/providers/cohere/cohere_test.go
  • core/providers/openai/openai_test.go
  • .github/workflows/scripts/release-core.sh
  • core/internal/testutil/test_retry_framework.go
  • core/internal/testutil/account.go
  • core/internal/testutil/complete_end_to_end.go
🧰 Additional context used
🧬 Code graph analysis (22)
core/internal/testutil/multi_turn_conversation.go (4)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/test_retry_framework.go (1)
  • WithChatTestRetry (274-424)
core/schemas/chatcompletions.go (1)
  • BifrostChatResponse (25-40)
core/internal/testutil/utils.go (2)
  • GetErrorMessage (597-621)
  • GetChatContent (320-347)
core/chatbot_test.go (1)
core/schemas/chatcompletions.go (1)
  • ChatParameters (154-183)
core/internal/testutil/responses_stream.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/azure/azure_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/multiple_images.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/simple_chat.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/automatic_function_calling.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/elevenlabs/elevenlabs_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/reasoning.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/bifrost.go (6)
core/providers/ollama/ollama.go (1)
  • NewOllamaProvider (28-60)
core/schemas/bifrost.go (7)
  • Groq (43-43)
  • SGL (44-44)
  • Parasail (45-45)
  • Perplexity (46-46)
  • Cerebras (47-47)
  • Gemini (48-48)
  • OpenRouter (49-49)
core/providers/groq/groq.go (1)
  • NewGroqProvider (27-58)
core/providers/parasail/parasail.go (1)
  • NewParasailProvider (27-53)
core/providers/cerebras/cerebras.go (1)
  • NewCerebrasProvider (27-53)
core/providers/openrouter/openrouter.go (1)
  • NewOpenRouterProvider (29-55)
core/internal/testutil/image_url.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/chat_completion_stream.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/transcription_stream.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/bedrock/bedrock_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/sgl/sgl_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • SGL (44-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/ollama/ollama_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Ollama (42-42)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/vertex/vertex_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Vertex (40-40)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/tests.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/end_to_end_tool_calling.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/text_completion_stream.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/tool_calls.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/transcription.go (2)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/schemas/transcriptions.go (1)
  • BifrostTranscriptionResponse (16-26)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
🔇 Additional comments (38)
core/internal/testutil/image_url.go (2)

1-1: LGTM! Package rename aligns with refactoring objectives.

The package declaration correctly reflects the new location and naming convention as part of the test infrastructure consolidation.


15-15: LGTM! Type reference correctly updated for local package.

The function signature now uses the unqualified ComprehensiveTestConfig type, which is appropriate since the type is defined locally in the testutil package (core/internal/testutil/account.go). This change is consistent with the refactoring that consolidates test utilities into a single package.

core/internal/testutil/multiple_images.go (1)

1-12: Package rename to testutil and imports look consistent

Package name now matches the file’s new location under core/internal/testutil, and the imports align with the usage below; nothing further needed here.

core/internal/testutil/simple_chat.go (1)

1-11: Package rename and local config type usage look correct

Using package testutil and the unqualified ComprehensiveTestConfig from the same package aligns with the new core/internal/testutil layout; imports are minimal and consistent. No issues here.

core/internal/testutil/multi_turn_conversation.go (2)

1-1: LGTM! Package rename and signature update are correct.

The package rename from scenarios to testutil and the update to use ComprehensiveTestConfig from the same package (instead of importing from config) align with the PR's objective to consolidate test utilities into core/internal/testutil.

Also applies to: 13-13


135-148: LGTM! Validation logic correctly delegated to retry helper.

The simplified Step2 handling appropriately delegates all validation to WithChatTestRetry via expectations2. The expectations ensure the response contains "alice" and doesn't contain memory failure indicators. By the time execution reaches line 139, either validation succeeded (bifrostErr == nil) or all retries were exhausted (bifrostErr != nil), so the error check and success logging are correct.

This refactoring successfully removes manual string checking while maintaining robust validation through the retry framework.

core/internal/testutil/tool_calls.go (1)

1-17: LGTM!

The package rename to testutil and the updated function signature using the local ComprehensiveTestConfig type are consistent with the broader test infrastructure refactoring described in the PR.

core/internal/testutil/setup.go (1)

1-4: LGTM!

The package comment and declaration have been properly updated to reflect the new testutil package name. The changes are consistent with the test infrastructure reorganization.

core/internal/testutil/error_parser.go (1)

1-1: LGTM!

Package rename to testutil aligns with the test infrastructure consolidation described in the PR objectives.

core/chatbot_test.go (2)

1-13: LGTM!

The conversion to an external test package (bifrost_test) is a best practice that properly isolates the integration test from the production code.


830-947: LGTM!

Excellent conversion of the standalone chatbot application to a proper test function with conditional execution. The TestChatbot wrapper with the RUN_CHATBOT_TEST environment variable check ensures this interactive test doesn't run during normal CI pipelines while still being available for manual testing.

core/internal/testutil/text_completion_stream.go (1)

1-17: LGTM!

The package rename to testutil and the updated function signature using the local ComprehensiveTestConfig type are consistent with the test infrastructure refactoring.

core/internal/testutil/reasoning.go (1)

1-14: LGTM!

The package rename to testutil and the updated function signature using the local ComprehensiveTestConfig type are consistent with the test infrastructure consolidation described in the PR.

core/internal/testutil/end_to_end_tool_calling.go (1)

1-1: ComprehensiveTestConfig migration to testutil is consistent

The switch to package testutil and updating RunEnd2EndToolCallingTest to take the local ComprehensiveTestConfig keeps the behavior intact and matches the struct definition in account.go (provider, chat model, scenarios, fallbacks). Call sites in testutil.RunAllComprehensiveTests are consistent with this signature.

Also applies to: 15-15

core/internal/testutil/chat_completion_stream.go (1)

1-1: RunChatCompletionStreamTest correctly updated to use local ComprehensiveTestConfig

The function now depends on testutil.ComprehensiveTestConfig, and all accessed fields (Provider, ChatModel, Fallbacks, Scenarios.CompletionStream/ToolCalls) align with the struct in account.go. The streaming behavior and retry logic remain unchanged.

Also applies to: 16-16

core/internal/testutil/automatic_function_calling.go (2)

1-1: Automatic function calling test wired to local ComprehensiveTestConfig correctly

RunAutomaticFunctionCallingTest now takes ComprehensiveTestConfig from the same package, and its usage (Scenarios.AutomaticFunctionCall, Provider, ChatModel, Fallbacks) matches the struct definition. Dual-API setup, tool choice config, and retry wiring remain the same, so behavior is preserved while centralizing config under testutil.

Also applies to: 14-159


161-180: validateAutomaticToolCall now acts as a logging helper only

The added comments and current implementation make validateAutomaticToolCall a non-failing logger that relies on WithDualAPITestRetry + ToolCallExpectations for actual assertions. Given that centralization, it’s reasonable that this helper just surfaces tool-call details and timezone hints without introducing extra flakiness.

core/providers/bedrock/bedrock_test.go (1)

7-7: Bedrock tests correctly migrated to shared testutil harness

Using testutil.SetupTest, testutil.ComprehensiveTestConfig, and testutil.RunAllComprehensiveTests standardizes Bedrock coverage with other providers. The TestScenarios flags are consistent with the Bedrock capabilities you’ve annotated (e.g., disabling text completion and image URL, enabling streaming, tool calls, embeddings, reasoning, and list models), and shutdown/cancel handling looks sound.

Also applies to: 18-31, 34-56

core/internal/testutil/utils.go (1)

209-222: Migration to CreateSpeechRequest complete; no stale references found

Verification confirms the rename is fully migrated. The old CreateSpeechInput name is gone, and CreateSpeechRequest is actively used in test files (plugin_normalization_test.go, plugin_streaming_test.go). The function fields are correctly wired for BifrostSpeechRequest.

core/internal/testutil/transcription_stream.go (1)

1-1: LGTM! Consistent package rename and type updates.

The package rename from scenarios to testutil and the function signature updates to use the unqualified ComprehensiveTestConfig type are consistent with the PR's objective to consolidate test utilities into core/internal/testutil.

Also applies to: 18-18, 326-326

core/internal/testutil/tests.go (1)

1-1: LGTM! Clean type consolidation.

The package rename and type signature updates correctly use the unqualified ComprehensiveTestConfig type from the local testutil package. The exported RunAllComprehensiveTests function provides a clean public API for test execution.

Also applies to: 12-12, 14-15, 64-64

Makefile (1)

318-322: LGTM! Consistent test path updates.

All test paths have been correctly updated to reflect the new location of provider tests in core/providers/$(PROVIDER)/ instead of the centralized tests/core-providers/. The working directory changes and junitfile paths are properly adjusted for the new directory depth. The new test-chatbot target follows existing patterns and provides clear usage instructions.

Also applies to: 338-342, 528-544

core/internal/testutil/transcription.go (1)

1-1: LGTM! Consistent with testutil migration.

Package rename and function signature updates match the pattern across all testutil files.

Also applies to: 18-18, 278-278, 501-501

core/bifrost.go (1)

21-32: LGTM! Clean per-provider package separation.

The refactoring from a consolidated providers package to individual per-provider packages (cerebras, groq, ollama, openrouter, parasail, sgl) improves modularity and package organization. All imports and constructor calls are consistent with the new structure.

Also applies to: 1309-1323

core/internal/testutil/cross_provider_scenarios.go (1)

1-1: LGTM! Package rename.

Simple package rename consistent with the testutil consolidation.

core/providers/parasail/parasail_test.go (1)

1-1: LGTM! Proper test migration to testutil.

The test file correctly migrates to use the testutil package and follows Go best practices by using an external test package (parasail_test). All references to SetupTest, ComprehensiveTestConfig, TestScenarios, and RunAllComprehensiveTests are properly updated.

Also applies to: 7-7, 18-18, 24-24, 29-29, 49-49

core/providers/azure/azure_test.go (1)

1-1: LGTM! Consistent test migration.

The test file follows the same migration pattern as other provider tests, correctly using the testutil package and external test package naming (azure_test). All updates are consistent with the broader refactoring.

Also applies to: 7-7, 20-20, 26-26, 36-36, 64-64

core/providers/sgl/sgl_test.go (1)

24-47: SGL ComprehensiveTestConfig and scenarios look consistent

Provider, model IDs, and TestScenarios flags are wired up consistently with testutil.ComprehensiveTestConfig/TestScenarios; nothing blocking here. Just make sure SGL actually supports all enabled scenarios (text completion, streaming, tools, images, embeddings, list models) so you don’t get systematic red tests.

core/providers/anthropic/anthropic_test.go (1)

24-50: Anthropic config/scenario matrix is coherent

The Anthropic ComprehensiveTestConfig looks coherent:

  • Chat+vision on the latest Sonnet generation.
  • Reasoning enabled, embeddings/text completion disabled, which matches the comments.
  • Fallbacks provide both an older Sonnet and the primary model.

No code changes needed; just ensure the model IDs and the “not supported” flags stay in sync with Anthropic’s actual feature set so CI doesn’t go red purely from capability mismatches.

core/providers/ollama/ollama_test.go (1)

24-46: Ollama scenario flags match documented capabilities

The Ollama ComprehensiveTestConfig/TestScenarios look reasonable:

  • Chat model set, text/embedding models intentionally left empty with scenarios disabled.
  • Tools, streaming chat, multi-turn, and end‑to‑end flags enabled.
  • Image-related and embedding scenarios disabled.

No changes required; just confirm that the enabled tool/stream scenarios are actually supported by your Ollama setup so the suite doesn’t become permanently red.

core/providers/gemini/gemini_test.go (1)

24-57: Gemini configuration is detailed and internally consistent

The Gemini ComprehensiveTestConfig is thorough:

  • Chat+vision via gemini-2.0-flash.
  • Separate models for embeddings, transcription, and TTS, with TTS fallbacks.
  • Scenarios wired to match: no text completion, image base64 on (URL off), speech on, transcription off, reasoning off with a clear TODO.

No structural issues here. If/when you add native Gemini reasoning support or transcription flows, toggling the corresponding TestScenarios flags will be straightforward.

core/providers/elevenlabs/elevenlabs_test.go (1)

24-50: Speech‑focused ElevenLabs config and scenarios look correct

The ElevenLabs ComprehensiveTestConfig is constrained appropriately to speech use cases:

  • Only speech synthesis and transcription models are set.
  • Scenarios enable SpeechSynthesis, SpeechSynthesisStream, and Transcription; everything else is disabled.

This aligns with ElevenLabs’ typical capability profile; I don’t see issues here. Just confirm that the streaming/non‑streaming flags map cleanly onto how your ElevenLabs integration is implemented.

core/providers/vertex/vertex_test.go (1)

1-53: LGTM! Clean migration to testutil package.

The refactoring correctly updates the package name to vertex_test, migrates all test utilities to the centralized testutil package, and preserves the original test logic. This aligns well with the PR's objective of consolidating test infrastructure.

core/providers/mistral/mistral_test.go (1)

1-55: LGTM! Consistent migration pattern.

The changes mirror the refactoring in other provider tests, correctly adopting the centralized testutil package while preserving test logic and configuration.

core/internal/testutil/responses_stream.go (2)

1-17: LGTM! Proper package migration.

The file has been correctly migrated into the testutil package, with function signatures updated to use the local ComprehensiveTestConfig type. The test logic remains unchanged.


821-821: Consistent type reference update.

The signature correctly uses the unqualified ComprehensiveTestConfig type, now that the function resides in the same package as the type definition.

core/providers/openrouter/openrouter_test.go (1)

1-54: LGTM! Consistent refactoring.

The OpenRouter test follows the same migration pattern as other provider tests, correctly adopting the testutil package infrastructure.

core/internal/testutil/cross_provider_test.go (1)

1-10: LGTM! Successful migration to testutil package.

The test file has been properly migrated into the testutil package with all type references and function calls correctly updated to use local (unqualified) names. The test structure and logic remain intact.

Also applies to: 14-147

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
core/internal/testutil/error_parser.go (1)

402-419: Remove unreachable code after t.Fatalf.

Line 416 contains return false after t.Fatalf() on line 415, which terminates execution immediately. The return statement is unreachable and can be removed.

Apply this diff to remove the unreachable code:

 func AssertNoError(t *testing.T, err *schemas.BifrostError, msgAndArgs ...interface{}) bool {
 	if err != nil {
 		parsed := ParseBifrostError(err)
 		message := "Expected no error"
 		if len(msgAndArgs) > 0 {
 			if msg, ok := msgAndArgs[0].(string); ok {
 				if len(msgAndArgs) > 1 {
 					message = fmt.Sprintf(msg, msgAndArgs[1:]...)
 				} else {
 					message = msg
 				}
 			}
 		}
 		t.Fatalf("%s, but got:\n%s", message, FormatError(parsed))
-		return false
 	}
 	return true
 }
core/internal/testutil/cross_provider_test.go (1)

9-12: Explain why tests are skipped in a refactoring PR.

Both test functions (TestCrossProviderScenarios and TestCrossProviderConsistency) are immediately skipped after being marked as parallel. In a refactoring PR that reorganizes test infrastructure, these tests should be runnable to verify the refactoring didn't break functionality. Skipped tests provide no validation that the moved code still works correctly.

Please clarify:

  • Why are these tests being skipped?
  • Is this temporary or permanent?
  • How is the refactored test infrastructure being validated?
🧹 Nitpick comments (9)
core/providers/groq/groq.go (1)

1-3: Update package doc comment to match new package name

The top-level comment still refers to Package providers, but the package is now groq. This will be misleading in go doc and for readers.

You can align the docstring with the new package name like this:

-// Package providers implements various LLM providers and their utility functions.
-// This file contains the Groq provider implementation.
+// Package groq implements the Groq provider and its utility functions.
+// This file contains the Groq provider implementation.
 package groq
core/internal/testutil/test_retry_framework.go (1)

1116-1147: Signature change is consistent; consider marking unused param explicitly

Switching the argument type to the local ComprehensiveTestConfig aligns with the new testutil package and avoids the old external config dependency—this looks correct.

testConfig isn’t used in the function body; if that’s intentional (kept only for future scenario-aware behavior or API stability), consider renaming it to _ to avoid lints and make the intent explicit:

-func GetTestRetryConfigForScenario(scenarioName string, testConfig ComprehensiveTestConfig) TestRetryConfig {
+func GetTestRetryConfigForScenario(scenarioName string, _ ComprehensiveTestConfig) TestRetryConfig {
core/internal/testutil/validation_presets.go (1)

208-293: Consider removing or utilizing the unused testConfig parameter.

The testConfig parameter is declared but never referenced in the function body. The function builds expectations based solely on scenarioName and customParams.

If the parameter is not needed, consider simplifying the signature:

-func GetExpectationsForScenario(scenarioName string, testConfig ComprehensiveTestConfig, customParams map[string]interface{}) ResponseExpectations {
+func GetExpectationsForScenario(scenarioName string, customParams map[string]interface{}) ResponseExpectations {

Alternatively, if testConfig should inform the expectations (e.g., using testConfig.Provider to call ModifyExpectationsForProvider), please verify that the implementation is complete.

core/internal/testutil/speech_synthesis.go (2)

16-16: Consider using the provided context parameter.

The function accepts a ctx context.Context parameter but creates a new context.Background() at line 113 instead. If the context parameter isn't needed, consider removing it from the function signature for clarity. Otherwise, use the provided context for the API call.

Apply this diff if the parameter should be used:

-			requestCtx := context.Background()
+			requestCtx := ctx
 
 			speechResponse, bifrostErr := WithSpeechTestRetry(t, speechRetryConfig, retryContext, expectations, "SpeechSynthesis_"+tc.name, func() (*schemas.BifrostSpeechResponse, *schemas.BifrostError) {
 				return client.SpeechRequest(requestCtx, request)
 			})

Or remove it from the signature if not needed:

-func RunSpeechSynthesisTest(t *testing.T, client *bifrost.Bifrost, ctx context.Context, testConfig ComprehensiveTestConfig) {
+func RunSpeechSynthesisTest(t *testing.T, client *bifrost.Bifrost, testConfig ComprehensiveTestConfig) {

Also applies to: 113-113


150-150: Consider using the provided context parameter.

Similar to RunSpeechSynthesisTest, this function accepts a ctx context.Context parameter but creates new context.Background() contexts at lines 219 and 301. For consistency and clarity, either use the provided context or remove it from the function signature.

Apply similar changes as suggested for RunSpeechSynthesisTest.

Also applies to: 219-219, 301-301

core/internal/testutil/text_completion_stream.go (2)

67-83: Use the derived timeout context for the stream request to avoid leaks

In all three subtests you call TextCompletionStreamRequest(ctx, request) and only later derive streamCtx := context.WithTimeout(ctx, ...) for the read loop. If the upstream call or provider misbehaves, the timeout will fail the test but won’t actually cancel the underlying request, potentially leaking goroutines or hanging connections during test runs.

Consider creating streamCtx before WithStreamRetry and using it for both the request and the select:

-		// Use proper streaming retry wrapper for the stream request
-		responseChannel, err := WithStreamRetry(t, retryConfig, retryContext, func() (chan *schemas.BifrostStream, *schemas.BifrostError) {
-			return client.TextCompletionStreamRequest(ctx, request)
-		})
+		// Create a timeout context for the stream request + reading
+		streamCtx, cancel := context.WithTimeout(ctx, 30*time.Second)
+		defer cancel()
+
+		// Use proper streaming retry wrapper for the stream request
+		responseChannel, err := WithStreamRetry(t, retryConfig, retryContext, func() (chan *schemas.BifrostStream, *schemas.BifrostError) {
+			return client.TextCompletionStreamRequest(streamCtx, request)
+		})
@@
-		// Create a timeout context for the stream reading
-		streamCtx, cancel := context.WithTimeout(ctx, 30*time.Second)
-		defer cancel()

and similarly for the varied‑prompts and parameters subtests with their respective timeouts. This keeps the lifecycle of the RPC and the read loop aligned.

Please verify this aligns with how WithStreamRetry expects contexts to be managed in the rest of core/internal/testutil.

Also applies to: 266-280, 408-420


231-235: Loop variable capture is not a correctness issue on Go 1.24.3, but explicit shadowing improves clarity

The code uses loop variables directly in t.Run closures at lines 231-235 and 372-376 without explicit shadowing. Since the repository targets Go 1.24.3, which fixed loop variable semantics in 1.22, this is no longer a correctness issue. However, explicit shadowing remains a defensive and clarity improvement:

-		for _, testCase := range testPrompts {
+		for _, testCase := range testPrompts {
+			testCase := testCase
			t.Run(testCase.name, func(t *testing.T) {

-		for _, paramTest := range parameterTests {
+		for _, paramTest := range parameterTests {
+			paramTest := paramTest
			t.Run(paramTest.name, func(t *testing.T) {

This pattern makes the intent explicit and is a common Go idiom for loop variable capture.

core/providers/sgl/sgl_test.go (1)

1-51: SGL test’s migration to testutil looks correct; consider deferring Shutdown for robustness

  • Import of core/internal/testutil and use of SetupTest, ComprehensiveTestConfig, TestScenarios, and RunAllComprehensiveTests are consistent with the shared helpers and look good.
  • Scenario flags line up with the configured SGL models and omit unsupported features (reasoning/tts/transcription), which makes sense.

As a small cleanup / safety improvement, you could ensure the client is always torn down even if the subtest fails or panics by deferring Shutdown instead of calling it at the end:

-	client, ctx, cancel, err := testutil.SetupTest()
+	client, ctx, cancel, err := testutil.SetupTest()
 	if err != nil {
 		t.Fatalf("Error initializing test setup: %v", err)
 	}
-	defer cancel()
+	defer cancel()
+	defer client.Shutdown()
@@
-	t.Run("SGLTests", func(t *testing.T) {
-		testutil.RunAllComprehensiveTests(t, client, ctx, testConfig)
-	})
-	client.Shutdown()
+	t.Run("SGLTests", func(t *testing.T) {
+		testutil.RunAllComprehensiveTests(t, client, ctx, testConfig)
+	})
core/providers/azure/azure_test.go (1)

7-37: Azure testutil migration is fine; clarify or simplify around the unconditional skip

  • The changes to use core/internal/testutil (SetupTest, ComprehensiveTestConfig, TestScenarios, RunAllComprehensiveTests) are consistent and look correct.
  • With the top-level t.Skip("Skipping Azure tests because Azure."), none of this configuration or the AZURE_API_KEY / AZURE_EMB_API_KEY logic will actually execute.

If Azure tests are meant to stay permanently disabled, consider either:

  • Adding a brief comment near the t.Skip explaining why, or
  • Dropping the unused env/config code to reduce noise.

If they’re only temporarily disabled, you might later remove that t.Skip and rely purely on the env gates you already have.

Also applies to: 63-65

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 456794c and ff542b1.

⛔ Files ignored due to path filters (3)
  • core/go.sum is excluded by !**/*.sum
  • tests/core-chatbot/go.sum is excluded by !**/*.sum
  • tests/core-providers/go.sum is excluded by !**/*.sum
📒 Files selected for processing (73)
  • .github/workflows/scripts/release-core.sh (1 hunks)
  • Makefile (5 hunks)
  • core/bifrost.go (2 hunks)
  • core/chatbot_test.go (6 hunks)
  • core/go.mod (1 hunks)
  • core/internal/testutil/account.go (1 hunks)
  • core/internal/testutil/automatic_function_calling.go (2 hunks)
  • core/internal/testutil/chat_completion_stream.go (2 hunks)
  • core/internal/testutil/complete_end_to_end.go (1 hunks)
  • core/internal/testutil/cross_provider_scenarios.go (1 hunks)
  • core/internal/testutil/cross_provider_test.go (4 hunks)
  • core/internal/testutil/embedding.go (2 hunks)
  • core/internal/testutil/end_to_end_tool_calling.go (1 hunks)
  • core/internal/testutil/error_parser.go (1 hunks)
  • core/internal/testutil/image_base64.go (1 hunks)
  • core/internal/testutil/image_url.go (1 hunks)
  • core/internal/testutil/list_models.go (2 hunks)
  • core/internal/testutil/multi_turn_conversation.go (2 hunks)
  • core/internal/testutil/multiple_images.go (1 hunks)
  • core/internal/testutil/multiple_tool_calls.go (2 hunks)
  • core/internal/testutil/reasoning.go (1 hunks)
  • core/internal/testutil/response_validation.go (1 hunks)
  • core/internal/testutil/responses_stream.go (3 hunks)
  • core/internal/testutil/setup.go (1 hunks)
  • core/internal/testutil/simple_chat.go (1 hunks)
  • core/internal/testutil/speech_synthesis.go (2 hunks)
  • core/internal/testutil/speech_synthesis_stream.go (3 hunks)
  • core/internal/testutil/test_retry_conditions.go (1 hunks)
  • core/internal/testutil/test_retry_framework.go (2 hunks)
  • core/internal/testutil/tests.go (3 hunks)
  • core/internal/testutil/text_completion.go (1 hunks)
  • core/internal/testutil/text_completion_stream.go (2 hunks)
  • core/internal/testutil/tool_calls.go (2 hunks)
  • core/internal/testutil/tool_calls_streaming.go (2 hunks)
  • core/internal/testutil/transcription.go (4 hunks)
  • core/internal/testutil/transcription_stream.go (3 hunks)
  • core/internal/testutil/utils.go (2 hunks)
  • core/internal/testutil/validation_presets.go (2 hunks)
  • core/providers/anthropic/anthropic_test.go (3 hunks)
  • core/providers/azure/azure_test.go (4 hunks)
  • core/providers/bedrock/bedrock_test.go (4 hunks)
  • core/providers/cerebras/cerebras.go (1 hunks)
  • core/providers/cerebras/cerebras_test.go (4 hunks)
  • core/providers/cohere/cohere_test.go (3 hunks)
  • core/providers/elevenlabs/elevenlabs_test.go (3 hunks)
  • core/providers/gemini/gemini_test.go (4 hunks)
  • core/providers/groq/groq.go (1 hunks)
  • core/providers/groq/groq_test.go (4 hunks)
  • core/providers/mistral/mistral_test.go (3 hunks)
  • core/providers/ollama/ollama.go (1 hunks)
  • core/providers/ollama/ollama_test.go (3 hunks)
  • core/providers/openai/openai_test.go (4 hunks)
  • core/providers/openrouter/openrouter.go (1 hunks)
  • core/providers/openrouter/openrouter_test.go (3 hunks)
  • core/providers/parasail/parasail.go (1 hunks)
  • core/providers/parasail/parasail_test.go (3 hunks)
  • core/providers/perplexity/perplexity_test.go (3 hunks)
  • core/providers/sgl/sgl.go (1 hunks)
  • core/providers/sgl/sgl_test.go (3 hunks)
  • core/providers/vertex/vertex_test.go (3 hunks)
  • tests/core-chatbot/go.mod (0 hunks)
  • tests/core-providers/README.md (0 hunks)
  • tests/core-providers/go.mod (0 hunks)
  • tests/governance/README.md (0 hunks)
  • tests/governance/__init__.py (0 hunks)
  • tests/governance/conftest.py (0 hunks)
  • tests/governance/pytest.ini (0 hunks)
  • tests/governance/requirements.txt (0 hunks)
  • tests/governance/test_customers_crud.py (0 hunks)
  • tests/governance/test_helpers.py (0 hunks)
  • tests/governance/test_teams_crud.py (0 hunks)
  • tests/governance/test_usage_tracking.py (0 hunks)
  • tests/governance/test_virtual_keys_crud.py (0 hunks)
💤 Files with no reviewable changes (13)
  • tests/governance/pytest.ini
  • tests/core-chatbot/go.mod
  • tests/governance/test_customers_crud.py
  • tests/governance/init.py
  • tests/governance/requirements.txt
  • tests/governance/test_teams_crud.py
  • tests/governance/conftest.py
  • tests/governance/test_usage_tracking.py
  • tests/core-providers/go.mod
  • tests/governance/test_helpers.py
  • tests/core-providers/README.md
  • tests/governance/README.md
  • tests/governance/test_virtual_keys_crud.py
🚧 Files skipped from review as they are similar to previous changes (27)
  • core/providers/openrouter/openrouter.go
  • core/internal/testutil/responses_stream.go
  • core/internal/testutil/setup.go
  • core/internal/testutil/list_models.go
  • core/internal/testutil/test_retry_conditions.go
  • core/internal/testutil/automatic_function_calling.go
  • core/internal/testutil/complete_end_to_end.go
  • core/internal/testutil/cross_provider_scenarios.go
  • core/internal/testutil/speech_synthesis_stream.go
  • core/providers/cerebras/cerebras_test.go
  • core/go.mod
  • core/providers/ollama/ollama.go
  • core/internal/testutil/multiple_tool_calls.go
  • core/providers/elevenlabs/elevenlabs_test.go
  • core/providers/cerebras/cerebras.go
  • core/internal/testutil/reasoning.go
  • core/providers/cohere/cohere_test.go
  • core/chatbot_test.go
  • core/internal/testutil/chat_completion_stream.go
  • core/internal/testutil/utils.go
  • core/providers/gemini/gemini_test.go
  • core/providers/parasail/parasail_test.go
  • core/internal/testutil/image_base64.go
  • core/internal/testutil/multiple_images.go
  • core/internal/testutil/account.go
  • core/internal/testutil/transcription_stream.go
  • core/internal/testutil/tool_calls_streaming.go
🧰 Additional context used
🧬 Code graph analysis (19)
core/providers/groq/groq_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/speech_synthesis.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/text_completion.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/end_to_end_tool_calling.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/validation_presets.go (2)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/response_validation.go (1)
  • ResponseExpectations (18-43)
core/internal/testutil/tests.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/bedrock/bedrock_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/image_url.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/test_retry_framework.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/sgl/sgl_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • SGL (44-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/text_completion_stream.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/simple_chat.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/transcription.go (2)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/schemas/transcriptions.go (1)
  • BifrostTranscriptionResponse (16-26)
core/internal/testutil/cross_provider_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/cross_provider_scenarios.go (11)
  • ProviderConfig (45-53)
  • CrossProviderTestConfig (38-42)
  • ConversationSettings (56-60)
  • MessageModality (19-19)
  • ModalityText (22-22)
  • ModalityTool (23-23)
  • ModalityVision (24-24)
  • TestSettings (63-67)
  • ValidationModerate (33-33)
  • GetPredefinedScenarios (110-245)
  • RunCrossProviderScenarioTest (649-774)
core/schemas/bifrost.go (4)
  • OpenAI (35-35)
  • Anthropic (37-37)
  • Groq (43-43)
  • Gemini (48-48)
core/providers/openrouter/openrouter_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/vertex/vertex_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Vertex (40-40)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/bifrost.go (6)
core/providers/ollama/ollama.go (1)
  • NewOllamaProvider (28-60)
core/providers/groq/groq.go (1)
  • NewGroqProvider (27-58)
core/providers/sgl/sgl.go (1)
  • NewSGLProvider (28-60)
core/providers/parasail/parasail.go (1)
  • NewParasailProvider (27-53)
core/providers/cerebras/cerebras.go (1)
  • NewCerebrasProvider (27-53)
core/providers/openrouter/openrouter.go (1)
  • NewOpenRouterProvider (29-55)
core/providers/anthropic/anthropic_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/perplexity/perplexity_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Perplexity (46-46)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
🔇 Additional comments (46)
core/internal/testutil/text_completion.go (1)

1-77: LGTM! Clean refactoring of test utilities.

The package rename from scenarios to testutil and the corresponding type reference updates are consistent with the PR's objective to consolidate test utilities into core/internal/testutil. The function logic remains unchanged, and all type references are correctly updated to use the local ComprehensiveTestConfig type.

core/internal/testutil/error_parser.go (1)

1-1: LGTM! Package rename aligns with test reorganization.

The package rename from scenarios to testutil is consistent with the PR's objective to consolidate test utilities under core/internal/testutil.

core/internal/testutil/validation_presets.go (2)

1-1: LGTM! Package declaration aligns with new location.

The package name correctly reflects the new location in core/internal/testutil.


3-8: LGTM! Import cleanup is correct.

The removal of the config package import is appropriate since ComprehensiveTestConfig is now defined in the same testutil package.

core/internal/testutil/speech_synthesis.go (2)

1-13: LGTM! Package declaration and imports are correct.

The package has been properly renamed to testutil and the imports are appropriate for a test utility file.


1-347: Excellent refactoring! The test utility migration is well-executed.

The migration from the external config package to the local testutil package is clean and consistent. The test functions are well-structured with:

  • Comprehensive test coverage (basic, advanced, HD models, multiple voices)
  • Proper retry logic and validation frameworks
  • Appropriate resource cleanup
  • Good logging and error messages

The only minor improvement suggested is addressing the unused context parameters noted above.

core/providers/groq/groq_test.go (3)

1-11: Package name and testutil import look consistent with the new test layout

Using package groq_test plus core/internal/testutil matches the new cross-provider test pattern and keeps these tests black-box against the groq provider API. No issues here.


19-54: ComprehensiveTestConfig wiring looks correct; please double‑check scenario coverage

testutil.SetupTest usage and the ComprehensiveTestConfig fields line up with the shared testutil definitions: provider is set to schemas.Groq, chat/text models and fallbacks are populated, and embedding is explicitly disabled with EmbeddingModel: "" and Embedding: false. The selected scenarios (text/chat/tool calls, streams, list models) seem reasonable for Groq, with unsupported capabilities left at their zero value.

Please just verify that:

  • Groq indeed shouldn’t run embedding / reasoning / speech / transcription scenarios yet, and
  • You don’t want any of those TestScenarios flags flipped on now that the tests are centralized.

If that’s intentional, this config looks good.


56-61: Context enrichment and centralized test runner integration look good

Adding the x-litellm-fallback flag to the test context and delegating to testutil.RunAllComprehensiveTests matches the shared test harness and should keep Groq tests in sync with future scenario additions. defer cancel() plus client.Shutdown() give the client a clean lifecycle.

core/internal/testutil/image_url.go (3)

1-1: LGTM! Package refactor aligns with PR objectives.

The package rename to testutil and the updated function signature using local ComprehensiveTestConfig are consistent with the broader refactor to consolidate test utilities under core/internal/testutil.

Also applies to: 15-15


134-154: LGTM! Flexible validation is appropriate for vision models.

The helper function provides a well-designed fallback validation strategy that accounts for variability in how different vision models describe images. The graceful degradation (checking for alternative descriptors at lines 145-148) ensures tests are robust while still catching genuine failures.


15-132: <!-- [scratchpad_start]
[task review_verification 1/1]
Verify all dependencies for RunImageURLTest after refactor

[observations]

  • All 9 listed helper functions verified present in testutil package
  • TestImageURL constant verified at utils.go:185
  • ComprehensiveTestConfig type verified at account.go:47
  • validateImageProcessingContent helper verified at image_url.go:134 (defined in same file, after RunImageURLTest)
  • Function called at image_url.go:113 and image_url.go:118

[analysis]

  • Complete dependency chain verified
  • All functions properly located in testutil package files
  • validateImageProcessingContent is a private helper function defined in the same file (image_url.go) where RunImageURLTest resides
  • No missing imports or undefined references
  • Refactored code has all required dependencies available

[done]
All verification checks passed. Original review comment requested verification that helper functions and constants exist after refactor. Complete verification confirms all 10+ dependencies (9 helper functions + 1 constant + 1 type + 1 local helper) are present and properly accessible.
[scratchpad_end]
-->

All helper functions and constants are present after refactor.

Verification confirms all dependencies referenced in RunImageURLTest are properly available in the testutil package: the 9 helper functions (CreateImageChatMessage, CreateImageResponsesMessage, WithDualAPITestRetry, GetChatContent, GetResponsesContent, VisionExpectations, ModifyExpectationsForProvider, GetErrorMessage, GetTestRetryConfigForScenario), the TestImageURL constant, ComprehensiveTestConfig type, and the validateImageProcessingContent helper function defined in the same file. No missing dependencies detected.

core/internal/testutil/text_completion_stream.go (2)

1-1: Package rename to testutil looks consistent with new layout

Renaming this file into the testutil package matches the new core/internal/testutil structure and shared helpers; change looks good.


17-17: Signature change to use local ComprehensiveTestConfig is correct

Using the unqualified ComprehensiveTestConfig from core/internal/testutil/account.go keeps test utilities self-contained; the function body already assumes that shape, so this adjustment is appropriate.

core/providers/sgl/sgl.go (1)

3-3: LGTM!

The package rename from providers to sgl aligns with the broader refactor to dedicated per-provider packages.

core/internal/testutil/response_validation.go (1)

1-1: LGTM!

The package rename from scenarios to testutil consolidates test utilities into a unified namespace, consistent with the PR's test infrastructure refactor.

.github/workflows/scripts/release-core.sh (1)

38-42: LGTM!

The test execution path correctly updated to run tests from the core directory using go test -v ./..., which aligns with the test reorganization moving provider tests from tests/core-providers to core/providers.

core/providers/parasail/parasail.go (1)

3-3: LGTM!

The package rename from providers to parasail is consistent with the per-provider package refactor pattern applied across the codebase.

core/internal/testutil/embedding.go (2)

1-1: LGTM!

The package rename from scenarios to testutil consolidates test utilities and eliminates external dependencies.


40-40: LGTM!

The function signature correctly updated to use the local ComprehensiveTestConfig type instead of config.ComprehensiveTestConfig, aligning with the test utility consolidation.

core/internal/testutil/end_to_end_tool_calling.go (2)

1-1: LGTM!

The package rename from scenarios to testutil is consistent with the broader test infrastructure refactor.


15-15: LGTM!

The function signature correctly updated to use the local ComprehensiveTestConfig type, eliminating the external config package dependency.

core/internal/testutil/tool_calls.go (2)

1-1: LGTM!

The package rename from scenarios to testutil consolidates test utilities into a unified namespace.


17-17: LGTM!

The function signature correctly updated to use the local ComprehensiveTestConfig type, consistent with the testutil migration pattern.

core/bifrost.go (2)

21-32: LGTM!

The imports correctly updated to use per-provider packages (cerebras, groq, ollama, openrouter, parasail, sgl) instead of a consolidated providers package, aligning with the per-provider package refactor.


1308-1323: LGTM!

The provider constructor calls correctly updated to reference the new per-provider packages:

  • ollama.NewOllamaProvider
  • groq.NewGroqProvider
  • sgl.NewSGLProvider
  • parasail.NewParasailProvider
  • cerebras.NewCerebrasProvider
  • openrouter.NewOpenRouterProvider

All constructor signatures remain unchanged, maintaining compatibility.

core/internal/testutil/simple_chat.go (1)

1-14: LGTM! Clean package migration.

The package name change from scenarios to testutil and the function signature update to use the local ComprehensiveTestConfig type are consistent with the PR's goal of consolidating test utilities. The test logic remains unchanged.

core/internal/testutil/multi_turn_conversation.go (2)

1-13: LGTM! Package migration is consistent.

The package rename and function signature update align with the broader refactoring to consolidate test utilities in the testutil package.


135-147: LGTM! Validation consolidation improves code quality.

The validation logic has been appropriately consolidated into WithChatTestRetry, reducing code duplication. The inline comment clearly explains that validation occurs within the retry framework.

Makefile (2)

528-544: LGTM! Well-designed interactive test target.

The new test-chatbot target follows existing Makefile patterns with proper:

  • Environment variable checks (RUN_CHATBOT_TEST)
  • .env file loading for API keys
  • Clear usage instructions
  • Appropriate gating for interactive tests

318-395: Verification successful: All provider test files are at the new locations.

The script confirms:

  • All 16 providers have test files at core/providers/{provider}/{provider}_test.go
  • The old tests/core-providers directory no longer exists (migration complete) ✓
  • core/chatbot_test.go is in place ✓

The Makefile updates correctly reference the new test path structure and all files have been properly migrated.

core/providers/bedrock/bedrock_test.go (1)

1-58: LGTM! Consistent test migration.

The test file has been properly updated to:

  • Use the bedrock_test package
  • Import from core/internal/testutil
  • Reference testutil.ComprehensiveTestConfig, testutil.TestScenarios, testutil.SetupTest(), and testutil.RunAllComprehensiveTests()

All changes are consistent with the test infrastructure refactoring.

core/internal/testutil/transcription.go (2)

1-18: LGTM! Package migration is clean.

The package rename to testutil and function signature update are consistent with the refactoring objectives.


278-501: LGTM! Type references updated consistently.

Both RunTranscriptionAdvancedTest and validateTranscriptionRoundTrip have been updated to use the local ComprehensiveTestConfig type. The test logic remains unchanged.

core/internal/testutil/tests.go (2)

1-61: LGTM! Core test orchestrator properly refactored.

Key improvements:

  • Package renamed to testutil for centralized test utilities
  • RunAllComprehensiveTests now exported (capitalized) for use by provider tests
  • TestScenarioFunc signature updated to use local ComprehensiveTestConfig
  • All test scenario references updated from qualified (scenarios.X) to local function calls

The refactoring maintains the test orchestration logic while consolidating utilities into a single package.


64-115: LGTM! Summary function updated consistently.

The printTestSummary function signature has been updated to use the local ComprehensiveTestConfig type, maintaining consistency with the broader refactoring.

core/providers/ollama/ollama_test.go (1)

1-52: LGTM! Ollama test migrated successfully.

The test file follows the established migration pattern:

  • Package updated to ollama_test
  • Imports updated to core/internal/testutil
  • All type and function references updated to use testutil equivalents

Changes are consistent with the test infrastructure refactoring.

core/providers/perplexity/perplexity_test.go (1)

1-51: LGTM! Perplexity test migrated successfully.

The migration follows the consistent pattern across all provider tests:

  • Package renamed to perplexity_test
  • Imports updated to core/internal/testutil
  • Type and function references updated to testutil equivalents

All changes align with the test infrastructure consolidation.

core/providers/openai/openai_test.go (1)

1-66: OpenAI provider test correctly migrated to testutil with coherent scenarios

The switch to core/internal/testutil (SetupTest, ComprehensiveTestConfig, TestScenarios, and RunAllComprehensiveTests) is consistent and compiles cleanly, and the enabled scenarios match the models you’ve configured (text/chat/streaming/tools/images/tts/transcription/embedding/reasoning/list‑models). No functional issues from this refactor.

core/providers/anthropic/anthropic_test.go (1)

1-54: Anthropic provider testutil wiring and scenarios look consistent

This test cleanly adopts core/internal/testutil (setup, config, scenarios, and runner), and the ComprehensiveTestConfig/TestScenarios values are internally consistent (e.g., embedding disabled with no embedding model set, reasoning enabled with a configured chat/vision model). No issues from the refactor.

core/providers/openrouter/openrouter_test.go (1)

1-52: OpenRouter test’s move to testutil and scenario masking for beta features looks good

The refactor to use core/internal/testutil helpers is consistent, and the ComprehensiveTestConfig / TestScenarios setup matches the comments about OpenRouter support (responses/image features and streaming tool calls disabled, others enabled). No functional issues from these changes.

core/providers/mistral/mistral_test.go (1)

1-53: Mistral testutil integration and scenario configuration are coherent

The test correctly switches to core/internal/testutil and populates ComprehensiveTestConfig/TestScenarios in a way that matches the provider’s capabilities (no text completion, but chat/streaming/tools/images/embedding enabled, list‑models disabled). The refactor itself looks solid.

core/providers/vertex/vertex_test.go (1)

1-51: Vertex provider test correctly wired to testutil with sensible env gating and scenarios

  • The switch to core/internal/testutil (SetupTest, ComprehensiveTestConfig, TestScenarios, RunAllComprehensiveTests) is straightforward and correct.
  • The skip condition properly requires either VERTEX_API_KEY or both VERTEX_PROJECT_ID and VERTEX_CREDENTIALS, and the scenario flags align with the configured models (no text completion, embedding enabled, list‑models disabled).

No issues from this refactor.

core/internal/testutil/cross_provider_test.go (3)

1-7: LGTM: Package structure is correct.

The package declaration and imports align with the refactoring objectives of moving test utilities into core/internal/testutil.


60-76: ****

The provider constants are correctly defined. Both Bedrock and Vertex are defined as ModelProvider constants in core/schemas/bifrost.go at lines 38 and 40 respectively. The code references in the test file are valid.


135-145: No issues found — both ValidationLenient and RunCrossProviderConsistencyTest are properly defined.

Verification confirms that ValidationLenient is defined at core/internal/testutil/cross_provider_scenarios.go:34 as a valid ValidationLevel constant, and RunCrossProviderConsistencyTest is defined at line 781 with the correct function signature matching the calls in the test. The code will compile without errors.

@akshaydeo akshaydeo force-pushed the 11-22-moves_all_tests_related_to_core_to_corresponding_files branch from ff542b1 to 382ff3e Compare November 24, 2025 08:04
@akshaydeo akshaydeo changed the base branch from graphite-base/916 to 11-24-feat_core_tests_retry_logic_enhancements November 24, 2025 08:04
@TejasGhatte TejasGhatte mentioned this pull request Nov 24, 2025
15 tasks
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
core/chatbot_test.go (2)

900-905: Add bounds check before accessing history[0].

The code assumes history[0] exists when handling the /clear command. While the session initialization adds a system message, defensive coding would add a bounds check to prevent potential panics.

Apply this diff to add a bounds check:

 case "/clear":
     // Keep system prompt but clear conversation history
-    systemPrompt := session.history[0] // Assuming first message is system
-    session.history = []schemas.ChatMessage{systemPrompt}
+    if len(session.history) > 0 && session.history[0].Role == schemas.ChatMessageRoleSystem {
+        systemPrompt := session.history[0]
+        session.history = []schemas.ChatMessage{systemPrompt}
+    } else {
+        session.history = []schemas.ChatMessage{}
+    }
     fmt.Println("🧹 Conversation history cleared!")
     continue

830-937: Critical: os.Exit() calls will terminate the entire test suite.

The runChatbot() function contains multiple os.Exit() calls (lines 841, 859, 869) which will terminate the entire test process, not just this test. When called from TestChatbot(), this prevents other tests from running.

Refactor to accept a *testing.T parameter and use t.Fatal() instead:

-func runChatbot() {
+func runChatbot(t *testing.T) {
     // Check for required environment variables
     if os.Getenv("OPENAI_API_KEY") == "" {
         fmt.Println("❌ Error: OPENAI_API_KEY environment variable is required")
         // ... error messages ...
-        os.Exit(1)
+        t.Fatal("OPENAI_API_KEY environment variable is required")
     }
     
     // ... other code ...
     
     session, err := NewChatSession(config)
     if err != nil {
         fmt.Printf("❌ Failed to create chat session: %v\n", err)
-        os.Exit(1)
+        t.Fatalf("Failed to create chat session: %v", err)
     }
     
     // Setup graceful shutdown
     sigChan := make(chan os.Signal, 1)
     signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)
     go func() {
         <-sigChan
         fmt.Println("\n\n👋 Goodbye! Cleaning up...")
         session.Cleanup()
-        os.Exit(0)
+        // In test context, don't exit - just cleanup
+        return
     }()

Then update the test wrapper:

 func TestChatbot(t *testing.T) {
     if os.Getenv("RUN_CHATBOT_TEST") == "" {
         t.Skip("Skipping interactive chatbot test. Set RUN_CHATBOT_TEST=1 to run")
     }
 
-    runChatbot()
+    runChatbot(t)
 }
🧹 Nitpick comments (5)
core/providers/parasail/parasail.go (1)

1-3: Update package doc comment to match renamed parasail package

The top-of-file comment still refers to Package providers, which is now inaccurate after renaming the package to parasail. This affects GoDoc clarity but not behavior.

You can align the doc comment with the package name like this:

-// Package providers implements various LLM providers and their utility functions.
-// This file contains the Parasail provider implementation.
+// Package parasail implements the Parasail LLM provider and its utility functions.
+// This file contains the Parasail provider implementation.
core/internal/testutil/test_retry_framework.go (1)

1116-1148: Signature change looks good. Consider removing unused parameter.

The type reference change from config.ComprehensiveTestConfig to ComprehensiveTestConfig correctly reflects the migration of the type to the local testutil package.

However, the testConfig parameter is declared but never used in the function body. Consider removing it if it's not needed for future functionality.

-func GetTestRetryConfigForScenario(scenarioName string, testConfig ComprehensiveTestConfig) TestRetryConfig {
+func GetTestRetryConfigForScenario(scenarioName string) TestRetryConfig {

Note: If this parameter is intentionally kept for future use or API consistency, this suggestion can be disregarded.

core/internal/testutil/error_parser.go (1)

401-419: Optional: Remove unreachable return statement.

Line 416 contains return false after t.Fatalf(), which is unreachable since Fatalf terminates test execution. While this doesn't affect functionality, removing it would clean up the code.

 func AssertNoError(t *testing.T, err *schemas.BifrostError, msgAndArgs ...interface{}) bool {
 	if err != nil {
 		parsed := ParseBifrostError(err)
 		message := "Expected no error"
 		if len(msgAndArgs) > 0 {
 			if msg, ok := msgAndArgs[0].(string); ok {
 				if len(msgAndArgs) > 1 {
 					message = fmt.Sprintf(msg, msgAndArgs[1:]...)
 				} else {
 					message = msg
 				}
 			}
 		}
 		t.Fatalf("%s, but got:\n%s", message, FormatError(parsed))
-		return false
 	}
 	return true
 }
core/chatbot_test.go (2)

167-213: Track FIXME comments for provider meta configurations.

The FIXME comments at lines 167, 189, and 209 indicate missing meta package configurations for Bedrock, Azure, and Vertex providers. These should be tracked and resolved in a follow-up.

Do you want me to open an issue to track these incomplete provider configurations?


41-232: Consider moving ComprehensiveTestAccount to testutil package.

Based on the PR objectives mentioning core/internal/testutil for shared test utilities, this account implementation could be moved there for reuse across multiple test files rather than duplicating it.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ff542b1 and 382ff3e.

⛔ Files ignored due to path filters (3)
  • core/go.sum is excluded by !**/*.sum
  • tests/core-chatbot/go.sum is excluded by !**/*.sum
  • tests/core-providers/go.sum is excluded by !**/*.sum
📒 Files selected for processing (73)
  • .github/workflows/scripts/release-core.sh (1 hunks)
  • Makefile (5 hunks)
  • core/bifrost.go (2 hunks)
  • core/chatbot_test.go (6 hunks)
  • core/go.mod (1 hunks)
  • core/internal/testutil/account.go (1 hunks)
  • core/internal/testutil/automatic_function_calling.go (2 hunks)
  • core/internal/testutil/chat_completion_stream.go (2 hunks)
  • core/internal/testutil/complete_end_to_end.go (1 hunks)
  • core/internal/testutil/cross_provider_scenarios.go (1 hunks)
  • core/internal/testutil/cross_provider_test.go (4 hunks)
  • core/internal/testutil/embedding.go (2 hunks)
  • core/internal/testutil/end_to_end_tool_calling.go (1 hunks)
  • core/internal/testutil/error_parser.go (1 hunks)
  • core/internal/testutil/image_base64.go (1 hunks)
  • core/internal/testutil/image_url.go (1 hunks)
  • core/internal/testutil/list_models.go (2 hunks)
  • core/internal/testutil/multi_turn_conversation.go (2 hunks)
  • core/internal/testutil/multiple_images.go (1 hunks)
  • core/internal/testutil/multiple_tool_calls.go (2 hunks)
  • core/internal/testutil/reasoning.go (1 hunks)
  • core/internal/testutil/response_validation.go (1 hunks)
  • core/internal/testutil/responses_stream.go (3 hunks)
  • core/internal/testutil/setup.go (1 hunks)
  • core/internal/testutil/simple_chat.go (1 hunks)
  • core/internal/testutil/speech_synthesis.go (2 hunks)
  • core/internal/testutil/speech_synthesis_stream.go (3 hunks)
  • core/internal/testutil/test_retry_conditions.go (1 hunks)
  • core/internal/testutil/test_retry_framework.go (2 hunks)
  • core/internal/testutil/tests.go (3 hunks)
  • core/internal/testutil/text_completion.go (1 hunks)
  • core/internal/testutil/text_completion_stream.go (2 hunks)
  • core/internal/testutil/tool_calls.go (2 hunks)
  • core/internal/testutil/tool_calls_streaming.go (2 hunks)
  • core/internal/testutil/transcription.go (4 hunks)
  • core/internal/testutil/transcription_stream.go (3 hunks)
  • core/internal/testutil/utils.go (2 hunks)
  • core/internal/testutil/validation_presets.go (2 hunks)
  • core/providers/anthropic/anthropic_test.go (3 hunks)
  • core/providers/azure/azure_test.go (3 hunks)
  • core/providers/bedrock/bedrock_test.go (4 hunks)
  • core/providers/cerebras/cerebras.go (1 hunks)
  • core/providers/cerebras/cerebras_test.go (4 hunks)
  • core/providers/cohere/cohere_test.go (3 hunks)
  • core/providers/elevenlabs/elevenlabs_test.go (3 hunks)
  • core/providers/gemini/gemini_test.go (4 hunks)
  • core/providers/groq/groq.go (1 hunks)
  • core/providers/groq/groq_test.go (4 hunks)
  • core/providers/mistral/mistral_test.go (3 hunks)
  • core/providers/ollama/ollama.go (1 hunks)
  • core/providers/ollama/ollama_test.go (3 hunks)
  • core/providers/openai/openai_test.go (4 hunks)
  • core/providers/openrouter/openrouter.go (1 hunks)
  • core/providers/openrouter/openrouter_test.go (3 hunks)
  • core/providers/parasail/parasail.go (1 hunks)
  • core/providers/parasail/parasail_test.go (3 hunks)
  • core/providers/perplexity/perplexity_test.go (3 hunks)
  • core/providers/sgl/sgl.go (1 hunks)
  • core/providers/sgl/sgl_test.go (3 hunks)
  • core/providers/vertex/vertex_test.go (3 hunks)
  • tests/core-chatbot/go.mod (0 hunks)
  • tests/core-providers/README.md (0 hunks)
  • tests/core-providers/go.mod (0 hunks)
  • tests/governance/README.md (0 hunks)
  • tests/governance/__init__.py (0 hunks)
  • tests/governance/conftest.py (0 hunks)
  • tests/governance/pytest.ini (0 hunks)
  • tests/governance/requirements.txt (0 hunks)
  • tests/governance/test_customers_crud.py (0 hunks)
  • tests/governance/test_helpers.py (0 hunks)
  • tests/governance/test_teams_crud.py (0 hunks)
  • tests/governance/test_usage_tracking.py (0 hunks)
  • tests/governance/test_virtual_keys_crud.py (0 hunks)
💤 Files with no reviewable changes (13)
  • tests/core-providers/go.mod
  • tests/governance/test_customers_crud.py
  • tests/governance/requirements.txt
  • tests/core-providers/README.md
  • tests/core-chatbot/go.mod
  • tests/governance/test_virtual_keys_crud.py
  • tests/governance/conftest.py
  • tests/governance/test_usage_tracking.py
  • tests/governance/test_teams_crud.py
  • tests/governance/init.py
  • tests/governance/test_helpers.py
  • tests/governance/README.md
  • tests/governance/pytest.ini
🚧 Files skipped from review as they are similar to previous changes (26)
  • core/internal/testutil/test_retry_conditions.go
  • core/internal/testutil/account.go
  • core/internal/testutil/tool_calls.go
  • core/providers/sgl/sgl.go
  • core/internal/testutil/automatic_function_calling.go
  • core/internal/testutil/end_to_end_tool_calling.go
  • core/internal/testutil/text_completion_stream.go
  • core/providers/groq/groq_test.go
  • Makefile
  • core/internal/testutil/cross_provider_scenarios.go
  • core/bifrost.go
  • core/providers/elevenlabs/elevenlabs_test.go
  • core/internal/testutil/responses_stream.go
  • core/providers/openrouter/openrouter.go
  • core/providers/parasail/parasail_test.go
  • core/providers/sgl/sgl_test.go
  • core/internal/testutil/complete_end_to_end.go
  • core/internal/testutil/validation_presets.go
  • core/internal/testutil/utils.go
  • core/internal/testutil/multi_turn_conversation.go
  • core/internal/testutil/setup.go
  • core/internal/testutil/transcription_stream.go
  • core/providers/ollama/ollama.go
  • .github/workflows/scripts/release-core.sh
  • core/internal/testutil/text_completion.go
  • core/internal/testutil/image_base64.go
🧰 Additional context used
🧬 Code graph analysis (25)
core/internal/testutil/image_url.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/speech_synthesis.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/test_retry_framework.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/anthropic/anthropic_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/list_models.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/perplexity/perplexity_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/transcription.go (2)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/schemas/transcriptions.go (1)
  • BifrostTranscriptionResponse (16-26)
core/providers/cerebras/cerebras_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/vertex/vertex_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Vertex (40-40)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/speech_synthesis_stream.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/ollama/ollama_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Ollama (42-42)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/cross_provider_test.go (2)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/cross_provider_scenarios.go (12)
  • ProviderConfig (45-53)
  • CrossProviderTestConfig (38-42)
  • ConversationSettings (56-60)
  • MessageModality (19-19)
  • ModalityText (22-22)
  • ModalityTool (23-23)
  • ModalityVision (24-24)
  • TestSettings (63-67)
  • ValidationModerate (33-33)
  • GetPredefinedScenarios (110-245)
  • RunCrossProviderScenarioTest (649-774)
  • RunCrossProviderConsistencyTest (781-860)
core/internal/testutil/chat_completion_stream.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/reasoning.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/multiple_tool_calls.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/multiple_images.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/gemini/gemini_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/openai/openai_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/tool_calls_streaming.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/cohere/cohere_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Cohere (39-39)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/mistral/mistral_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/bedrock/bedrock_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/tests.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/simple_chat.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/embedding.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
🔇 Additional comments (55)
core/internal/testutil/test_retry_framework.go (1)

1-1: LGTM! Package rename aligns with directory structure.

The package rename from scenarios to testutil correctly reflects the new location at core/internal/testutil/ and is consistent with the PR's goal of consolidating test utilities.

core/internal/testutil/tool_calls_streaming.go (2)

1-1: LGTM! Package rename aligns with refactoring objectives.

The package declaration change from scenarios to testutil is consistent with the PR's goal of consolidating test utilities into the core/internal/testutil package.


211-211: LGTM! Function signature correctly updated to use local type.

The parameter type change from config.ComprehensiveTestConfig to ComprehensiveTestConfig correctly reflects that the type is now defined locally within the testutil package (as shown in core/internal/testutil/account.go). This eliminates the external dependency on the config package.

core/internal/testutil/error_parser.go (1)

1-1: LGTM! Package rename aligns well with the refactoring.

The package rename from scenarios to testutil is clear and follows Go naming conventions for test utility packages. This change integrates well with the broader PR objective of consolidating test utilities under core/internal/testutil.

core/providers/cerebras/cerebras.go (1)

3-3: All imports have been correctly updated—no action needed.

The verification confirms that the package rename from providers to cerebras has been properly implemented across the codebase. The import at core/bifrost.go:21 correctly uses the new path "github.com/maximhq/bifrost/core/providers/cerebras", and the provider initialization at core/bifrost.go:1319 properly references the new package. No old-style imports remain.

core/internal/testutil/cross_provider_test.go (3)

1-1: LGTM! Package declaration aligns with the testutil migration.

The package has been correctly renamed from its previous location to testutil, consistent with the PR's objective to consolidate test utilities under core/internal/testutil.


11-12: Tests are currently skipped.

Both cross-provider tests are disabled via t.Skip(). The test structure is preserved but not executed. Ensure these tests are re-enabled and validated once the migration is complete.

Also applies to: 115-116


135-135: No issues found.

The ValidationLenient constant is properly defined in core/internal/testutil/cross_provider_scenarios.go at line 34 as ValidationLenient ValidationLevel = "lenient", and its usage at line 135 in cross_provider_test.go is valid.

core/internal/testutil/reasoning.go (1)

1-14: LGTM! Clean refactoring to consolidate test utilities.

The package rename from scenarios to testutil and the use of the local ComprehensiveTestConfig type (without the config. qualifier) successfully consolidate test utilities into a single package. This improves code organization by eliminating external dependencies on tests/core-providers/config.

core/internal/testutil/response_validation.go (1)

1-1: LGTM! Package rename aligns with the refactoring.

The package declaration change from scenarios to testutil is consistent with the PR's goal of consolidating test utilities.

core/internal/testutil/multiple_images.go (1)

1-15: LGTM! Consistent refactoring pattern.

The changes align with the PR's refactoring goals: package rename to testutil and using the local ComprehensiveTestConfig type without external package qualification.

core/internal/testutil/list_models.go (2)

1-14: LGTM! Function signature updated correctly.

The RunListModelsTest function signature now uses the local ComprehensiveTestConfig type, consistent with the package consolidation.


112-112: LGTM! Second function signature updated consistently.

The RunListModelsPaginationTest function signature follows the same pattern, maintaining consistency across the file.

core/internal/testutil/chat_completion_stream.go (1)

1-16: LGTM! Refactoring applied consistently.

Package rename and type unqualification match the established pattern across all testutil files.

core/providers/cerebras/cerebras_test.go (2)

1-24: LGTM! Provider test successfully migrated to testutil.

The test file correctly imports and uses the consolidated testutil package. All references (testutil.SetupTest, testutil.ComprehensiveTestConfig) are properly qualified.


33-54: LGTM! Test configuration and execution updated correctly.

The test scenarios configuration and test runner (testutil.TestScenarios, testutil.RunAllComprehensiveTests) properly use the refactored testutil package.

core/internal/testutil/simple_chat.go (1)

1-14: LGTM! Function signature refactored consistently.

The RunSimpleChatTest function now uses the local ComprehensiveTestConfig type, following the same pattern as other test utility functions.

core/internal/testutil/transcription.go (3)

1-18: LGTM! First function signature updated correctly.

The RunTranscriptionTest function uses the local ComprehensiveTestConfig type, consistent with the refactoring pattern.


278-278: LGTM! Second function signature updated consistently.

The RunTranscriptionAdvancedTest function signature follows the same refactoring pattern.


501-501: LGTM! Helper function signature updated correctly.

The validateTranscriptionRoundTrip helper function signature is updated consistently with the other functions in this file.

core/internal/testutil/tests.go (3)

1-1: LGTM! Package rename aligns with the new testutil organization.

The package rename from tests to testutil is part of the broader refactor to consolidate test utilities under core/internal/testutil.


12-15: LGTM! Type and function signature updates are consistent.

The updates to use the local ComprehensiveTestConfig type and capitalize RunAllComprehensiveTests for export are appropriate for the new package structure.


24-52: LGTM! Test scenario references correctly updated.

The test scenario function references have been appropriately updated to use unqualified names (e.g., RunTextCompletionTest instead of scenarios.RunTextCompletionTest), which is correct since these functions are now in the same testutil package.

core/providers/perplexity/perplexity_test.go (2)

1-10: LGTM! Clean migration to testutil package.

The package rename and import update correctly align with the new test organization structure where test utilities are centralized in core/internal/testutil.


18-48: LGTM! All testutil references correctly updated.

The migration is complete and consistent:

  • testutil.SetupTest() for test initialization
  • testutil.ComprehensiveTestConfig and testutil.TestScenarios for configuration
  • testutil.RunAllComprehensiveTests() for test execution
core/go.mod (1)

14-14: LGTM! Appropriate dependency classification change.

Moving github.com/stretchr/testify from an indirect to a direct dependency is correct since tests are now integrated within the core module structure rather than being in a separate test module.

core/internal/testutil/embedding.go (2)

1-1: LGTM! Package consolidation into testutil.

The package rename is consistent with the broader refactor to centralize test utilities in core/internal/testutil.


40-40: LGTM! Function signature correctly updated.

The use of the local ComprehensiveTestConfig type (without qualification) is correct now that this function resides in the same testutil package as the type definition.

core/internal/testutil/multiple_tool_calls.go (2)

1-1: LGTM! Consistent package migration.

The package rename to testutil aligns with the repository-wide test utilities consolidation effort.


23-23: LGTM! Type reference correctly updated.

The function signature now uses the local ComprehensiveTestConfig type, which is appropriate since the type definition has been moved into the same package.

core/providers/gemini/gemini_test.go (2)

1-10: LGTM! Consistent test organization migration.

The package rename and import path update follow the same pattern as other provider tests, ensuring consistency across the codebase.


18-61: LGTM! Complete and correct testutil integration.

All test setup, configuration, and execution references have been properly migrated to use the testutil package. The migration is thorough and consistent.

core/providers/openai/openai_test.go (2)

1-10: LGTM! Standard test migration pattern.

The package and import changes are consistent with the test infrastructure refactor being applied across all providers.


18-66: LGTM! Thorough testutil integration.

All references to test setup, configuration types, and test runners have been correctly migrated to the testutil package.

core/providers/ollama/ollama_test.go (2)

1-10: LGTM! Final piece of consistent test migration.

The package rename and import update complete the consistent pattern applied across all provider test files in this refactor.


18-50: LGTM! Complete testutil adoption.

All test infrastructure references have been successfully migrated to use the centralized testutil package. The refactor demonstrates excellent consistency across the entire PR.

core/providers/anthropic/anthropic_test.go (1)

1-56: LGTM! Clean refactoring to use centralized test utilities.

The migration from the old config package to testutil is correctly implemented. All type references, imports, and function calls have been properly updated while preserving the existing test logic and configuration.

core/providers/openrouter/openrouter_test.go (1)

1-54: LGTM! Refactoring correctly applied.

All references to the test utilities have been successfully migrated to the testutil package. The changes are consistent with the broader refactoring pattern across providers.

core/providers/cohere/cohere_test.go (1)

1-54: LGTM! Consistent migration to testutil package.

The test file has been successfully updated to use the centralized testutil package. All type references and function calls are correct.

core/providers/azure/azure_test.go (1)

1-66: LGTM! Test utilities successfully migrated.

The Azure provider tests have been correctly updated to use the testutil package. All imports, types, and function calls are properly aligned with the new test infrastructure.

core/providers/vertex/vertex_test.go (1)

1-53: LGTM! Refactoring completed successfully.

The Vertex provider tests have been correctly migrated to use the centralized testutil package. All changes follow the established refactoring pattern.

core/providers/mistral/mistral_test.go (1)

1-55: LGTM! Final provider test successfully refactored.

The Mistral provider tests have been correctly updated to use the testutil package. The refactoring maintains consistency across all provider tests in this PR.

core/internal/testutil/image_url.go (3)

1-12: LGTM! Package reorganization looks correct.

The package declaration change from scenarios to testutil and the removal of the external config import are consistent with the PR's objective to move test utilities into core/internal/testutil.


15-15: Function signature correctly updated for new package location.

The change from config.ComprehensiveTestConfig to ComprehensiveTestConfig is appropriate since the type is now defined in the same package (per the relevant code snippet from core/internal/testutil/account.go).


16-154: All helper functions and constants are available in the testutil package.

Verification confirms that all 9 helper functions and the TestImageURL constant are properly defined in the testutil package:

✅ Helper functions found: CreateImageChatMessage, CreateImageResponsesMessage, GetTestRetryConfigForScenario, VisionExpectations, ModifyExpectationsForProvider, WithDualAPITestRetry, GetErrorMessage, GetChatContent, GetResponsesContent

TestImageURL constant found in core/internal/testutil/utils.go at line 185

The code is ready as-is. All required dependencies for the new image_url.go test file are available.

core/providers/bedrock/bedrock_test.go (4)

1-10: LGTM! Clean refactoring of package and imports.

The package rename to bedrock_test follows Go's black-box testing convention, and the import path update correctly reflects the new test utility location at core/internal/testutil.


12-22: LGTM! Proper test setup and resource management.

The test setup correctly uses testutil.SetupTest(), handles errors appropriately, and ensures proper cleanup with the deferred cancel() call. The AWS credential check is a good practice for conditional test execution.


54-58: LGTM! Proper test execution and cleanup.

The test correctly invokes testutil.RunAllComprehensiveTests() with the appropriate parameters and ensures proper resource cleanup with client.Shutdown().


24-52: The model configuration is valid—no changes needed.

The concerns raised in the original review are not valid. The codebase includes an explicit model mapping in core/internal/testutil/account.go (lines 138–139) that resolves simplified model names to full Bedrock identifiers:

  • "claude-sonnet-4""global.anthropic.claude-sonnet-4-20250514-v1:0"
  • "claude-3.7-sonnet""us.anthropic.claude-3-7-sonnet-20250219-v1:0"

The simplified names used in the test configuration (lines 27, 29, 33) are valid aliases that the system resolves to proper Bedrock model IDs. The "claude-3.7-sonnet" model is a legitimate Claude 3.7 variant released on 2025-02-19. The mixed naming format (full Bedrock IDs alongside simplified names) is intentional and supported by the codebase design.

Likely an incorrect or invalid review comment.

core/internal/testutil/speech_synthesis_stream.go (2)

1-1: LGTM! Clean package refactoring.

The package rename from scenarios to testutil improves clarity and aligns with the PR's goal of consolidating test utilities into a centralized location.


16-16: Function signature updates are correct and complete.

The parameter type changes from config.ComprehensiveTestConfig to ComprehensiveTestConfig at lines 16 and 229 are appropriate and properly integrated. Both functions are included in the testScenarios slice in tests.go (lines 42-43) and are correctly typed against the TestScenarioFunc type alias that uses the same unqualified ComprehensiveTestConfig type. No old package imports remain, and all callers are properly updated.

core/chatbot_test.go (3)

1-1: LGTM: Appropriate package for external test.

The bifrost_test package is correct for an external test that exercises the public API.


13-13: LGTM: Testing import added.

The testing import is correctly added to support the new test wrapper function.


939-947: Test wrapper implementation is correct.

The TestChatbot function correctly uses t.Skip() to gate the interactive test behind the RUN_CHATBOT_TEST environment variable. However, ensure the runChatbot() function is updated to accept *testing.T as noted in the previous comment.

core/internal/testutil/speech_synthesis.go (1)

1-13: LGTM! Well-structured test refactoring.

The refactoring from package scenarios to package testutil is well-executed. The code demonstrates good testing practices:

  • Proper test isolation with subtests and parallel execution
  • Comprehensive validation with retry frameworks
  • Resource cleanup with t.Cleanup()
  • Clear test case organization and logging

The migration to local ComprehensiveTestConfig types aligns with the PR's objective to consolidate test utilities.

Also applies to: 22-147, 156-324, 326-347

Comment thread core/chatbot_test.go
Comment thread core/internal/testutil/speech_synthesis.go
Comment thread core/providers/cerebras/cerebras.go Outdated
Comment thread core/providers/groq/groq.go
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
core/internal/testutil/embedding.go (1)

124-143: Fix invalid range over int and simplify length handling

responseDataLength is an int, so for i := range responseDataLength will not compile. On top of that, the current adjustment logic for 2D embeddings can lead to out-of-bounds access if len(response.Data) differs from len(testTexts).

You can fix both the compile error and the potential index issue by treating len(response.Data) as the authoritative length and failing fast on mismatch:

-	embeddings := make([][]float32, len(testTexts))
-	responseDataLength := len(response.Data)
-	if responseDataLength != len(testTexts) {
-		if responseDataLength > 0 && response.Data[0].Embedding.Embedding2DArray != nil {
-			responseDataLength = len(response.Data[0].Embedding.Embedding2DArray)
-		}
-		if responseDataLength != len(testTexts) {
-			t.Fatalf("Expected %d embedding results, got %d", len(testTexts), responseDataLength)
-		}
-	}
-
-	for i := range responseDataLength {
+	embeddings := make([][]float32, len(testTexts))
+	responseDataLength := len(response.Data)
+	if responseDataLength != len(testTexts) {
+		t.Fatalf("Expected %d embedding results, got %d", len(testTexts), responseDataLength)
+	}
+
+	for i := 0; i < responseDataLength; i++ {

If you truly need to support a Embedding2DArray shape where a single Data element contains multiple vectors, consider adding a dedicated branch for that case rather than reusing responseDataLength while still indexing response.Data[i].

core/internal/testutil/account.go (1)

76-97: Add SGL key support to match configured providers

GetConfiguredProviders and GetConfigForProvider both include schemas.SGL, but GetKeysForProvider has no case schemas.SGL. As soon as the comprehensive test account is used to initialize providers, SGL will hit the default branch and be treated as “unsupported provider”, despite being declared supported.

To keep things coherent and avoid initialization/runtime errors when SGL is enabled in tests, add a key configuration for SGL (mirroring other providers):

 func (account *ComprehensiveTestAccount) GetKeysForProvider(ctx *context.Context, providerKey schemas.ModelProvider) ([]schemas.Key, error) {
 	switch providerKey {
@@
 	case schemas.Groq:
 		return []schemas.Key{
 			{
 				Value:  os.Getenv("GROQ_API_KEY"),
 				Models: []string{},
 				Weight: 1.0,
 			},
 		}, nil
+	case schemas.SGL:
+		return []schemas.Key{
+			{
+				Value:  os.Getenv("SGL_API_KEY"),
+				Models: []string{},
+				Weight: 1.0,
+			},
+		}, nil

You may want to align the env var name (SGL_API_KEY vs something else) with however SGL auth is expected in your deployment.

Also, in the ProviderOpenAICustom branch, the comment says “Use GROQ API key” but the code reads OPENAI_API_KEY; updating the comment would avoid confusion.

Also applies to: 100-276, 427-440

🧹 Nitpick comments (2)
core/providers/sgl/sgl.go (1)

82-95: Update comments to match actual SGL capabilities

The comments state that TextCompletion and Embedding are “not supported”, but the implementations clearly wire both up via OpenAI‑compatible endpoints (HandleOpenAITextCompletionRequest and HandleOpenAIEmbeddingRequest).

To avoid confusion:

  • Either update the comments to reflect that these operations are supported for SGL, or
  • If they are intentionally unsupported in some configurations, enforce that via NewUnsupportedOperationError rather than by comment only.

Also applies to: 180-193

core/providers/groq/groq.go (1)

125-152: Avoid shadowing response variable in streaming loop

In TextCompletionStream, the goroutine does:

for response := range response {
    ...
}

This shadows the outer response channel with the loop variable, which is legal but makes the code harder to read and reason about.

-	response, err := provider.ChatCompletionStream(ctx, postHookRunner, key, chatRequest)
+	streamChan, err := provider.ChatCompletionStream(ctx, postHookRunner, key, chatRequest)
@@
-	responseChan := make(chan *schemas.BifrostStream, 1)
+	responseChan := make(chan *schemas.BifrostStream, 1)
 	go func() {
 		defer close(responseChan)
-		for response := range response {
-			if response.BifrostError != nil {
-				responseChan <- response
+		for item := range streamChan {
+			if item.BifrostError != nil {
+				responseChan <- item
 				continue
 			}
-			if response.BifrostChatResponse != nil {
-				textCompletionResponse := response.BifrostChatResponse.ToTextCompletionResponse()
+			if item.BifrostChatResponse != nil {
+				textCompletionResponse := item.BifrostChatResponse.ToTextCompletionResponse()
@@
-					responseChan <- &schemas.BifrostStream{
-						BifrostTextCompletionResponse: textCompletionResponse,
-					}
+					responseChan <- &schemas.BifrostStream{
+						BifrostTextCompletionResponse: textCompletionResponse,
+					}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ff542b1 and 382ff3e.

⛔ Files ignored due to path filters (3)
  • core/go.sum is excluded by !**/*.sum
  • tests/core-chatbot/go.sum is excluded by !**/*.sum
  • tests/core-providers/go.sum is excluded by !**/*.sum
📒 Files selected for processing (73)
  • .github/workflows/scripts/release-core.sh (1 hunks)
  • Makefile (5 hunks)
  • core/bifrost.go (2 hunks)
  • core/chatbot_test.go (6 hunks)
  • core/go.mod (1 hunks)
  • core/internal/testutil/account.go (1 hunks)
  • core/internal/testutil/automatic_function_calling.go (2 hunks)
  • core/internal/testutil/chat_completion_stream.go (2 hunks)
  • core/internal/testutil/complete_end_to_end.go (1 hunks)
  • core/internal/testutil/cross_provider_scenarios.go (1 hunks)
  • core/internal/testutil/cross_provider_test.go (4 hunks)
  • core/internal/testutil/embedding.go (2 hunks)
  • core/internal/testutil/end_to_end_tool_calling.go (1 hunks)
  • core/internal/testutil/error_parser.go (1 hunks)
  • core/internal/testutil/image_base64.go (1 hunks)
  • core/internal/testutil/image_url.go (1 hunks)
  • core/internal/testutil/list_models.go (2 hunks)
  • core/internal/testutil/multi_turn_conversation.go (2 hunks)
  • core/internal/testutil/multiple_images.go (1 hunks)
  • core/internal/testutil/multiple_tool_calls.go (2 hunks)
  • core/internal/testutil/reasoning.go (1 hunks)
  • core/internal/testutil/response_validation.go (1 hunks)
  • core/internal/testutil/responses_stream.go (3 hunks)
  • core/internal/testutil/setup.go (1 hunks)
  • core/internal/testutil/simple_chat.go (1 hunks)
  • core/internal/testutil/speech_synthesis.go (2 hunks)
  • core/internal/testutil/speech_synthesis_stream.go (3 hunks)
  • core/internal/testutil/test_retry_conditions.go (1 hunks)
  • core/internal/testutil/test_retry_framework.go (2 hunks)
  • core/internal/testutil/tests.go (3 hunks)
  • core/internal/testutil/text_completion.go (1 hunks)
  • core/internal/testutil/text_completion_stream.go (2 hunks)
  • core/internal/testutil/tool_calls.go (2 hunks)
  • core/internal/testutil/tool_calls_streaming.go (2 hunks)
  • core/internal/testutil/transcription.go (4 hunks)
  • core/internal/testutil/transcription_stream.go (3 hunks)
  • core/internal/testutil/utils.go (2 hunks)
  • core/internal/testutil/validation_presets.go (2 hunks)
  • core/providers/anthropic/anthropic_test.go (3 hunks)
  • core/providers/azure/azure_test.go (3 hunks)
  • core/providers/bedrock/bedrock_test.go (4 hunks)
  • core/providers/cerebras/cerebras.go (1 hunks)
  • core/providers/cerebras/cerebras_test.go (4 hunks)
  • core/providers/cohere/cohere_test.go (3 hunks)
  • core/providers/elevenlabs/elevenlabs_test.go (3 hunks)
  • core/providers/gemini/gemini_test.go (4 hunks)
  • core/providers/groq/groq.go (1 hunks)
  • core/providers/groq/groq_test.go (4 hunks)
  • core/providers/mistral/mistral_test.go (3 hunks)
  • core/providers/ollama/ollama.go (1 hunks)
  • core/providers/ollama/ollama_test.go (3 hunks)
  • core/providers/openai/openai_test.go (4 hunks)
  • core/providers/openrouter/openrouter.go (1 hunks)
  • core/providers/openrouter/openrouter_test.go (3 hunks)
  • core/providers/parasail/parasail.go (1 hunks)
  • core/providers/parasail/parasail_test.go (3 hunks)
  • core/providers/perplexity/perplexity_test.go (3 hunks)
  • core/providers/sgl/sgl.go (1 hunks)
  • core/providers/sgl/sgl_test.go (3 hunks)
  • core/providers/vertex/vertex_test.go (3 hunks)
  • tests/core-chatbot/go.mod (0 hunks)
  • tests/core-providers/README.md (0 hunks)
  • tests/core-providers/go.mod (0 hunks)
  • tests/governance/README.md (0 hunks)
  • tests/governance/__init__.py (0 hunks)
  • tests/governance/conftest.py (0 hunks)
  • tests/governance/pytest.ini (0 hunks)
  • tests/governance/requirements.txt (0 hunks)
  • tests/governance/test_customers_crud.py (0 hunks)
  • tests/governance/test_helpers.py (0 hunks)
  • tests/governance/test_teams_crud.py (0 hunks)
  • tests/governance/test_usage_tracking.py (0 hunks)
  • tests/governance/test_virtual_keys_crud.py (0 hunks)
💤 Files with no reviewable changes (13)
  • tests/core-chatbot/go.mod
  • tests/governance/README.md
  • tests/governance/pytest.ini
  • tests/core-providers/go.mod
  • tests/governance/init.py
  • tests/governance/test_virtual_keys_crud.py
  • tests/governance/requirements.txt
  • tests/governance/test_usage_tracking.py
  • tests/governance/conftest.py
  • tests/governance/test_teams_crud.py
  • tests/core-providers/README.md
  • tests/governance/test_helpers.py
  • tests/governance/test_customers_crud.py
🚧 Files skipped from review as they are similar to previous changes (21)
  • .github/workflows/scripts/release-core.sh
  • core/internal/testutil/responses_stream.go
  • core/providers/parasail/parasail.go
  • core/providers/ollama/ollama.go
  • core/internal/testutil/setup.go
  • core/go.mod
  • core/internal/testutil/test_retry_conditions.go
  • core/internal/testutil/image_url.go
  • core/providers/ollama/ollama_test.go
  • core/internal/testutil/complete_end_to_end.go
  • core/internal/testutil/test_retry_framework.go
  • core/internal/testutil/tool_calls_streaming.go
  • core/internal/testutil/multiple_tool_calls.go
  • core/providers/gemini/gemini_test.go
  • core/providers/parasail/parasail_test.go
  • core/internal/testutil/list_models.go
  • core/chatbot_test.go
  • core/internal/testutil/reasoning.go
  • core/internal/testutil/image_base64.go
  • core/providers/mistral/mistral_test.go
  • core/internal/testutil/simple_chat.go
🧰 Additional context used
🧬 Code graph analysis (27)
core/internal/testutil/multiple_images.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/bifrost.go (6)
core/providers/ollama/ollama.go (1)
  • NewOllamaProvider (28-60)
core/providers/groq/groq.go (1)
  • NewGroqProvider (27-58)
core/providers/sgl/sgl.go (1)
  • NewSGLProvider (28-60)
core/providers/parasail/parasail.go (1)
  • NewParasailProvider (27-53)
core/providers/cerebras/cerebras.go (1)
  • NewCerebrasProvider (27-53)
core/providers/openrouter/openrouter.go (1)
  • NewOpenRouterProvider (29-55)
core/providers/cohere/cohere_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Cohere (39-39)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/speech_synthesis.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/cerebras/cerebras_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/tests.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/speech_synthesis_stream.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/tool_calls.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/text_completion.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/anthropic/anthropic_test.go (5)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (2)
  • Anthropic (37-37)
  • Fallback (128-131)
core/schemas/models.go (1)
  • Model (109-129)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/embedding.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/validation_presets.go (2)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/response_validation.go (1)
  • ResponseExpectations (18-43)
core/internal/testutil/cross_provider_test.go (2)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/cross_provider_scenarios.go (13)
  • ProviderConfig (45-53)
  • CrossProviderTestConfig (38-42)
  • ConversationSettings (56-60)
  • MessageModality (19-19)
  • ModalityText (22-22)
  • ModalityTool (23-23)
  • ModalityVision (24-24)
  • TestSettings (63-67)
  • ValidationModerate (33-33)
  • GetPredefinedScenarios (110-245)
  • RunCrossProviderScenarioTest (649-774)
  • ValidationLenient (34-34)
  • RunCrossProviderConsistencyTest (781-860)
core/providers/bedrock/bedrock_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/perplexity/perplexity_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Perplexity (46-46)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/openrouter/openrouter_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • OpenRouter (49-49)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/end_to_end_tool_calling.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/groq/groq_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/chat_completion_stream.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/text_completion_stream.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/openai/openai_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/azure/azure_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/transcription.go (3)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/schemas/transcriptions.go (1)
  • BifrostTranscriptionResponse (16-26)
core/providers/vertex/vertex_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Vertex (40-40)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/transcription_stream.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/sgl/sgl_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • SGL (44-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/multi_turn_conversation.go (2)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/test_retry_framework.go (1)
  • WithChatTestRetry (274-424)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
🔇 Additional comments (42)
core/internal/testutil/response_validation.go (1)

1-1: Package rename to testutil looks consistent

Aligning this file under core/internal/testutil matches the rest of the testing helpers; no functional issues introduced.

core/internal/testutil/embedding.go (1)

39-50: RunEmbeddingTest now using local ComprehensiveTestConfig is fine

Switching to the testutil-local ComprehensiveTestConfig keeps embedding tests consistent with the rest of the test harness; behavior and call pattern are unchanged.

core/providers/sgl/sgl.go (1)

3-60: Per-provider sgl package is consistent with the refactor

Moving this file under package sgl matches the per-provider layout used elsewhere; client construction and config wiring remain unchanged.

core/internal/testutil/error_parser.go (1)

1-1: Error parsing utilities correctly moved under testutil

Package rename aligns this file with the rest of the internal testing helpers; no behavioral impact.

core/internal/testutil/cross_provider_scenarios.go (1)

1-1: Cross‑provider scenario tooling correctly namespaced under testutil

Moving this to package testutil is consistent with the other shared test helpers; existing scenario and judge logic stays intact.

core/providers/groq/groq.go (1)

3-58: Groq provider moved into its own package cleanly

Renaming to package groq is consistent with other provider modules; constructor and method wiring remain the same.

core/internal/testutil/account.go (1)

1-4: Test account/config moved under testutil appropriately

Renaming this to package testutil and updating the top comment keeps all test account and config helpers under a single internal namespace.

core/internal/testutil/tool_calls.go (1)

1-17: Tool call tests correctly migrated to testutil.ComprehensiveTestConfig

Using the local ComprehensiveTestConfig here keeps the tool-calls test in line with the rest of the test harness. The dual Chat/Responses API validation and shared expectations remain unchanged.

core/internal/testutil/text_completion_stream.go (1)

1-1: LGTM! Clean refactoring to testutil package.

The package rename and type signature update align perfectly with the PR's goal of consolidating test utilities into core/internal/testutil.

Also applies to: 17-17

core/internal/testutil/multiple_images.go (1)

1-1: LGTM! Consistent refactoring.

Package and type changes are consistent with the testutil migration.

Also applies to: 15-15

core/internal/testutil/utils.go (2)

1-1: LGTM! Improved path resolution.

The migration to testutil package and the addition of runtime-based path discovery for the lion image data makes the code more robust and portable compared to hardcoded relative paths.

Also applies to: 7-8, 195-201


209-209: LGTM! Function name aligns with comment.

The rename from CreateSpeechInput to CreateSpeechRequest is consistent with the return type (*schemas.BifrostSpeechRequest) and improves clarity.

core/internal/testutil/text_completion.go (1)

1-1: LGTM! Consistent testutil migration.

Package and signature changes follow the established refactoring pattern.

Also applies to: 14-14

core/internal/testutil/end_to_end_tool_calling.go (1)

1-1: LGTM! Standard refactoring.

Package and type updates are consistent with the testutil consolidation effort.

Also applies to: 15-15

core/internal/testutil/validation_presets.go (1)

1-1: LGTM! Validation presets migrated correctly.

The package and function signature updates maintain consistency with the broader testutil refactoring.

Also applies to: 208-208

core/internal/testutil/tests.go (1)

1-1: LGTM! Test runner successfully refactored.

The package rename to testutil, function export (capitalization of RunAllComprehensiveTests), and updates to use local test scenario functions are all correct. The exported function is now properly accessible to provider test packages.

Also applies to: 12-15, 25-52, 64-64

core/providers/groq/groq_test.go (1)

1-62: LGTM! Clean refactoring to testutil package.

The migration from the config package to the internal testutil package is consistent and complete. Package naming follows Go testing conventions (groq_test), and all type references (ComprehensiveTestConfig, TestScenarios) and function calls (SetupTest, RunAllComprehensiveTests) are properly updated.

core/internal/testutil/chat_completion_stream.go (1)

1-16: LGTM! Package and type references updated correctly.

The package rename to testutil and function signature update to use the local ComprehensiveTestConfig type are consistent with the test infrastructure consolidation. The function body logic remains unchanged.

core/internal/testutil/speech_synthesis_stream.go (1)

1-16: LGTM! Consistent refactoring for speech synthesis streaming tests.

Package declaration and function signatures properly updated to use the local testutil types. Both RunSpeechSynthesisStreamTest and RunSpeechSynthesisStreamAdvancedTest are consistently migrated.

core/internal/testutil/automatic_function_calling.go (2)

1-14: LGTM! Package and signature updated correctly.

The package rename to testutil and function signature update are consistent with the refactoring objectives.


161-180: LGTM! Validation consolidated into retry framework.

The validation logic has been appropriately moved into WithDualAPITestRetry (lines 114-120), with validateAutomaticToolCall now serving as an additional logging helper. The comments clearly document this architectural change. This consolidation reduces duplication and centralizes validation logic.

core/internal/testutil/speech_synthesis.go (1)

1-16: LGTM! Speech synthesis tests migrated to testutil.

Package declaration and function signatures properly updated. Both RunSpeechSynthesisTest and RunSpeechSynthesisAdvancedTest are consistently refactored to use local testutil types.

core/providers/cerebras/cerebras_test.go (1)

1-57: LGTM! Provider test successfully migrated to testutil.

The Cerebras provider test has been cleanly migrated to use the testutil package. Package naming follows Go testing conventions (cerebras_test), and all type references and function calls are properly updated to use testutil equivalents.

core/providers/elevenlabs/elevenlabs_test.go (1)

1-56: LGTM! ElevenLabs provider test successfully migrated.

The ElevenLabs provider test follows the same clean migration pattern as other provider tests. Package naming conventions are correct (elevenlabs_test), and all references to config types/functions are properly updated to testutil equivalents.

core/internal/testutil/multi_turn_conversation.go (2)

1-13: LGTM! Package and signature updated correctly.

The package rename to testutil and function signature update are consistent with the broader refactoring effort.


135-148: LGTM! Validation consolidated into retry framework.

The memory recall validation has been appropriately moved into the WithChatTestRetry framework via expectations2 (lines 130-133), which validates that the response contains "alice" and doesn't contain memory failure indicators. The comments clearly document this architectural change, and the simplified flow is easier to follow.

Makefile (2)

318-395: LGTM: Test path updates correctly implement the new structure.

The changes properly update test paths to reflect the migration of tests from tests/core-providers/ to core/providers/$(PROVIDER)/. The relative path depth (../../../) is correct for navigating from core/providers/$(PROVIDER) back to the repository root.


528-544: LGTM: Well-structured interactive test target.

The new test-chatbot target is properly guarded with environment variable checks and provides clear usage instructions. Loading from .env is a good practice for local development.

core/providers/openrouter/openrouter.go (1)

3-3: LGTM: Package declaration updated for per-provider structure.

The package rename from providers to openrouter aligns with the broader refactoring to use per-provider packages instead of a consolidated providers package.

core/internal/testutil/transcription_stream.go (1)

1-1: LGTM: Test utility migration to testutil package.

The package rename and removal of the external config package dependency correctly implements the test infrastructure consolidation. The function signatures now use local ComprehensiveTestConfig types.

Also applies to: 18-18, 326-326

core/providers/bedrock/bedrock_test.go (1)

1-1: LGTM: Test file migrated to testutil pattern.

All references correctly updated from the old config package to the new testutil package. The changes are consistent with the test infrastructure consolidation across all provider tests.

Also applies to: 7-7, 18-18, 24-55

core/bifrost.go (1)

21-32: LGTM: Per-provider imports implemented correctly.

The refactor from a consolidated providers package to individual per-provider packages is implemented consistently. All constructor calls properly reference their respective packages (e.g., ollama.NewOllamaProvider, groq.NewGroqProvider).

Also applies to: 1309-1323

core/providers/anthropic/anthropic_test.go (1)

1-1: LGTM: Consistent test migration pattern.

All test utility references properly migrated to the testutil package, following the same pattern as other provider tests in this PR.

Also applies to: 7-7, 18-53

core/providers/cohere/cohere_test.go (1)

1-1: LGTM: Test utilities correctly migrated.

Follows the established pattern for migrating test infrastructure to the testutil package.

Also applies to: 7-7, 18-51

core/providers/openrouter/openrouter_test.go (1)

1-1: LGTM: Test migration completed consistently.

All test utility references properly updated to use the testutil package, maintaining consistency with the other provider test files.

Also applies to: 7-7, 18-51

core/providers/azure/azure_test.go (1)

1-66: LGTM! Clean migration to testutil.

The refactoring correctly updates the package name, imports, and all type/function references from the old config package to the new testutil package. The test logic remains unchanged, and all references are properly updated.

core/providers/sgl/sgl_test.go (1)

1-53: LGTM! Consistent with the testutil migration.

The changes correctly update all references from the old config package to the new testutil package. Package name, imports, types, and function calls are all properly updated.

core/providers/perplexity/perplexity_test.go (1)

1-51: LGTM! Proper migration to testutil.

All references have been correctly updated from the config package to testutil. The refactoring maintains the existing test logic while properly updating the infrastructure.

core/providers/openai/openai_test.go (1)

1-68: LGTM! Testutil migration applied correctly.

The OpenAI test file has been properly updated with the new testutil package references. All type and function calls are correctly migrated.

core/internal/testutil/transcription.go (1)

1-550: LGTM! Function signatures correctly updated.

The package rename from scenarios to testutil and the removal of the config package qualifier from function signatures are correct. Since ComprehensiveTestConfig is now defined locally in the testutil package, the unqualified type references are appropriate.

core/providers/vertex/vertex_test.go (1)

1-53: LGTM! Vertex test properly migrated.

All references have been correctly updated from the config package to testutil, following the same pattern as other provider tests. The refactoring is clean and consistent.

core/internal/testutil/cross_provider_test.go (1)

1-147: LGTM! Cross-provider tests correctly integrated into testutil.

The migration correctly removes external package qualifiers since the types and functions are now local to the testutil package. All references to config and scenarios have been properly updated to use local definitions.

Comment thread core/providers/cerebras/cerebras.go
@Pratham-Mishra04 Pratham-Mishra04 changed the base branch from 11-24-feat_core_tests_retry_logic_enhancements to graphite-base/916 November 24, 2025 08:53
@akshaydeo akshaydeo force-pushed the 11-22-moves_all_tests_related_to_core_to_corresponding_files branch from 382ff3e to efa9e85 Compare November 24, 2025 10:15
@akshaydeo akshaydeo mentioned this pull request Nov 24, 2025
18 tasks
@akshaydeo akshaydeo force-pushed the 11-22-moves_all_tests_related_to_core_to_corresponding_files branch from efa9e85 to 6bba680 Compare November 24, 2025 10:30
@graphite-app graphite-app Bot changed the base branch from graphite-base/916 to main November 24, 2025 10:31
@akshaydeo akshaydeo force-pushed the 11-22-moves_all_tests_related_to_core_to_corresponding_files branch from 6bba680 to 615ad7c Compare November 24, 2025 10:31
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
core/internal/testutil/chat_completion_stream.go (1)

189-189: Clean up the malformed comment.

The inline comment contains two unrelated fragments separated by excessive whitespace. The "Reasonable upper bound" text doesn't describe this line's purpose (adding "paris" to expected content).

Apply this diff to fix the comment:

-		expectations.ShouldContainAnyOf = append(expectations.ShouldContainAnyOf, []string{"paris"}...) // Should include story elements                                                         // Reasonable upper bound
+		expectations.ShouldContainAnyOf = append(expectations.ShouldContainAnyOf, []string{"paris"}...) // Should include story elements (robot painting story in Paris)
core/internal/testutil/error_parser.go (2)

402-419: Fix unreachable code and naming inconsistency.

The function has two issues:

  1. Line 416 (return false) is unreachable because t.Fatalf on line 415 immediately terminates the test.
  2. The function name AssertNoError suggests non-fatal assertion behavior, but t.Fatalf makes it fatal like RequireNoError.

Choose one of these solutions:

Solution 1 (Recommended): Make it a true assertion with non-fatal behavior

-		t.Fatalf("%s, but got:\n%s", message, FormatError(parsed))
+		t.Errorf("%s, but got:\n%s", message, FormatError(parsed))
 		return false

Solution 2: Remove this function since RequireNoError already exists

If fatal behavior is always desired, remove AssertNoError and use RequireNoError instead, as they currently have identical behavior.


46-104: Add nil check for err.Error before accessing its fields.

The code accesses err.Error.Message, err.Error.Type, err.Error.Param, and err.Error.Error without checking if err.Error itself is nil. Since BifrostError.Error is a pointer type (*ErrorField), this will cause panics if nil.

Lines requiring protection: 74, 136–137, 153, 217, 241, 274–275, 295, 313–314, 468.

Add a nil check like:

if err.Error == nil {
	// handle case or return early
}

before any accesses to err.Error fields.

♻️ Duplicate comments (3)
core/internal/testutil/speech_synthesis.go (1)

113-113: Unused context parameter still present.

The functions continue to create new context.Background() contexts instead of using the passed ctx parameter, preventing callers from controlling test cancellation, timeouts, or passing context values. This issue was previously identified and remains unresolved.

Also applies to: 219-219, 301-301

core/providers/groq/groq.go (1)

1-3: Update package comment to reflect the new package name.

The package comment still references "Package providers" but the package declaration is now groq. This issue was previously identified in review comments.

Apply this diff to update the comment:

-// Package providers implements various LLM providers and their utility functions.
-// This file contains the Groq provider implementation.
+// Package groq implements the Groq LLM provider.
 package groq
core/providers/cerebras/cerebras.go (1)

1-3: Package comment still outdated despite past review resolution.

The package comment still references "Package providers" instead of "Package cerebras", even though past review comments indicate this was addressed in commits 44a6fb8 to efa9e85. This suggests the fix may not have been included in this PR or there's a merge conflict.

Apply this diff to update the comment:

-// Package providers implements various LLM providers and their utility functions.
-// This file contains the Cerebras provider implementation.
+// Package cerebras implements the Cerebras LLM provider.
 package cerebras
🧹 Nitpick comments (3)
core/internal/testutil/multiple_images.go (1)

1-1: Refactor to local testutil config type looks consistent; consider de‑duplicating scenario name

The move to package testutil and switching RunMultipleImagesTest to use the local ComprehensiveTestConfig type align with the new testutil layout, and the referenced fields (Provider, VisionModel, Scenarios.MultipleImages, Fallbacks) all exist on that struct (see core/internal/testutil/account.go, lines 46-62). The helper continues to behave the same while dropping the external config dependency, which is good.

As a small optional cleanup, "MultipleImages" is hard‑coded in several places in this function (t.Run, GetTestRetryConfigForScenario, ScenarioName, and the label passed to WithChatTestRetry). Extracting a const multipleImagesScenario = "MultipleImages" (in this file or a shared testutil constants file) would reduce repetition and keep these call sites in sync if the name ever changes.

Also applies to: 15-103

core/internal/testutil/automatic_function_calling.go (1)

162-179: Consider clarifying comment to reflect supplementary validation.

The comment states the function "just provides additional logging," but lines 171-176 still perform soft validation (checking timezone presence and logging warnings). Consider updating the comment to distinguish between critical validation (in WithDualAPITestRetry) and supplementary validation (in this function).

Example clarification:

-// Validation for tool call already happened inside WithDualAPITestRetry
-// If we reach here, the tool call was successful
-// This function just provides additional logging for tool call details
+// Critical validation for tool call already happened inside WithDualAPITestRetry
+// This function performs supplementary validation and provides detailed logging
core/internal/testutil/chat_completion_stream.go (1)

316-318: Consider logging the early exit for debugging clarity.

The silent goto after 100 responses may mask issues if the channel doesn't close properly, unlike the main test's explicit failure at line 139. While this might be intentional to prevent hanging on verbose providers, adding a log message would aid debugging.

Apply this diff to add logging:

 					if responseCount > 100 {
+						t.Logf("⚠️ Stopping stream reading after %d chunks (safety limit)", responseCount)
 						goto toolStreamComplete
 					}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 382ff3e and 615ad7c.

⛔ Files ignored due to path filters (3)
  • core/go.sum is excluded by !**/*.sum
  • tests/core-chatbot/go.sum is excluded by !**/*.sum
  • tests/core-providers/go.sum is excluded by !**/*.sum
📒 Files selected for processing (73)
  • .github/workflows/scripts/release-core.sh (1 hunks)
  • Makefile (5 hunks)
  • core/bifrost.go (2 hunks)
  • core/chatbot_test.go (6 hunks)
  • core/go.mod (1 hunks)
  • core/internal/testutil/account.go (1 hunks)
  • core/internal/testutil/automatic_function_calling.go (2 hunks)
  • core/internal/testutil/chat_completion_stream.go (2 hunks)
  • core/internal/testutil/complete_end_to_end.go (1 hunks)
  • core/internal/testutil/cross_provider_scenarios.go (1 hunks)
  • core/internal/testutil/cross_provider_test.go (4 hunks)
  • core/internal/testutil/embedding.go (2 hunks)
  • core/internal/testutil/end_to_end_tool_calling.go (1 hunks)
  • core/internal/testutil/error_parser.go (1 hunks)
  • core/internal/testutil/image_base64.go (1 hunks)
  • core/internal/testutil/image_url.go (1 hunks)
  • core/internal/testutil/list_models.go (2 hunks)
  • core/internal/testutil/multi_turn_conversation.go (2 hunks)
  • core/internal/testutil/multiple_images.go (1 hunks)
  • core/internal/testutil/multiple_tool_calls.go (2 hunks)
  • core/internal/testutil/reasoning.go (1 hunks)
  • core/internal/testutil/response_validation.go (1 hunks)
  • core/internal/testutil/responses_stream.go (3 hunks)
  • core/internal/testutil/setup.go (1 hunks)
  • core/internal/testutil/simple_chat.go (1 hunks)
  • core/internal/testutil/speech_synthesis.go (2 hunks)
  • core/internal/testutil/speech_synthesis_stream.go (3 hunks)
  • core/internal/testutil/test_retry_conditions.go (1 hunks)
  • core/internal/testutil/test_retry_framework.go (2 hunks)
  • core/internal/testutil/tests.go (3 hunks)
  • core/internal/testutil/text_completion.go (1 hunks)
  • core/internal/testutil/text_completion_stream.go (2 hunks)
  • core/internal/testutil/tool_calls.go (2 hunks)
  • core/internal/testutil/tool_calls_streaming.go (2 hunks)
  • core/internal/testutil/transcription.go (4 hunks)
  • core/internal/testutil/transcription_stream.go (3 hunks)
  • core/internal/testutil/utils.go (2 hunks)
  • core/internal/testutil/validation_presets.go (2 hunks)
  • core/providers/anthropic/anthropic_test.go (3 hunks)
  • core/providers/azure/azure_test.go (3 hunks)
  • core/providers/bedrock/bedrock_test.go (4 hunks)
  • core/providers/cerebras/cerebras.go (1 hunks)
  • core/providers/cerebras/cerebras_test.go (4 hunks)
  • core/providers/cohere/cohere_test.go (3 hunks)
  • core/providers/elevenlabs/elevenlabs_test.go (3 hunks)
  • core/providers/gemini/gemini_test.go (4 hunks)
  • core/providers/groq/groq.go (1 hunks)
  • core/providers/groq/groq_test.go (4 hunks)
  • core/providers/mistral/mistral_test.go (3 hunks)
  • core/providers/ollama/ollama.go (1 hunks)
  • core/providers/ollama/ollama_test.go (3 hunks)
  • core/providers/openai/openai_test.go (4 hunks)
  • core/providers/openrouter/openrouter.go (1 hunks)
  • core/providers/openrouter/openrouter_test.go (3 hunks)
  • core/providers/parasail/parasail.go (1 hunks)
  • core/providers/parasail/parasail_test.go (3 hunks)
  • core/providers/perplexity/perplexity_test.go (3 hunks)
  • core/providers/sgl/sgl.go (1 hunks)
  • core/providers/sgl/sgl_test.go (3 hunks)
  • core/providers/vertex/vertex_test.go (3 hunks)
  • tests/core-chatbot/go.mod (0 hunks)
  • tests/core-providers/README.md (0 hunks)
  • tests/core-providers/go.mod (0 hunks)
  • tests/governance/README.md (0 hunks)
  • tests/governance/__init__.py (0 hunks)
  • tests/governance/conftest.py (0 hunks)
  • tests/governance/pytest.ini (0 hunks)
  • tests/governance/requirements.txt (0 hunks)
  • tests/governance/test_customers_crud.py (0 hunks)
  • tests/governance/test_helpers.py (0 hunks)
  • tests/governance/test_teams_crud.py (0 hunks)
  • tests/governance/test_usage_tracking.py (0 hunks)
  • tests/governance/test_virtual_keys_crud.py (0 hunks)
💤 Files with no reviewable changes (13)
  • tests/governance/pytest.ini
  • tests/governance/test_virtual_keys_crud.py
  • tests/core-providers/go.mod
  • tests/core-providers/README.md
  • tests/governance/conftest.py
  • tests/core-chatbot/go.mod
  • tests/governance/test_customers_crud.py
  • tests/governance/requirements.txt
  • tests/governance/README.md
  • tests/governance/init.py
  • tests/governance/test_helpers.py
  • tests/governance/test_usage_tracking.py
  • tests/governance/test_teams_crud.py
🚧 Files skipped from review as they are similar to previous changes (20)
  • core/providers/parasail/parasail.go
  • core/providers/sgl/sgl.go
  • core/providers/cohere/cohere_test.go
  • core/internal/testutil/tool_calls.go
  • core/providers/cerebras/cerebras_test.go
  • Makefile
  • core/internal/testutil/list_models.go
  • core/internal/testutil/transcription_stream.go
  • core/internal/testutil/embedding.go
  • core/chatbot_test.go
  • core/internal/testutil/cross_provider_scenarios.go
  • core/providers/openai/openai_test.go
  • core/providers/perplexity/perplexity_test.go
  • core/internal/testutil/image_base64.go
  • core/providers/elevenlabs/elevenlabs_test.go
  • core/providers/parasail/parasail_test.go
  • core/internal/testutil/response_validation.go
  • core/providers/groq/groq_test.go
  • core/internal/testutil/validation_presets.go
  • core/internal/testutil/text_completion.go
🧰 Additional context used
🧬 Code graph analysis (27)
core/internal/testutil/test_retry_framework.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/end_to_end_tool_calling.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/mistral/mistral_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (2)
  • Mistral (41-41)
  • Fallback (128-131)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/ollama/ollama_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Ollama (42-42)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/multiple_images.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/speech_synthesis_stream.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/multiple_tool_calls.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/speech_synthesis.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/multi_turn_conversation.go (2)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/utils.go (2)
  • GetErrorMessage (597-630)
  • GetChatContent (320-347)
core/internal/testutil/complete_end_to_end.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/azure/azure_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/openrouter/openrouter_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • OpenRouter (49-49)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/responses_stream.go (3)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/schemas/responses.go (1)
  • ResponsesStreamResponseType (1351-1351)
core/schemas/bifrost.go (1)
  • BifrostStream (318-325)
core/internal/testutil/text_completion_stream.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/bedrock/bedrock_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/tool_calls_streaming.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/reasoning.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/transcription.go (2)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/schemas/transcriptions.go (1)
  • BifrostTranscriptionResponse (16-26)
core/internal/testutil/automatic_function_calling.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/cross_provider_test.go (2)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/cross_provider_scenarios.go (13)
  • ProviderConfig (45-53)
  • CrossProviderTestConfig (38-42)
  • ConversationSettings (56-60)
  • MessageModality (19-19)
  • ModalityText (22-22)
  • ModalityTool (23-23)
  • ModalityVision (24-24)
  • TestSettings (63-67)
  • ValidationModerate (33-33)
  • GetPredefinedScenarios (110-245)
  • RunCrossProviderScenarioTest (649-774)
  • ValidationLenient (34-34)
  • RunCrossProviderConsistencyTest (781-860)
core/internal/testutil/chat_completion_stream.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/sgl/sgl_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • SGL (44-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/anthropic/anthropic_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (2)
  • Anthropic (37-37)
  • Fallback (128-131)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/image_url.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/bifrost.go (9)
core/providers/ollama/ollama.go (1)
  • NewOllamaProvider (28-60)
core/schemas/bifrost.go (7)
  • Groq (43-43)
  • SGL (44-44)
  • Parasail (45-45)
  • Perplexity (46-46)
  • Cerebras (47-47)
  • Gemini (48-48)
  • OpenRouter (49-49)
core/providers/groq/groq.go (1)
  • NewGroqProvider (27-58)
core/providers/sgl/sgl.go (1)
  • NewSGLProvider (28-60)
core/providers/parasail/parasail.go (1)
  • NewParasailProvider (27-53)
core/providers/perplexity/perplexity.go (1)
  • NewPerplexityProvider (29-55)
core/providers/cerebras/cerebras.go (1)
  • NewCerebrasProvider (27-53)
core/providers/gemini/gemini.go (1)
  • NewGeminiProvider (31-58)
core/providers/openrouter/openrouter.go (1)
  • NewOpenRouterProvider (29-55)
core/internal/testutil/simple_chat.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/gemini/gemini_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
🔇 Additional comments (43)
core/internal/testutil/tool_calls_streaming.go (1)

1-1: LGTM! Clean refactor aligning with the new package structure.

The package rename to testutil and the removal of the config. qualifier from ComprehensiveTestConfig are correct. Since ComprehensiveTestConfig is now defined locally in core/internal/testutil/account.go, using the unqualified type name is appropriate. The rest of the file remains unchanged, making this a focused, low-risk refactor.

Also applies to: 211-211

core/go.mod (1)

14-14: Promoting testify to a direct dependency is appropriate for the test reorganization.

Since tests are now co-located in the core packages (per the PR refactor), testify is now directly imported by those test files. Promoting it from an indirect to a direct dependency correctly reflects this change in the module's dependency graph. Version v1.11.1 has no known security vulnerabilities or CVEs.

core/internal/testutil/speech_synthesis.go (1)

1-1: LGTM: Clean refactoring to testutil package.

The package rename and function signature updates correctly reflect the consolidation of test utilities into core/internal/testutil. The unqualified ComprehensiveTestConfig type is appropriate since both the type definition and these functions now reside in the same package.

Also applies to: 16-16, 150-150

core/internal/testutil/automatic_function_calling.go (2)

1-11: LGTM! Package rename aligns with refactor objectives.

The package declaration change from scenarios to testutil is consistent with the PR's goal of consolidating test utilities into core/internal/testutil.


14-14: LGTM! Correct use of unqualified type.

The parameter type change to ComprehensiveTestConfig (without package qualifier) is correct since the type is now defined in the same testutil package.

core/internal/testutil/responses_stream.go (3)

1-1: LGTM! Package rename aligns with refactoring goals.

The package rename from scenarios to testutil correctly reflects the new location and consolidates test utilities as intended by this refactoring.


17-17: LGTM! Function signature correctly updated.

The signature change removes the external config package dependency and uses the local ComprehensiveTestConfig type, which is properly defined in core/internal/testutil/account.go. This makes the package more self-contained.


821-821: LGTM! Validation function signature correctly updated.

Consistent with the refactoring, this signature change removes the external config package dependency and uses the local ComprehensiveTestConfig type.

core/internal/testutil/chat_completion_stream.go (2)

1-1: LGTM: Package reorganization correctly applied.

The package declaration and function signature changes properly reflect the consolidation of test utilities into the testutil package, with ComprehensiveTestConfig now defined locally.

Also applies to: 17-17


23-215: Well-structured streaming tests with comprehensive validation.

Both test scenarios include:

  • Proper timeout handling with context
  • Safety limits against infinite loops
  • Detailed logging for debugging
  • Thorough response validation
  • Appropriate use of the retry framework

The implementation demonstrates good testing practices.

Also applies to: 219-334

core/internal/testutil/error_parser.go (2)

1-1: LGTM! Package rename aligns with test utility reorganization.

The package name change from scenarios to testutil is appropriate and aligns with the PR's goal of consolidating test utilities into core/internal/testutil.


106-511: LGTM! Well-structured error handling utilities.

The error categorization, parsing, and formatting logic is comprehensive and well-organized:

  • Systematic error categorization by status codes, error types, and message keywords
  • Context-specific suggestions for each error category
  • Reasonable retry logic with exponential backoff capped at 30 seconds
  • Provider-specific guidance with helpful status page links
core/internal/testutil/test_retry_conditions.go (1)

1-1: LGTM! Package rename aligns with test utilities consolidation.

The package rename from scenarios to testutil is consistent with the PR's objective to consolidate test utilities under core/internal/testutil.

core/internal/testutil/setup.go (1)

1-4: LGTM! Package rename and documentation updated correctly.

The package rename from config to testutil and the corresponding package comment update are consistent with the PR's consolidation of test utilities.

core/internal/testutil/test_retry_framework.go (1)

1-1116: LGTM! Package consolidation executed correctly.

The package rename from scenarios to testutil and the removal of the external config import in favor of local ComprehensiveTestConfig aligns with the PR's objective to consolidate test utilities under core/internal/testutil.

core/internal/testutil/account.go (1)

1-4: LGTM! Package rename and documentation updated correctly.

The package rename from config to testutil with the corresponding package comment update is consistent with the PR's consolidation of test utilities.

.github/workflows/scripts/release-core.sh (1)

38-42: LGTM! Test command updated to reflect new test structure.

The change from provider-specific test navigation to running go test -v ./... from the core directory aligns with the PR's restructuring of tests under core/providers.

core/internal/testutil/utils.go (2)

209-222: LGTM!

The comment now correctly references CreateSpeechRequest, matching the actual function name.


194-207: The file path construction is correct—no changes needed.

The script confirms that lion_base64.txt exists at core/internal/testutil/scenarios/media/lion_base64.txt, which exactly matches the path the function constructs. The "scenarios" subdirectory is intentional and properly nested within the testutil package directory. The function works as designed.

Likely an incorrect or invalid review comment.

core/internal/testutil/speech_synthesis_stream.go (1)

1-1: LGTM!

The package rename and type unqualification align with the PR's goal of consolidating test utilities into the testutil package and removing external dependencies on the config package.

Also applies to: 16-16, 229-229

core/internal/testutil/text_completion_stream.go (1)

1-1: LGTM!

Consistent with the broader refactoring to consolidate test utilities in the testutil package.

Also applies to: 17-17

core/internal/testutil/reasoning.go (1)

1-1: LGTM!

The package rename and type unqualification are consistent with the PR's refactoring goals.

Also applies to: 14-14

core/internal/testutil/multiple_tool_calls.go (1)

1-1: LGTM!

The changes align with the PR's goal of consolidating test utilities into the testutil package.

Also applies to: 23-23

core/providers/mistral/mistral_test.go (1)

1-1: LGTM!

The test file correctly adopts the new testutil package and updated type references. This demonstrates the consumer side of the refactoring is working as expected.

Also applies to: 7-7, 18-18, 24-24, 32-32, 52-52

core/internal/testutil/image_url.go (1)

1-1: LGTM!

The package rename and type unqualification are consistent with the broader test infrastructure consolidation.

Also applies to: 15-15

core/providers/ollama/ollama.go (1)

3-3: The review comment is based on an incorrect architectural assumption.

The codebase shows providers are already organized as separate subpackages (ollama, openai, anthropic, azure, bedrock, etc.) under core/providers/. There is no monolithic providers package that was renamed to ollama. All imports throughout the codebase are already using the correct subpackage paths (e.g., github.com/maximhq/bifrost/core/providers/ollama, github.com/maximhq/bifrost/core/providers/openai). The package structure is correct and requires no import updates.

Likely an incorrect or invalid review comment.

core/providers/openrouter/openrouter_test.go (1)

1-51: LGTM! Clean refactoring to testutil package.

The migration from the old config package to testutil is implemented correctly:

  • Package name follows Go test conventions (openrouter_test)
  • Import path correctly references core/internal/testutil
  • All type and function references are properly qualified with testutil
  • Test logic remains unchanged
core/internal/testutil/end_to_end_tool_calling.go (1)

1-15: LGTM! Correct package migration.

The package rename from scenarios to testutil and the use of unqualified ComprehensiveTestConfig is correct, as this type is now defined within the same package.

core/internal/testutil/complete_end_to_end.go (1)

1-15: LGTM! Consistent package refactoring.

Package declaration and type reference updates are consistent with the broader testutil consolidation effort.

core/providers/ollama/ollama_test.go (1)

1-49: LGTM! Properly migrated to testutil.

All references to test utilities are correctly updated to use the testutil package. Package naming follows Go conventions.

core/providers/bedrock/bedrock_test.go (1)

1-55: LGTM! Clean migration to testutil package.

The refactoring correctly updates all test utility references to use the consolidated testutil package while maintaining the existing test logic.

core/providers/gemini/gemini_test.go (1)

1-60: LGTM! Consistent testutil migration.

All test utility references are correctly updated. The refactoring maintains test functionality while improving code organization.

core/internal/testutil/simple_chat.go (1)

1-14: LGTM! Proper package consolidation.

Package declaration and unqualified type usage are correct for this testutil package file.

core/providers/azure/azure_test.go (1)

1-63: LGTM! Successfully migrated to testutil package.

All test utility references are correctly updated to use the testutil package. The refactoring maintains existing test functionality while improving the codebase organization.

core/providers/anthropic/anthropic_test.go (1)

1-56: LGTM! Clean refactoring to testutil package.

The migration from the old config package to testutil is well-executed. All references (SetupTest, ComprehensiveTestConfig, TestScenarios, RunAllComprehensiveTests) are properly updated and consistent.

core/internal/testutil/multi_turn_conversation.go (1)

1-149: LGTM! Refactoring improves consistency.

The migration to the testutil package is correct, and the validation approach is cleaner by using the expectations framework via WithChatTestRetry rather than inline validation.

core/providers/sgl/sgl_test.go (1)

1-53: LGTM! Consistent migration to testutil.

All references properly updated to use the centralized testutil package.

core/internal/testutil/tests.go (1)

1-115: LGTM! Successfully consolidated test utilities.

The function is now properly exported (RunAllComprehensiveTests) and uses local types without external package qualifiers. The test scenario registrations are correctly updated.

core/internal/testutil/transcription.go (1)

1-550: LGTM! Type references correctly updated.

All function signatures properly migrated to use the local ComprehensiveTestConfig type from the testutil package.

core/providers/vertex/vertex_test.go (1)

1-53: LGTM! Consistent with other provider tests.

All testutil references are correctly applied.

core/internal/testutil/cross_provider_test.go (1)

1-147: LGTM! Cross-provider tests successfully migrated.

All types (ProviderConfig, CrossProviderTestConfig, ConversationSettings, TestSettings, MessageModality) and helper functions are correctly referenced from the local testutil package.

core/bifrost.go (2)

21-32: LGTM! Import reorganization to per-provider packages.

The imports have been updated from a consolidated providers package to individual per-provider packages (cerebras, groq, ollama, openrouter, parasail, sgl).


1308-1324: LGTM! Constructor calls correctly updated.

All provider constructors are properly invoked using their respective package namespaces. Error handling is correctly applied based on each constructor's signature.

Comment thread core/providers/openrouter/openrouter.go
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
core/internal/testutil/cross_provider_test.go (1)

10-12: Re-enable or remove the permanently skipped test.

This test is unconditionally skipped, providing no test coverage for cross-provider scenarios. Additionally, the return statement after t.Skip() is redundant since t.Skip() already stops execution, and using t.Parallel() before an immediate skip is unusual.

If these tests are temporarily disabled, consider adding a comment explaining why and when they'll be re-enabled. If they're obsolete, remove them entirely. Would you like me to help create an issue to track re-enabling these tests?

core/internal/testutil/error_parser.go (1)

402-419: Fix naming inconsistency and unreachable code.

AssertNoError calls t.Fatalf() which terminates execution, making the return false on line 416 unreachable. The function name suggests it should use t.Errorf() (fail but continue), while the implementation matches RequireNoError behavior (fail and stop).

Consider either:

  1. Rename to RequireNoErrorAlt or similar to match the fail-and-stop behavior
  2. Change t.Fatalf() to t.Errorf() if assert semantics (fail but continue) are intended

Apply this diff for option 2 (assert semantics):

 func AssertNoError(t *testing.T, err *schemas.BifrostError, msgAndArgs ...interface{}) bool {
 	if err != nil {
 		parsed := ParseBifrostError(err)
 		message := "Expected no error"
 		if len(msgAndArgs) > 0 {
 			if msg, ok := msgAndArgs[0].(string); ok {
 				if len(msgAndArgs) > 1 {
 					message = fmt.Sprintf(msg, msgAndArgs[1:]...)
 				} else {
 					message = msg
 				}
 			}
 		}
-		t.Fatalf("%s, but got:\n%s", message, FormatError(parsed))
+		t.Errorf("%s, but got:\n%s", message, FormatError(parsed))
 		return false
 	}
 	return true
 }
core/internal/testutil/simple_chat.go (1)

145-147: Remove unreachable error check.

This error check is unreachable because if either chatError or responsesError is non-nil, the test would have already terminated at lines 126-131 via t.Fatalf().

Apply this diff to remove the dead code:

 		t.Logf("🎉 Both Chat Completions and Responses APIs passed SimpleChat test!")
-
-		// Fail test if either API failed
-		if chatError != nil || responsesError != nil {
-			t.Fatalf("❌ SimpleChat test failed - one or both APIs failed")
-		}
-
-		t.Logf("🎉 Both Chat Completions and Responses APIs passed SimpleChat test!")
 	})
 }
♻️ Duplicate comments (5)
core/internal/testutil/cross_provider_test.go (1)

114-116: Same issue as TestCrossProviderScenarios.

This test has the same unconditional skip pattern with redundant return and unusual t.Parallel() usage.

core/providers/groq/groq.go (1)

1-2: Update package comment to reflect new package name.

The package-level comment still references "Package providers" but should be updated to "Package groq" to match the package declaration on line 3 and follow Go documentation conventions.

core/chatbot_test.go (1)

633-639: Critical: Missing Provider and Model fields in synthesis request.

This issue was already identified in a previous review. The synthesis request is missing the Provider and Model fields that are present in the regular request (lines 486-491). This will likely cause the synthesis to fail or use an incorrect model.

Apply this diff to add the missing fields:

 synthesisRequest := &schemas.BifrostChatRequest{
+    Provider: s.config.Provider,
+    Model:    s.config.Model,
     Input: conversationWithSynthesis,
     Params: &schemas.ChatParameters{
         Temperature:         s.config.Temperature,
         MaxCompletionTokens: s.config.MaxTokens,
     },
 }
core/providers/cerebras/cerebras.go (1)

1-3: Update package documentation to match the new package name.

The package comment still references "Package providers" but the package is now cerebras. This issue was flagged in previous reviews but appears to still be present.

Apply this diff to fix the documentation:

-// Package providers implements various LLM providers and their utility functions.
-// This file contains the Cerebras provider implementation.
+// Package cerebras implements the Cerebras LLM provider.
 package cerebras
core/internal/testutil/speech_synthesis.go (1)

113-113: Use the passed context parameter instead of creating a new background context.

Both RunSpeechSynthesisTest and RunSpeechSynthesisAdvancedTest accept a ctx context.Context parameter but create new context.Background() contexts at lines 113, 219, and 301 instead of using the passed context. This prevents callers from controlling test cancellation, timeouts, or passing context values through the test hierarchy.

Replace context.Background() with the passed ctx parameter at these three locations.

Also applies to: 219-219, 301-301

🧹 Nitpick comments (3)
core/chatbot_test.go (1)

167-170: Address FIXME comments for provider-specific configurations.

The commented-out MetaConfig sections for Bedrock, Azure, and Vertex indicate that the meta package doesn't exist yet. These configurations may be needed for full provider functionality.

Do you want me to help track these items by opening issues, or are these configurations planned for a future implementation?

Also applies to: 189-195, 209-213

core/providers/perplexity/perplexity_test.go (1)

18-51: Test harness integration looks solid; consider deferring client.Shutdown for robustness

testutil.SetupTest, ComprehensiveTestConfig, TestScenarios, and RunAllComprehensiveTests are wired correctly and reflect Perplexity’s supported features (chat only, no text, images, embeddings, etc.). This should behave the same as before, just via the shared testutil package.

One small improvement: if a future change introduces an early return after setup (additional checks, table-driven subtests, etc.), client.Shutdown() at the end might be skipped. Deferring it immediately after the error check makes cleanup more robust:

-	client, ctx, cancel, err := testutil.SetupTest()
-	if err != nil {
-		t.Fatalf("Error initializing test setup: %v", err)
-	}
-	defer cancel()
+	client, ctx, cancel, err := testutil.SetupTest()
+	if err != nil {
+		t.Fatalf("Error initializing test setup: %v", err)
+	}
+	defer cancel()
+	defer client.Shutdown()
@@
-	t.Run("PerplexityTests", func(t *testing.T) {
-		testutil.RunAllComprehensiveTests(t, client, ctx, testConfig)
-	})
-	client.Shutdown()
+	t.Run("PerplexityTests", func(t *testing.T) {
+		testutil.RunAllComprehensiveTests(t, client, ctx, testConfig)
+	})
core/providers/gemini/gemini_test.go (1)

1-63: Gemini test correctly migrated; consider optional cleanup of unused scenario models

The migration to gemini_test + core/internal/testutil is correct: SetupTest and RunAllComprehensiveTests are called with the right arguments, and enabled scenarios (chat, tools, image base64, embedding, speech, list models) all have matching model configuration.

You’re also setting TranscriptionModel and ReasoningModel while the corresponding scenarios are false, which is harmless but a bit misleading. If those flows aren’t meant to run yet, you could optionally drop or comment those fields to avoid confusion, or flip the booleans when you’re ready to enable the tests.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 382ff3e and 615ad7c.

⛔ Files ignored due to path filters (3)
  • core/go.sum is excluded by !**/*.sum
  • tests/core-chatbot/go.sum is excluded by !**/*.sum
  • tests/core-providers/go.sum is excluded by !**/*.sum
📒 Files selected for processing (73)
  • .github/workflows/scripts/release-core.sh (1 hunks)
  • Makefile (5 hunks)
  • core/bifrost.go (2 hunks)
  • core/chatbot_test.go (6 hunks)
  • core/go.mod (1 hunks)
  • core/internal/testutil/account.go (1 hunks)
  • core/internal/testutil/automatic_function_calling.go (2 hunks)
  • core/internal/testutil/chat_completion_stream.go (2 hunks)
  • core/internal/testutil/complete_end_to_end.go (1 hunks)
  • core/internal/testutil/cross_provider_scenarios.go (1 hunks)
  • core/internal/testutil/cross_provider_test.go (4 hunks)
  • core/internal/testutil/embedding.go (2 hunks)
  • core/internal/testutil/end_to_end_tool_calling.go (1 hunks)
  • core/internal/testutil/error_parser.go (1 hunks)
  • core/internal/testutil/image_base64.go (1 hunks)
  • core/internal/testutil/image_url.go (1 hunks)
  • core/internal/testutil/list_models.go (2 hunks)
  • core/internal/testutil/multi_turn_conversation.go (2 hunks)
  • core/internal/testutil/multiple_images.go (1 hunks)
  • core/internal/testutil/multiple_tool_calls.go (2 hunks)
  • core/internal/testutil/reasoning.go (1 hunks)
  • core/internal/testutil/response_validation.go (1 hunks)
  • core/internal/testutil/responses_stream.go (3 hunks)
  • core/internal/testutil/setup.go (1 hunks)
  • core/internal/testutil/simple_chat.go (1 hunks)
  • core/internal/testutil/speech_synthesis.go (2 hunks)
  • core/internal/testutil/speech_synthesis_stream.go (3 hunks)
  • core/internal/testutil/test_retry_conditions.go (1 hunks)
  • core/internal/testutil/test_retry_framework.go (2 hunks)
  • core/internal/testutil/tests.go (3 hunks)
  • core/internal/testutil/text_completion.go (1 hunks)
  • core/internal/testutil/text_completion_stream.go (2 hunks)
  • core/internal/testutil/tool_calls.go (2 hunks)
  • core/internal/testutil/tool_calls_streaming.go (2 hunks)
  • core/internal/testutil/transcription.go (4 hunks)
  • core/internal/testutil/transcription_stream.go (3 hunks)
  • core/internal/testutil/utils.go (2 hunks)
  • core/internal/testutil/validation_presets.go (2 hunks)
  • core/providers/anthropic/anthropic_test.go (3 hunks)
  • core/providers/azure/azure_test.go (3 hunks)
  • core/providers/bedrock/bedrock_test.go (4 hunks)
  • core/providers/cerebras/cerebras.go (1 hunks)
  • core/providers/cerebras/cerebras_test.go (4 hunks)
  • core/providers/cohere/cohere_test.go (3 hunks)
  • core/providers/elevenlabs/elevenlabs_test.go (3 hunks)
  • core/providers/gemini/gemini_test.go (4 hunks)
  • core/providers/groq/groq.go (1 hunks)
  • core/providers/groq/groq_test.go (4 hunks)
  • core/providers/mistral/mistral_test.go (3 hunks)
  • core/providers/ollama/ollama.go (1 hunks)
  • core/providers/ollama/ollama_test.go (3 hunks)
  • core/providers/openai/openai_test.go (4 hunks)
  • core/providers/openrouter/openrouter.go (1 hunks)
  • core/providers/openrouter/openrouter_test.go (3 hunks)
  • core/providers/parasail/parasail.go (1 hunks)
  • core/providers/parasail/parasail_test.go (3 hunks)
  • core/providers/perplexity/perplexity_test.go (3 hunks)
  • core/providers/sgl/sgl.go (1 hunks)
  • core/providers/sgl/sgl_test.go (3 hunks)
  • core/providers/vertex/vertex_test.go (3 hunks)
  • tests/core-chatbot/go.mod (0 hunks)
  • tests/core-providers/README.md (0 hunks)
  • tests/core-providers/go.mod (0 hunks)
  • tests/governance/README.md (0 hunks)
  • tests/governance/__init__.py (0 hunks)
  • tests/governance/conftest.py (0 hunks)
  • tests/governance/pytest.ini (0 hunks)
  • tests/governance/requirements.txt (0 hunks)
  • tests/governance/test_customers_crud.py (0 hunks)
  • tests/governance/test_helpers.py (0 hunks)
  • tests/governance/test_teams_crud.py (0 hunks)
  • tests/governance/test_usage_tracking.py (0 hunks)
  • tests/governance/test_virtual_keys_crud.py (0 hunks)
💤 Files with no reviewable changes (13)
  • tests/governance/test_customers_crud.py
  • tests/governance/pytest.ini
  • tests/governance/README.md
  • tests/core-chatbot/go.mod
  • tests/governance/conftest.py
  • tests/governance/test_virtual_keys_crud.py
  • tests/core-providers/README.md
  • tests/governance/test_teams_crud.py
  • tests/governance/init.py
  • tests/governance/test_usage_tracking.py
  • tests/governance/test_helpers.py
  • tests/governance/requirements.txt
  • tests/core-providers/go.mod
🚧 Files skipped from review as they are similar to previous changes (22)
  • core/providers/openrouter/openrouter.go
  • core/providers/sgl/sgl.go
  • core/internal/testutil/speech_synthesis_stream.go
  • core/internal/testutil/complete_end_to_end.go
  • core/internal/testutil/image_base64.go
  • core/internal/testutil/setup.go
  • core/internal/testutil/transcription_stream.go
  • core/providers/elevenlabs/elevenlabs_test.go
  • core/internal/testutil/utils.go
  • core/internal/testutil/tool_calls.go
  • core/providers/anthropic/anthropic_test.go
  • core/providers/cerebras/cerebras_test.go
  • core/internal/testutil/responses_stream.go
  • core/providers/cohere/cohere_test.go
  • core/internal/testutil/test_retry_conditions.go
  • core/internal/testutil/test_retry_framework.go
  • core/internal/testutil/text_completion_stream.go
  • core/internal/testutil/cross_provider_scenarios.go
  • .github/workflows/scripts/release-core.sh
  • core/internal/testutil/account.go
  • core/internal/testutil/embedding.go
  • core/internal/testutil/multiple_images.go
🧰 Additional context used
🧬 Code graph analysis (24)
core/internal/testutil/chat_completion_stream.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/validation_presets.go (2)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/response_validation.go (1)
  • ResponseExpectations (18-43)
core/internal/testutil/list_models.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/multiple_tool_calls.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/end_to_end_tool_calling.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/bifrost.go (8)
core/providers/ollama/ollama.go (1)
  • NewOllamaProvider (28-60)
core/schemas/bifrost.go (7)
  • Groq (43-43)
  • SGL (44-44)
  • Parasail (45-45)
  • Perplexity (46-46)
  • Cerebras (47-47)
  • Gemini (48-48)
  • OpenRouter (49-49)
core/providers/groq/groq.go (1)
  • NewGroqProvider (27-58)
core/providers/sgl/sgl.go (1)
  • NewSGLProvider (28-60)
core/providers/parasail/parasail.go (1)
  • NewParasailProvider (27-53)
core/providers/perplexity/perplexity.go (1)
  • NewPerplexityProvider (29-55)
core/providers/cerebras/cerebras.go (1)
  • NewCerebrasProvider (27-53)
core/providers/openrouter/openrouter.go (1)
  • NewOpenRouterProvider (29-55)
core/internal/testutil/tool_calls_streaming.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/automatic_function_calling.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/perplexity/perplexity_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Perplexity (46-46)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/chatbot_test.go (1)
core/schemas/chatcompletions.go (1)
  • ChatParameters (154-183)
core/internal/testutil/multi_turn_conversation.go (4)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/test_retry_framework.go (1)
  • WithChatTestRetry (274-424)
core/schemas/chatcompletions.go (1)
  • BifrostChatResponse (25-40)
core/internal/testutil/utils.go (2)
  • GetErrorMessage (597-630)
  • GetChatContent (320-347)
core/providers/parasail/parasail_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Parasail (45-45)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/transcription.go (2)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/schemas/transcriptions.go (1)
  • BifrostTranscriptionResponse (16-26)
core/internal/testutil/tests.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/mistral/mistral_test.go (5)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (2)
  • Mistral (41-41)
  • Fallback (128-131)
core/schemas/models.go (1)
  • Model (109-129)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/ollama/ollama_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Ollama (42-42)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/image_url.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/bedrock/bedrock_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/vertex/vertex_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Vertex (40-40)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/reasoning.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/openrouter/openrouter_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • OpenRouter (49-49)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/speech_synthesis.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/text_completion.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/simple_chat.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
🔇 Additional comments (41)
core/internal/testutil/reasoning.go (1)

1-1: Refactor to testutil package and local ComprehensiveTestConfig looks correct

Using package testutil for core/internal/testutil and switching RunReasoningTest to the unqualified ComprehensiveTestConfig (now defined in this package) cleanly removes the dependency on the old tests/core-providers/config package without changing behavior. Callers under core that import internal/testutil should remain compatible after adjusting their imports to this new location.

Also applies to: 14-14

core/internal/testutil/cross_provider_test.go (2)

14-110: Refactoring looks good.

The migration to local package types and functions is clean and consistent. All references (SetupTest, ProviderConfig, CrossProviderTestConfig, ConversationSettings, MessageModality, TestSettings, GetPredefinedScenarios, RunCrossProviderScenarioTest) have been correctly updated to use the local testutil package equivalents.


118-146: Refactoring looks good.

The type and function references have been consistently updated to use local testutil package equivalents, matching the pattern in the first test.

core/providers/groq/groq.go (1)

3-3: LGTM: Package rename aligns with refactoring goals.

The package declaration correctly reflects the new directory structure where each provider is now in its own package under core/providers/.

core/chatbot_test.go (3)

1-1: LGTM! Correct package declaration for external test.

The package declaration bifrost_test and the testing import are correct for converting this from a standalone application to a proper Go test file.

Also applies to: 13-13


830-937: LGTM! Function rename aligns with test conversion.

The rename from main() to runChatbot() correctly converts this from a standalone application entry point to a test helper function. The implementation remains intact and is appropriately called from the test wrapper.


939-947: LGTM! Well-structured test wrapper for interactive test.

The test wrapper correctly implements Go testing conventions and appropriately skips by default since this is an interactive integration test. The skip message clearly documents how to enable the test using RUN_CHATBOT_TEST=1, which aligns with the Makefile target mentioned in the PR objectives.

core/internal/testutil/error_parser.go (1)

1-1: LGTM! Package name aligns with directory structure.

The package rename from scenarios to testutil is consistent with the refactoring objective to consolidate test utilities under core/internal/testutil.

core/internal/testutil/simple_chat.go (1)

1-1: LGTM! Package rename and local type usage are correct.

The package name change to testutil and the use of the local ComprehensiveTestConfig type (defined in core/internal/testutil/account.go) successfully eliminate the external config package dependency, aligning with the PR's consolidation objectives.

Also applies to: 14-14

core/providers/perplexity/perplexity_test.go (1)

1-10: Package rename and testutil import are correct

Using perplexity_test as an external test package and switching to core/internal/testutil aligns this provider test with the new shared test harness; no issues here.

core/providers/ollama/ollama_test.go (3)

1-10: LGTM!

The package rename to ollama_test follows Go conventions for external test packages, and the import path migration from tests/core-providers/config to core/internal/testutil aligns with the PR's test consolidation objectives.


18-46: LGTM!

The test setup and configuration have been correctly migrated to use testutil.SetupTest() and testutil.ComprehensiveTestConfig. All type references are consistent with the new test utility package structure.


48-51: Code changes verified and approved.

The migration to the new testutil package is complete. Verification confirms:

  • testutil.RunAllComprehensiveTests() function exists and is properly exported in core/internal/testutil/tests.go
  • testutil.SetupTest() and testutil.ComprehensiveTestConfig are correctly used
  • No remaining references to the old tests/core-providers/config import path
  • All test files consistently use the new testutil package
core/internal/testutil/response_validation.go (1)

1-1: LGTM! Clean package rename.

The package rename from scenarios to testutil is consistent with the broader refactoring to consolidate test utilities.

core/internal/testutil/image_url.go (1)

1-15: LGTM! Consistent refactoring.

The package rename and type reference update are clean and consistent with the broader migration to testutil.

core/internal/testutil/end_to_end_tool_calling.go (1)

1-15: LGTM! Consistent refactoring.

The package rename and removal of the external config package dependency are consistent with the PR's refactoring objectives.

core/internal/testutil/tool_calls_streaming.go (1)

1-211: LGTM! Clean migration to testutil package.

The package rename and type reference updates are consistent with the broader refactoring to centralize test utilities.

core/internal/testutil/validation_presets.go (1)

1-208: LGTM! Consistent type reference migration.

The update to use the local ComprehensiveTestConfig type instead of the qualified config.ComprehensiveTestConfig aligns well with the refactoring to consolidate test utilities.

core/internal/testutil/multiple_tool_calls.go (1)

1-23: LGTM! Clean refactoring.

The package rename and type reference update are consistent with the broader migration to centralize test configuration in the testutil package.

core/internal/testutil/tests.go (1)

1-115: LGTM! Clean refactor to consolidate test utilities.

The package rename to testutil and migration of ComprehensiveTestConfig to a local type is well-executed. All test scenario function references are consistently updated from qualified (scenarios.RunX) to unqualified (RunX) form, and the logic remains unchanged.

core/internal/testutil/automatic_function_calling.go (1)

1-180: LGTM! Validation logic appropriately delegated to retry framework.

The refactor to use local ComprehensiveTestConfig is clean, and the comment updates at lines 162-165 correctly clarify that validation now occurs within WithDualAPITestRetry. The function appropriately focuses on providing supplementary logging for tool call details.

core/bifrost.go (2)

21-32: LGTM! Per-provider imports align with modular architecture.

The shift from a consolidated providers import to per-provider imports (cerebras, groq, ollama, openrouter, parasail, sgl) is a clean refactor that better reflects the modular provider structure.


1308-1324: LGTM! Provider constructors correctly updated.

All six affected provider constructors (Ollama, Groq, SGL, Parasail, Cerebras, OpenRouter) are consistently updated from the consolidated providers.NewXProvider form to per-package constructors (e.g., ollama.NewOllamaProvider). The constructor signatures and behavior remain unchanged.

core/internal/testutil/text_completion.go (1)

1-77: LGTM! Clean refactor to testutil package.

The package rename and migration to local ComprehensiveTestConfig type is straightforward and correct.

core/internal/testutil/speech_synthesis.go (1)

1-14: LGTM! Package refactor to testutil.

The package rename and migration to local ComprehensiveTestConfig type is correctly applied.

core/internal/testutil/multi_turn_conversation.go (1)

1-149: LGTM! Clean refactor with validation delegated to retry framework.

The package rename to testutil, migration to local ComprehensiveTestConfig, and simplified validation flow (lines 135-147) are well-executed. The comments correctly note that validation now occurs within WithChatTestRetry, making the test logic cleaner and more maintainable.

core/internal/testutil/list_models.go (1)

1-230: LGTM! Clean refactor to testutil package.

The package rename and migration to local ComprehensiveTestConfig type across both RunListModelsTest and RunListModelsPaginationTest is straightforward and correct.

core/providers/openrouter/openrouter_test.go (1)

1-54: LGTM! Test file correctly migrated to testutil.

The package rename to openrouter_test, import update to testutil, and consistent reference updates across SetupTest, ComprehensiveTestConfig, TestScenarios, and RunAllComprehensiveTests are correctly applied. The test configuration and execution logic remain unchanged.

core/providers/groq/groq_test.go (1)

1-62: LGTM! Clean refactoring to testutil.

The migration from the tests package to groq_test and the transition from config to testutil for test setup and types is consistent and correct.

core/providers/mistral/mistral_test.go (1)

1-55: LGTM! Consistent refactoring.

The migration to mistral_test package and testutil imports follows the same pattern as other provider tests.

core/providers/parasail/parasail_test.go (1)

1-52: LGTM! Refactoring applied consistently.

The migration to parasail_test package and testutil types is correctly implemented.

Makefile (2)

528-544: New chatbot test target looks reasonable.

The new test-chatbot target provides a clear interactive test workflow with environment variable guards and helpful usage instructions.


318-395: Path adjustments verified as correct for new test structure.

The verification confirms that all path adjustments in the Makefile are correct:

  • Provider test files exist at the expected locations: core/providers/<provider>/<provider>_test.go
  • From any provider test directory, ../../../ correctly navigates to the repository root
  • The increased navigation depth from cd ../.. to cd ../../.. and relative paths from ../../ to ../../../ accurately reflect the new directory structure
core/internal/testutil/transcription.go (1)

1-550: LGTM! Type references updated correctly.

The function signatures correctly reference the local ComprehensiveTestConfig type instead of the external config.ComprehensiveTestConfig. This aligns with the consolidation of test utilities into the testutil package.

core/go.mod (1)

14-14: LGTM! testify correctly promoted to direct dependency.

Since core/internal/testutil uses github.com/stretchr/testify/require directly, promoting testify to a direct dependency is correct.

core/providers/sgl/sgl_test.go (1)

1-53: LGTM! Refactoring correctly applied.

The migration to sgl_test package and testutil imports is consistent with other provider tests.

core/internal/testutil/chat_completion_stream.go (1)

1-336: LGTM! Type references correctly updated.

The function signature correctly uses the local ComprehensiveTestConfig type, consistent with the testutil consolidation.

core/providers/bedrock/bedrock_test.go (1)

1-58: Bedrock provider test correctly migrated to testutil with consistent scenarios

The switch to bedrock_test plus core/internal/testutil looks sound: SetupTest is used with the right signature, ComprehensiveTestConfig and TestScenarios are wired consistently (all true scenarios have corresponding model strings), and RunAllComprehensiveTests is invoked with the expected arguments. Env gating and resource cleanup (defer cancel() + client.Shutdown()) also look correct.

core/providers/openai/openai_test.go (1)

1-68: OpenAI provider test wiring to testutil is coherent and complete

SetupTest, ComprehensiveTestConfig, TestScenarios, and RunAllComprehensiveTests are all used as intended, and every enabled scenario has matching model/fallback configuration (text, chat, vision, embedding, transcription, speech, reasoning, list models). Env gating on OPENAI_API_KEY and the defer cancel() / client.Shutdown() lifecycle look correct.

core/providers/azure/azure_test.go (1)

1-66: Azure provider test uses testutil correctly and handles embedding gating cleanly

The move to azure_test with core/internal/testutil is wired correctly: SetupTest call, ComprehensiveTestConfig/TestScenarios initialization, and RunAllComprehensiveTests usage are all consistent. Embedding is safely toggled off by clearing EmbeddingModel and Scenarios.Embedding when AZURE_EMB_API_KEY is absent, and all other enabled scenarios (chat/stream/tools/images/reasoning/list models) have appropriate model configuration.

core/providers/vertex/vertex_test.go (1)

1-53: Vertex provider test wiring and auth gating logic look correct

The Vertex test’s migration to core/internal/testutil is consistent with the other providers: SetupTest, ComprehensiveTestConfig, TestScenarios, and RunAllComprehensiveTests are all used correctly. The skip condition properly requires either VERTEX_API_KEY or both VERTEX_PROJECT_ID and VERTEX_CREDENTIALS, and all enabled scenarios (chat/stream/tools/images/embedding) have matching model configuration while text completion is cleanly disabled.

Comment thread core/providers/ollama/ollama.go
Comment thread core/providers/parasail/parasail.go
@akshaydeo akshaydeo force-pushed the 11-22-moves_all_tests_related_to_core_to_corresponding_files branch from 615ad7c to 91d3339 Compare November 24, 2025 10:57
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
core/internal/testutil/error_parser.go (1)

402-419: Critical: AssertNoError incorrectly uses t.Fatalf instead of t.Errorf.

Line 415 calls t.Fatalf(), which immediately terminates test execution. This makes AssertNoError behave identically to RequireNoError, violating the standard testing convention where Assert functions should be non-fatal and allow the test to continue.

Additionally, line 416's return false is unreachable because t.Fatalf stops execution.

Apply this diff to fix the assertion behavior:

 func AssertNoError(t *testing.T, err *schemas.BifrostError, msgAndArgs ...interface{}) bool {
 	if err != nil {
 		parsed := ParseBifrostError(err)
 		message := "Expected no error"
 		if len(msgAndArgs) > 0 {
 			if msg, ok := msgAndArgs[0].(string); ok {
 				if len(msgAndArgs) > 1 {
 					message = fmt.Sprintf(msg, msgAndArgs[1:]...)
 				} else {
 					message = msg
 				}
 			}
 		}
-		t.Fatalf("%s, but got:\n%s", message, FormatError(parsed))
+		t.Errorf("%s, but got:\n%s", message, FormatError(parsed))
 		return false
 	}
 	return true
 }
core/internal/testutil/transcription_stream.go (1)

18-323: Minor issues in streaming transcription round‑trip test (RunTranscriptionStreamTest)

Two nits worth addressing while you’re here:

  1. Fallbacks for TTS step (line 80)
    ttsRequest is a BifrostSpeechRequest but uses Fallbacks: testConfig.TranscriptionFallbacks. Given ComprehensiveTestConfig has dedicated SpeechSynthesisFallbacks, it would be clearer and more semantically correct to use those for the TTS generation step.

  2. Ineffective nil‑check for lastResponse (lines 176, 255)
    lastResponse is initialized as &schemas.BifrostStream{}, so if lastResponse == nil can never fire, even if the stream produces no chunks. Initializing it as var lastResponse *schemas.BifrostStream (nil) and only setting it inside the receive loop would make that check meaningful.

These don’t affect core behavior but will make the test harness sharper and less surprising.

core/internal/testutil/cross_provider_test.go (2)

9-111: Remove or conditionally enable unreachable test code.

The return statement on line 12 makes lines 14-110 unreachable. Either remove the dead code, make the skip conditional (e.g., based on an environment variable), or remove the early return to enable the test.

Apply this diff to make the skip conditional:

 func TestCrossProviderScenarios(t *testing.T) {
 	t.Parallel()
-	t.Skip("Skipping cross provider scenarios test")
-	return
+	if os.Getenv("RUN_CROSS_PROVIDER_TESTS") == "" {
+		t.Skip("Skipping cross provider scenarios test. Set RUN_CROSS_PROVIDER_TESTS=1 to enable.")
+	}
 
 	client, ctx, cancel, err := SetupTest()

113-147: Remove or conditionally enable unreachable test code.

The return statement on line 116 makes lines 118-146 unreachable. Apply the same fix as in TestCrossProviderScenarios.

Apply this diff to make the skip conditional:

 func TestCrossProviderConsistency(t *testing.T) {
 	t.Parallel()
-	t.Skip("Skipping cross provider consistency test")
-	return
+	if os.Getenv("RUN_CROSS_PROVIDER_TESTS") == "" {
+		t.Skip("Skipping cross provider consistency test. Set RUN_CROSS_PROVIDER_TESTS=1 to enable.")
+	}
 
 	client, ctx, cancel, err := SetupTest()
♻️ Duplicate comments (3)
core/providers/openrouter/openrouter.go (1)

1-3: Fix package doc comment to match openrouter package

The top comment still says “Package providers” while the package is openrouter, which makes the Go doc misleading.

-// Package providers implements various LLM providers and their utility functions.
-// This file contains the OpenRouter provider implementation.
+// Package openrouter implements the OpenRouter LLM provider.
+// This file contains the OpenRouter provider implementation.
 package openrouter
core/chatbot_test.go (1)

633-639: Critical: synthesis request still missing Provider and Model

synthesizeToolResults builds a BifrostChatRequest without Provider or Model, unlike the main request in SendMessage. This will typically cause ChatCompletionRequest to fail validation or route incorrectly, so agentic mode synthesis won’t work as intended.

Add the missing fields so synthesis uses the same backend as the main conversation:

-	synthesisRequest := &schemas.BifrostChatRequest{
-		Input: conversationWithSynthesis,
-		Params: &schemas.ChatParameters{
-			Temperature:         s.config.Temperature,
-			MaxCompletionTokens: s.config.MaxTokens,
-		},
-	}
+	synthesisRequest := &schemas.BifrostChatRequest{
+		Provider: s.config.Provider,
+		Model:    s.config.Model,
+		Input:    conversationWithSynthesis,
+		Params: &schemas.ChatParameters{
+			Temperature:         s.config.Temperature,
+			MaxCompletionTokens: s.config.MaxTokens,
+		},
+	}
core/internal/testutil/speech_synthesis.go (1)

16-324: Use the passed ctx instead of creating context.Background()

Both RunSpeechSynthesisTest and RunSpeechSynthesisAdvancedTest accept ctx context.Context but ignore it and use context.Background() for requestCtx (lines 113, 219, 301). That blocks callers from controlling cancellation/timeouts or passing context values into these tests.

Suggest replacing each requestCtx := context.Background() with requestCtx := ctx (or just inlining ctx where used) so the existing signatures actually take effect.

🧹 Nitpick comments (9)
core/internal/testutil/automatic_function_calling.go (1)

161-180: Consider simplifying the explanatory comment.

The validation helper now correctly delegates primary validation to WithDualAPITestRetry and focuses on supplementary logging. The multi-line comment (lines 162-165) explains this well but could be more concise.

Consider this more concise alternative:

 func validateAutomaticToolCall(t *testing.T, toolCalls []ToolCallInfo, apiName string) {
-	// Validation for tool call already happened inside WithDualAPITestRetry
-	// If we reach here, the tool call was successful
-	// This function just provides additional logging for tool call details
-	
+	// Primary validation happens in WithDualAPITestRetry; this provides supplementary logging
+	
 	for _, toolCall := range toolCalls {
core/providers/perplexity/perplexity_test.go (1)

18-23: Optionally co-locate client shutdown with other cleanup via defer

Not a blocker, but you can make the lifecycle a bit clearer and more robust to future early returns by deferring client.Shutdown() next to defer cancel() and dropping the explicit call at the end:

-	client, ctx, cancel, err := testutil.SetupTest()
-	if err != nil {
-		t.Fatalf("Error initializing test setup: %v", err)
-	}
-	defer cancel()
+	client, ctx, cancel, err := testutil.SetupTest()
+	if err != nil {
+		t.Fatalf("Error initializing test setup: %v", err)
+	}
+	defer cancel()
+	defer client.Shutdown()
@@
 	t.Run("PerplexityTests", func(t *testing.T) {
-		testutil.RunAllComprehensiveTests(t, client, ctx, testConfig)
-	})
-	client.Shutdown()
+		testutil.RunAllComprehensiveTests(t, client, ctx, testConfig)
+	})

This preserves the current ordering (shutdown before cancel) while keeping all cleanup in one place.

Also applies to: 47-51

core/chatbot_test.go (2)

539-597: Tighten tool error message formatting (optional)

Here you format the tool error with %v on *schemas.BifrostError, which will dump the whole struct into ContentStr. If you want a cleaner user-facing message, consider extracting just the error text (e.g., using the error message field) before persisting it.


830-947: Consider avoiding os.Exit in the test helper path

runChatbot is now called from TestChatbot, but it still uses os.Exit for error paths and signal handling. When RUN_CHATBOT_TEST is set and this test runs under go test, os.Exit will terminate the entire test binary immediately, bypassing normal test reporting for other packages.

If you ever want to run this alongside other tests, consider refactoring runChatbot to return an error and let TestChatbot call t.Fatal / t.Skip instead of exiting the process.

core/internal/testutil/test_retry_framework.go (1)

1115-1148: Signature migration to local ComprehensiveTestConfig looks consistent

Updating GetTestRetryConfigForScenario to take the local ComprehensiveTestConfig keeps it aligned with testutil/account.go and call sites; behavior is unchanged.

Note that testConfig is still unused and scenarios like "CompleteEnd2End_ToolResult" currently fall back to DefaultTestRetryConfig. If you ever need per-scenario tuning based on config, you can add explicit cases and start using testConfig here.

core/internal/testutil/complete_end_to_end.go (1)

1-418: Complete end‑to‑end test correctly migrated to testutil.ComprehensiveTestConfig

The package change and updated RunCompleteEnd2EndTest signature are consistent with the rest of the testutil refactor; the function still uses testConfig.Provider, ChatModel, VisionModel, and Fallbacks as before.

If you want a dedicated retry profile for "CompleteEnd2End_ToolResult", you can add a specific case in GetTestRetryConfigForScenario; right now it falls back to the default config, which is also fine.

Makefile (1)

528-545: Minor consistency tweak for test-chatbot target

The interactive test-chatbot target is well-gated behind RUN_CHATBOT_TEST and reuses the .env loading pattern, which is good. To keep behavior aligned with other test targets, consider also setting GOWORK=off (or documenting why it intentionally differs) when running go test under core so workspace vs module mode is predictable across all test commands.

core/internal/testutil/tests.go (1)

1-61: Public RunAllComprehensiveTests API and scenario wiring look good

Exposing RunAllComprehensiveTests off testutil with ComprehensiveTestConfig makes the provider tests much cleaner, and the testScenarios slice correctly includes all the helper runners (chat, streaming, responses, speech, transcription, embedding, reasoning, list-models). As a minor improvement, you might later extend printTestSummary to also surface the “advanced”/pagination variants for more granular reporting, but the current summary is already useful.

core/internal/testutil/response_validation.go (1)

858-906: Tighten ValidateSpeechResponse audio checks for clarity

In validateSpeechSynthesisResponse, the initial if response.Audio == nil { ... return } and the subsequent if shouldHaveAudio && response.Audio == nil { ... return } branch are effectively redundant, since the first branch will already return on nil audio. Consider collapsing this into a single check that keys off should_have_audio (or dropping the second block) to make the intended semantics—whether audio is always required vs conditionally required—clearer and avoid dead code paths.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 615ad7c and 91d3339.

⛔ Files ignored due to path filters (2)
  • tests/core-chatbot/go.sum is excluded by !**/*.sum
  • tests/core-providers/go.sum is excluded by !**/*.sum
📒 Files selected for processing (73)
  • .github/workflows/scripts/release-core.sh (1 hunks)
  • Makefile (5 hunks)
  • core/bifrost.go (2 hunks)
  • core/chatbot_test.go (6 hunks)
  • core/go.mod (1 hunks)
  • core/internal/testutil/account.go (1 hunks)
  • core/internal/testutil/automatic_function_calling.go (2 hunks)
  • core/internal/testutil/chat_completion_stream.go (2 hunks)
  • core/internal/testutil/complete_end_to_end.go (1 hunks)
  • core/internal/testutil/cross_provider_scenarios.go (1 hunks)
  • core/internal/testutil/cross_provider_test.go (4 hunks)
  • core/internal/testutil/embedding.go (2 hunks)
  • core/internal/testutil/end_to_end_tool_calling.go (1 hunks)
  • core/internal/testutil/error_parser.go (1 hunks)
  • core/internal/testutil/image_base64.go (1 hunks)
  • core/internal/testutil/image_url.go (1 hunks)
  • core/internal/testutil/list_models.go (2 hunks)
  • core/internal/testutil/multi_turn_conversation.go (2 hunks)
  • core/internal/testutil/multiple_images.go (1 hunks)
  • core/internal/testutil/multiple_tool_calls.go (2 hunks)
  • core/internal/testutil/reasoning.go (1 hunks)
  • core/internal/testutil/response_validation.go (1 hunks)
  • core/internal/testutil/responses_stream.go (3 hunks)
  • core/internal/testutil/setup.go (1 hunks)
  • core/internal/testutil/simple_chat.go (1 hunks)
  • core/internal/testutil/speech_synthesis.go (2 hunks)
  • core/internal/testutil/speech_synthesis_stream.go (3 hunks)
  • core/internal/testutil/test_retry_conditions.go (1 hunks)
  • core/internal/testutil/test_retry_framework.go (2 hunks)
  • core/internal/testutil/tests.go (3 hunks)
  • core/internal/testutil/text_completion.go (1 hunks)
  • core/internal/testutil/text_completion_stream.go (2 hunks)
  • core/internal/testutil/tool_calls.go (2 hunks)
  • core/internal/testutil/tool_calls_streaming.go (2 hunks)
  • core/internal/testutil/transcription.go (4 hunks)
  • core/internal/testutil/transcription_stream.go (3 hunks)
  • core/internal/testutil/utils.go (2 hunks)
  • core/internal/testutil/validation_presets.go (2 hunks)
  • core/providers/anthropic/anthropic_test.go (3 hunks)
  • core/providers/azure/azure_test.go (3 hunks)
  • core/providers/bedrock/bedrock_test.go (4 hunks)
  • core/providers/cerebras/cerebras.go (1 hunks)
  • core/providers/cerebras/cerebras_test.go (4 hunks)
  • core/providers/cohere/cohere_test.go (3 hunks)
  • core/providers/elevenlabs/elevenlabs_test.go (3 hunks)
  • core/providers/gemini/gemini_test.go (4 hunks)
  • core/providers/groq/groq.go (1 hunks)
  • core/providers/groq/groq_test.go (4 hunks)
  • core/providers/mistral/mistral_test.go (3 hunks)
  • core/providers/ollama/ollama.go (1 hunks)
  • core/providers/ollama/ollama_test.go (3 hunks)
  • core/providers/openai/openai_test.go (4 hunks)
  • core/providers/openrouter/openrouter.go (1 hunks)
  • core/providers/openrouter/openrouter_test.go (3 hunks)
  • core/providers/parasail/parasail.go (1 hunks)
  • core/providers/parasail/parasail_test.go (3 hunks)
  • core/providers/perplexity/perplexity_test.go (3 hunks)
  • core/providers/sgl/sgl.go (1 hunks)
  • core/providers/sgl/sgl_test.go (3 hunks)
  • core/providers/vertex/vertex_test.go (3 hunks)
  • tests/core-chatbot/go.mod (0 hunks)
  • tests/core-providers/README.md (0 hunks)
  • tests/core-providers/go.mod (0 hunks)
  • tests/governance/README.md (0 hunks)
  • tests/governance/__init__.py (0 hunks)
  • tests/governance/conftest.py (0 hunks)
  • tests/governance/pytest.ini (0 hunks)
  • tests/governance/requirements.txt (0 hunks)
  • tests/governance/test_customers_crud.py (0 hunks)
  • tests/governance/test_helpers.py (0 hunks)
  • tests/governance/test_teams_crud.py (0 hunks)
  • tests/governance/test_usage_tracking.py (0 hunks)
  • tests/governance/test_virtual_keys_crud.py (0 hunks)
💤 Files with no reviewable changes (13)
  • tests/governance/test_helpers.py
  • tests/governance/test_customers_crud.py
  • tests/governance/README.md
  • tests/core-chatbot/go.mod
  • tests/governance/pytest.ini
  • tests/governance/test_usage_tracking.py
  • tests/core-providers/go.mod
  • tests/governance/requirements.txt
  • tests/governance/init.py
  • tests/governance/test_virtual_keys_crud.py
  • tests/governance/conftest.py
  • tests/core-providers/README.md
  • tests/governance/test_teams_crud.py
✅ Files skipped from review due to trivial changes (1)
  • core/providers/openrouter/openrouter_test.go
🚧 Files skipped from review as they are similar to previous changes (24)
  • core/providers/groq/groq.go
  • core/providers/parasail/parasail.go
  • core/internal/testutil/test_retry_conditions.go
  • core/providers/anthropic/anthropic_test.go
  • core/go.mod
  • core/internal/testutil/reasoning.go
  • core/providers/cohere/cohere_test.go
  • core/providers/bedrock/bedrock_test.go
  • core/providers/ollama/ollama.go
  • core/internal/testutil/tool_calls_streaming.go
  • core/internal/testutil/speech_synthesis_stream.go
  • core/internal/testutil/cross_provider_scenarios.go
  • core/internal/testutil/setup.go
  • core/providers/sgl/sgl.go
  • core/internal/testutil/tool_calls.go
  • core/internal/testutil/image_base64.go
  • .github/workflows/scripts/release-core.sh
  • core/internal/testutil/transcription.go
  • core/internal/testutil/text_completion.go
  • core/providers/sgl/sgl_test.go
  • core/providers/groq/groq_test.go
  • core/providers/cerebras/cerebras.go
  • core/internal/testutil/validation_presets.go
  • core/providers/openai/openai_test.go
🧰 Additional context used
🧬 Code graph analysis (23)
core/internal/testutil/end_to_end_tool_calling.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/list_models.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/test_retry_framework.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/embedding.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/multiple_images.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/bifrost.go (7)
core/providers/ollama/ollama.go (1)
  • NewOllamaProvider (28-60)
core/schemas/bifrost.go (7)
  • Groq (43-43)
  • SGL (44-44)
  • Parasail (45-45)
  • Perplexity (46-46)
  • Cerebras (47-47)
  • Gemini (48-48)
  • OpenRouter (49-49)
core/providers/groq/groq.go (1)
  • NewGroqProvider (27-58)
core/providers/parasail/parasail.go (1)
  • NewParasailProvider (27-53)
core/providers/perplexity/perplexity.go (1)
  • NewPerplexityProvider (29-55)
core/providers/cerebras/cerebras.go (1)
  • NewCerebrasProvider (27-53)
core/providers/openrouter/openrouter.go (1)
  • NewOpenRouterProvider (29-55)
core/internal/testutil/speech_synthesis.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/chat_completion_stream.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/multiple_tool_calls.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/vertex/vertex_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/complete_end_to_end.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/automatic_function_calling.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/transcription_stream.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/mistral/mistral_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/tests.go (2)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/text_completion.go (1)
  • RunTextCompletionTest (14-77)
core/internal/testutil/image_url.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/text_completion_stream.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/azure/azure_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/cross_provider_test.go (2)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/cross_provider_scenarios.go (13)
  • ProviderConfig (45-53)
  • CrossProviderTestConfig (38-42)
  • ConversationSettings (56-60)
  • MessageModality (19-19)
  • ModalityText (22-22)
  • ModalityTool (23-23)
  • ModalityVision (24-24)
  • TestSettings (63-67)
  • ValidationModerate (33-33)
  • GetPredefinedScenarios (110-245)
  • RunCrossProviderScenarioTest (649-774)
  • ValidationLenient (34-34)
  • RunCrossProviderConsistencyTest (781-860)
core/providers/perplexity/perplexity_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Perplexity (46-46)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/simple_chat.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/gemini/gemini_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/multi_turn_conversation.go (5)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/test_retry_framework.go (1)
  • WithChatTestRetry (274-424)
core/schemas/chatcompletions.go (1)
  • BifrostChatResponse (25-40)
core/schemas/bifrost.go (1)
  • ChatCompletionRequest (89-89)
core/internal/testutil/utils.go (2)
  • GetErrorMessage (597-630)
  • GetChatContent (320-347)
🔇 Additional comments (34)
core/internal/testutil/multiple_tool_calls.go (1)

1-24: Refactor to local testutil config type looks consistent

Using package testutil and switching RunMultipleToolCallsTest to take the unqualified ComprehensiveTestConfig from this package is consistent with the new internal testutil config consolidation. All referenced fields (Scenarios.MultipleToolCalls, Provider, ChatModel, Fallbacks) exist on ComprehensiveTestConfig, so this should be a no-op behaviorally and helps decouple from the old external config package.

core/internal/testutil/account.go (1)

1-4: LGTM! Clean package rename.

The package has been appropriately renamed from config to testutil, and the documentation comment has been updated accordingly. This aligns well with the PR's objective of consolidating test utilities into core/internal/testutil.

core/internal/testutil/multiple_images.go (2)

1-1: LGTM! Package rename aligns with refactoring.

The package declaration correctly reflects the move from scenarios to testutil, consistent with the PR's objective to consolidate test utilities under core/internal/testutil.


15-15: LGTM! Type reference correctly updated.

The function signature correctly uses the unqualified ComprehensiveTestConfig type, which is now defined locally in core/internal/testutil/account.go. This change is consistent with the package refactoring.

core/internal/testutil/utils.go (3)

1-1: LGTM! Package rename aligns with test reorganization.

The package rename from scenarios to testutil is consistent with the PR's objective to consolidate test utilities into core/internal/testutil.


209-222: LGTM! Function rename improves naming consistency.

The rename from CreateSpeechInput to CreateSpeechRequest better reflects the return type and aligns with naming conventions.


194-207: File verification successful—no issues found.

The lion_base64.txt file exists at the expected location. The runtime-based path discovery approach is sound and will correctly locate the file. Implementation looks good.

core/internal/testutil/error_parser.go (1)

1-1: LGTM! Package rename aligns with test reorganization.

The package rename from scenarios to testutil correctly reflects the new location and purpose of this test utility code.

core/internal/testutil/automatic_function_calling.go (2)

1-14: LGTM! Refactoring aligns with consolidation goals.

The package rename to testutil and the update to use the local ComprehensiveTestConfig type are consistent with the PR objective to consolidate test utilities into core/internal/testutil. This removes the external dependency on the config package and improves modularity.


15-159: Well-structured test implementation.

The test logic is clean and well-organized:

  • Clear setup of dual API testing scenario
  • Proper use of retry configuration for tool call validation
  • Comprehensive error reporting when either API fails
  • Good separation of concerns between setup, execution, and validation
core/providers/perplexity/perplexity_test.go (2)

1-10: Package name and shared testutil import look good

Using the external perplexity_test package and importing core/internal/testutil aligns this test with the new centralized test utilities and keeps it black‑box against the provider implementation.


18-45: Comprehensive test config and scenarios are wired consistently

testutil.SetupTest usage, ComprehensiveTestConfig construction, and the TestScenarios flags look consistent with Perplexity’s supported features (chat/streaming enabled, text completion/embeddings/images/tool calling disabled) and with the shared testutil types.

core/internal/testutil/image_url.go (1)

1-132: Image URL test now correctly uses testutil.ComprehensiveTestConfig

The move to package testutil and switching RunImageURLTest to take the local ComprehensiveTestConfig is consistent with the rest of the testutil refactor; usage of Provider, VisionModel, and Fallbacks remains intact.

core/internal/testutil/end_to_end_tool_calling.go (1)

1-263: End‑to‑end tool calling test aligned with testutil.ComprehensiveTestConfig

The function’s signature and package move to testutil look correct, and all references to testConfig (provider, chat model, fallbacks) still line up with the ComprehensiveTestConfig definition.

core/internal/testutil/simple_chat.go (1)

1-151: Simple chat test now uses local ComprehensiveTestConfig consistently

The refactor to package testutil and the updated RunSimpleChatTest signature integrate cleanly with the rest of the testutil API; scenario gating, models, and fallbacks still behave as before.

core/bifrost.go (1)

21-32: Per‑provider imports and constructors wired correctly in createBaseProvider

The new imports for cerebras, groq, ollama, openrouter, parasail, and sgl and the corresponding switch cases now call the right per‑package constructors:

  • schemas.Ollamaollama.NewOllamaProvider
  • schemas.Groqgroq.NewGroqProvider
  • schemas.SGLsgl.NewSGLProvider
  • schemas.Parasailparasail.NewParasailProvider
  • schemas.Cerebrascerebras.NewCerebrasProvider
  • schemas.OpenRouteropenrouter.NewOpenRouterProvider(...), nil

Signatures line up with each constructor’s return type, so behavior is preserved while aligning with the new per‑provider package layout.

Also applies to: 1293-1324

core/internal/testutil/chat_completion_stream.go (1)

16-335: Signature migration to local ComprehensiveTestConfig looks correct

The updated RunChatCompletionStreamTest signature and usage of testConfig/ctx are consistent with the rest of testutil and keep behavior intact. No issues from this refactor.

core/internal/testutil/transcription_stream.go (1)

325-600: Advanced transcription streaming tests look consistent with new config/ctx wiring

RunTranscriptionStreamAdvancedTest correctly adopts the new ComprehensiveTestConfig type and threads ctx through TTS generation and TranscriptionStreamRequest calls. The retry/validation patterns match the rest of testutil. No additional issues spotted.

core/internal/testutil/multi_turn_conversation.go (1)

13-148: Multi‑turn conversation test refactor looks solid

The updated RunMultiTurnConversationTest signature and the use of WithChatTestRetry + ConversationExpectations for both turns (including memory recall in step 2) are consistent with the new testutil patterns and keep behavior clear and centralized. No issues found.

core/internal/testutil/list_models.go (1)

14-230: List models tests correctly migrated to local config and ctx‑aware API

Both RunListModelsTest and RunListModelsPaginationTest now use ComprehensiveTestConfig and thread ctx into ListModelsRequest while keeping retry/expectations logic intact. Pagination checks and latency validation remain appropriate. No further changes needed.

core/providers/cerebras/cerebras_test.go (1)

7-55: Cerebras test migration to testutil looks consistent

The switch to testutil.SetupTest, testutil.ComprehensiveTestConfig, testutil.TestScenarios, and testutil.RunAllComprehensiveTests is coherent, and the scenario flags/model choices (e.g., no embeddings, no images, list-models enabled) are internally consistent with the inline comments. No issues from this refactor side.

Makefile (1)

318-395: test-core provider routing and reporting wiring looks sound

The provider check (core/providers/$(PROVIDER)/$(PROVIDER)_test.go), provider discovery with find, .env loading, and the gotestsum invocations (including junit paths and regexes based on PROVIDER_TEST_NAME) are all consistent and should work well with the new per-provider test layout. The cd/junit paths (../../../$$REPORT_FILE and ../$$REPORT_FILE) also line up correctly with the directory structure.

core/providers/elevenlabs/elevenlabs_test.go (1)

7-54: Elevenlabs test configuration matches the new shared test harness

The move to testutil (SetupTest, ComprehensiveTestConfig, TestScenarios, RunAllComprehensiveTests) is consistent, and the scenario matrix (speech + transcription enabled, everything else off) correctly reflects the provided models in testConfig. No behavioral regressions apparent from this refactor.

core/internal/testutil/tests.go (1)

64-115: Summary logging correctly reflects enabled scenarios

printTestSummary’s use of testConfig.Scenarios combined with model presence checks (e.g., Embedding + EmbeddingModel, Reasoning + ReasoningModel) is a nice guard against misconfigured providers and produces a clear per-provider capability summary without impacting test behavior.

core/internal/testutil/embedding.go (1)

1-40: LGTM! Clean refactoring to testutil package.

The package migration and type reference updates are correct. The function signature properly uses the local ComprehensiveTestConfig type instead of the external config.ComprehensiveTestConfig.

core/internal/testutil/text_completion_stream.go (1)

1-17: LGTM! Consistent package migration.

The changes align with the testutil consolidation pattern. Package declaration and function signature are correctly updated.

core/providers/ollama/ollama_test.go (1)

1-50: LGTM! Provider test successfully migrated to testutil.

All references to the old config package have been properly replaced with testutil. The test setup, configuration types, and test runner are all correctly updated.

core/providers/parasail/parasail_test.go (1)

1-50: LGTM! Consistent migration pattern.

The Parasail provider test follows the same clean migration pattern as other provider tests. All testutil references are correct.

core/providers/gemini/gemini_test.go (1)

1-61: LGTM! Gemini test properly migrated.

All testutil references are correct, including SetupTest(), ComprehensiveTestConfig, TestScenarios, and RunAllComprehensiveTests().

core/providers/mistral/mistral_test.go (1)

1-53: LGTM! Mistral test successfully updated.

The migration to testutil is complete and correct. All function calls and type references properly use the new package.

core/providers/azure/azure_test.go (1)

1-65: LGTM! Azure test successfully migrated.

All testutil references are correctly updated. The conditional logic for embedding tests is preserved as expected.

core/internal/testutil/responses_stream.go (2)

1-17: LGTM! Responses stream test utilities successfully migrated.

The package declaration and function signature are correctly updated to use the local ComprehensiveTestConfig type.


821-821: LGTM! Helper function signature correctly updated.

The validateResponsesStreamingResponse function signature properly uses the unqualified ComprehensiveTestConfig type.

core/providers/vertex/vertex_test.go (1)

1-53: LGTM! Clean refactoring to testutil package.

The migration from config to testutil is complete and consistent. All type references (ComprehensiveTestConfig, TestScenarios) and function calls (SetupTest, RunAllComprehensiveTests) are correctly updated to use the new testutil package, and the package declaration follows Go conventions for external testing.

@akshaydeo akshaydeo force-pushed the 11-22-moves_all_tests_related_to_core_to_corresponding_files branch from 91d3339 to 132a1f5 Compare November 24, 2025 16:09
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
core/providers/cohere/cohere_test.go (1)

12-52: Enable reasoning tests with an explicit Cohere ReasoningModel (or disable the scenario)

The migration to testutil is structurally correct, but there’s a likely config bug:

  • Scenarios.Reasoning is set to true (Line 45), while testutil.ComprehensiveTestConfig includes a ReasoningModel field that is not set here and will therefore be the empty string.
  • In other providers’ tests (e.g., Bedrock, OpenAI, Gemini), ReasoningModel is explicitly populated whenever Scenarios.Reasoning is true, which strongly suggests the reasoning test helpers expect a non‑empty model name.

To avoid reasoning tests running against an empty model identifier (or otherwise misbehaving), I’d recommend either:

  • Set ReasoningModel to the intended Cohere reasoning model, e.g.:
 testConfig := testutil.ComprehensiveTestConfig{
   Provider:       schemas.Cohere,
   ChatModel:      "command-a-03-2025",
   VisionModel:    "command-a-vision-07-2025", // Cohere's latest vision model
   TextModel:      "",                         // Cohere focuses on chat
   EmbeddingModel: "embed-v4.0",
+  ReasoningModel: "<cohere-reasoning-model>",
   Scenarios: testutil.TestScenarios{
  • Or, if reasoning isn’t actually wired up yet for Cohere, flip Scenarios.Reasoning to false for now to reflect that.

Separately (pure nit), the image comments mention c4ai-aya-vision-8b while the configured vision model is command-a-vision-07-2025; if that older note no longer applies, updating or removing it would reduce confusion.

♻️ Duplicate comments (6)
core/providers/ollama/ollama.go (1)

1-3: Align package comment with ollama package name

The top-of-file comment still documents Package providers while this file is package ollama, so GoDoc will be misleading. Updating the comment to match the package keeps docs consistent:

-// Package providers implements various LLM providers and their utility functions.
-// This file contains the Ollama provider implementation.
+// Package ollama implements the Ollama LLM provider.
 package ollama
core/internal/testutil/speech_synthesis.go (1)

16-324: Use the passed ctx instead of context.Background() in speech tests

Both RunSpeechSynthesisTest and RunSpeechSynthesisAdvancedTest accept a ctx context.Context but then ignore it and create new background contexts (requestCtx := context.Background()), so callers cannot control cancellation/timeouts or pass values through.

You can keep the signatures and just use the provided ctx in all three places:

-				requestCtx := context.Background()
+				requestCtx := ctx
@@
-			requestCtx := context.Background()
+			requestCtx := ctx
@@
-					requestCtx := context.Background()
+					requestCtx := ctx

This will make these helpers respect the context passed in via the test harness.

core/providers/groq/groq.go (1)

1-3: Fix package comment to reference groq instead of providers

The header still says Package providers even though this file is package groq, which makes the GoDoc misleading. Consider updating it like:

-// Package providers implements various LLM providers and their utility functions.
-// This file contains the Groq provider implementation.
+// Package groq implements the Groq provider and its utility functions.
 package groq
core/providers/parasail/parasail.go (1)

1-3: Update package comment to match parasail package

The file is now package parasail, but the leading comment still documents Package providers. Updating it keeps GoDoc accurate:

-// Package providers implements various LLM providers and their utility functions.
-// This file contains the Parasail provider implementation.
+// Package parasail implements the Parasail LLM provider.
 package parasail
core/providers/cerebras/cerebras.go (1)

1-3: Top-of-file package comment is out of sync with package name

The file is now package cerebras but the leading comment still refers to “Package providers”, which will generate confusing GoDoc.

Consider updating it:

-// Package providers implements various LLM providers and their utility functions.
-// This file contains the Cerebras provider implementation.
+// Package cerebras implements the Cerebras LLM provider and its utility functions.
+// This file contains the Cerebras provider implementation.
 package cerebras
core/chatbot_test.go (1)

633-639: Critical: synthesis request still missing Provider and Model

s.synthesizeToolResults builds synthesisRequest with only Input and Params. The main chat request includes Provider and Model, so this synthesis call will either fail validation or use an unintended default.

Mirror the main request by including these fields:

-	synthesisRequest := &schemas.BifrostChatRequest{
-		Input: conversationWithSynthesis,
-		Params: &schemas.ChatParameters{
-			Temperature:         s.config.Temperature,
-			MaxCompletionTokens: s.config.MaxTokens,
-		},
-	}
+	synthesisRequest := &schemas.BifrostChatRequest{
+		Provider: s.config.Provider,
+		Model:    s.config.Model,
+		Input:    conversationWithSynthesis,
+		Params: &schemas.ChatParameters{
+			Temperature:         s.config.Temperature,
+			MaxCompletionTokens: s.config.MaxTokens,
+		},
+	}
🧹 Nitpick comments (3)
core/internal/testutil/automatic_function_calling.go (1)

14-15: Automatic function-calling validation is now entirely centralized in the retry framework

RunAutomaticFunctionCallingTest delegates correctness checks to WithDualAPITestRetry via expectations, and validateAutomaticToolCall is now purely for additional logging. That’s fine as long as ToolCallExpectations enforces presence/shape of the tool call; you might optionally add a guard/log when toolCalls is empty to make missing calls more obvious in logs.

Also applies to: 161-180

Makefile (1)

318-395: Consider simplifying directory navigation pattern.

The multiple cd commands (e.g., cd core/providers/$(PROVIDER) followed by cd ../../..) create tight coupling to the directory structure. If the nesting level changes, multiple locations need updates.

Consider using absolute paths or storing the base directory in a variable:

+CORE_DIR := core
+PROVIDERS_DIR := $(CORE_DIR)/providers
+
-cd core/providers/$(PROVIDER) && GOWORK=off gotestsum \
+cd $(PROVIDERS_DIR)/$(PROVIDER) && GOWORK=off gotestsum \

Or use -C flag to change directory for a single command where supported.

core/providers/bedrock/bedrock_test.go (1)

1-56: Bedrock test configuration is sound; consider tightening comments/messages

The migration to core/internal/testutil (setup, config, scenarios, and runner) is correct, and the Bedrock models/fallbacks plus enabled scenarios align with the intent to exercise chat, tools, embeddings, reasoning, and list‑models.

Two small nits you might optionally address:

  • The skip message in Line 15 still says "Skipping Bedrock embedding..." even though this test now runs a comprehensive suite; renaming it to "Skipping Bedrock tests..." would be clearer.
  • TextModel is set to the Mistral instruct model while Scenarios.TextCompletion/TextCompletionStream are false and the comment mentions Claude not supporting text completion. If you don’t plan to run text‑completion via Mistral, consider clarifying the comment; if you do, enabling the corresponding scenarios would make that intent explicit.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 91d3339 and 132a1f5.

⛔ Files ignored due to path filters (2)
  • tests/core-chatbot/go.sum is excluded by !**/*.sum
  • tests/core-providers/go.sum is excluded by !**/*.sum
📒 Files selected for processing (73)
  • .github/workflows/scripts/release-core.sh (1 hunks)
  • Makefile (5 hunks)
  • core/bifrost.go (2 hunks)
  • core/chatbot_test.go (6 hunks)
  • core/go.mod (1 hunks)
  • core/internal/testutil/account.go (1 hunks)
  • core/internal/testutil/automatic_function_calling.go (2 hunks)
  • core/internal/testutil/chat_completion_stream.go (2 hunks)
  • core/internal/testutil/complete_end_to_end.go (1 hunks)
  • core/internal/testutil/cross_provider_scenarios.go (1 hunks)
  • core/internal/testutil/cross_provider_test.go (4 hunks)
  • core/internal/testutil/embedding.go (2 hunks)
  • core/internal/testutil/end_to_end_tool_calling.go (1 hunks)
  • core/internal/testutil/error_parser.go (1 hunks)
  • core/internal/testutil/image_base64.go (1 hunks)
  • core/internal/testutil/image_url.go (1 hunks)
  • core/internal/testutil/list_models.go (2 hunks)
  • core/internal/testutil/multi_turn_conversation.go (2 hunks)
  • core/internal/testutil/multiple_images.go (1 hunks)
  • core/internal/testutil/multiple_tool_calls.go (2 hunks)
  • core/internal/testutil/reasoning.go (1 hunks)
  • core/internal/testutil/response_validation.go (1 hunks)
  • core/internal/testutil/responses_stream.go (3 hunks)
  • core/internal/testutil/setup.go (1 hunks)
  • core/internal/testutil/simple_chat.go (1 hunks)
  • core/internal/testutil/speech_synthesis.go (2 hunks)
  • core/internal/testutil/speech_synthesis_stream.go (3 hunks)
  • core/internal/testutil/test_retry_conditions.go (1 hunks)
  • core/internal/testutil/test_retry_framework.go (2 hunks)
  • core/internal/testutil/tests.go (3 hunks)
  • core/internal/testutil/text_completion.go (1 hunks)
  • core/internal/testutil/text_completion_stream.go (2 hunks)
  • core/internal/testutil/tool_calls.go (2 hunks)
  • core/internal/testutil/tool_calls_streaming.go (2 hunks)
  • core/internal/testutil/transcription.go (4 hunks)
  • core/internal/testutil/transcription_stream.go (3 hunks)
  • core/internal/testutil/utils.go (2 hunks)
  • core/internal/testutil/validation_presets.go (2 hunks)
  • core/providers/anthropic/anthropic_test.go (3 hunks)
  • core/providers/azure/azure_test.go (3 hunks)
  • core/providers/bedrock/bedrock_test.go (4 hunks)
  • core/providers/cerebras/cerebras.go (1 hunks)
  • core/providers/cerebras/cerebras_test.go (4 hunks)
  • core/providers/cohere/cohere_test.go (3 hunks)
  • core/providers/elevenlabs/elevenlabs_test.go (3 hunks)
  • core/providers/gemini/gemini_test.go (4 hunks)
  • core/providers/groq/groq.go (1 hunks)
  • core/providers/groq/groq_test.go (4 hunks)
  • core/providers/mistral/mistral_test.go (3 hunks)
  • core/providers/ollama/ollama.go (1 hunks)
  • core/providers/ollama/ollama_test.go (3 hunks)
  • core/providers/openai/openai_test.go (4 hunks)
  • core/providers/openrouter/openrouter.go (1 hunks)
  • core/providers/openrouter/openrouter_test.go (3 hunks)
  • core/providers/parasail/parasail.go (1 hunks)
  • core/providers/parasail/parasail_test.go (3 hunks)
  • core/providers/perplexity/perplexity_test.go (3 hunks)
  • core/providers/sgl/sgl.go (1 hunks)
  • core/providers/sgl/sgl_test.go (3 hunks)
  • core/providers/vertex/vertex_test.go (3 hunks)
  • tests/core-chatbot/go.mod (0 hunks)
  • tests/core-providers/README.md (0 hunks)
  • tests/core-providers/go.mod (0 hunks)
  • tests/governance/README.md (0 hunks)
  • tests/governance/__init__.py (0 hunks)
  • tests/governance/conftest.py (0 hunks)
  • tests/governance/pytest.ini (0 hunks)
  • tests/governance/requirements.txt (0 hunks)
  • tests/governance/test_customers_crud.py (0 hunks)
  • tests/governance/test_helpers.py (0 hunks)
  • tests/governance/test_teams_crud.py (0 hunks)
  • tests/governance/test_usage_tracking.py (0 hunks)
  • tests/governance/test_virtual_keys_crud.py (0 hunks)
💤 Files with no reviewable changes (13)
  • tests/governance/pytest.ini
  • tests/core-chatbot/go.mod
  • tests/core-providers/README.md
  • tests/governance/requirements.txt
  • tests/governance/test_virtual_keys_crud.py
  • tests/governance/test_usage_tracking.py
  • tests/governance/README.md
  • tests/governance/test_helpers.py
  • tests/governance/test_customers_crud.py
  • tests/governance/conftest.py
  • tests/governance/init.py
  • tests/governance/test_teams_crud.py
  • tests/core-providers/go.mod
🚧 Files skipped from review as they are similar to previous changes (23)
  • core/internal/testutil/cross_provider_test.go
  • core/go.mod
  • core/internal/testutil/response_validation.go
  • core/providers/sgl/sgl.go
  • core/providers/openrouter/openrouter.go
  • core/providers/groq/groq_test.go
  • core/providers/mistral/mistral_test.go
  • core/internal/testutil/responses_stream.go
  • core/internal/testutil/tool_calls_streaming.go
  • core/internal/testutil/multiple_tool_calls.go
  • core/providers/sgl/sgl_test.go
  • core/providers/cerebras/cerebras_test.go
  • core/internal/testutil/error_parser.go
  • core/providers/elevenlabs/elevenlabs_test.go
  • core/internal/testutil/cross_provider_scenarios.go
  • core/internal/testutil/text_completion_stream.go
  • core/providers/azure/azure_test.go
  • core/internal/testutil/chat_completion_stream.go
  • core/internal/testutil/utils.go
  • core/providers/parasail/parasail_test.go
  • core/internal/testutil/text_completion.go
  • core/internal/testutil/embedding.go
  • core/internal/testutil/reasoning.go
🧰 Additional context used
🧬 Code graph analysis (25)
core/internal/testutil/speech_synthesis.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/automatic_function_calling.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/multi_turn_conversation.go (3)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/test_retry_framework.go (1)
  • WithChatTestRetry (274-424)
core/internal/testutil/utils.go (2)
  • GetErrorMessage (597-630)
  • GetChatContent (320-347)
core/internal/testutil/tool_calls.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/transcription_stream.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/gemini/gemini_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/bedrock/bedrock_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/complete_end_to_end.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/test_retry_framework.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/openrouter/openrouter_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • OpenRouter (49-49)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/transcription.go (2)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/schemas/transcriptions.go (1)
  • BifrostTranscriptionResponse (16-26)
core/internal/testutil/end_to_end_tool_calling.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/image_base64.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/tests.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/anthropic/anthropic_test.go (5)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (2)
  • Anthropic (37-37)
  • Fallback (128-131)
core/schemas/models.go (1)
  • Model (109-129)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/multiple_images.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/openai/openai_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/speech_synthesis_stream.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/vertex/vertex_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/providers/cohere/cohere_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Cohere (39-39)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/chatbot_test.go (1)
core/schemas/chatcompletions.go (1)
  • ChatParameters (154-183)
core/internal/testutil/list_models.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/validation_presets.go (2)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/response_validation.go (1)
  • ResponseExpectations (18-43)
core/internal/testutil/simple_chat.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/perplexity/perplexity_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Perplexity (46-46)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
🔇 Additional comments (33)
core/internal/testutil/test_retry_conditions.go (1)

1-1: LGTM! Package rename aligns with test reorganization.

The package declaration has been correctly updated from scenarios to testutil as part of consolidating test utilities into core/internal/testutil. The retry condition implementations remain unchanged, making this a clean refactor.

core/internal/testutil/account.go (1)

1-4: Package rename to testutil looks consistent

The package doc now correctly starts with Package testutil and matches the package testutil declaration and usage across test utilities. No issues from this rename on this file.

core/internal/testutil/speech_synthesis.go (1)

1-1: testutil package declaration is consistent

The package declaration matches the rest of the test utilities and the updated imports; no further changes needed here.

core/internal/testutil/setup.go (1)

1-4: Package rename and documentation alignment look good

The package comment and package testutil declaration are consistent with the new test utility role; no functional changes introduced here.

core/chatbot_test.go (1)

830-947: Interactive chatbot test wrapper is reasonable but note process-exit behavior

Wrapping the CLI chatbot in TestChatbot behind RUN_CHATBOT_TEST is a pragmatic way to keep this out of normal CI. Just be aware that runChatbot uses os.Exit, so when the test is enabled it will terminate the test binary rather than returning control to go test. If that’s intentional for this integration-style test, the current setup is fine.

.github/workflows/scripts/release-core.sh (1)

38-42: Core test invocation aligns with new layout

Running go test -v ./... from the core directory matches the refactor that moved provider tests under core/; this should exercise the entire core test suite during release.

core/internal/testutil/multiple_images.go (1)

1-2: Multiple images test now correctly uses local ComprehensiveTestConfig

Switching to package testutil and using the local ComprehensiveTestConfig keeps this scenario aligned with the new shared test utility types; behavior is unchanged.

Also applies to: 15-19

core/internal/testutil/image_url.go (1)

1-2: Image URL dual-API test wiring looks consistent with new testutil config

The move to package testutil and the unqualified ComprehensiveTestConfig parameter matches the broader refactor; the retry and expectations logic remains intact.

Also applies to: 15-19

core/internal/testutil/test_retry_framework.go (1)

1-2: Fix unused testConfig parameter in GetTestRetryConfigForScenario (compile blocker)

Verified: GetTestRetryConfigForScenario (line 1116) accepts testConfig ComprehensiveTestConfig but never uses it. The entire function body contains only a switch on scenarioName with no reference to testConfig. In Go, this causes a compile-time error ("testConfig declared but not used"), blocking builds.

Apply the suggested fix to bind the unused parameter to the blank identifier:

-func GetTestRetryConfigForScenario(scenarioName string, testConfig ComprehensiveTestConfig) TestRetryConfig {
+func GetTestRetryConfigForScenario(scenarioName string, _ ComprehensiveTestConfig) TestRetryConfig {

Likely an incorrect or invalid review comment.

core/internal/testutil/tool_calls.go (1)

1-17: LGTM - Clean refactor to testutil package.

The package rename and type consolidation are well-executed. The function signature correctly uses the local ComprehensiveTestConfig type, eliminating the external dependency on the config package.

core/internal/testutil/end_to_end_tool_calling.go (1)

1-15: LGTM - Consistent refactor.

Package and type references correctly updated to use the consolidated testutil namespace.

core/internal/testutil/simple_chat.go (1)

1-14: LGTM - Proper package consolidation.

The refactor correctly moves this test utility to the testutil package with appropriate type references.

core/internal/testutil/image_base64.go (1)

1-15: LGTM - Clean migration.

Package and type references properly updated to use the testutil namespace.

core/internal/testutil/validation_presets.go (1)

1-208: LGTM - Validation presets properly migrated.

The function signature correctly uses the local ComprehensiveTestConfig type, maintaining consistency with the broader refactor.

core/internal/testutil/speech_synthesis_stream.go (1)

1-16: LGTM - Both speech synthesis functions properly updated.

Package declaration and function signatures (lines 16 and 229) correctly use the local testutil types.

core/internal/testutil/list_models.go (1)

1-14: LGTM - List models utilities properly migrated.

Both RunListModelsTest (line 14) and RunListModelsPaginationTest (line 112) correctly use the local ComprehensiveTestConfig type.

core/providers/perplexity/perplexity_test.go (1)

1-48: LGTM - Excellent migration to testutil package.

The Perplexity test file demonstrates the complete migration pattern:

  • Package properly renamed to perplexity_test (line 1)
  • Import correctly updated to use testutil (line 7)
  • All function and type references updated to use the testutil namespace (lines 18, 24, 29, 48)
  • Test structure and logic preserved

This refactor successfully consolidates test utilities into a single, well-organized package while maintaining test functionality.

Makefile (1)

528-544: LGTM! Well-structured interactive test target.

The new test-chatbot target follows established patterns:

  • Appropriate environment variable gating for interactive tests
  • Clear usage documentation
  • Consistent .env loading pattern
core/internal/testutil/transcription_stream.go (2)

1-18: LGTM! Clean refactor to testutil package.

The package rename from scenarios to testutil and the removal of the config import align with the PR's objective to consolidate test utilities. The function signature changes are straightforward and maintain the same semantics.


326-326: Consistent signature update.

The RunTranscriptionStreamAdvancedTest signature change matches the pattern from RunTranscriptionStreamTest, maintaining consistency across the testutil package.

core/internal/testutil/transcription.go (1)

1-18: LGTM! Consistent refactoring pattern.

The package rename and signature update follow the same pattern as other testutil files in this PR. The changes are straightforward and maintain backward compatibility through the internal package structure.

core/internal/testutil/tests.go (1)

12-61: LGTM! Well-executed consolidation of test orchestration.

The export of RunAllComprehensiveTests and the update of scenario function references from external scenarios.* to local Run*Test functions successfully centralizes test orchestration in the testutil package. This improves discoverability and reduces coupling between test modules.

core/internal/testutil/complete_end_to_end.go (1)

1-15: LGTM! Consistent with testutil consolidation.

The package rename and signature update follow the established pattern across all testutil files in this PR.

core/providers/anthropic/anthropic_test.go (1)

1-53: LGTM! Correct implementation of testutil migration.

The provider test file correctly adopts the new testutil package:

  • Appropriate use of anthropic_test package for external testing
  • All imports and type references updated consistently
  • Test setup and execution properly delegated to testutil

This serves as a good reference implementation for other provider tests.

core/bifrost.go (2)

21-32: LGTM! Clean transition to per-provider imports.

The addition of explicit per-provider imports (cerebras, groq, ollama, openrouter, parasail, sgl) aligns with the PR's objective to establish per-provider package structure. This improves modularity and makes provider dependencies explicit.


1309-1323: Consistent constructor updates for new provider structure.

The switch from providers.NewXProvider to per-package constructors (ollama.NewOllamaProvider, groq.NewGroqProvider, etc.) correctly implements the new provider organization while maintaining the same public API surface.

core/internal/testutil/multi_turn_conversation.go (2)

1-13: LGTM! Consistent testutil migration.

Package rename and signature update follow the established pattern across all testutil files.


135-147: Good refactoring: centralized validation through retry framework.

The simplification of validation logic by delegating to WithChatTestRetry via expectations2 is a positive change:

  • Reduces code duplication across test scenarios
  • Centralizes validation logic in the retry framework
  • The inline comment clearly documents this architectural decision

The expectations2 object (lines 130-133) properly defines the validation rules, and the success logging confirms the expected behavior.

core/providers/ollama/ollama_test.go (1)

1-50: Ollama provider testutil migration and scenario config look consistent

The package switch to ollama_test, use of testutil.SetupTest, testutil.ComprehensiveTestConfig, testutil.TestScenarios, and testutil.RunAllComprehensiveTests is coherent. Unsupported features (text completion, embeddings, images) are correctly left unconfigured and disabled via Scenarios, while chat and tool flows are enabled. No further changes needed here.

core/providers/openai/openai_test.go (1)

1-68: OpenAI comprehensive test config correctly leverages testutil

The switch to openai_test plus testutil.SetupTest, testutil.ComprehensiveTestConfig, testutil.TestScenarios, and testutil.RunAllComprehensiveTests is consistent and type‑correct. All scenarios are enabled and have corresponding model (and, where relevant, fallback) configuration, which matches the intent of this being a full‑coverage provider test.

core/providers/gemini/gemini_test.go (1)

1-60: Gemini test harness wiring and scenario gating are coherent

The refactor to gemini_test with testutil.SetupTest, testutil.ComprehensiveTestConfig, testutil.TestScenarios, and testutil.RunAllComprehensiveTests is correct. Scenario flags line up with the comments (e.g., reasoning and transcription intentionally disabled with TODO notes), so the configuration clearly reflects current capabilities and planned follow‑ups.

core/providers/openrouter/openrouter_test.go (1)

1-54: Clean refactoring to centralized test utilities.

The migration from the config package to testutil is executed correctly. The package naming convention (openrouter_test) follows Go best practices for external tests, and all references have been updated consistently. The test logic remains unchanged, maintaining proper error handling and resource cleanup.

core/providers/vertex/vertex_test.go (1)

1-53: Clean refactoring to centralized test utilities.

The migration from the config package to testutil is executed correctly. The package naming convention (vertex_test) follows Go best practices for external tests, and all namespace references have been updated consistently. The test structure and logic remain unchanged, with proper error handling and resource cleanup in place.

@akshaydeo akshaydeo force-pushed the 11-22-moves_all_tests_related_to_core_to_corresponding_files branch 2 times, most recently from a8d18b1 to f946845 Compare November 25, 2025 10:58
@akshaydeo akshaydeo force-pushed the 11-22-moves_all_tests_related_to_core_to_corresponding_files branch from f946845 to 9800538 Compare November 25, 2025 11:02
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
core/internal/testutil/speech_synthesis.go (1)

113-113: Replace context.Background() with passed ctx parameter in three locations.

The functions RunSpeechSynthesisTest and RunSpeechSynthesisAdvancedTest receive a ctx context.Context parameter, but the code creates new background contexts instead of using the passed parameter at lines 113, 219, and 301. Replace requestCtx := context.Background() with requestCtx := ctx in all three locations.

🧹 Nitpick comments (3)
core/internal/testutil/cross_provider_test.go (1)

118-147: Consistency test setup mirrors scenario config; consider deduplicating provider list

The consistency test’s use of local ProviderConfig and CrossProviderTestConfig (with ValidationLenient) is consistent with the scenario test and with the helpers in this package. The only nit is that the provider slice here repeats data from the scenarios test; extracting a shared helper (e.g., defaultProvidersForCrossTests()) would reduce drift if you tweak provider coverage later, but it’s not required for this refactor.

core/internal/testutil/validation_presets.go (1)

1-8: GetExpectationsForScenario now matches testutil config, with an unused parameter

Updating GetExpectationsForScenario to take ComprehensiveTestConfig keeps the API in sync with callers and with other helpers in this package. Note that testConfig is still unused inside the function; if vet/no-unused-params noise becomes an issue, you could either remove the parameter (and update call sites) or start threading provider/scenario-specific data from it into expectations.

Also applies to: 207-293

core/internal/testutil/responses_stream.go (1)

11-11: Minor: Extra blank line in imports.

There's an extra blank line between imports that could be cleaned up for consistency.

 import (
 	"context"
 	"fmt"
 	"os"
 	"strings"
 	"testing"
 	"time"
-
 
 	bifrost "github.com/maximhq/bifrost/core"
 	"github.com/maximhq/bifrost/core/schemas"
 )
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 132a1f5 and 9800538.

⛔ Files ignored due to path filters (2)
  • tests/core-chatbot/go.sum is excluded by !**/*.sum
  • tests/core-providers/go.sum is excluded by !**/*.sum
📒 Files selected for processing (73)
  • .github/workflows/scripts/release-core.sh (1 hunks)
  • Makefile (5 hunks)
  • core/bifrost.go (2 hunks)
  • core/chatbot_test.go (6 hunks)
  • core/go.mod (1 hunks)
  • core/internal/testutil/account.go (1 hunks)
  • core/internal/testutil/automatic_function_calling.go (2 hunks)
  • core/internal/testutil/chat_completion_stream.go (2 hunks)
  • core/internal/testutil/complete_end_to_end.go (1 hunks)
  • core/internal/testutil/cross_provider_scenarios.go (1 hunks)
  • core/internal/testutil/cross_provider_test.go (4 hunks)
  • core/internal/testutil/embedding.go (2 hunks)
  • core/internal/testutil/end_to_end_tool_calling.go (1 hunks)
  • core/internal/testutil/error_parser.go (1 hunks)
  • core/internal/testutil/image_base64.go (1 hunks)
  • core/internal/testutil/image_url.go (1 hunks)
  • core/internal/testutil/list_models.go (2 hunks)
  • core/internal/testutil/multi_turn_conversation.go (2 hunks)
  • core/internal/testutil/multiple_images.go (1 hunks)
  • core/internal/testutil/multiple_tool_calls.go (2 hunks)
  • core/internal/testutil/reasoning.go (1 hunks)
  • core/internal/testutil/response_validation.go (1 hunks)
  • core/internal/testutil/responses_stream.go (3 hunks)
  • core/internal/testutil/setup.go (1 hunks)
  • core/internal/testutil/simple_chat.go (1 hunks)
  • core/internal/testutil/speech_synthesis.go (2 hunks)
  • core/internal/testutil/speech_synthesis_stream.go (3 hunks)
  • core/internal/testutil/test_retry_conditions.go (1 hunks)
  • core/internal/testutil/test_retry_framework.go (2 hunks)
  • core/internal/testutil/tests.go (3 hunks)
  • core/internal/testutil/text_completion.go (1 hunks)
  • core/internal/testutil/text_completion_stream.go (2 hunks)
  • core/internal/testutil/tool_calls.go (2 hunks)
  • core/internal/testutil/tool_calls_streaming.go (2 hunks)
  • core/internal/testutil/transcription.go (4 hunks)
  • core/internal/testutil/transcription_stream.go (3 hunks)
  • core/internal/testutil/utils.go (2 hunks)
  • core/internal/testutil/validation_presets.go (2 hunks)
  • core/providers/anthropic/anthropic_test.go (3 hunks)
  • core/providers/azure/azure_test.go (3 hunks)
  • core/providers/cerebras/cerebras.go (1 hunks)
  • core/providers/cerebras/cerebras_test.go (4 hunks)
  • core/providers/cohere/cohere_test.go (3 hunks)
  • core/providers/elevenlabs/elevenlabs_test.go (3 hunks)
  • core/providers/gemini/gemini_test.go (4 hunks)
  • core/providers/groq/groq.go (1 hunks)
  • core/providers/groq/groq_test.go (4 hunks)
  • core/providers/mistral/mistral_test.go (3 hunks)
  • core/providers/ollama/ollama.go (1 hunks)
  • core/providers/ollama/ollama_test.go (3 hunks)
  • core/providers/openai/openai_test.go (4 hunks)
  • core/providers/openrouter/openrouter.go (1 hunks)
  • core/providers/openrouter/openrouter_test.go (3 hunks)
  • core/providers/parasail/parasail.go (1 hunks)
  • core/providers/parasail/parasail_test.go (3 hunks)
  • core/providers/perplexity/perplexity_test.go (3 hunks)
  • core/providers/sgl/sgl.go (1 hunks)
  • core/providers/sgl/sgl_test.go (3 hunks)
  • core/providers/vertex/vertex_test.go (3 hunks)
  • tests/core-chatbot/go.mod (0 hunks)
  • tests/core-providers/README.md (0 hunks)
  • tests/core-providers/bedrock_test.go (0 hunks)
  • tests/core-providers/go.mod (0 hunks)
  • tests/governance/README.md (0 hunks)
  • tests/governance/__init__.py (0 hunks)
  • tests/governance/conftest.py (0 hunks)
  • tests/governance/pytest.ini (0 hunks)
  • tests/governance/requirements.txt (0 hunks)
  • tests/governance/test_customers_crud.py (0 hunks)
  • tests/governance/test_helpers.py (0 hunks)
  • tests/governance/test_teams_crud.py (0 hunks)
  • tests/governance/test_usage_tracking.py (0 hunks)
  • tests/governance/test_virtual_keys_crud.py (0 hunks)
💤 Files with no reviewable changes (14)
  • tests/governance/init.py
  • tests/core-providers/go.mod
  • tests/core-chatbot/go.mod
  • tests/governance/README.md
  • tests/governance/pytest.ini
  • tests/governance/test_helpers.py
  • tests/governance/test_virtual_keys_crud.py
  • tests/governance/test_customers_crud.py
  • tests/core-providers/README.md
  • tests/governance/requirements.txt
  • tests/core-providers/bedrock_test.go
  • tests/governance/test_usage_tracking.py
  • tests/governance/test_teams_crud.py
  • tests/governance/conftest.py
🚧 Files skipped from review as they are similar to previous changes (25)
  • core/internal/testutil/transcription_stream.go
  • core/internal/testutil/error_parser.go
  • core/providers/ollama/ollama.go
  • core/providers/openrouter/openrouter.go
  • core/internal/testutil/automatic_function_calling.go
  • core/bifrost.go
  • core/internal/testutil/test_retry_conditions.go
  • core/internal/testutil/complete_end_to_end.go
  • core/providers/groq/groq.go
  • core/providers/vertex/vertex_test.go
  • core/internal/testutil/chat_completion_stream.go
  • core/providers/perplexity/perplexity_test.go
  • core/internal/testutil/image_url.go
  • core/providers/gemini/gemini_test.go
  • core/internal/testutil/reasoning.go
  • core/chatbot_test.go
  • core/providers/ollama/ollama_test.go
  • core/internal/testutil/utils.go
  • core/go.mod
  • core/providers/anthropic/anthropic_test.go
  • core/providers/cerebras/cerebras_test.go
  • core/internal/testutil/image_base64.go
  • core/internal/testutil/multiple_images.go
  • core/internal/testutil/test_retry_framework.go
  • core/providers/sgl/sgl.go
🧰 Additional context used
🧬 Code graph analysis (22)
core/internal/testutil/end_to_end_tool_calling.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/speech_synthesis.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/text_completion.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/text_completion_stream.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/openrouter/openrouter_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • OpenRouter (49-49)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/tool_calls.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/multi_turn_conversation.go (3)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/test_retry_framework.go (1)
  • WithChatTestRetry (274-424)
core/internal/testutil/utils.go (2)
  • GetErrorMessage (597-630)
  • GetChatContent (320-347)
core/internal/testutil/list_models.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/elevenlabs/elevenlabs_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Elevenlabs (50-50)
core/internal/testutil/transcription.go (2)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/schemas/transcriptions.go (1)
  • BifrostTranscriptionResponse (16-26)
core/providers/mistral/mistral_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (2)
  • Mistral (41-41)
  • Fallback (128-131)
core/internal/testutil/embedding.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/multiple_tool_calls.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/speech_synthesis_stream.go (2)
core/bifrost.go (1)
  • Bifrost (50-69)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/simple_chat.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/providers/cohere/cohere_test.go (4)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Cohere (39-39)
core/internal/testutil/tests.go (1)
  • RunAllComprehensiveTests (15-61)
core/internal/testutil/responses_stream.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/tests.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/validation_presets.go (2)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/response_validation.go (1)
  • ResponseExpectations (18-43)
core/internal/testutil/tool_calls_streaming.go (1)
core/internal/testutil/account.go (1)
  • ComprehensiveTestConfig (47-63)
core/internal/testutil/cross_provider_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/cross_provider_scenarios.go (13)
  • ProviderConfig (45-53)
  • CrossProviderTestConfig (38-42)
  • ConversationSettings (56-60)
  • MessageModality (19-19)
  • ModalityText (22-22)
  • ModalityTool (23-23)
  • ModalityVision (24-24)
  • TestSettings (63-67)
  • ValidationModerate (33-33)
  • GetPredefinedScenarios (110-245)
  • RunCrossProviderScenarioTest (649-774)
  • ValidationLenient (34-34)
  • RunCrossProviderConsistencyTest (781-860)
core/schemas/bifrost.go (4)
  • OpenAI (35-35)
  • Anthropic (37-37)
  • Groq (43-43)
  • Gemini (48-48)
core/providers/parasail/parasail_test.go (3)
core/internal/testutil/setup.go (1)
  • SetupTest (51-60)
core/internal/testutil/account.go (2)
  • ComprehensiveTestConfig (47-63)
  • TestScenarios (22-44)
core/schemas/bifrost.go (1)
  • Parasail (45-45)
🔇 Additional comments (40)
core/internal/testutil/multiple_tool_calls.go (2)

1-1: LGTM! Clean package consolidation.

The package rename from scenarios to testutil aligns with the PR's objective to consolidate test utilities into a unified package.


23-23: LGTM! Correct type reference update.

The function signature correctly uses the unqualified ComprehensiveTestConfig type now that it's defined locally in the testutil package. The function logic remains unchanged, making this a clean refactoring.

core/providers/cerebras/cerebras.go (1)

1-2: LGTM! Package refactoring correctly applied.

The package comment and declaration now correctly reference cerebras instead of providers, aligning with the PR's objective to reorganize provider packages into individual namespaces.

core/internal/testutil/end_to_end_tool_calling.go (2)

1-1: LGTM! Package rename aligns with test infrastructure consolidation.

The package declaration correctly reflects the move from scenarios to the unified testutil package as part of the test infrastructure reorganization.


15-15: LGTM! Function signature updated correctly.

The signature now uses the local ComprehensiveTestConfig type from the testutil package, successfully removing the dependency on the external config package. The type structure remains the same, ensuring all existing usages throughout the function continue to work correctly.

core/internal/testutil/speech_synthesis_stream.go (2)

1-1: LGTM! Package consolidation is correct.

The package rename from scenarios to testutil aligns with the PR's objective to consolidate test infrastructure into a unified core/internal/testutil package.


16-16: LGTM! Function signatures correctly updated.

The removal of the config. package qualifier from ComprehensiveTestConfig is correct, as the type is now defined in the same testutil package (as seen in core/internal/testutil/account.go). Both function signatures are properly updated and consistent with the package consolidation.

Also applies to: 229-229

core/internal/testutil/cross_provider_scenarios.go (1)

1-1: Package rename to testutil is consistent and non-breaking

Aligning this file under package testutil matches its new location (core/internal/testutil) and lets local tests reference these helpers directly without an extra import; behavior and exported types stay unchanged.

core/internal/testutil/cross_provider_test.go (1)

1-111: Cross‑provider scenario test wiring correctly targets new testutil types

Using package testutil and the local ProviderConfig, CrossProviderTestConfig, ConversationSettings, TestSettings, and modality/validation constants keeps this integration-style test self-contained in the internal test utilities package. The provider definitions and scenario loop correctly feed into RunCrossProviderScenarioTest for both Chat Completions and Responses API.

core/providers/parasail/parasail.go (1)

1-3: LGTM! Package declaration correctly updated.

The package declaration has been properly changed from package providers to package parasail, aligning with the per-provider package structure. The package documentation issue was already addressed in previous commits.

core/internal/testutil/account.go (1)

1-4: LGTM! Clean package refactor.

The package has been properly renamed from config to testutil, with the documentation comment updated accordingly. This aligns with the PR's goal of consolidating test utilities into a unified package.

core/internal/testutil/response_validation.go (1)

1-1: LGTM! Package rename completed.

The package declaration has been correctly updated from scenarios to testutil, consistent with the test infrastructure consolidation.

core/internal/testutil/speech_synthesis.go (1)

1-16: LGTM! Package refactor completed.

The package has been correctly renamed from scenarios to testutil, and the function signatures properly updated to use the unqualified ComprehensiveTestConfig type.

core/providers/mistral/mistral_test.go (1)

1-52: LGTM! Test file properly migrated to testutil.

The test file has been correctly updated to use the testutil package:

  • Import path updated to use core/internal/testutil
  • All type references properly qualified with testutil. prefix
  • Test setup, configuration, and runner invocations follow the consistent refactor pattern
.github/workflows/scripts/release-core.sh (1)

38-42: LGTM! Test execution simplified appropriately.

The script has been correctly updated to run tests directly from the core directory with go test -v ./..., which aligns with the test reorganization where provider tests are now located under core/providers/. This simplification improves maintainability.

core/internal/testutil/setup.go (1)

1-4: LGTM! Package documentation and declaration properly updated.

The package has been correctly renamed from config to testutil, with the documentation comment updated to reflect the new package name. This maintains consistency with the test infrastructure consolidation.

core/internal/testutil/embedding.go (1)

1-40: LGTM! Function signature properly updated.

The package has been correctly renamed from scenarios to testutil, and the RunEmbeddingTest function signature has been properly updated to use the unqualified ComprehensiveTestConfig type from the local package. This eliminates the external config package dependency as intended.

core/internal/testutil/simple_chat.go (1)

1-15: RunSimpleChatTest now correctly uses local ComprehensiveTestConfig

Switching the package to testutil and updating RunSimpleChatTest to take the local ComprehensiveTestConfig type matches the struct in account.go and the other helpers; no behavioral change, and the configuration wiring looks consistent.

core/internal/testutil/tool_calls.go (1)

1-18: RunToolCallsTest signature aligns with new testutil config

Using ComprehensiveTestConfig here is consistent with the struct definition in account.go and how other scenario helpers are wired; references to Scenarios, Provider, ChatModel, and Fallbacks all match the new type, so the refactor is safe.

core/internal/testutil/tool_calls_streaming.go (1)

1-18: RunToolCallsStreamingTest correctly migrated to ComprehensiveTestConfig

The function now consuming ComprehensiveTestConfig (while checking Scenarios.ToolCallsStreaming and using Provider, ChatModel, and Fallbacks) is consistent with the shared testutil config pattern; behavior of the streaming tool-call test remains the same.

Also applies to: 210-213

core/internal/testutil/text_completion.go (1)

1-18: RunTextCompletionTest correctly switched to ComprehensiveTestConfig

The move to ComprehensiveTestConfig (checking Scenarios.TextCompletion and using TextModel, Provider, and TextCompletionFallbacks) is consistent with the shared config struct and preserves the existing behavior of this test helper.

core/providers/parasail/parasail_test.go (1)

1-8: Parasail provider tests correctly migrated to testutil-based harness

Switching to package parasail_test, importing core/internal/testutil, using testutil.SetupTest, and passing a testutil.ComprehensiveTestConfig with testutil.TestScenarios into testutil.RunAllComprehensiveTests is consistent with the new shared test harness and should keep the Parasail suite aligned with other providers.

Please run the updated core tests for this provider (e.g., make test-core PROVIDER=parasail) to confirm everything passes end‑to‑end after the refactor.

Also applies to: 18-30, 48-52

core/internal/testutil/text_completion_stream.go (1)

1-18: RunTextCompletionStreamTest now correctly uses shared ComprehensiveTestConfig

The updated signature and use of ComprehensiveTestConfig (including Scenarios.TextCompletionStream, model selection, and TextCompletionFallbacks) are consistent with the consolidated testutil config and with the expectations/retry helpers that now also accept this type.

core/providers/cohere/cohere_test.go (1)

1-8: Cohere provider tests successfully switched to the shared testutil harness

Using package cohere_test with testutil.SetupTest, a testutil.ComprehensiveTestConfig (including testutil.TestScenarios), and testutil.RunAllComprehensiveTests brings the Cohere suite in line with the new centralized core test infrastructure; the wiring and scenario flags look consistent with the configured models.

After this refactor, please run the Cohere core tests (e.g., make test-core PROVIDER=cohere) to confirm everything still passes under the new layout.

Also applies to: 18-30, 50-54

core/providers/openrouter/openrouter_test.go (1)

1-54: LGTM! Clean refactoring to testutil package.

The migration from the old tests package and config imports to the new openrouter_test package and testutil imports is consistent and complete. All type references and function calls have been updated correctly.

Makefile (2)

528-544: LGTM! Well-documented test-chatbot target.

The new test-chatbot target is well-implemented with:

  • Clear environment variable gating via RUN_CHATBOT_TEST
  • Helpful usage instructions
  • Documentation of required environment variables
  • Proper .env file loading

The interactive test gating prevents accidental execution in CI/CD pipelines.


318-342: The directory navigation logic is correct and handles failures properly.

The concern in the review comment is based on a misunderstanding of the code structure. Looking at lines 338-342, the cd ../../.. command is separated from the gotestsum execution by a semicolon (;), which means it executes unconditionally regardless of whether gotestsum succeeds or fails. The || TEST_FAILED=1; only sets the error flag; it doesn't prevent the subsequent cd ../../.. from executing. The error flag is checked later at line 445 for exit status determination. Therefore, directory state corruption cannot occur—the working directory is guaranteed to return to the repository root after test execution, whether tests pass or fail.

Likely an incorrect or invalid review comment.

core/internal/testutil/tests.go (1)

1-61: LGTM! Clean consolidation into testutil package.

The refactoring successfully:

  • Exports RunAllComprehensiveTests for external use by provider tests
  • Updates all type references to use the local ComprehensiveTestConfig type
  • Replaces external package scenario references (scenarios.*) with local function calls (Run*Test)
  • Maintains consistent function signatures throughout
core/providers/groq/groq_test.go (1)

1-62: LGTM! Consistent migration to testutil.

All references have been correctly updated to use the testutil package, matching the pattern used in other provider test files.

core/providers/sgl/sgl_test.go (1)

1-53: LGTM! Proper testutil migration.

The SGL provider test has been correctly updated to use the consolidated testutil package with all type and function references properly migrated.

core/providers/openai/openai_test.go (1)

1-68: LGTM! Complete testutil integration.

The OpenAI provider test correctly adopts the testutil package with all necessary updates to imports, type references, and function calls.

core/internal/testutil/multi_turn_conversation.go (1)

1-148: LGTM! Proper validation delegation to retry framework.

The package migration to testutil is correct, and the validation approach has been properly streamlined. The validation logic is now fully delegated to WithChatTestRetry via expectations2, which validates that the model remembers "Alice". The post-retry check at lines 139-141 correctly fails fast if the retry framework exhausted all attempts.

The updated comments at lines 143-144 clearly document that validation occurs inside WithChatTestRetry, improving code clarity.

core/internal/testutil/list_models.go (1)

1-230: LGTM! Clean migration to testutil package.

Both RunListModelsTest and RunListModelsPaginationTest have been correctly updated to:

  • Use the testutil package declaration
  • Remove the external config package import
  • Accept unqualified ComprehensiveTestConfig parameters

The changes maintain consistency with the broader refactoring effort.

core/providers/azure/azure_test.go (1)

1-66: LGTM!

The refactoring correctly migrates from the old config package to testutil. The external test package pattern (azure_test) is idiomatic Go for black-box testing. Context cleanup with defer cancel() and client.Shutdown() are properly handled.

core/internal/testutil/transcription.go (3)

1-18: LGTM!

Package rename to testutil and function signature update to use local ComprehensiveTestConfig type are consistent with the refactoring effort. The import cleanup (removing the config package) is correct.


278-278: LGTM!

Function signature correctly updated to use local ComprehensiveTestConfig.


501-501: LGTM!

Internal validation function signature correctly updated to use local ComprehensiveTestConfig.

core/internal/testutil/responses_stream.go (2)

1-17: LGTM!

Package rename and function signature updates are consistent with the refactoring. The import structure is correct with only the config import removed.


821-821: LGTM!

Function signature correctly updated to use local ComprehensiveTestConfig type.

core/providers/elevenlabs/elevenlabs_test.go (1)

1-56: LGTM!

The refactoring correctly migrates from the old config package to testutil. The test configuration appropriately enables only the capabilities that ElevenLabs supports (speech synthesis and transcription). The external test package pattern (elevenlabs_test) is idiomatic Go.

Note: The ToolCallsStreaming field is not explicitly set in the Scenarios struct, but it defaults to false which is the correct behavior for ElevenLabs.

Copy link
Copy Markdown
Contributor Author

akshaydeo commented Nov 25, 2025

Merge activity

  • Nov 25, 11:48 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Nov 25, 11:49 AM UTC: @akshaydeo merged this pull request with Graphite.

@akshaydeo akshaydeo merged commit 719b188 into main Nov 25, 2025
8 checks passed
@akshaydeo akshaydeo deleted the 11-22-moves_all_tests_related_to_core_to_corresponding_files branch November 25, 2025 11:49
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