{"record":{"id":"6276939de620824d","repo":"Hmbown/CodeWhale","slug":"serialize-tui-path","errorCode":null,"errorMessage":"serialize TUI path","messagePattern":"serialize TUI path","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/models/src/lib.rs","lineNumber":910,"sourceCode":"        );\n\n        let via_tui_path = MessageRequest {\n            model: \"model\".to_string(),\n            messages: vec![],\n            max_tokens: 1024,\n            system: None,\n            tools: None,\n            tool_choice: None,\n            metadata: None,\n            thinking: None,\n            reasoning_effort: None,\n            stream: Some(true),\n            temperature: None,\n            top_p: None,\n        };\n        let via_core_path: codewhale_core::request::MessageRequest = via_tui_path.clone();\n        assert_eq!(\n            serde_json::to_vec(&via_tui_path).expect(\"serialize TUI path\"),\n            serde_json::to_vec(&via_core_path).expect(\"serialize core path\")\n        );\n    }\n\n    #[test]\n    fn interrupted_assistant_role_round_trips_as_distinct_session_item() {\n        let message = Message {\n            role: Role::InterruptedAssistant,\n            content: vec![ContentBlock::Text {\n                text: \"partial output\".to_string(),\n                cache_control: None,\n            }],\n        };\n        let encoded = serde_json::to_string(&message).expect(\"message should serialize\");\n        let decoded: Message = serde_json::from_str(&encoded).expect(\"message should deserialize\");\n        assert_eq!(decoded, message);\n        assert_ne!(decoded.role, \"assistant\");\n    }","sourceCodeStart":892,"sourceCodeEnd":928,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/crates/models/src/lib.rs#L892-L928","documentation":"A test-only expect(\"serialize TUI path\") panic: serde_json::to_vec failed on the MessageRequest built via the TUI-crate path. The test proves the historical TUI MessageRequest is the same type as codewhale_core::request::MessageRequest and serializes identically; this panic means the TUI-constructed value itself could not be serialized (bad field value), breaking that equivalence guarantee.","triggerScenarios":"Thrown at crates/models/src/lib.rs:910 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the serde error to find which MessageRequest field failed (e.g. a custom Serialize impl returning an error)","Fix the field construction in the test or the Serialize impl in the type","Keep both paths (TUI and core) building the identical struct so byte-equality holds"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}