Address pushes API review findings - #385
Closed
chruffins wants to merge 1 commit into
Closed
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 13a1a28. Configure here.
| // clear retryable error rather than orchestrating this caller into | ||
| // a successor job that does not yet exist. A retry once the entry | ||
| // drops creates a fresh job. | ||
| return nil, fmt.Errorf("%w: push job %s is being finalized after a record write failure; retry", ErrNotFound, id) |
There was a problem hiding this comment.
Finalize retry mapped as 500
Low Severity
CreatePush now returns a wrapped ErrNotFound in the mid-finalization window and documents it as retryable, but the HTTP handler only special-cases images.ErrNotFound. That path falls through to internal_error 500 instead of a clear retryable API status.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 13a1a28. Configure here.
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.


Addresses the review findings on #353, apart from the retention/pagination question (deferred, matches repo-wide precedent).
Bugs
lib/imagepush/manager.go— each push now runs undercontext.WithTimeout(pushTimeout)so a wedged registry can't pin a queue slot forever (default concurrency is 2).Dead code removed
WaitForPush+ the whole subscriber/notify machinery (subscribers,StatusEvent,subscribe/unsubscribe/notify) had no production caller — only tests. Removed them and theWaitForPush/InProgressDigestsentries from theManagerinterface.LiveCacheManifestDigests(theocicachegc.RootsProvidermethod) stays as the single GC root source; the in-memory digest lookup is now an unexportedinProgressDigests. Tests now pollGetPushvia awaitTerminalhelper.Dedup simplification
waitForInflightRelease5ms spin-wait and the waiter-into-successor dance built to handle the rare "terminal write failed, record dropped" window. Dedup still merges concurrent creates for the same key under the lock; in the residual mid-finalization window a create returns a clear retryable error instead of orchestrating a successor. The inflight map (needed for GC roots) is unchanged.Structural
credFingerprintnow normalizes the precomputed base64Authshorthand into username/password so the same login hashes identically either way (previously the two forms produced different fingerprints).toPushWithPositionshared byGetPush/ListPushesso the domain projection + queue-position enrichment can't drift between them.persistTerminal.Nits
pushToOAPIgateslayers/bytespresence onstatus == pushedinstead ofvalue > 0.writeMetadatanow fsyncs the containing directory after the rename so a crash can't lose the directory entry.Deferred
lib/builds/BuildQueuehas a materially richer contract (serial keys, cancel, per-key queries, metrics callbacks) than the extractedlib/queue; folding it is a cross-cutting change to the build subsystem and is better done as its own PR (already ticketed). Not folded here.ListPushes— deferred, matches repo-wide precedent.Verification
go test -race ./lib/imagepush/ ./lib/queue/pass.lib/imagesandcmd/api/apican't be exercised in this sandbox (build binary / local builder registry required) —cmd/api/api/pushes.gochange is a syntax-checked status-gate only.Note
Medium Risk
Changes core push job lifecycle, dedup, and persistence; bounded concurrency and OCI cache GC depend on correct in-flight digest tracking, though behavior is largely simplification plus defensive timeouts.
Overview
Addresses pushes API review feedback by tightening image push reliability and trimming unused surface area.
Each registry export now runs under a 30-minute timeout so a hung remote cannot hold a bounded queue slot indefinitely. Terminal outcomes (including panics) go through shared
persistTerminallogic, and push metadata writes fsync the parent directory after rename so directory entries survive a crash.WaitForPush, subscriber/notify machinery, andInProgressDigestson the publicManagerinterface are removed (no production callers). GC roots stay onLiveCacheManifestDigestsonly; tests pollGetPushviawaitTerminal. In-flight dedup no longer spins waiting on torn-down records—during the rare post-write-failure windowCreatePushreturns a clear retryable error instead of orchestrating a successor job.credFingerprintnormalizes base64Authshorthand to username/password so equivalent logins dedupe correctly.toPushWithPositionis shared byGetPush/ListPushes.pushToOAPIexposeslayers/bytesonly when status is pushed, not when values are merely non-zero.Reviewed by Cursor Bugbot for commit 13a1a28. Bugbot is set up for automated code reviews on this repo. Configure here.