graphify icon indicating copy to clipboard operation
graphify copied to clipboard

[Bug]: Maven POM ingestion drops most inter-module `depends_on` edges: inherited groupId and `${...}` properties are not resolved

Open afsantamaria-stratio opened this issue 2 months ago • 1 comments

What happened?

Summary

_parse_pom (graphify/manifest_ingest.py) builds each module's package id and each dependency's id from the literal text of the POM. Two common Maven patterns make those ids disagree, so the depends_on edge points at a node that doesn't exist and is pruned as dangling by build_from_json:

  1. Inherited groupId. A module that takes its groupId from <parent> — the norm in a multi-module reactor — gets the bare id artifactId, because root.findtext("groupId") only reads the module's own top-level element:

    gid = root.findtext("groupId")          # None when inherited from <parent>
    name = f"{gid}:{aid}" if gid else aid   # -> "livy-server", not "org.apache.livy:livy-server"
    

    Dependencies on it always carry a groupId (Maven requires it), so they are emitted as org.apache.livy:livy-server and never match. Such a module can never be the target of an edge.

  2. Unresolved properties. ${project.groupId}, ${scala.binary.version} and any other property are kept verbatim in dependency coordinates (${project.groupId}:livy-rsc, livy-core_${scala.binary.version}), while the target module's own id is written out (org.apache.livy:livy-rsc). No match, no edge.

The failure is silent: nodes for every module are created, only the edges are missing.

Steps to reproduce

apache/livy` (21 modules) shows both causes in one file.

  
  git clone --depth 1 https://github.com/apache/livy.git
  cd livy && graphify update .
  graphify explain "livy-server"
  

  `server/pom.xml` declares four internal dependencies; the graph keeps one:

  | Dependency | `groupId` | `artifactId` | Target's own id | Edge |
  |---|---|---|---|---|
  | `livy-test-lib` | `org.apache.livy` | `livy-test-lib` | `org.apache.livy:livy-test-lib` | ✅ |
  | `livy-rsc` | `${project.groupId}` | `livy-rsc` | `org.apache.livy:livy-rsc` | ❌ (2) |
  | `livy-core` | `${project.groupId}` | `livy-core_${scala.binary.version}` | `livy-core-parent` / `livy-core_2.12` | ❌ (1, 2) |
  | `livy-repl` | `org.apache.livy` | `livy-repl_${scala.binary.version}` | `livy-repl-parent` / `livy-repl_2.12` | ❌ (1, 2) |

  Across the repo:

  - The POMs declare **55** inter-module dependencies; the graph contains **18** `depends_on`
    edges between modules.
  - 8 of the 25 module nodes inherit their groupId (`livy-server`, `livy-core-parent`,
    `livy-repl-parent`, `livy-scala-api-parent`, `livy-integration-test`, `livy-assembly`,
    `livy-beeline`, `livy-coverage-report`). **None of the 18 edges targets any of them.**
  - Asked "which modules depend on `livy-core`?", the graph answers none; the POMs list 8.

Error output or graph output

Inter-module dependencies resolve to their module nodes, as they would under Maven's own effective-POM rules.

Graphify version

0.9.67

Environment

No response

Additional context

No response

afsantamaria-stratio avatar Sep 24 '26 10:09 afsantamaria-stratio

Fixed in v0.9.68 (now on PyPI) by #3823 — thanks @chiliec.

Release: https://github.com/Graphify-Labs/graphify/releases/tag/v0.9.68

safishamsi avatar Sep 25 '26 15:09 safishamsi