resolveSourceUrl
Multi-repo resolution shared by every source-link producer (the diagram enrichment, the function-metrics report, the descriptions report) so a file resolves to the same link everywhere. Two strategies, in order:
Absolute-path prefix — pick the Context whose
gitRootis the deepest prefix of absoluteFile (handles nested repos / a repo inside another checkout). This is the common case once the analyzer reports an on-disk absolute path.Relative-path probe — when no absolute match, try
<gitRoot>/<relativePath>in each repo; first existing file wins. Skips blank //usr…/bazel-out/…paths that can't be tracked source.
Returns null when nothing matches (caller renders the location without a link). Empty contexts ⇒ always null.