@@ -97,6 +97,14 @@ pub struct FfeResult {
9797 pub allocation_key : MaybeOwnedZendString ,
9898 pub reason : i32 ,
9999 pub error_code : i32 ,
100+ // serial_id is the selected split's serial id, carried for APM span
101+ // enrichment (ffe_flags_enc). The source field is Option<i32>; since the
102+ // C ABI cannot represent Option<i32> as a plain field, we surface the
103+ // presence separately via has_serial_id. Consumers MUST gate on
104+ // has_serial_id (the Pattern B "missing variant => default" semantic) and
105+ // never treat serial_id == 0 as "absent".
106+ pub serial_id : i32 ,
107+ pub has_serial_id : bool ,
100108 pub do_log : bool ,
101109 pub valid : bool ,
102110}
@@ -220,6 +228,8 @@ fn result_from_assignment(assignment: Result<ffe::Assignment, EvaluationError>)
220228 AssignmentReason :: Default => REASON_DEFAULT ,
221229 } ,
222230 error_code : ERROR_NONE ,
231+ serial_id : assignment. serial_id . unwrap_or ( 0 ) ,
232+ has_serial_id : assignment. serial_id . is_some ( ) ,
223233 do_log : assignment. do_log ,
224234 valid : true ,
225235 }
@@ -244,6 +254,8 @@ fn result_from_assignment(assignment: Result<ffe::Assignment, EvaluationError>)
244254 allocation_key : None ,
245255 reason,
246256 error_code,
257+ serial_id : 0 ,
258+ has_serial_id : false ,
247259 do_log : false ,
248260 valid : true ,
249261 }
@@ -258,6 +270,8 @@ fn invalid_result() -> FfeResult {
258270 allocation_key : None ,
259271 reason : REASON_ERROR ,
260272 error_code : ERROR_GENERAL ,
273+ serial_id : 0 ,
274+ has_serial_id : false ,
261275 do_log : false ,
262276 valid : false ,
263277 }
0 commit comments