Repository navigation
Conversation
The rewrites of the universe, cookbook and cookbook version documents, which point download locations at the proxy, move out of internal/handler into internal/metadata/chef with the proxy URL as an explicit input. The handler keeps fetching, caching and downloads, and its functions stay as thin wrappers. The package imports only the standard library and builds for wasip1.
|
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 48 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 Chef step.
As in #612 for npm, the Chef Supermarket metadata transformations move out of
internal/handlerintointernal/metadata/chef:RewriteUniverse,RewriteCookbookandRewriteVersion, which point the universe'slocation_pathanddownload_url, a cookbook's version URLs, and a version'scookbookandfileURLs at the proxy, andRewriteVersionURLfor a single version URLAPIURL,CookbookURL,VersionURLandDownloadURL, where the proxy serves each document and archiveNormalizeVersion, which accepts both1.2.3and Berkshelf's1_2_3EncodeJSON, which keeps dependency constraints such as>= 1.0unescapedChef has no cooldown filtering, so
Optionsonly carries the proxy URL. The package doesn't depend onhandler.Proxy. The code moves as it was, so the bytes served are the same.What stays in the handler: fetching, the metadata and rewrite caches, routes, request validation, cache keys and downloads. The handler's functions stay as thin wrappers, so the handler tests run unchanged against the real routes.
encodeChefJSONstays as a wrapper too, since the Terraform handler uses it.Portability:
GOOS=wasip1 GOARCH=wasm go build ./internal/metadata/chefworks. The package imports only the standard library;imports_test.gofails on any non-standard import and onnet,net/http,log/slogordatabase/sql.New tests in
internal/metadata/chefcover each rewrite, null and unrecognised version URLs, fields left as they are, documents of the wrong shape, name and version escaping, version normalisation and the unescaped encoding. They were mutation-checked, as was the handler's wiring. There are no Chef benchmarks to compare.go test ./...andgolangci-lint run ./...pass.