{"record":{"id":"74526087c81be89c","repo":"xai-org/x-algorithm","slug":"not-implemented-to-thrift-for-dropreason","errorCode":null,"errorMessage":"Not implemented: to_thrift for DropReason","messagePattern":"Not implemented: to_thrift for DropReason","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"visibility-filtering-client/models.rs","lineNumber":279,"sourceCode":"        TType::Struct\n    }\n\n    fn from_thrift(proto: &mut dyn TInputProtocol) -> Self {\n        proto.read_struct_begin().unwrap();\n        loop {\n            let field = proto.read_field_begin().unwrap();\n            if field.field_type == TType::Stop {\n                break;\n            }\n            proto.skip(field.field_type).unwrap();\n            proto.read_field_end().unwrap();\n        }\n        proto.read_struct_end().unwrap();\n        DropReason {}\n    }\n\n    fn to_thrift(&self, _proto: &mut dyn TOutputProtocol) {\n        panic!(\"Not implemented: to_thrift for DropReason\")\n    }\n}\n\nimpl MValCodec for FilteredReason {\n    fn thrift_type() -> TType {\n        TType::Struct\n    }\n\n    fn from_thrift(proto: &mut dyn TInputProtocol) -> Self {\n        proto.read_struct_begin().unwrap();\n        let mut result = FilteredReason::UnspecifiedReason;\n        loop {\n            let field = proto.read_field_begin().unwrap();\n            if field.field_type == TType::Stop {\n                break;\n            }\n            match field.id {\n                Some(1) => {","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/visibility-filtering-client/models.rs#L261-L297","documentation":"DropReason is an empty struct whose Thrift codec implements only decoding; to_thrift panics to mark serialization as unimplemented. It is a placeholder type read from visibility-filtering responses.","triggerScenarios":"Any attempt to write a DropReason value through MValCodec::to_thrift, including generic encode paths and round-trip tests.","commonSituations":"Generic serialization infrastructure that encodes all codec types; refactors that move DropReason into an outbound path.","solutions":["Exclude DropReason from serialization; it carries no data.","If encoding is required, implement to_thrift as an empty struct: write_struct_begin, write_field_stop, write_struct_end.","Replace uses with the protobuf equivalent if it must cross a boundary."],"exampleFix":"// before\nfn to_thrift(&self, _proto: &mut dyn TOutputProtocol) {\n    panic!(\"Not implemented: to_thrift for DropReason\")\n}\n\n// after (empty struct)\nfn to_thrift(&self, proto: &mut dyn TOutputProtocol) {\n    proto.write_struct_begin(&TStructIdentifier::new(\"DropReason\")).unwrap();\n    proto.write_field_stop().unwrap();\n    proto.write_struct_end().unwrap();\n}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"trait WriteCodec { fn to_thrift(&self, p: &mut dyn TOutputProtocol); }\n// DropReason (empty struct) is not WriteCodec; encoders can't reach the panic","tryCatchPattern":"if std::panic::catch_unwind(|| dr.to_thrift(proto)).is_err() { /* no data to serialize; skip */ }","preventionTips":["Use directional codec traits.","Since DropReason is empty, prefer a unit/Option marker instead of serializing it.","Keep generic encoders driven by an explicit allow-list of types."],"tags":["rust","thrift","serialization","codec","visibility-filtering","not-implemented"],"backgroundTag":"thrift-unimplemented-serializer","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}