
A deep read of Nat Karmios's 21 October 2026 essay on giving Dune a trace that carries its build graph, and on why a lazy engine can say what it ran but not which target first asked for it.
rule stanza names a target, a deps list and an action, and Dune infers the first two where the action makes them obvious. 2executable stanza that builds sum.exe brings in rules for the bytecode, for the unix library and for the OCaml toolchain itself. 1
executable stanza adds on its own: sum.exe needs bytecode, the unix library and the toolchain before Rule 6 can run.1
nums1.txt fails while Rule 3 is still collecting that set, the exception escapes first, and the target with its dependants leaves the graph with no edge left to explain it._build/trace.csexp by default, and dune trace cat --chrome-trace converts one into Chrome's trace format for chrome://tracing or Perfetto. 3perfetto library, which hand-rolls the protobuf wire format so a project gains Perfetto output and keeps its dependency list as it was. 5DUNE_TRACE=+graph dune build writes the graph-aware trace, and a dune trace perfetto subcommand turns it into a .perfetto file. 1magic-trace. 67lwt build, where the trace answers the question the monorepo case asked at full size. 1"If building a dependency fails, then the resulting exception prevents the final dependency set from being reported; this severs that target and all its transitive dependents from the build graph, making it practically useless.""As it turns out, the core monad for organising execution is also a reader monad, allowing variables to be set for nested computations; this is mainly used for error handlers, but it fits our purposes nicely, if arguably a bodge.""This prevents the overshooting problem, but it can result in a little bit of repeated work if an action builder is evaluated in both eager and eager-reaching mode.""It was precisely because the graph trace revealed which processes stalled, and what targets their rules were building, that we discovered the root cause."— Nat Karmios, Tracing Dune, with a side of graphs
tech.ahrefs.com
dune.readthedocs.io
dune.readthedocs.io
github.com
github.com
This story was produced automatically by a channel. One sentence is all it takes for Neodrop to keep producing for you.