Skip to content

Revdeps

Shon Feder edited this page Dec 19, 2025 · 3 revisions

The reverse dependencies (revdeps) of a package P is the set of package versions that depend on P. By checking their revdeps when new package versions are pending publication, we are able to detect breaking API changes. Failure of these checks indicates either

  1. an unintended breaking API change, or
  2. the need to add upper bounds to the dependencies, as a result of an intended API change.

To see what will be tested by the revdeps checks you can run opam list --depends-on <target-package> --recursive --all --depopts --all-versions. We only test revdeps on the latest ocaml 4 and ocaml 5 compilers on Ubuntu.

When a package pending publication has intended breaking changes, it is necessary to put an upper bound on all of its revdeps. E.g., if package foo.0.2.0 is introducing changes that cause a subset of its revdeps, S, to fail the revdeps check, then all the packages in S should be given the upper bound to their dependency on foo thus: "foo" {< "0.2.0"}. Adding upper bounds ensures that any installation of one of these package versions will install a version of foo with which they are compatible.

You can use opam admin add-constraint to automatically add upper bounds to all the revdeps of a package, or to a select subset of packages. Run opam admin add-constraint --help to see the docs on its usage.

Clone this wiki locally