npm: add upstream.npm_full_metadata to serve publish times without cooldown - #297
Merged
Merged
Conversation
- Request application/json from the npm upstream when the option is set, independent of cooldown, so served packuments carry the "time" map - Wire the option through the shared Proxy struct and the PROXY_UPSTREAM_NPM_FULL_METADATA environment override - Document it in config.example.yaml and docs/configuration.md - Test that the option forces full metadata with cooldown disabled
VictorCodesseira
marked this pull request as ready for review
September 1, 2026 18:53
andrew
approved these changes
Sep 2, 2026
andrew
left a comment
Contributor
There was a problem hiding this comment.
upstream is the right place for this — it modifies how upstream.npm is fetched. Thanks.
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.
PR #241 sends a combined Accept header so upstreams that reject the abbreviated
packument type fall back to full metadata, but the combined header still
prefers the abbreviated format — so registry.npmjs.org keeps returning
packuments with no
timemap, and withcache_metadataon, that timeless bodyis served to every client regardless of the client's own Accept header. The
only way to get full packuments today is to enable cooldown, which ties a
metadata-format choice to a filtering feature.
Timeless packuments break clients that gate on publish age. Yarn 4's
npmMinimalAgeGate(on by default in recent Yarn) fails closed whentimestamps are missing, so every resolution through the proxy is refused, old
versions included:
Changes:
upstream.npm_full_metadata(envPROXY_UPSTREAM_NPM_FULL_METADATA,default false); when set, the npm metadata fetch uses
application/jsonexclusively, independent of cooldown
Proxystruct the wayGradleReadOnlyandDirectServeareconfig.example.yamlanddocs/configuration.mdmetadata with cooldown disabled
Placed under
upstreambeside the npm URL it modifies, since that sectionalready carries fetch behavior (
allow_private_hosts,allow_loopback,auth) — happy to move it top-level next tocache_metadata/metadata_ttlif you prefer that grouping, or to a different shape entirely (for example
honoring the client's Accept header with per-format caching, which would also
work but costs a second cached copy per package).
go test ./...,go fmt,go vetclean.Companion PR: #296 (making the cooldown download check read stored publish
times instead of re-parsing packuments).