Repository navigation
test(failure): pin that provider detail scrubs a key the provider echoes - #139
Conversation
extract_provider_error_detail runs the quoted provider message through sanitize_api_error, and that detail is shown to users. No test covered a provider echoing the rejected key back in its error message. Pin it for OpenAI- and Anthropic-shaped keys.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Comment |
Tiny Sweeper reviewReviewed head: Verdict: Ready for maintainer review · Priority: none Diagnostics and supporting detailsFull summaryPull request purpose (title): test(failure): pin that provider detail scrubs a key the provider echoes. This test-only pull request adds `extract_provider_error_detail_scrubs_a_key_the_provider_echoes` to `crates/tinyinference-llm/src/failure_tests.rs` to pin that the extracted provider error detail keeps the human-readable message while dropping a provider-echoed key, covering both OpenAI-shaped (`sk-proj-…`) and Anthropic-shaped (`sk-ant-api03-…`) synthetic keys built at runtime. No implementation changed. Review snapshot
Completeness: Complete What changedAdds a single test to `crates/tinyinference-llm/src/failure_tests.rs` that builds synthetic key-shaped strings at runtime, feeds a provider JSON error echoing the key into `extract_provider_error_detail`, and asserts the returned detail contains the message text but not the key body, for both OpenAI- and Anthropic-shaped keys. No production code was modified. Features
TestsNo supported feature-to-test mapping was produced. Test execution is not inferred. FindingsNo active actionable findings. Before mergeNone. Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
Summary
extract_provider_error_detail_scrubs_a_key_the_provider_echoes(failure_tests.rs). When a provider echoes the rejected key in its JSON error message, the extracted detail keeps the message and drops the key. Covers OpenAI-shaped (sk-proj-…) and Anthropic-shaped (sk-ant-api03-…) keys.Why
extract_provider_error_detail(andwith_provider_detail) quote the provider's message to the user aftersanitize_api_error. Nothing tested the key-echo case. OpenHuman's host test for it was flagged in review (tinyhumansai/openhuman#8301) as belonging here, because the scrubbing is this crate's behaviour. The host keeps one smoke check.Testing
cargo test -p tinyinference-llm --lib -- extract_provider_error_detail: 5 passed.sanitize_api_error(trimmed)replaced bytrimmed.to_string()infailure/text.rs, the new test fails on the key-leak assertion. The file was restored afterwards.rustfmt --edition 2024 --checkis clean.Test-only. No behaviour change.
🤖 Generated with Claude Code