The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(inference): cover catalog completeness and retry hint rendering
Steven Enamakeld2a3925c4988
diff --git a/crates/openhuman-core/src/inference/failure_copy/localized_tests.rs b/crates/openhuman-core/src/inference/failure_copy/localized_tests.rsindex a5a0bfc10b..48e316624a 100644--- a/crates/openhuman-core/src/inference/failure_copy/localized_tests.rs+++ b/crates/openhuman-core/src/inference/failure_copy/localized_tests.rs@@ -56,3 +56,85 @@ fn unknown_locale_key_and_parameter_types_fall_back_safely() {);assert_eq!(unknown, "safe English fallback");}++const CATALOG_KEYS: &[&str] = &[+ "chat_error.action_budget",+ "chat_error.auth_error",+ "chat_error.budget_exhausted",+ "chat_error.capability_unsupported",+ "chat_error.chat_template_rejected",+ "chat_error.codex_session_expired",+ "chat_error.context_overflow",+ "chat_error.empty_response",+ "chat_error.inference",+ "chat_error.local_session_managed_unavailable",+ "chat_error.malformed_history",+ "chat_error.managed_budget_exhausted",+ "chat_error.managed_internal",+ "chat_error.managed_malformed_request",+ "chat_error.managed_rate_limited",+ "chat_error.managed_request_rejected",+ "chat_error.managed_unavailable",+ "chat_error.max_iterations",+ "chat_error.model_config_rejected",+ "chat_error.model_unavailable",+ "chat_error.network",+ "chat_error.payload_too_large",+ "chat_error.provider_unavailable",+ "chat_error.rate_limited",+ "chat_error.rate_limited_billing",+ "chat_error.request_rejected",+ "chat_error.retryHint.aboutMinute",+ "chat_error.retryHint.aboutMinutes",+ "chat_error.retryHint.immediately",+ "chat_error.retryHint.oneSecond",+ "chat_error.retryHint.seconds",+ "chat_error.session_expired",+ "chat_error.timeout",+ "chat_error.turn_timeout",+];++#[test]+fn catalog_has_non_empty_copy_for_every_supported_locale_and_key() {+ for locale in chat_error_catalog::SUPPORTED_LOCALES {+ for key in CATALOG_KEYS {+ let text = chat_error_catalog::translation(locale, key)+ .unwrap_or_else(|| panic!("missing {locale} / {key}"));+ assert!(!text.trim().is_empty(), "empty {locale} / {key}");+ // The `{n}` placeholder exists exactly where the English source has one.+ let english_has = chat_error_catalog::translation("en", key)+ .unwrap()+ .contains("{n}");+ assert_eq!(+ text.contains("{n}"),+ english_has,+ "placeholder drift {locale} / {key}"+ );+ }+ }+}++#[test]+fn catalog_rejects_unknown_locale_or_key() {+ assert!(chat_error_catalog::translation("xx", "chat_error.timeout").is_none());+ assert!(chat_error_catalog::translation("en", "chat_error.nope").is_none());+}++#[test]+fn every_locale_renders_each_retry_hint_bucket() {+ for locale in chat_error_catalog::SUPPORTED_LOCALES {+ for (secs, expect_n) in [(0u64, None), (1, None), (30, Some("30")), (60, None), (150, Some("3"))] {+ let out = render_channel_failure(+ locale,+ "fallback",+ Some("chat_error.rate_limited"),+ Some(&serde_json::json!({ "retry_after_secs": secs })),+ );+ assert_ne!(out, "fallback");+ assert!(!out.contains("{n}"), "{locale} {secs}: {out}");+ if let Some(n) = expect_n {+ assert!(out.contains(n), "{locale} {secs}: {out}");+ }+ }+ }+}