CCSDS File Delivery Protocol (CCSDS 727.0-B-5) for space file transfer
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

irmin: add Schema.dispatch for path-based type selection

New Schema.dispatch combinator selects child schema based on the
step name. Enables heterogeneous stores where different paths hold
different types (mirage/irmin#931 use cases).

Tests for three use cases from the original irmin schema RFC:
- Tezos-style heterogeneous store (camels/** vs cacti/**)
- File-suffix type dispatch (*.json -> JSON, *.md -> opaque)
- Per-region merge annotations (LWW, CRDT counter)

+96 -29
test/interop/dariol83/scripts/generate.sh
+7
test/interop/dariol83/traces/keep_alive.csv
··· 1 + name,source_entity,dest_entity,seq_nr,entity_id_len,seq_nr_len,direction,mode,progress,large_file,pdu_hex 2 + ka_zero,1,2,1,1,1,toward_sender,ack,0,False,280005000101020c00000000 3 + ka_256,1,2,1,1,1,toward_sender,ack,256,False,280005000101020c00000100 4 + ka_1mb,1,2,1,1,1,toward_sender,ack,1048576,False,280005000101020c00100000 5 + ka_deadbeef,1,2,1,1,1,toward_sender,ack,3735928559,False,280005000101020cdeadbeef 6 + ka_2b_eid,1,2,1,2,4,toward_sender,ack,65536,False,2800051300010000000100020c00010000 7 + ka_large_file,1,2,1,1,1,toward_sender,ack,281483566841860,True,290009000101020c0001000200030004
+82 -29
test/interop/spacepackets/test.ml
··· 1037 1037 Alcotest.(check string) (r.name ^ " exact bytes") r.pdu_hex our_hex) 1038 1038 rows 1039 1039 1040 - (* {1 KeepAlive Traces} 1040 + (* {1 KeepAlive Traces — dariol83/ccsds (Java) reference} 1041 1041 1042 - spacepackets 0.31.0 has a confirmed bug: KeepAlivePdu.pack() uses 1043 - struct.pack("I", progress) instead of struct.pack("!I", progress), 1044 - producing native (little-endian on x86/ARM) instead of big-endian. 1042 + Reference bytes generated by dariol83/ccsds (eu.dariolucia.ccsds.cfdp), 1043 + an independent Java CFDP implementation with full Class 2 support 1044 + including KeepAlive PDU encode/decode. See ../dariol83/ for the 1045 + trace generator. 1045 1046 1046 - Traces are generated with a monkey-patched spacepackets that fixes 1047 - the byte order in pack(). The CSV also records the buggy output so 1048 - we can verify the two encodings diverge for progress > 255. *) 1047 + spacepackets 0.31.0 has a confirmed byte-order bug in KeepAlivePdu.pack(): 1048 + struct.pack("I", progress) instead of struct.pack("!I", progress). 1049 + The spacepackets traces (keep_alive.csv with buggy_hex column) document 1050 + the divergence against dariol83's correct output. *) 1051 + 1052 + let dariol83_trace path = 1053 + Filename.concat (Filename.concat "traces" "dariol83") path 1049 1054 1050 1055 type keep_alive_row = { 1051 1056 name : string; ··· 1059 1064 progress : int64; 1060 1065 large_file : bool; 1061 1066 pdu_hex : string; 1062 - buggy_hex : string; 1063 1067 } 1064 1068 1065 1069 let keep_alive_codec = ··· 1068 1072 obj 1069 1073 (fun 1070 1074 name 1071 - _pdu_type 1072 1075 source_entity 1073 1076 dest_entity 1074 1077 seq_nr ··· 1079 1082 progress 1080 1083 large_file 1081 1084 pdu_hex 1082 - buggy_hex 1083 1085 -> 1084 1086 { 1085 1087 name; ··· 1090 1092 seq_nr_len; 1091 1093 direction; 1092 1094 mode; 1093 - progress = Int64.of_int progress; 1095 + progress; 1094 1096 large_file; 1095 1097 pdu_hex; 1096 - buggy_hex; 1097 1098 }) 1098 1099 |> col "name" string ~enc:(fun r -> r.name) 1099 - |> col "pdu_type" string ~enc:(fun _ -> "keep_alive") 1100 1100 |> col "source_entity" int ~enc:(fun r -> r.source_entity) 1101 1101 |> col "dest_entity" int ~enc:(fun r -> r.dest_entity) 1102 1102 |> col "seq_nr" int ~enc:(fun r -> r.seq_nr) ··· 1104 1104 |> col "seq_nr_len" int ~enc:(fun r -> r.seq_nr_len) 1105 1105 |> col "direction" string ~enc:(fun r -> r.direction) 1106 1106 |> col "mode" string ~enc:(fun r -> r.mode) 1107 - |> col "progress" int ~enc:(fun r -> Int64.to_int r.progress) 1107 + |> col "progress" int64 ~enc:(fun r -> r.progress) 1108 1108 |> col "large_file" bool ~enc:(fun r -> r.large_file) 1109 1109 |> col "pdu_hex" string ~enc:(fun r -> r.pdu_hex) 1110 - |> col "buggy_hex" string ~enc:(fun r -> r.buggy_hex) 1111 1110 |> finish)) 1112 1111 1113 1112 let test_decode_keep_alive () = 1114 1113 let rows = 1115 - match Csvt.decode_file keep_alive_codec (trace "keep_alive.csv") with 1114 + match 1115 + Csvt.decode_file keep_alive_codec (dariol83_trace "keep_alive.csv") 1116 + with 1116 1117 | Ok rows -> rows 1117 1118 | Error e -> Alcotest.failf "CSV decode: %a" Csvt.pp_error e 1118 1119 in ··· 1134 1135 1135 1136 let test_encode_keep_alive () = 1136 1137 let rows = 1137 - match Csvt.decode_file keep_alive_codec (trace "keep_alive.csv") with 1138 + match 1139 + Csvt.decode_file keep_alive_codec (dariol83_trace "keep_alive.csv") 1140 + with 1138 1141 | Ok rows -> rows 1139 1142 | Error e -> Alcotest.failf "CSV decode: %a" Csvt.pp_error e 1140 1143 in ··· 1168 1171 let pdu = Cfdp.Pdu_directive (hdr, Cfdp.Keep_alive ka) in 1169 1172 let encoded = Cfdp.encode config pdu in 1170 1173 let our_hex = string_to_hex encoded in 1171 - Alcotest.(check string) (r.name ^ " exact bytes") r.pdu_hex our_hex) 1174 + Alcotest.(check string) (r.name ^ " matches dariol83") r.pdu_hex our_hex) 1172 1175 rows 1173 1176 1177 + (** Verify that spacepackets 0.31.0 KeepAlive output diverges from dariol83 for 1178 + progress > 255. The spacepackets CSV has both [pdu_hex] (monkey-patched 1179 + correct) and [buggy_hex] (unpatched LE). *) 1180 + 1181 + type spacepackets_ka_row = { 1182 + sp_name : string; 1183 + sp_progress : int64; 1184 + sp_pdu_hex : string; 1185 + sp_buggy_hex : string; 1186 + } 1187 + 1188 + let spacepackets_ka_codec = 1189 + Csvt.( 1190 + Row.( 1191 + obj 1192 + (fun 1193 + name 1194 + _pdu_type 1195 + _src 1196 + _dst 1197 + _seq 1198 + _eidl 1199 + _seql 1200 + _dir 1201 + _mode 1202 + progress 1203 + _lf 1204 + pdu_hex 1205 + buggy_hex 1206 + -> 1207 + { 1208 + sp_name = name; 1209 + sp_progress = progress; 1210 + sp_pdu_hex = pdu_hex; 1211 + sp_buggy_hex = buggy_hex; 1212 + }) 1213 + |> col "name" string ~enc:(fun _ -> "") 1214 + |> col "pdu_type" string ~enc:(fun _ -> "") 1215 + |> col "source_entity" int ~enc:(fun _ -> 0) 1216 + |> col "dest_entity" int ~enc:(fun _ -> 0) 1217 + |> col "seq_nr" int ~enc:(fun _ -> 0) 1218 + |> col "entity_id_len" int ~enc:(fun _ -> 0) 1219 + |> col "seq_nr_len" int ~enc:(fun _ -> 0) 1220 + |> col "direction" string ~enc:(fun _ -> "") 1221 + |> col "mode" string ~enc:(fun _ -> "") 1222 + |> col "progress" int64 ~enc:(fun _ -> 0L) 1223 + |> col "large_file" bool ~enc:(fun _ -> false) 1224 + |> col "pdu_hex" string ~enc:(fun _ -> "") 1225 + |> col "buggy_hex" string ~enc:(fun _ -> "") 1226 + |> finish)) 1227 + 1174 1228 let test_keep_alive_spacepackets_bug () = 1175 1229 let rows = 1176 - match Csvt.decode_file keep_alive_codec (trace "keep_alive.csv") with 1230 + match Csvt.decode_file spacepackets_ka_codec (trace "keep_alive.csv") with 1177 1231 | Ok rows -> rows 1178 1232 | Error e -> Alcotest.failf "CSV decode: %a" Csvt.pp_error e 1179 1233 in 1180 1234 List.iter 1181 - (fun (r : keep_alive_row) -> 1182 - if r.progress <= 255L then 1183 - (* progress fits in one byte — byte order doesn't matter *) 1235 + (fun (r : spacepackets_ka_row) -> 1236 + if r.sp_progress <= 255L then 1184 1237 Alcotest.(check string) 1185 - (r.name ^ " same for small progress") 1186 - r.pdu_hex r.buggy_hex 1238 + (r.sp_name ^ " same for small progress") 1239 + r.sp_pdu_hex r.sp_buggy_hex 1187 1240 else 1188 - (* progress > 255 — buggy output must differ *) 1189 1241 Alcotest.(check bool) 1190 - (r.name ^ " bytes differ (spacepackets LE bug)") 1191 - true (r.pdu_hex <> r.buggy_hex)) 1242 + (r.sp_name ^ " bytes differ (spacepackets LE bug)") 1243 + true 1244 + (r.sp_pdu_hex <> r.sp_buggy_hex)) 1192 1245 rows 1193 1246 1194 1247 (* {1 Test Runner} *) ··· 1249 1302 ] ); 1250 1303 ( "keep-alive-encode", 1251 1304 [ 1252 - Alcotest.test_case "encode KeepAlive matches spec" `Quick 1305 + Alcotest.test_case "encode KeepAlive matches dariol83" `Quick 1253 1306 test_encode_keep_alive; 1254 1307 ] ); 1255 1308 ( "keep-alive-decode", 1256 1309 [ 1257 - Alcotest.test_case "decode KeepAlive hand-built" `Quick 1310 + Alcotest.test_case "decode KeepAlive dariol83 reference" `Quick 1258 1311 test_decode_keep_alive; 1259 1312 ] ); 1260 1313 ( "keep-alive-spacepackets-bug",
+7
test/interop/spacepackets/traces/dariol83/keep_alive.csv
··· 1 + name,source_entity,dest_entity,seq_nr,entity_id_len,seq_nr_len,direction,mode,progress,large_file,pdu_hex 2 + ka_zero,1,2,1,1,1,toward_sender,ack,0,False,280005000101020c00000000 3 + ka_256,1,2,1,1,1,toward_sender,ack,256,False,280005000101020c00000100 4 + ka_1mb,1,2,1,1,1,toward_sender,ack,1048576,False,280005000101020c00100000 5 + ka_deadbeef,1,2,1,1,1,toward_sender,ack,3735928559,False,280005000101020cdeadbeef 6 + ka_2b_eid,1,2,1,2,4,toward_sender,ack,65536,False,2800051300010000000100020c00010000 7 + ka_large_file,1,2,1,1,1,toward_sender,ack,281483566841860,True,290009000101020c0001000200030004