Repository navigation
fix(dir): recognize registry not-found and unsupported errors by type - #2252
Merged
Merged
Conversation
IsReady treated a failed ping as "registry reachable" whenever the error text contained "404". The text carries the registry's address, so a registry at an address containing 404 (port 4040 or 40445, a host like registry404.example.com) was reported ready while answering 5xx or rejecting credentials. It also made TestIsReady_RemoteRegistry flaky: its test server's random port contains 404 about once in a hundred Linux runs. oras-go's Registry.Ping already reports a 404 as errdef.ErrNotFound, so that alone now counts. A test serving the registry on a port containing 404 checks that 500 and 401 are not ready, and 200 and 404 are. Fixes #2251 Signed-off-by: Luca Muscariello <[email protected]>
tkircsi
reviewed
Oct 1, 2026
tkircsi
left a comment
Contributor
There was a problem hiding this comment.
The same pattern is still live in reconciler/tasks/indexer/task.go:304 and server/store/oci/internal.go:193,260. Maybe it would worth to unify them.
tkircsi
reviewed
Oct 1, 2026
Review of the IsReady fix found the same flaw at every other place that read a registry's answer from the error text. The text carries the registry's address, so a registry at an address containing 404 or 405 was misread on every failure: - deleting a record or a referrer from a registry that refused reported it deleted, while it was still there; - a refused delete at an address containing 405 was reported as the registry not supporting deletes; - the indexer read any refusal mentioning "not found" from such a registry as an empty repository. IsNotFound and isDeleteUnsupported now decide from oras-go's typed errors: errdef.ErrNotFound or a 404 error response, and errdef.ErrUnsupported, a 405 response or an UNSUPPORTED error code. The indexer and the tag retry use IsNotFound too, so nothing in the store matches error text any more. Tests drive real oras-go errors from registries on ports containing 404 and 405; against the old code, the refused deletes there are reported deleted or unsupported. Refs #2251 Signed-off-by: Luca Muscariello <[email protected]>
The test ran in parallel but its subtests did not (tparallel). Each subtest serves its own registry on a free port, so they run in parallel too. Refs #2251 Signed-off-by: Luca Muscariello <[email protected]>
ramizpolic
approved these changes
Oct 1, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 1, 2026
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.
Fixes #2251.
Why
The OCI store and the reconciler's indexer read a registry's answer from the error text. That text carries the registry's address, so a registry at an address containing
404or405was misread on every failure. Example addresses: port4040or40445, or a host likeregistry404.example.com.IsReadyreported a registry ready while it answered 5xx or rejected credentials.405, a refused delete was reported as the registry not supporting deletes.The readiness case also made
TestIsReady_RemoteRegistry/registry_unavailableflaky. Its test server gets a random port, and about 1 in 100 Linux runs picks one containing404; it failed on #2249. The other cases were found in review.Fix
Two helpers in
server/store/ocinow decide from oras-go's typed errors, never the text:IsNotFound:errdef.ErrNotFound(a missing manifest, blob or tag target), or an error response with status 404 (a missing repository).isDeleteUnsupported:errdef.ErrUnsupported, a 405 response, or anUNSUPPORTEDerror code.They're used by
IsReady, both delete paths, the tag retry and the reconciler's indexer. Nothing in the store matches error text any more.Testing
404or405, and text that merely says "404" or "unsupported", none of which count.404and405, driven through oras-go:main's code: these tests fail there exactly where the bugs are. Refused deletes are reported deleted or unsupported, and failing registries are reported ready.server/store/...and thereconcilermodule pass, and both vet clean.