Skip to content

Fix buf dep graph --format json silently dropping dependencies#4419

Merged
emcfarlane merged 2 commits intobufbuild:mainfrom
CGA1123:cga1123/dep-graph-json
Mar 31, 2026
Merged

Fix buf dep graph --format json silently dropping dependencies#4419
emcfarlane merged 2 commits intobufbuild:mainfrom
CGA1123:cga1123/dep-graph-json

Conversation

@CGA1123
Copy link
Copy Markdown
Contributor

@CGA1123 CGA1123 commented Mar 30, 2026

The addDeps method had a return nil that exited the entire loop after encountering the first already-seen dependency, causing all subsequent dependencies to be silently dropped from the JSON output. Changed to continue so the loop processes all dependencies.

Adds a regression test with a three-module workspace (alpha, common, zeta) where zeta depends on both alpha and common. Because modules are walked alphabetically, both of zeta's deps are already in the seen map when zeta is processed, which triggered the early return.

The addDeps method had a `return nil` that exited the entire loop after
encountering the first already-seen dependency, causing all subsequent
dependencies to be silently dropped from the JSON output. Changed to
`continue` so the loop processes all dependencies.

Adds a regression test with a three-module workspace (alpha, common,
zeta) where zeta depends on both alpha and common. Because modules are
walked alphabetically, both of zeta's deps are already in the seen map
when zeta is processed, which triggered the early return.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@emcfarlane emcfarlane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! Looks good.

@emcfarlane emcfarlane merged commit 540c848 into bufbuild:main Mar 31, 2026
10 checks passed
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.

2 participants