Skip to main content

auth_cloudflare/
fallback_catalog.rs

1//! Fallback catalog - the offline model list when live discovery fails.
2//!
3//! ORDER IS POLICY (feedback 01/05/06): DeepSeek V4 Flash is first and is
4//! the development default; GLM-5.3 Flash is experimental and must never
5//! lead the fallback list. The single source of truth lives in
6//! [`crate::catalog`]; these functions expose it without duplicating ids.
7
8/// The ordered offline fallback list (DeepSeek Flash first, GLM not first).
9pub fn fallback_models() -> Vec<&'static str> {
10	crate::catalog::FALLBACK_MODELS.to_vec()
11}
12
13/// Models marked experimental by project policy (GLM-5.3 Flash and GLM-5.3).
14pub fn experimental_models() -> Vec<&'static str> {
15	crate::catalog::EXPERIMENTAL_MODELS.to_vec()
16}
17
18#[cfg(test)]
19mod tests {
20	use super::*;
21
22	#[test]
23	fn fallback_first_is_default() {
24		assert_eq!(fallback_models()[0], crate::DEFAULT_MODEL);
25	}
26
27	#[test]
28	fn glm_is_not_first_in_fallback() {
29		let models = fallback_models();
30		// The fallback list carries the glm-5.3 family; no GLM variant may lead it.
31		assert_ne!(models[0], crate::EXPERIMENTAL_MODEL);
32		assert!(!models[0].contains("glm"));
33		assert!(models.iter().any(|id| id.contains("glm")));
34	}
35
36	#[test]
37	fn experimental_models_covers_glm_family() {
38		assert_eq!(experimental_models(), vec!["@cf/zai-org/glm-5.3-flash", "@cf/zai-org/glm-5.3"]);
39	}
40
41	#[test]
42	fn fallback_omits_safety_model() {
43		assert!(!fallback_models().contains(&"@cf/meta/llama-guard-3-8b"));
44	}
45}