Skip to content
Preptima
hardDesignScenarioSeniorStaff

Your monorepo's CI runs the full test suite on every pull request, and it now takes forty minutes regardless of whether someone touched one file or a hundred. How would you fix that?

4 min readUpdated 2026-08-15

Answer

Short answer

Build a dependency graph of the repository's build targets, diff the changed files against it to compute the affected subset, and run only that subset; the graph's correctness, not the diff itself, is what determines whether the speedup is trustworthy.

Was this answer helpful?

Likely follow-ups

  • How would you handle a change to a shared configuration file or a build tool version, which nothing depends on explicitly but which can break everything?
  • What would make you distrust the affected-target result for a given PR and fall back to running everything?
  • How would you test the graph itself for correctness, separately from testing the code it describes?
  • How does this interact with a merge queue, where several PRs land close together and each recomputes an affected set against a slightly different base?

Related questions

Related Topics