My aggregated monorepo of OCaml code, automaintained
0
fork

Configure Feed

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

day11/doc: include blessed status and dep compile hashes in layer hash

The compile layer hash now depends on:
- blessed status (affects output path structure)
- dep compile layer hashes (compile reads dep .odoc for cross-refs)

Previously the compile hash only depended on the build hash and tool
hash, meaning changes to deps' .odoc output or blessed status wouldn't
invalidate the compile cache.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+21 -19
+21 -19
day11/doc/generate.ml
··· 120 120 ~build_hash_blessed ~find_odoc_tool node with 121 121 | None -> None 122 122 | Some (composite_tool_hash, universe, blessed, _pkg_loc, mounts, prep_dir) -> 123 - (* Collect dep compile layer dirs for overlayfs stacking *) 123 + (* Collect dep compile layers for overlayfs stacking *) 124 124 let seen = Hashtbl.create 16 in 125 125 List.iter (collect_transitive_deps seen) node.deps; 126 - let dep_compile_dirs = Hashtbl.fold (fun bh () acc -> 126 + let dep_compile_layers = Hashtbl.fold (fun bh () acc -> 127 127 match Hashtbl.find_opt compile_results bh with 128 - | Some bl -> Build.dir ~os_dir bl :: acc 128 + | Some bl -> bl :: acc 129 129 | None -> acc 130 130 ) seen [] in 131 + let dep_compile_dirs = List.map (Build.dir ~os_dir) dep_compile_layers in 132 + let dep_compile_hashes = List.map (fun (bl : build) -> bl.hash) 133 + dep_compile_layers in 131 134 let cmd = 132 135 "export PATH=/home/opam/doc-tools/bin:$PATH && eval $(opam env) && " ^ 133 136 Command.odoc_driver_voodoo ~pkg:node.pkg ~universe 134 137 ~blessed ~actions:"compile-only" ~odoc_bin ~odoc_md_bin in 135 138 let hash = Day11_layer.Hash.of_strings 136 - [ "compile"; node.hash; composite_tool_hash ] in 139 + ([ "compile"; node.hash; composite_tool_hash; 140 + (if blessed then "blessed" else "unblessed") ] 141 + @ dep_compile_hashes) in 137 142 let compile_node : build = 138 143 { hash; pkg = node.pkg; deps = [ node ]; universe = Day11_solution.Universe.dummy } in 139 144 let on_extract ~layer_dir ~success:_ = ··· 205 210 Command.odoc_driver_voodoo ~pkg:node.pkg ~universe 206 211 ~blessed ~actions:"link-and-gen" ~odoc_bin ~odoc_md_bin in 207 212 let hash = Day11_layer.Hash.of_strings 208 - ([ "link"; compile_bl.hash; universe; composite_tool_hash ] 213 + ([ "link"; compile_bl.hash; universe; composite_tool_hash; 214 + (if blessed then "blessed" else "unblessed") ] 209 215 @ dep_hashes) in 210 216 let link_node : build = 211 217 { hash; pkg = node.pkg; ··· 239 245 240 246 let doc_all_package env benv ~os_dir ~driver_tool ~odoc_tools 241 247 ~build_hash_blessed ~find_odoc_tool ~compile_results 242 - ~build_hash ~universe_hashes 248 + ~build_hash ~universe_hashes:_ 243 249 (node : build) = 244 250 match prepare_package ~os_dir ~driver_tool ~odoc_tools 245 251 ~build_hash_blessed ~find_odoc_tool node with 246 252 | None -> None 247 253 | Some (composite_tool_hash, universe, blessed, _pkg_loc, mounts, prep_dir) -> 248 - (* Collect dep compile layer dirs for overlayfs stacking *) 254 + (* Collect dep compile layers for overlayfs stacking + hash *) 249 255 let seen = Hashtbl.create 16 in 250 256 List.iter (collect_transitive_deps seen) node.deps; 251 - let dep_compile_dirs = Hashtbl.fold (fun bh () acc -> 257 + let dep_compile_layers = Hashtbl.fold (fun bh () acc -> 252 258 match Hashtbl.find_opt compile_results bh with 253 - | Some bl -> Build.dir ~os_dir bl :: acc 259 + | Some bl -> bl :: acc 254 260 | None -> acc 255 261 ) seen [] in 262 + let dep_compile_dirs = List.map (Build.dir ~os_dir) dep_compile_layers in 263 + let dep_compile_hashes = List.map (fun (bl : build) -> bl.hash) 264 + dep_compile_layers in 256 265 (* HTML RW mount — mount entire html dir so global assets (css, js) 257 266 and per-package output both land in the shared dir *) 258 267 let html_base = Fpath.(os_dir / "html") in 259 268 let html_mount = Day11_container.Mount.bind_rw 260 269 ~src:(Fpath.to_string html_base) 261 270 Odoc_store.container_html in 262 - let dep_compile_layers = 263 - List.filter_map (fun dep_bh -> 264 - if String.equal dep_bh build_hash then None 265 - else Hashtbl.find_opt compile_results dep_bh 266 - ) universe_hashes 267 - in 268 - let dep_hashes = List.map (fun (bl : build) -> bl.hash) 269 - dep_compile_layers in 270 271 let cmd = 271 272 "export PATH=/home/opam/doc-tools/bin:$PATH && eval $(opam env) && " ^ 272 273 Command.odoc_driver_voodoo ~pkg:node.pkg ~universe 273 274 ~blessed ~actions:"all" ~odoc_bin ~odoc_md_bin in 274 275 let hash = Day11_layer.Hash.of_strings 275 - ([ "doc-all"; node.hash; universe; composite_tool_hash ] 276 - @ dep_hashes) in 276 + ([ "doc-all"; node.hash; universe; composite_tool_hash; 277 + (if blessed then "blessed" else "unblessed") ] 278 + @ dep_compile_hashes) in 277 279 let doc_node : build = 278 280 { hash; pkg = node.pkg; 279 281 deps = [ node ] @ dep_compile_layers; universe = Day11_solution.Universe.dummy } in