{"record":{"id":"41035907e64b7a89","repo":"xai-org/x-algorithm","slug":"not-implemented-to-thrift-for-action","errorCode":null,"errorMessage":"Not implemented: to_thrift for Action","messagePattern":"Not implemented: to_thrift for Action","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"visibility-filtering-client/models.rs","lineNumber":255,"sourceCode":"                        proto.read_field_end().unwrap();\n                    }\n                    proto.read_struct_end().unwrap();\n                    if has_avoid {\n                        result = Action::Avoid;\n                    }\n                }\n                _ => {\n                    proto.skip(field.field_type).unwrap();\n                }\n            }\n            proto.read_field_end().unwrap();\n        }\n        proto.read_struct_end().unwrap();\n        result\n    }\n\n    fn to_thrift(&self, _proto: &mut dyn TOutputProtocol) {\n        panic!(\"Not implemented: to_thrift for Action\")\n    }\n}\n\nimpl MValCodec for DropReason {\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        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        }","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/visibility-filtering-client/models.rs#L237-L273","documentation":"Action's MValCodec implementation is decode-only; calling to_thrift panics with an explicit 'not implemented' message. The type is meant to be read from Thrift responses, not written back.","triggerScenarios":"Encoding an Action enum/struct via MValCodec::to_thrift — e.g. persisting it, sending it in a request, or a round-trip serialization test.","commonSituations":"Generic serializers that iterate all codec impls; new code forwarding Action values over Thrift; test utilities asserting encode/decode symmetry.","solutions":["Do not serialize Action via this codec.","Implement to_thrift by writing the same discriminators/tags the from_thrift reader consumes.","Use the protobuf equivalent (vf_pb) if wire serialization is required."],"exampleFix":"// before\nfn to_thrift(&self, _proto: &mut dyn TOutputProtocol) {\n    panic!(\"Not implemented: to_thrift for Action\")\n}\n\n// after\nfn to_thrift(&self, proto: &mut dyn TOutputProtocol) {\n    // write the same tag/discriminator layout from_thrift parses\n    proto.write_struct_begin(&TStructIdentifier::new(\"Action\")).unwrap();\n    /* field writes mirroring the reader */\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// Action does not implement WriteCodec -> accidental encode fails at compile time","tryCatchPattern":"let r = std::panic::catch_unwind(|| a.to_thrift(proto));\nif r.is_err() { /* skip field or use protobuf representation */ }","preventionTips":["Split codec traits by direction.","Review new outbound paths for Action usage before merge.","Mark decode-only types in code review checklists."],"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"}