My aggregated monorepo of OCaml code, automaintained
0
fork

Configure Feed

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

Include tool nodes in doc DAG so their compile layers are stacked

Tool packages like ocaml-compiler have documentable libraries
(stdlib) but aren't in the regular build DAG — they're only in
the tool DAG. Without indexing them in build_by_hash and creating
doc nodes for them, find_dep_compile_layers can't find their
compile layers, causing unresolved cross-references (e.g.
Stdlib.Format.formatter in base's docs).

Fix: add tool nodes to build_by_hash, derive their compilers,
and include them in the doc node creation loop so they get
compile/doc-all nodes and appear in build_to_doc_hash.

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

+9 -2
+9 -2
day11/doc/generate.ml
··· 194 194 result 195 195 in 196 196 List.iter (fun node -> ignore (derive_compiler node)) nodes; 197 + List.iter (fun node -> ignore (derive_compiler node)) tool_nodes; 197 198 (* find_odoc_tool_for_hash: given a build node hash, return the matching odoc tool *) 198 199 let find_odoc_tool_for_hash build_hash = 199 200 match Hashtbl.find_opt node_compiler build_hash with ··· 212 213 |> Option.map (fun (_, _, final) -> final) 213 214 in 214 215 (* Build indexes *) 216 + (* Index ALL nodes (build + tool) by hash so find_dep_compile_layers 217 + can locate dep compile layers for tool packages like ocaml-compiler 218 + that aren't in the regular build DAG but have documentable libs. *) 215 219 let build_by_hash : (string, build) Hashtbl.t = 216 - Hashtbl.create (List.length nodes) in 220 + Hashtbl.create (List.length nodes + List.length tool_nodes) in 217 221 List.iter (fun (node : build) -> 218 222 Hashtbl.replace build_by_hash node.hash node) nodes; 223 + List.iter (fun (node : build) -> 224 + if not (Hashtbl.mem build_by_hash node.hash) then 225 + Hashtbl.replace build_by_hash node.hash node) tool_nodes; 219 226 let needs_split : (string, bool) Hashtbl.t = Hashtbl.create 64 in 220 227 List.iter (fun (_target, (result : Day11_solution.Solve_result.t)) -> 221 228 let compiler = find_compiler result.build_deps in ··· 347 354 Hashtbl.replace compile_nodes node.hash dn 348 355 else 349 356 Hashtbl.replace doc_all_nodes node.hash dn 350 - ) nodes; 357 + ) (nodes @ tool_nodes); 351 358 let patch_doc_deps build_hash (dn : build) = 352 359 let build_node = Hashtbl.find build_by_hash build_hash in 353 360 let seen = Hashtbl.create 16 in