Repository navigation
Conversation
The compact index filter, the version listing, the versions API's publish times and the gem filename parser move out of internal/handler into internal/metadata/gem, which imports only the standard library and builds for wasip1. The handler keeps fetching, caching, the cooldown decision and downloads, and its functions stay as thin wrappers, so the handler tests run unchanged. internal/mirror calls gem.FilenameIdentity.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
gem.FilterIndex took a callback saying which versions to leave out. It now takes Options with a CooldownPolicy, the evaluation time and the publish times read from the versions API, as the other metadata packages do, and decides per version itself. The handler passes the proxy clock.
Part of #501, the RubyGems step.
As in #612 for npm, the RubyGems metadata transformations move out of
internal/handlerintointernal/metadata/gem:FilterIndex, which drops the compact index lines of the versions cooldown holds back and returns the versions it keptIndexVersions, which lists a compact index's versions as the versions API names themPublishTimesandVersion, which read publish times from/api/v1/versions/{name}.json, keyed with the platform as the compact index writes itFilenameIdentity, the gem filename parserThe compact index carries no publish times; they come from the versions API document fetched alongside it.
FilterIndextakes the same kind ofOptionsas the npm, PyPI and Composer packages: aCooldownPolicy, the evaluation time and anOnWithheldcallback, plus the publish times (Published) andWithholdUnknown, which holds back versions the times don't have when they may be older than the index. It decides per version itself. The package doesn't depend onhandler.Proxy.One behaviour change: every version of an index is now judged at one time, the proxy's clock, instead of the system time at each check. In production these are the same.
What stays in the handler: fetching, the metadata and rewrite caches, routes and downloads. The handler's functions stay as thin wrappers and
gemVersionis an alias forgem.Version, so the handler tests run unchanged.internal/mirrorcallsgem.FilenameIdentity;handler.GemFilenameIdentitystays as a wrapper.Portability:
GOOS=wasip1 GOARCH=wasm go build ./internal/metadata/gemworks.imports_test.gofails on any non-standard import outside an allowlist (cooldown,internal/packageurland what it uses) and onnet,net/http,log/slogordatabase/sql.New tests in
internal/metadata/gemcover the filter (versions in cooldown, no or a disabled policy, versions without a time, the callback, the evaluation time), the version listing, publish times with platforms and unparseable times, and the filename parser including its length bound. They were mutation-checked, as was the handler's wiring.TestCooldownSupportedCoversHandlersnow also readsinternal/metadata, as in the pub, Cargo, NuGet and Conda PRs. There are no gem benchmarks to compare.go test ./...andgolangci-lint run ./...pass.Summary by CodeRabbit