···3232 manager;
3333 }
34343535-let contains ~needle haystack =
3636- Re.execp (Re.compile (Re.str needle)) haystack
3535+let contains ~needle haystack = Re.execp (Re.compile (Re.str needle)) haystack
37363837(* A plain RUN step's command key always contains its full space-joined argv, so
3938 two RUN steps that differ in any argument are distinct steps. *)
···5756 let p = atom p and o1 = atom o1 and o2 = atom o2 in
5857 let id po o = Cache_key.step_id ~parent_id:po ~op_key:o in
5958 check (String.equal (id p o1) (id p o1));
6060- if String.compare o1 o2 <> 0 then check (String.compare (id p o1) (id p o2) <> 0)
5959+ if String.compare o1 o2 <> 0 then
6060+ check (String.compare (id p o1) (id p o2) <> 0)
61616262let suite =
6363 ( "cache_key",
···11+(** Cache key fuzz suite. *)
22+13val suite : string * Alcobar.test_case list
24(** Property/fuzz tests for {!Builder.Cache_key}: a plain RUN command key keeps
33- its full argv, a package-manager step keys only on its manager tag
44- (identity comes from the resolved layer), and the step id is injective in its
55- op key and parent. *)
55+ its full argv, a package-manager step keys only on its manager tag (identity
66+ comes from the resolved layer), and the step id is injective in its op key
77+ and parent. *)
···11(** Pure, deterministic cache-key components for build steps.
2233- A build step's cache identity is hashed from its resolved plan; these are the
44- parts of that hash that depend only on the plan (not on engine backend/store
55- state). They are factored out here so the keying — where a wrong key silently
66- reuses another step's layer — can be unit-tested and fuzzed in isolation. *)
33+ A build step's cache identity is hashed from its resolved plan; these are
44+ the parts of that hash that depend only on the plan (not on engine
55+ backend/store state). They are factored out here so the keying — where a
66+ wrong key silently reuses another step's layer — can be unit-tested and
77+ fuzzed in isolation. *)
7889val digest : string -> string
910(** [digest s] is the hex SHA-256 of [s], the hash the step ids fold through. *)
···21222223val network_key : Plan.run -> string
2324(** [network_key r] is the cache-key fragment for a step's resolved network
2424- mode, so equivalent hints ([\[\]] and [\["default"\]]) share an entry. *)
2525+ mode, so equivalent hints ([[]] and [["default"]]) share an entry. *)
25262627val env_key : (string * string) list -> string
2728(** [env_key env] formats a step's environment for the cache key. *)
···32333334val step_id : parent_id:string -> op_key:string -> string
3435(** [step_id ~parent_id ~op_key] is a step's content id: the parent chain's id
3535- folded with this step's op key, so the id pins the step and all it builds on.
3636- Deterministic and collision-resistant in [op_key] for a fixed [parent_id]. *)
3636+ folded with this step's op key, so the id pins the step and all it builds
3737+ on. Deterministic and collision-resistant in [op_key] for a fixed
3838+ [parent_id]. *)
···1818 manager;
1919 }
20202121-let neq msg a b =
2222- Alcotest.(check bool) msg true (String.compare a b <> 0)
2121+let neq msg a b = Alcotest.(check bool) msg true (String.compare a b <> 0)
23222423(* A package-manager step keys ONLY on its manager, not the command words: its
2524 identity is the resolved layer (carried in the engine's backend run key), so
···3130 let bar = run ~manager:(Some "apk") ~argv:[ "apk"; "add"; "bar" ] () in
3231 Alcotest.(check string)
3332 "a pkg command key is the manager tag, independent of the command words"
3434- (Cache_key.command_key foo) (Cache_key.command_key bar);
3535- neq "different managers are still distinct" (Cache_key.command_key foo)
3333+ (Cache_key.command_key foo)
3434+ (Cache_key.command_key bar);
3535+ neq "different managers are still distinct"
3636+ (Cache_key.command_key foo)
3637 (Cache_key.command_key
3738 (run ~manager:(Some "opam") ~argv:[ "apk"; "add"; "foo" ] ()))
3839