Repository navigation
Conversation
The maven-metadata.xml cooldown filter moves out of internal/handler into internal/metadata/maven: parsing the version list, <latest>, <release> and <lastUpdated> with their offsets, removing versions in cooldown in place, and the coordinate and version helpers. The package takes the cooldown policy, the time it is evaluated at and a publish-time lookup explicitly, and reports held-back versions through OnWithheld. Publish times still come from the handler, looked up only as far as the filter asks. Cooldown is checked with Evaluate at one EvaluatedAt.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 34 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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.
Part of #501, the Maven step.
As in #612 for npm, the Maven metadata transformations move out of
internal/handlerintointernal/metadata/maven:Filter, which removes versions in cooldown from an artifact'smaven-metadata.xmland points<latest>and<release>at the newest versions left, editing the document in placeParseMetadata,MetadataandWithout, which read the version list,<latest>,<release>and<lastUpdated>with their offsets and take versions outCoordinates,UsableVersionandPackagePURLThe package takes its inputs explicitly in
Options: the cooldown policy, the time cooldown is evaluated at, and aPublishTimelookup. It reports versions cooldown holds back throughOnWithheld, which the handler logs and records for the default repository as before. It doesn't depend onhandler.Proxy.Publish times stay in the handler: the versions table, else the
.pom'sLast-Modified.Filterasks for them from the newest version back and stops at the first that is old enough, and asks for none when<lastUpdated>is out of cooldown, so Maven Central sees the same requests as before.What stays in the handler: fetching, the rewrite cache, the checksum files served beside the metadata, the publish-time lookup, and downloads with their cooldown check. The handler's functions stay as thin wrappers, so the handler tests run unchanged against the real routes.
Cooldown in the filter is checked with
Evaluateat oneEvaluatedAtinstead ofIsAllowedper version, as ininternal/metadata/npm. The handler passestime.Now(), so results are the same unless a filter runs across a cooldown boundary.Portability:
GOOS=wasip1 GOARCH=wasm go build ./internal/metadata/mavenworks.imports_test.gofails on any non-standard import outside an allowlist (cooldown, purl, vers, packageurl-go,internal/packageurl) and onnet,net/http,log/slogordatabase/sql.New tests in
internal/metadata/mavencover versions held back from the end of the list with lookups stopping at the first old enough,<lastUpdated>out of cooldown skipping all lookups and an unreadable one, SNAPSHOT versions and versions without a time, a failed lookup, a missing or disabled policy, directories that aren't an artifact's and metadata without a version list, malformed XML and other charsets,<latest>and<release>kept, moved or dropped (including CRLF lines), and the coordinate and version helpers. They were mutation-checked, as was the handler's wiring. There are no Maven benchmarks to compare.go test ./...andgolangci-lint run ./...pass.