Skip to content

Add dependency maintainer data command - #215

Merged
andrew merged 5 commits into
git-pkgs:mainfrom
abhinavgautam01:feature/maintainer-data-111
Jun 5, 2026
Merged

andrew merged 5 commits into
git-pkgs:mainfrom
abhinavgautam01:feature/maintainer-data-111

Conversation

@abhinavgautam01

Copy link
Copy Markdown
Contributor

Closes #111

Summary

  • Add git pkgs maintainers to show package maintainer counts and identities
  • Add --single to highlight dependencies with exactly one maintainer
  • Add --all to include transitive lockfile dependencies
  • Support ecosystem/ref filters and JSON output
  • Document the new command in README and internals docs

Testing

  • go test ./cmd -run 'TestMaintainer|TestPagerFlagAccepted'
  • go build ./...
  • go test ./...
  • go test -race ./...
  • go tool golangci-lint run ./...
  • git diff --check
  • go run . maintainers --help

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a new git pkgs maintainers command to surface package maintainer identity/count data from registries, supporting supply-chain review workflows (e.g., identifying single-maintainer dependencies).

Changes:

  • Introduces git pkgs maintainers with --single, --all, ecosystem filtering, and JSON/text output.
  • Wires the new command into the CLI and pager-flag acceptance tests.
  • Updates user-facing docs (README) and internal architecture docs to describe maintainer data fetching.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
README.md Documents the new maintainers command, examples, and notes it among network-backed commands.
docs/internals.md Describes maintainer data as extrinsic registry data fetched directly via registries.
cmd/root.go Registers the new maintainers subcommand.
cmd/pager_test.go Ensures maintainers accepts the global --pager flag.
cmd/maintainers.go Implements the maintainers command, output formatting, filtering, and concurrent lookups.
cmd/maintainers_test.go Adds unit tests for PURL handling, dependency selection, result building, and formatting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/maintainers.go Resolved
Comment thread cmd/maintainers.go Resolved

@andrew andrew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

fetchMaintainerData makes one FetchMaintainersFromPURL call per unique package with no caching. With direct deps only that's maybe 50–100 registry requests per run; with --all on a typical npm lockfile it's 500–2000. The 60s shared deadline with 8 workers means most of those will time out into LookupErrors anyway, but the ones that do complete still hit npm/pypi/rubygems on every invocation.

#111 says this data belongs alongside outdated and licenses, and those commands cache through the packages table with a 24h TTL. I'd like maintainers to do the same. That means either a maintainers table or a JSON column on packages; happy to discuss which before you rework. Until there's a cache I'd also drop --all, since it's the flag that turns this from dozens of requests into thousands.

Smaller things, same as the other PRs:

  • --format json still prints plain text on the empty paths (No direct dependencies found., No maintainer data found.). JSON output should always be JSON; emit an empty MaintainersResult.
  • docs/internals.md changes "fetch and cache this external data" to "with caching where supported" and adds a paragraph explaining why this command doesn't cache. Please keep the original wording and make the command cache instead.

@abhinavgautam01

Copy link
Copy Markdown
Contributor Author

fetchMaintainerData makes one FetchMaintainersFromPURL call per unique package with no caching. With direct deps only that's maybe 50–100 registry requests per run; with --all on a typical npm lockfile it's 500–2000. The 60s shared deadline with 8 workers means most of those will time out into LookupErrors anyway, but the ones that do complete still hit npm/pypi/rubygems on every invocation.

#111 says this data belongs alongside outdated and licenses, and those commands cache through the packages table with a 24h TTL. I'd like maintainers to do the same. That means either a maintainers table or a JSON column on packages; happy to discuss which before you rework. Until there's a cache I'd also drop --all, since it's the flag that turns this from dozens of requests into thousands.

Smaller things, same as the other PRs:

  • --format json still prints plain text on the empty paths (No direct dependencies found., No maintainer data found.). JSON output should always be JSON; emit an empty MaintainersResult.
  • docs/internals.md changes "fetch and cache this external data" to "with caching where supported" and adds a paragraph explaining why this command doesn't cache. Please keep the original wording and make the command cache instead.

thanks, fixed....

maintainers now uses the package cache with the same 24h TTL pattern as the other network-backed commands. I added maintainers and maintainers_synced_at columns to packages, read cached maintainer data before making registry calls, fetch only cache misses, and write successful lookup results back to the cache. Empty maintainer lists are cached too; lookup errors are not cached..

I kept --all since the request-volume issue is now mitigated by caching...

Also fixed the JSON empty-result paths so they emit an empty MaintainersResult instead of plain text and restored the internals wording to say these commands fetch and cache external data....

@andrew andrew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The cache layer is right: maintainers + maintainers_synced_at on packages, GetCachedMaintainers/SavePackageMaintainersBatch, and the JSON/docs fixes are all good. --all is fine now there's a cache.

The fetch path for misses still does one registries.FetchMaintainersFromPURL call per package through an 8-worker pool. On a cold --all run that's hundreds of individual registry requests, and they all share one 60s context so the tail times out.

Same resolution as #214: we're adding Maintainers to enrichment.PackageInfo (the ecosyste.ms bulk response already carries it). Once that's released:

  • replace fetchMaintainerDataUncached with a single client.BulkLookup(ctx, misses) via NewEnrichmentClient
  • read pkg.Maintainers from the result and drop the worker pool, the sync import, the registries/registries/all imports, and maintainerLookupConcurrency
  • 5-minute timeout to match the other enrichment commands

I'll ping here when the enrichment release is tagged (same one as #214).

Also SchemaVersion = 10 collides with #213 and #214 which both set 10; this will need bumping depending on merge order, plus a rebase onto main now #212 has landed (overlaps in root.go, pager_test.go, internals.md, README).

@abhinavgautam01

Copy link
Copy Markdown
Contributor Author

The cache layer is right: maintainers + maintainers_synced_at on packages, GetCachedMaintainers/SavePackageMaintainersBatch, and the JSON/docs fixes are all good. --all is fine now there's a cache.

The fetch path for misses still does one registries.FetchMaintainersFromPURL call per package through an 8-worker pool. On a cold --all run that's hundreds of individual registry requests, and they all share one 60s context so the tail times out.

Same resolution as #214: we're adding Maintainers to enrichment.PackageInfo (the ecosyste.ms bulk response already carries it). Once that's released:

  • replace fetchMaintainerDataUncached with a single client.BulkLookup(ctx, misses) via NewEnrichmentClient
  • read pkg.Maintainers from the result and drop the worker pool, the sync import, the registries/registries/all imports, and maintainerLookupConcurrency
  • 5-minute timeout to match the other enrichment commands

I'll ping here when the enrichment release is tagged (same one as #214).

Also SchemaVersion = 10 collides with #213 and #214 which both set 10; this will need bumping depending on merge order, plus a rebase onto main now #212 has landed (overlaps in root.go, pager_test.go, internals.md, README).

thanks, i rebased this onto main and resolved the freshness/maintainers overlaps. I also bumped SchemaVersion to 12 and changed the maintainer lookup timeout to 5 minutes...

i checked the available github.com/git-pkgs/enrichment releases and the latest visible tag is still v0.2.3; PackageInfo does not expose Maintainers yet. i left the current cached registry miss path in place for now so the command continues to work. Once the enrichment release with PackageInfo.Maintainers is tagged, I’ll replace the worker pool with a single NewEnrichmentClient(...).BulkLookup, read pkg.Maintainers and remove the sync/registries imports plus maintainerLookupConcurrency....

@abhinavgautam01
abhinavgautam01 requested a review from andrew May 28, 2026 14:44
@andrew

andrew commented May 29, 2026

Copy link
Copy Markdown
Contributor

enrichment v0.3.0 is tagged with PackageInfo.Maintainers []Maintainer (Login, Name, Email, URL, Role) via git-pkgs/enrichment#26, so this can be unblocked now.

  • bump github.com/git-pkgs/enrichment to v0.3.0 in go.mod
  • replace fetchMaintainerDataUncached and the worker pool with one NewEnrichmentClient(...).BulkLookup(ctx, misses), reading pkg.Maintainers
  • drop the sync, registries, and registries/all imports plus maintainerLookupConcurrency

Maintainers is populated by the ecosyste.ms backend only; PURLs that route to the registries backend (private registries) will come back with an empty slice. That's the expected tradeoff for getting public packages down to a single bulk request.

@abhinavgautam01

Copy link
Copy Markdown
Contributor Author

enrichment v0.3.0 is tagged with PackageInfo.Maintainers []Maintainer (Login, Name, Email, URL, Role) via git-pkgs/enrichment#26, so this can be unblocked now.

  • bump github.com/git-pkgs/enrichment to v0.3.0 in go.mod
  • replace fetchMaintainerDataUncached and the worker pool with one NewEnrichmentClient(...).BulkLookup(ctx, misses), reading pkg.Maintainers
  • drop the sync, registries, and registries/all imports plus maintainerLookupConcurrency

Maintainers is populated by the ecosyste.ms backend only; PURLs that route to the registries backend (private registries) will come back with an empty slice. That's the expected tradeoff for getting public packages down to a single bulk request.

thanks, this is updated now...

I bumped github.com/git-pkgs/enrichment to v0.3.0 and replaced the uncached maintainer fetch path with a single NewEnrichmentClient(...).BulkLookup(ctx, misses). The command now reads pkg.Maintainers from enrichment.PackageInfo and i removed the worker pool plus the sync, registries, and registries/all imports....

i also kept the 5-minute timeout and added test coverage for the enrichment-backed lookup path, including the expected empty maintainer slice when a PURL has no maintainer data..

@andrew andrew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The enrichment switch is right: the worker pool and registries imports are gone, misses go through one NewEnrichmentClient(...).BulkLookup, results read pkg.Maintainers, and the cache write only touches the maintainer columns. GetCachedMaintainers/SavePackageMaintainersBatch mirror the funding helpers and look fine.

A couple of leftovers from the old implementation:

  • docs/internals.md still adds a paragraph saying the command "queries package registries directly through github.com/git-pkgs/registries for cache misses". That's no longer true; please drop that paragraph and fold maintainers into the existing enrichment-commands sentence instead. Same for the intro line ("maintainer data from package registries") and the README wording near the top ("maintainers queries package registries for maintainer access data"): it now goes through ecosyste.ms via enrichment like outdated/licenses, so just list it alongside those.
  • MaintainerInfo.UUID was populated by the old registries.Maintainer path. enrichment.Maintainer has no UUID, so the field is always empty now; please drop it (and the references in normalizeMaintainers/maintainerDisplay).

On sequencing: #213 has merged and #214 only needs a rebase, so I'd suggest waiting for #214 to land and then rebasing this on top. That keeps SchemaVersion = 12 correct and avoids resolving the packages schema, queries.go, go.mod, root.go, pager_test.go, README and internals.md overlaps twice.

@abhinavgautam01

Copy link
Copy Markdown
Contributor Author

The enrichment switch is right: the worker pool and registries imports are gone, misses go through one NewEnrichmentClient(...).BulkLookup, results read pkg.Maintainers, and the cache write only touches the maintainer columns. GetCachedMaintainers/SavePackageMaintainersBatch mirror the funding helpers and look fine.

A couple of leftovers from the old implementation:

  • docs/internals.md still adds a paragraph saying the command "queries package registries directly through github.com/git-pkgs/registries for cache misses". That's no longer true; please drop that paragraph and fold maintainers into the existing enrichment-commands sentence instead. Same for the intro line ("maintainer data from package registries") and the README wording near the top ("maintainers queries package registries for maintainer access data"): it now goes through ecosyste.ms via enrichment like outdated/licenses, so just list it alongside those.
  • MaintainerInfo.UUID was populated by the old registries.Maintainer path. enrichment.Maintainer has no UUID, so the field is always empty now; please drop it (and the references in normalizeMaintainers/maintainerDisplay).

On sequencing: #213 has merged and #214 only needs a rebase, so I'd suggest waiting for #214 to land and then rebasing this on top. That keeps SchemaVersion = 12 correct and avoids resolving the packages schema, queries.go, go.mod, root.go, pager_test.go, README and internals.md overlaps twice.

thanks, that makes sense. i will wait for #214 to land, then rebase this branch on top of main so SchemaVersion = 12 stays correct and I only resolve the shared packages schema / queries.go / docs / command registration overlaps once...

After that rebase i’ll also clean up the remaining maintainer docs wording to reflect the enrichment path and drop the now-unused MaintainerInfo.UUID field plus the related normalization/display references...

@andrew

andrew commented May 31, 2026

Copy link
Copy Markdown
Contributor

Needs a rebase

@abhinavgautam01

Copy link
Copy Markdown
Contributor Author

Needs a rebase

but, you told after landing #214 then i have to do the rebase on top of that...🤧

@andrew

andrew commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

#213 (deprecated) and #214 (funding) have landed since this was opened, so this needs a rebase onto main. The conflicts are pure overlap (both PRs added new content in adjacent sections):

  • internal/database/database.go: keep SchemaVersion = 12 (your existing value; main is now at 11)
  • internal/database/queries.go: CachedMaintainers/GetCachedMaintainers/save helpers go side-by-side with Add dependency funding info command #214's CachedPackageFunding/GetCachedPackageFunding/SavePackageFundingBatch
  • cmd/root.go and cmd/pager_test.go: keep addMaintainersCmd and "maintainers" alongside both addDeprecatedCmd/addFundingCmd and "deprecated"/"funding"
  • README.md: the network-commands sentence, quick-start block, and per-command section all need entries for deprecated, funding and maintainers
  • docs/internals.md: same merge pattern in the intro paragraph; keep your maintainers paragraph after the funding/deprecated paragraph in Package Enrichment

Once rebased and CI is green I'll take another look.

@abhinavgautam01
abhinavgautam01 force-pushed the feature/maintainer-data-111 branch from 6f86312 to 39662fa Compare June 2, 2026 07:41
@abhinavgautam01
abhinavgautam01 requested a review from andrew June 2, 2026 07:49

@andrew andrew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Almost there. The previous round's asks are partly addressed:

  • MaintainerInfo.UUID is gone, good.
  • docs/internals.md does fold maintainers into the enrichment-commands sentence, but it also adds a new paragraph ("The maintainers command stores package maintainer lists in packages and uses the same 24-hour TTL as other package metadata commands.") that duplicates info already in the paragraph above it. Drop the new paragraph and extend the existing inline mention instead, alongside funding: "The funding command stores package funding links in packages, the maintainers command stores package maintainer lists in packages, and the deprecated command uses the versions cache and fetches exact-version status from registries when cached deprecation metadata is missing."

One small README consistency thing: the funding section opens with "Checks ecosyste.ms package metadata for funding links..."; the new maintainers section drops the source ("Checks package metadata for maintainer data..."). Mirror the funding wording so it's clear maintainers also comes from ecosyste.ms.

@andrew

andrew commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Heads-up: #225 just landed and centralizes the user agent string into a package-level userAgent var in cmd/root.go. When you rebase, please change enrichment.WithUserAgent("git-pkgs/" + version) to enrichment.WithUserAgent(userAgent) so we keep the format in one place.

@abhinavgautam01
abhinavgautam01 force-pushed the feature/maintainer-data-111 branch from 39662fa to 00d73cf Compare June 3, 2026 14:04
@abhinavgautam01

Copy link
Copy Markdown
Contributor Author

Almost there. The previous round's asks are partly addressed:

  • MaintainerInfo.UUID is gone, good.
  • docs/internals.md does fold maintainers into the enrichment-commands sentence, but it also adds a new paragraph ("The maintainers command stores package maintainer lists in packages and uses the same 24-hour TTL as other package metadata commands.") that duplicates info already in the paragraph above it. Drop the new paragraph and extend the existing inline mention instead, alongside funding: "The funding command stores package funding links in packages, the maintainers command stores package maintainer lists in packages, and the deprecated command uses the versions cache and fetches exact-version status from registries when cached deprecation metadata is missing."

One small README consistency thing: the funding section opens with "Checks ecosyste.ms package metadata for funding links..."; the new maintainers section drops the source ("Checks package metadata for maintainer data..."). Mirror the funding wording so it's clear maintainers also comes from ecosyste.ms.

fixed... i dropped the duplicate maintainers paragraph from docs/internals.md and folded maintainers into the existing package-cache sentence alongside funding and deprecated. i also updated the README maintainers section to mirror the funding wording and explicitly say it checks ecosyste.ms package metadata...

@abhinavgautam01

Copy link
Copy Markdown
Contributor Author

Heads-up: #225 just landed and centralizes the user agent string into a package-level userAgent var in cmd/root.go. When you rebase, please change enrichment.WithUserAgent("git-pkgs/" + version) to enrichment.WithUserAgent(userAgent) so we keep the format in one place.

Fixed after rebasing onto current main. fetchMaintainerDataUncached now uses enrichment.WithUserAgent(userAgent) so it follows the centralized user-agent string from cmd/root.go.

@andrew andrew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All previous review asks are addressed: fetchMaintainerDataUncached uses a single BulkLookup with enrichment.WithUserAgent(userAgent), the docs are folded into the existing enrichment-commands sentences without duplication, the README maintainers section mirrors the funding wording, MaintainerInfo.UUID is gone, and SchemaVersion is correctly at 12 with the new maintainers/maintainers_synced_at columns wired into the rebuild path.

@andrew
andrew merged commit 9549f0c into git-pkgs:main Jun 5, 2026
4 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.

Maintainer data

3 participants