GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||
GeezerVison is showing github.com — Add opt-in retention for generic artifacts by profiling · Pull Request #513 · git-pkgs/proxy Conversation
|
| Use case | Generic behavior |
|---|---|
No storage.retention configuration |
No age-based eviction; existing behavior is preserved. |
Only storage.retention.default: "30d" |
Generic remains excluded; the default still applies to other supported ecosystems. |
Explicit generic entries in packages, without ecosystems.generic |
Only the listed packages use their configured retention. All other generic packages remain excluded, even if default is set. |
Explicit ecosystems.generic: "30d" |
All generic packages use 30 days unless a package rule overrides it. |
Both ecosystems.generic and a matching package rule |
The package rule wins, including "0" to disable age-based eviction for that package. |
1. Preserve existing behavior: no opt-in. Leave storage.retention unset. Existing installations that already use only a global default also keep generic excluded:
storage: retention: default: "30d" # Other supported ecosystems only; generic stays excluded.
2. Opt in selected packages only. This example enables retention for one GitHub repository. It does not enable retention for any other generic repository. default is optional and is omitted here to make the scope clear:
storage: retention: packages: "pkg:generic/owner%2Frepo": "30d"
Adding default: "30d" to this example would affect other supported ecosystems, but would still not opt in unlisted generic packages. A package rule covers that package's versions and assets; each cached asset ages individually based on its last access, with recently fetched files protected as before.
3. Opt in all generic packages. Set the generic ecosystem rule explicitly:
storage: retention: ecosystems: generic: "30d"
4. Override or exclude a package after opting in the ecosystem. This keeps one repository outside age-based eviction and gives another a longer retention:
storage: retention: ecosystems: generic: "30d" packages: "pkg:generic/owner%2Fkeep": "0" "pkg:generic/owner%2Flong-lived": "90d"
For generic, precedence is matching package rule → explicit generic ecosystem rule → no age-based eviction. There is no fallback to the global default.
Explicit rules also apply to existing cached assets, so the initial sweep can evict older unused files. Users opting in accept that an evicted upstream asset may no longer be available for refetch. storage.max_size remains independent: exclusion from age-based eviction, including "0", does not prevent capacity-based LRU eviction.
generic with its existing stored package PURL form, such as pkg:generic/jqlang%2Fjq.default_not_applied list.Tests cover legacy global-default preservation, explicit ecosystem and package opt-in, isolation from other generic repositories, package-level disabling, actual Release package PURL storage, recent-access protection, eviction, and refetch through the generic HTTP route. The integration upstream is an httptest.Server, not live GitHub.
Passed on Linux with Go 1.26.7, against a source snapshot containing only this PR's changes:
go test -p=1 ./... -timeout 5m
go vet -p=1 ./...
go build -p=1 -buildvcs=false ./...
go test -p=1 -race ./internal/config ./internal/retention ./internal/handler ./internal/server -run 'Generic|Retention|NotCovered|RulesFor|RulesMinPositive' -count=1 -timeout 3m
Changed Go files pass gofmt, and git diff --check passes. -buildvcs=false was used because the validation snapshot has no .git directory. PostgreSQL integration tests were skipped (PROXY_DATABASE_URL was unset); local tests used SQLite. Full race and lint checks across the CI operating-system matrix are left to CI.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The explicit opt-in preserves existing retention configurations. Verified that upgrading with only a global default keeps generic assets cached, and a package rule evicts only the selected repository's assets, which can then be fetched again. Approval is for the code; merge should wait for CI to pass.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.