Skip to content

fix(manifest_ingest): scope Maven pom.xml dependency parsing correctly#2020

Open
kimdzhekhon wants to merge 1 commit into
Graphify-Labs:v8from
kimdzhekhon:fix/pom-dependency-scope-and-groupid-inherit
Open

fix(manifest_ingest): scope Maven pom.xml dependency parsing correctly#2020
kimdzhekhon wants to merge 1 commit into
Graphify-Labs:v8from
kimdzhekhon:fix/pom-dependency-scope-and-groupid-inherit

Conversation

@kimdzhekhon

Copy link
Copy Markdown

Summary

Found via code review, not tied to an existing issue. Two accuracy bugs in _parse_pom():

  1. dependencyManagement/plugin dependencies leaking in as real deps. root.findall(".//dependencies/dependency") searches the entire tree, so it also matched <dependencyManagement><dependencies> entries (version pins, not actual dependencies) and <build><plugins><plugin><dependencies> (build-tool-only deps), producing false depends_on edges. Scoped to root-level <dependencies> plus <profiles><profile><dependencies> — the only legitimate sources of a project's actual dependencies.
  2. Missing groupId/version parent inheritance. A child module commonly omits <groupId>/<version> and inherits them from <parent>. The old code left them unset in that case, so the node id became a bare artifactId instead of group:artifact — silently breaking depends_on edges from any other pom referencing the dependency by full coordinates. Falls back to parent/groupId / parent/version when the top-level element is absent.

Test plan

  • Added 4 tests in tests/test_manifest_ingest.py: top-level deps only picked up; dependencyManagement/plugin deps excluded; groupId inherited from parent; version inherited from parent
  • uv run pytest tests/test_manifest_ingest.py -q -k pom — 6 passed
  • uv run pytest tests/ -q — full suite: 3416 passed (5 pre-existing failures unrelated to this change, missing optional openai dependency in this environment)

_parse_pom() had two accuracy bugs found by code review:

1. root.findall(".//dependencies/dependency") searches the whole tree,
   so it also picked up <dependencyManagement> entries (version pins,
   not real dependencies) and <build><plugins><plugin> dependencies as
   if they were project dependencies, producing false depends_on edges.
   Scoped to root-level <dependencies> plus <profiles><profile>
   dependencies, which are the only legitimate dependency sources.

2. A child module's <groupId>/<version> are commonly omitted and
   inherited from <parent>. The old code left them unset in that case,
   so the node id became a bare artifactId instead of "group:artifact",
   silently breaking depends_on edges from any other pom that references
   the dependency by its full coordinates. Falls back to
   parent/groupId and parent/version when the top-level element is
   absent.

Found via codex-assisted code review, verified against the actual code
before delegating the fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant