CCSDS Synchronization and Channel Coding (131.0-B, 231.0-B)
0
fork

Configure Feed

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

csvt: use Textloc.Error.t natively with Path/Sort context

Same refactor pattern as xmlt (d786b041, 067b745c):

- Dropped the custom error ADT (Missing_header, Missing_column,
Bad_value, Truncated_row, Encode_error, Invalid_utf8), error_to_string,
pp_error.
- module Error = Textloc.Error (re-exports shared infrastructure).
- module Sort = Row | Field | Header with to_string, pp, kinded,
or_kind.
- Internal helpers raise Textloc.Error.msgf/msg; try/with at boundaries.
- decode/decode_string/decode_channel/decode_file/fold_channel/fold_file
now return (_, string) result.
- Added primed variants returning (_, Error.t) result.
- Path threading: push_array for row index, push_object for column
name -- errors carry structural context.
- Added ?max_rows / ?max_cols limits on decode.
- Kept Invalid_utf8_encode of int exception.

Tests tightened to STRUCTURAL assertions (exact frames list, exact
message) instead of substring checks.

Same tightening retrofitted to xmlt's context tests -- 12 tests
now assert exact Textloc.Error.t shape (full frame list including
outer-first ordering, exact message) rather than 'contains'.

Downstream fixes: ocaml-cdm collapses its typed error ADT to
[Parse_error of string]; 38 interop test files updated from
[Alcotest.failf "%a" Csvt.pp_error e] to ["%s" e].

csvt: 60 tests pass. xmlt: 177 tests pass.

+3 -5
+3 -5
test/interop/dariol83/test.ml
··· 37 37 let parse_cltu_rows () = 38 38 match Csvt.decode_file cltu_codec (trace "cltu.csv") with 39 39 | Ok rows -> rows 40 - | Error e -> Alcotest.failf "failed to parse cltu.csv: %a" Csvt.pp_error e 40 + | Error e -> Alcotest.failf "failed to parse cltu.csv: %s" e 41 41 42 42 let cltu_encode (r : cltu_row) () = 43 43 let tc_frame = bytes_of_hex r.tc_frame_hex in ··· 106 106 let parse_rand_rows () = 107 107 match Csvt.decode_file rand_codec (trace "randomizer.csv") with 108 108 | Ok rows -> rows 109 - | Error e -> 110 - Alcotest.failf "failed to parse randomizer.csv: %a" Csvt.pp_error e 109 + | Error e -> Alcotest.failf "failed to parse randomizer.csv: %s" e 111 110 112 111 let randomize (r : rand_row) () = 113 112 let input = bytes_of_hex r.input_hex in ··· 161 160 let parse_rs_rows () = 162 161 match Csvt.decode_file rs_codec (trace "reed_solomon.csv") with 163 162 | Ok rows -> rows 164 - | Error e -> 165 - Alcotest.failf "failed to parse reed_solomon.csv: %a" Csvt.pp_error e 163 + | Error e -> Alcotest.failf "failed to parse reed_solomon.csv: %s" e 166 164 167 165 let test_rs_encode (r : rs_row) () = 168 166 let data = bytes_of_hex r.data_hex in