fix(gcsartifact): recognize wrapped storage.ErrObjectNotExist - #1375
Open
shoemoney wants to merge 1 commit into
Open
fix(gcsartifact): recognize wrapped storage.ErrObjectNotExist#1375shoemoney wants to merge 1 commit into
shoemoney wants to merge 1 commit into
Conversation
shoemoney
force-pushed
the
fix/gcsartifact-wrapped-not-exist
branch
from
August 24, 2026 15:31
94920b4 to
25e2ef7
Compare
Load and GetArtifactVersion compared blob.attrs' error against
storage.ErrObjectNotExist with ==. cloud.google.com/go/storage always
wraps that sentinel (formatObjectErr: fmt.Errorf("%w: %w",
ErrObjectNotExist, err)), so the check never matched in production and
callers doing errors.Is(err, fs.ErrNotExist) got a generic "could not
get blob attributes" error instead of a not-found signal.
ErrVersionConflict a few lines up in this same file already documents
the fix: "It is always wrapped, so test for it with [errors.Is]".
Apply that same rule to storage.ErrObjectNotExist at both call sites.
shoemoney
force-pushed
the
fix/gcsartifact-wrapped-not-exist
branch
from
August 25, 2026 16:43
25e2ef7 to
ceda149
Compare
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.
Link to Issue or Description of Change
2. Or, if no issue exists, describe the change:
Problem:
artifact/gcsartifact/service.gohas two identical checks (LoadandGetArtifactVersion) that compare the error fromblob.attrs(ctx)againststorage.ErrObjectNotExistwith==:The pinned
cloud.google.com/go/storage v1.64.0always wraps this sentinel.ObjectHandle.Attrsroutes throughhttpStorageClient.GetObject→formatObjectErr:So in production
err == storage.ErrObjectNotExistis alwaysfalse, and thefs.ErrNotExisttranslation is dead code. A caller doingerrors.Is(err, fs.ErrNotExist)after a real not-found gets a generic "could not get blob attributes" error instead of a not-found signal.This package already documents the fix for this exact class of bug two functions up, on
ErrVersionConflict:This PR applies that same rule to
storage.ErrObjectNotExistat both call sites.Solution:
Change both
err == storage.ErrObjectNotExistchecks toerrors.Is(err, storage.ErrObjectNotExist). Botherrorsandstoragewere already imported. No other behavior changes — one concern only.Testing Plan
Unit Tests:
Added
TestNotFoundIsWrappedSentinelinartifact/gcsartifact/gcs_test.go, covering bothLoadandGetArtifactVersion. It adds a smallattrsErrhook to the existing in-memory fake (fakeBucket/fakeObject) soattrs()can return a wrappedstorage.ErrObjectNotExist— mirroring what the real client actually returns — instead of the fake's previous bare-sentinel behavior, which never exercised this bug.Confirmed RED on the pre-fix code (test added, fix withheld):
GREEN after the fix, along with the full existing package suite:
Also ran, all clean:
golangci-lint run ./artifact/...— 0 issuesgolangci-lint fmt ./artifact/...— no changesgo mod tidy -diff— emptygo build -mod=readonly work— succeedsManual End-to-End (E2E) Tests:
Not applicable — this is a pure error-classification fix inside
gcsService.Load/GetArtifactVersion, fully covered by the unit test above; no UI, runner, or live-GCS surface is touched.Checklist