Repository navigation
fix(composer): hold every dist of a version the minimum age holds - #477
Merged
Merged
Conversation
locateComposerDist compared the dist reference before checking the gate, so a request for a held version under a reference this proxy does not publish answered 404. In a group the merged p2 document can carry the dist of a later member (another upstream, another reference); the earlier proxy's 404 let group.firstHit pass on and the later member served the version the earlier one holds back. The gate is now checked first, so the answer is 403 whatever the reference, as for curation. A version that is old enough, or that the upstream does not publish, still answers 404 for an unknown reference. The paragraph of hosted-proxy-group.md that described the gap is removed: the batch availability answer now matches serving. Refs openartifact#471. Co-Authored-By: Claude Fable 5.2 <[email protected]>
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.
Follow-up from the #473 review: the Composer proxy checked the minimum age only after comparing the dist reference.
Problem
locateComposerDistreturnederrNotFoundwhen the reference in the request wasn't the one this proxy publishes, beforecheckGateran. In a group of two Composer proxies of different upstreams, the merged p2 document can offer a version through the later member's dist URL. The earlier proxy, which holds that version back by its minimum age, answered 404.group.firstHitpasses over a 404, so the later member served the version.Curation didn't have this problem:
serveComposerDistchecks it from the path, before anything else.Change
checkGatenow runs before the reference comparison. A held version answers403for any reference; the minimum age holds the version, not one dist of it. Unchanged:404for a reference the proxy doesn't publish (a stale or forged URL);404;locate.With this, the rule from #471 ("the first member that has the version decides, held or not") holds for Composer as written. I removed the paragraph in
hosted-proxy-group.mdthat documented the difference, and added an upgrade note.Test
TestComposerProxy_MinAgeRefusesAnyReferenceOfATooNewVersionuses the aged fixture (1.1.0 published a minute ago, a 24 h gate):There's no group-level test. The group's behaviour on a member's 403 is already covered, and this PR only changes what the member answers. I can add one with two fake upstreams if you'd like it pinned end to end.
Checks
golangci-lint run ./...passes.go test -short -race ./internal/proxy/andgo test ./internal/group/pass.make docs-checkpasses.🤖 Generated with Claude Code