Repository navigation
Add change feeds for npm and Packagist - #126
Merged
Merged
Conversation
The changes package reads the feeds in which registries list the packages that changed since a given point: npm's replicate _changes feed and Packagist's metadata/changes.json. Feeds are stateless; the caller owns the cursor and moves on only after acting on the changes. Moved from git-pkgs/proxy (#625), with the cursor returned instead of kept in the feed, the feed URL as an option, and a page without last_seq no longer losing the names read before it.
andrew
requested changes
Oct 30, 2026
andrew
left a comment
Contributor
There was a problem hiding this comment.
Please fix npm startup for feed URLs containing query parameters and add a regression test through NewNPM(WithURL(...)).Start.
Contributor
Author
|
Fixed in 88ec8f0. |
andrew
approved these changes
Oct 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves the change feed readers from git-pkgs/proxy#625 here, as asked in the review there. A new
changes/package reads the feeds in which registries list the packages that changed since a given point, starting with npm (replicate.npmjs.com/registry/_changes) and Packagist (metadata/changes.json).Cursor(a string, so it can be stored) and moves on to the returned one after acting on the changes. On errorChangesreturns the cursor it was given.NewNPMandNewPackagisttakeWithClient(a*client.Client, so requests get its retries and limits) andWithURL.PackagistFeedURLbuilds the URL for a Packagist instance.Startreads the timestamp from the 400 a request withoutsincegets. A delete is reported asvendor/pkgandvendor/pkg~dev, and aresyncasChanges.All.Startreadsupdate_seqfrom the database document, and sequences are passed back as given.Changesreads up to ten pages of 10000 and skips_design/ids.last_seq, the names of the earlier pages were lost.Changesnow returns them with the cursor after the last good page and no error.Tests run against fake Packagist and replicate servers: start position, update/delete/resync, errors returning the cursor, paging and the page cap, a later page failing either way, and string sequences. The proxy side is ready against this branch and will bump registries once there's a tag.