Skip to content

top-module over-invalidates compile rule with cmi-deps from full (libraries) closure #14477

@robinbb

Description

@robinbb

Summary

dune ocaml top-module rebuilds the top-module artefact when any library declared in the parent stanza's (libraries ...) field has its interface modified — even libraries that are referenced ONLY from .mli (and therefore dropped by top_module.ml's Module.set_source ~ml_kind:Intf None).

Reproducer

(Same setup as the baseline test in #14476.)

A library mylib with (libraries dep_for_intf dep_for_impl), where m.ml references only Dep_for_impl.value and m.mli references only Dep_for_intf.t. After dune ocaml top-module mylib/m.ml initial build, editing dep_for_intf's .mli triggers a rebuild of _build/default/.topmod/mylib/m.ml/mylib__M.cmo despite no reference from m.ml to Dep_for_intf.

Severity

Soundness is preserved (over-rebuilds, never under-rebuilds). The cost is incremental-rebuild perf in iterative dune utop / dune ocaml top-module workflows on monorepos with libraries that have many (libraries ...) deps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions