Add rake task to generate the in-repo gems dependency graph

What does this MR do and why?

Each in-repo gem pipeline only runs when that gem's own directory changes. A change to gems/gitlab-utils does not test the gems that depend on it, and a change to gems/gitlab-rspec does not test the 6 gems that use it in their test bundle.

To fix this, CI needs to know which gem depends on which. I build that graph from what the repo already records: the PATH sources in Gemfile.lock and Gemfile.next.lock, for the monolith and for every gem in gems/ and vendor/gems/. Nothing new to maintain or keep in sync, and no code analysis for gem-level edges.

  • I read each gem's own lockfile, not only the monolith's. That is the bundle its tests run with, so it includes development dependencies such as gitlab-rspec.
  • The logic is a plain Ruby class in tooling/ with no Rails. CI can run it on a slim Ruby image without the bundle. The follow-up MR does this.
  • The rake task gems:dependency_graph prints the graph as JSON, so we can publish it regularly later. Publishing is not part of this MR.
  • Current graph: 44 nodes (the monolith . plus 43 gems). Only 8 gems depend on other in-repo gems.

This is step 1 of 2.

Dependencies inside the monolith (domains/, bounded contexts) and Rubydex are out of scope. The graph can grow to include them later.

monolith-dependencies.json (rake gems:dependency_graph)

monolith-dependencies-2026-10-02.pdf (rake "gems:dependency_graph[mermaid]" then exported to PDF)

References

Screenshots or screen recordings

Does not apply. No UI change.

How to set up and validate locally

  1. Run bundle exec rake gems:dependency_graph. It prints the graph as JSON.
  2. Check an entry. For example, gems/gitlab-http lists ["gems/gitlab-rspec", "gems/gitlab-utils"].
  3. Run bundle exec rake "gems:dependency_graph[mermaid]". It prints the same graph as a Mermaid flowchart.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Fabio Pitino

Merge request reports

Loading
Loading