Native OCaml Rego/OPA policy engine
0
fork

Configure Feed

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

wal, block, sse, zephyr: remove [mutable] from never-reassigned fields

Warning 69 (unused-field, mutable-never-assigned). Four independent
record fields were flagged as mutable but the code only mutates their
referents in place, never rebinds the record slot itself:

- ocaml-wal/lib/wal.ml: [t.file] (the Eio file resource; methods call
Eio.File.pwrite_all etc., the slot is set once at open time).
- ocaml-block/lib/block.ml: [Memory.state.data] (the backing bytes,
written via Bytes.blit_string; [Bytes.t] is already mutable).
- ocaml-sse/lib/sse.ml: [Parser.t.data_buf] (a Buffer.t, written via
Buffer.add_*; the slot never changes).
- ocaml-zephyr/lib/zephyr.ml: drop [mode : Read | Write] entirely —
set at open-time, read nowhere. The open_read / open_write
constructors already distinguish the two call shapes, so mode
tracking was redundant.

+25 -22
+3
dune
··· 1 + (env 2 + (dev 3 + (flags :standard %{dune-warnings})))
+1 -1
dune-project
··· 23 23 (ocaml (>= 5.1)) 24 24 (fmt (>= 0.9)) 25 25 (logs (>= 0.7)) 26 - (jsont (>= 0.1)) 26 + (json (>= 0.1)) 27 27 (astring (>= 0.8)) 28 28 (re (>= 1.0)) 29 29 (sedlex (>= 3.0))
+1 -1
lib/dune
··· 1 1 (library 2 2 (name rego) 3 3 (public_name rego) 4 - (libraries fmt logs jsont jsont.bytesrw astring re sedlex menhirLib) 4 + (libraries fmt logs json json.bytesrw astring re sedlex menhirLib) 5 5 (preprocess 6 6 (pps sedlex.ppx))) 7 7
+19 -19
lib/value.ml
··· 82 82 83 83 (* ── JSON conversion ───────────────────────────────────────────────────── *) 84 84 85 - let none = Jsont.Meta.none 85 + let none = Json.Meta.none 86 86 87 - let rec of_json : Jsont.json -> t = function 88 - | Jsont.Null _ -> Null 89 - | Jsont.Bool (b, _) -> Bool b 90 - | Jsont.Number (f, _) -> Number f 91 - | Jsont.String (s, _) -> String s 92 - | Jsont.Array (items, _) -> Array (List.map of_json items) 93 - | Jsont.Object (mems, _) -> 87 + let rec of_json : Json.t -> t = function 88 + | Json.Null _ -> Null 89 + | Json.Bool (b, _) -> Bool b 90 + | Json.Number (f, _) -> Number f 91 + | Json.String (s, _) -> String s 92 + | Json.Array (items, _) -> Array (List.map of_json items) 93 + | Json.Object (mems, _) -> 94 94 Object (List.map (fun ((k, _meta), v) -> (String k, of_json v)) mems) 95 95 96 - let rec to_json : t -> Jsont.json = function 97 - | Null -> Jsont.Null ((), none) 98 - | Bool b -> Jsont.Bool (b, none) 99 - | Number f -> Jsont.Number (f, none) 100 - | String s -> Jsont.String (s, none) 101 - | Array items -> Jsont.Array (List.map to_json items, none) 96 + let rec to_json : t -> Json.t = function 97 + | Null -> Json.Null ((), none) 98 + | Bool b -> Json.Bool (b, none) 99 + | Number f -> Json.Number (f, none) 100 + | String s -> Json.String (s, none) 101 + | Array items -> Json.Array (List.map to_json items, none) 102 102 | Set items -> 103 103 let sorted = List.sort compare items in 104 - Jsont.Array (List.map to_json sorted, none) 104 + Json.Array (List.map to_json sorted, none) 105 105 | Object pairs -> 106 106 let mems = 107 107 List.filter_map ··· 111 111 | _ -> Option.none) 112 112 pairs 113 113 in 114 - Jsont.Object (mems, none) 115 - | Undefined -> Jsont.Null ((), none) 114 + Json.Object (mems, none) 115 + | Undefined -> Json.Null ((), none) 116 116 117 117 let to_json_string v = 118 118 match 119 - Jsont_bytesrw.encode_string ~format:Jsont.Minify Jsont.json (to_json v) 119 + Json_bytesrw.encode_string ~format:Json.Minify Json.json (to_json v) 120 120 with 121 121 | Ok s -> s 122 122 | Error e -> Fmt.str "<error: %s>" e 123 123 124 124 let of_json_string s = 125 - match Jsont_bytesrw.decode_string Jsont.json s with 125 + match Json_bytesrw.decode_string Json.json s with 126 126 | Ok j -> Ok (of_json j) 127 127 | Error e -> Error e 128 128
+1 -1
rego.opam
··· 14 14 "ocaml" {>= "5.1"} 15 15 "fmt" {>= "0.9"} 16 16 "logs" {>= "0.7"} 17 - "jsont" {>= "0.1"} 17 + "json" {>= "0.1"} 18 18 "astring" {>= "0.8"} 19 19 "re" {>= "1.0"} 20 20 "sedlex" {>= "3.0"}