Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/openhuman/inference/provider/compatible.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,13 @@ impl OpenAiCompatibleProvider {
Some(model),
status,
);
} else if super::is_provider_config_rejection_http(status, self.name.as_str(), &error) {
super::log_provider_config_rejection(
"responses_api",
self.name.as_str(),
Some(model),
status,
);
} else if super::should_report_provider_http_failure(status) {
crate::core::observability::report_error(
message.as_str(),
Expand Down Expand Up @@ -856,6 +863,13 @@ impl OpenAiCompatibleProvider {
Some(native_request.model.as_str()),
status,
);
} else if super::is_provider_config_rejection_http(status, self.name.as_str(), &body) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[major] Five new else if branches (39 lines across all five arms) but zero new tests. The project's testing strategy requires at least one failure-path test per new code path, and the coverage gate enforces ≥ 80% on changed lines via diff-cover — these branches won't be covered by the existing suite.

The helpers themselves are exercised in ops.rs (provider_config_rejection_suppression module), but the new arms in compatible.rs are not reachable from those unit tests. compatible_tests.rs has no mock-HTTP infrastructure that exercises error classification paths.

Suggested fix: add a #[tokio::test] in compatible_tests.rs (or a new compatible_config_rejection_tests.rs) using wiremock or httpmock to serve a 400 with a config-rejection body, then assert that the result is Err(...) (error still propagated) and that report_error was not called (i.e., no Sentry upload). One test covering the representative streaming_chat arm plus a brief comment that the same path applies to the other four would satisfy the gate.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added tests for that.

super::log_provider_config_rejection(
"streaming_chat",
self.name.as_str(),
Some(native_request.model.as_str()),
status,
);
} else if super::should_report_provider_http_failure(status) {
crate::core::observability::report_error(
message.as_str(),
Expand Down Expand Up @@ -1348,6 +1362,13 @@ impl Provider for OpenAiCompatibleProvider {
Some(model),
status,
);
} else if super::is_provider_config_rejection_http(status, self.name.as_str(), &error) {
super::log_provider_config_rejection(
"chat_completions",
self.name.as_str(),
Some(model),
status,
);
} else if super::should_report_provider_http_failure(status) {
crate::core::observability::report_error(
message.as_str(),
Expand Down Expand Up @@ -1797,6 +1818,13 @@ impl Provider for OpenAiCompatibleProvider {
Some(model),
status,
);
} else if super::is_provider_config_rejection_http(status, self.name.as_str(), &error) {
super::log_provider_config_rejection(
"native_chat",
self.name.as_str(),
Some(model),
status,
);
} else if super::should_report_provider_http_failure(status) {
crate::core::observability::report_error(
message.as_str(),
Expand Down Expand Up @@ -1952,6 +1980,17 @@ impl Provider for OpenAiCompatibleProvider {
Some(model_owned.as_str()),
status,
);
} else if super::is_provider_config_rejection_http(
status,
provider_name.as_str(),
&raw_error,
) {
super::log_provider_config_rejection(
"stream_chat",
provider_name.as_str(),
Some(model_owned.as_str()),
status,
);
} else if super::should_report_provider_http_failure(status) {
crate::core::observability::report_error(
message.as_str(),
Expand Down
Loading