Repository navigation
Add dependency maintainer data command - #215
Conversation
There was a problem hiding this comment.
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 maintainerswith--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.
andrew
left a comment
There was a problem hiding this comment.
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 jsonstill prints plain text on the empty paths (No direct dependencies found.,No maintainer data found.). JSON output should always be JSON; emit an emptyMaintainersResult.docs/internals.mdchanges "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
left a comment
There was a problem hiding this comment.
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
fetchMaintainerDataUncachedwith a singleclient.BulkLookup(ctx, misses)viaNewEnrichmentClient - read
pkg.Maintainersfrom the result and drop the worker pool, thesyncimport, theregistries/registries/allimports, andmaintainerLookupConcurrency - 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).
46aee0d to
fc52799
Compare
thanks, i rebased this onto main and resolved the freshness/maintainers overlaps. I also bumped i checked the available |
|
|
thanks, this is updated now... I bumped 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
left a comment
There was a problem hiding this comment.
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.mdstill adds a paragraph saying the command "queries package registries directly throughgithub.com/git-pkgs/registriesfor cache misses". That's no longer true; please drop that paragraph and foldmaintainersinto the existing enrichment-commands sentence instead. Same for the intro line ("maintainer data from package registries") and the README wording near the top ("maintainersqueries package registries for maintainer access data"): it now goes through ecosyste.ms viaenrichmentlikeoutdated/licenses, so just list it alongside those.MaintainerInfo.UUIDwas populated by the oldregistries.Maintainerpath.enrichment.Maintainerhas no UUID, so the field is always empty now; please drop it (and the references innormalizeMaintainers/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 After that rebase i’ll also clean up the remaining maintainer docs wording to reflect the enrichment path and drop the now-unused |
|
Needs a rebase |
but, you told after landing #214 then i have to do the rebase on top of that...🤧 |
|
#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):
Once rebased and CI is green I'll take another look. |
6f86312 to
39662fa
Compare
andrew
left a comment
There was a problem hiding this comment.
Almost there. The previous round's asks are partly addressed:
MaintainerInfo.UUIDis gone, good.docs/internals.mddoes foldmaintainersinto the enrichment-commands sentence, but it also adds a new paragraph ("Themaintainerscommand stores package maintainer lists inpackagesand 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, alongsidefunding: "Thefundingcommand stores package funding links inpackages, themaintainerscommand stores package maintainer lists inpackages, and thedeprecatedcommand uses theversionscache 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.
|
Heads-up: #225 just landed and centralizes the user agent string into a package-level |
39662fa to
00d73cf
Compare
fixed... i dropped the duplicate maintainers paragraph from |
Fixed after rebasing onto current main. |
andrew
left a comment
There was a problem hiding this comment.
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.
Closes #111
Summary
git pkgs maintainersto show package maintainer counts and identities--singleto highlight dependencies with exactly one maintainer--allto include transitive lockfile dependenciesTesting
go test ./cmd -run 'TestMaintainer|TestPagerFlagAccepted'go build ./...go test ./...go test -race ./...go tool golangci-lint run ./...git diff --checkgo run . maintainers --help