Skip to content

download: fix ignored OCI downloader settings - #9113

Open
sspaink wants to merge 1 commit into
open-policy-agent:mainfrom
sspaink:download-oci-size-limit-persist
Open

download: fix ignored OCI downloader settings#9113
sspaink wants to merge 1 commit into
open-policy-agent:mainfrom
sspaink:download-oci-size-limit-persist

Conversation

@sspaink

@sspaink sspaink commented Aug 31, 2026

Copy link
Copy Markdown
Member

Running the unused linter with field-writes-are-uses set to false, which is not enabled in .golangci.yaml, flags five fields in this package that are only ever written. Two of them are real bugs.

OCIDownloader.WithSizeLimitBytes and WithBundlePersistence stored their arguments in fields download() never read, so size_limit_bytes went unenforced for OCI bundle sources and the reader's guard on persisted delta bundles could never fire. Wire both through as Downloader does.

The rest are dead: the trigger channel on both downloaders, unused since Trigger() calls oneShot directly, and Downloader.stopped, dead since Stop() moved to sync.Once. TestStopWithMultipleCalls asserted on the latter, a check that could not fail; it now asserts the Stop calls return, the deadlock it guards.

Running the unused linter with field-writes-are-uses set to false,
which is not enabled in .golangci.yaml, flags five fields in this
package that are only ever written. Two of them are real bugs.

OCIDownloader.WithSizeLimitBytes and WithBundlePersistence stored their
arguments in fields download() never read, so size_limit_bytes went
unenforced for OCI bundle sources and the reader's guard on persisted
delta bundles could never fire. Wire both through as Downloader does.

The rest are dead: the trigger channel on both downloaders, unused
since Trigger() calls oneShot directly, and Downloader.stopped, dead
since Stop() moved to sync.Once. TestStopWithMultipleCalls asserted on
the latter, a check that could not fail; it now asserts the Stop calls
return, the deadlock it guards.

Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant