atmosphere: a blend is a value, and one parser owns the name
Atmosphere::lerp returned an endpoint at t=0.5 and apologised for it in a comment — the enum had nowhere to put a blend. It has one now: Custom carries the four tones, so a room halfway from MintTea to NeonGlow can be stored, compared and sent, not only drawn. Unnameable by construction, so nothing can ask for a blend by name and get a room she never chose. Presence::lerped_colors re-derived the same blend itself, which is why the broken lerp could sit there for months without anything looking wrong. It calls this one now. Three copies of the name→preset match existed — presence, tuie_app, and from_name — and they disagreed about a typo: ignore it, silently fall back to Default, or refuse. One table. What each caller does with None stays at the call site, because those really are different decisions: a misspelling from outside must not undo the room she picked, and one from the settings enum is a bug here. The file also claimed to be unwired scaffolding while main.rs, presence and the tool all used it.
This commit is contained in:
parent
7d8a8f996f
commit
2217de84ff
19 changed files with 297 additions and 161 deletions
|
|
@ -669,7 +669,6 @@ pub struct ErrorResponse {
|
|||
pub message: String,
|
||||
}
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
@ -684,7 +683,9 @@ mod tests {
|
|||
let msg = parse(r#"{"role":"user","content":"plain text"}"#);
|
||||
assert!(matches!(msg.content, MessageContent::Text(ref t) if t == "plain text"));
|
||||
|
||||
let conv = msg.to_conversation_message().expect("legacy content is valid");
|
||||
let conv = msg
|
||||
.to_conversation_message()
|
||||
.expect("legacy content is valid");
|
||||
assert_eq!(conv.role, MessageRole::User);
|
||||
assert_eq!(
|
||||
conv.blocks,
|
||||
|
|
@ -774,8 +775,7 @@ mod tests {
|
|||
.unwrap();
|
||||
|
||||
let line = serde_json::to_string(&conv).unwrap();
|
||||
let back: crate::core::session::ConversationMessage =
|
||||
serde_json::from_str(&line).unwrap();
|
||||
let back: crate::core::session::ConversationMessage = serde_json::from_str(&line).unwrap();
|
||||
assert_eq!(back.blocks, conv.blocks);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue