Item 11 of 15 of #168: "Split internal/imgcache by role". Starts when the item before it (one handler body for the two image routes) is squash-merged to next. Closes #39.
Today (next at 989da78)
internal/imgcache holds both the pipeline (Service, service.go) and the cache (cache.go, storage.go, eviction.go, contentlock.go and others). #39 kept these together as tightly coupled; the coupling is the shared types, which #307 moves to a package of their own, after which the two halves are independent and each fits in one reading. The cache also has two-step reads, Lookup then GetVariant and LookupSource then GetSourceContent, and checkNegativeCache sits apart from the rest.
Names, recorded here
Taken from the proposals in #168, since this item needs them: imgcache.Service becomes Proxy in a new package internal/imageproxy (README.md describes pixa as something that "proxies images from upstream sources, optionally resizing or transforming them, and serves the results", which is what this type does); ServiceConfig goes with it as imageproxy.Config; imgcache.CacheConfig becomes imgcache.Config. The cache gets one read and one write per kind: Variant(key) and PutVariant, Source(src) and PutSource, Failure(src) and PutFailure for the negative cache. No other name changes under this item.
Definition of done
internal/imageproxy holds Proxy and its config, and its package comment says it fetches, transforms, caches and serves images; internal/imgcache holds the cache only, and its package comment says so.
imageproxy imports imgcache; imgcache does not import imageproxy.
The cache's reads and writes are the six methods above; the two-step reads are gone, and the negative cache is read and written through Failure and PutFailure like the rest.
module.go and imgcache.go hold nothing that belongs in another file.
sneak asked for each main recommendation of #168 to be its own issue, built before 1.0, one at a time in the order listed (#168 (comment)). That instruction is his approval of this item, including its reversal of keeping the two halves together under #39. Existing tests change only as this item needs: they follow code that moves or is renamed, and the tests of code this item removes go with it; no other assertion is weakened or dropped.
Model: opus-5-5
Item 11 of 15 of https://git.eeqj.de/sneak/pixa/issues/168: "Split `internal/imgcache` by role". Starts when the item before it (one handler body for the two image routes) is squash-merged to `next`. Closes https://git.eeqj.de/sneak/pixa/issues/39.
## Today (`next` at `989da78`)
`internal/imgcache` holds both the pipeline (`Service`, `service.go`) and the cache (`cache.go`, `storage.go`, `eviction.go`, `contentlock.go` and others). https://git.eeqj.de/sneak/pixa/issues/39 kept these together as tightly coupled; the coupling is the shared types, which https://git.eeqj.de/sneak/pixa/issues/307 moves to a package of their own, after which the two halves are independent and each fits in one reading. The cache also has two-step reads, `Lookup` then `GetVariant` and `LookupSource` then `GetSourceContent`, and `checkNegativeCache` sits apart from the rest.
## Names, recorded here
Taken from the proposals in https://git.eeqj.de/sneak/pixa/issues/168, since this item needs them: `imgcache.Service` becomes `Proxy` in a new package `internal/imageproxy` (`README.md` describes pixa as something that "proxies images from upstream sources, optionally resizing or transforming them, and serves the results", which is what this type does); `ServiceConfig` goes with it as `imageproxy.Config`; `imgcache.CacheConfig` becomes `imgcache.Config`. The cache gets one read and one write per kind: `Variant(key)` and `PutVariant`, `Source(src)` and `PutSource`, `Failure(src)` and `PutFailure` for the negative cache. No other name changes under this item.
## Definition of done
- `internal/imageproxy` holds `Proxy` and its config, and its package comment says it fetches, transforms, caches and serves images; `internal/imgcache` holds the cache only, and its package comment says so.
- `imageproxy` imports `imgcache`; `imgcache` does not import `imageproxy`.
- The cache's reads and writes are the six methods above; the two-step reads are gone, and the negative cache is read and written through `Failure` and `PutFailure` like the rest.
- `module.go` and `imgcache.go` hold nothing that belongs in another file.
- Behaviour is unchanged on every route.
- https://git.eeqj.de/sneak/pixa/issues/39 is closed by the PR.
## Approval and tests
sneak asked for each main recommendation of https://git.eeqj.de/sneak/pixa/issues/168 to be its own issue, built before 1.0, one at a time in the order listed (https://git.eeqj.de/sneak/pixa/issues/168#issuecomment-153513). That instruction is his approval of this item, including its reversal of keeping the two halves together under https://git.eeqj.de/sneak/pixa/issues/39. Existing tests change only as this item needs: they follow code that moves or is renamed, and the tests of code this item removes go with it; no other assertion is weakened or dropped.
Model: opus-5-5
clawbot
added this to the 1.0.0 milestone 2026-10-21 12:50:57 +02:00
clawbot
self-assigned this 2026-10-21 12:50:58 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Item 11 of 15 of #168: "Split
internal/imgcacheby role". Starts when the item before it (one handler body for the two image routes) is squash-merged tonext. Closes #39.Today (
nextat989da78)internal/imgcacheholds both the pipeline (Service,service.go) and the cache (cache.go,storage.go,eviction.go,contentlock.goand others). #39 kept these together as tightly coupled; the coupling is the shared types, which #307 moves to a package of their own, after which the two halves are independent and each fits in one reading. The cache also has two-step reads,LookupthenGetVariantandLookupSourcethenGetSourceContent, andcheckNegativeCachesits apart from the rest.Names, recorded here
Taken from the proposals in #168, since this item needs them:
imgcache.ServicebecomesProxyin a new packageinternal/imageproxy(README.mddescribes pixa as something that "proxies images from upstream sources, optionally resizing or transforming them, and serves the results", which is what this type does);ServiceConfiggoes with it asimageproxy.Config;imgcache.CacheConfigbecomesimgcache.Config. The cache gets one read and one write per kind:Variant(key)andPutVariant,Source(src)andPutSource,Failure(src)andPutFailurefor the negative cache. No other name changes under this item.Definition of done
internal/imageproxyholdsProxyand its config, and its package comment says it fetches, transforms, caches and serves images;internal/imgcacheholds the cache only, and its package comment says so.imageproxyimportsimgcache;imgcachedoes not importimageproxy.FailureandPutFailurelike the rest.module.goandimgcache.gohold nothing that belongs in another file.Approval and tests
sneak asked for each main recommendation of #168 to be its own issue, built before 1.0, one at a time in the order listed (#168 (comment)). That instruction is his approval of this item, including its reversal of keeping the two halves together under #39. Existing tests change only as this item needs: they follow code that moves or is renamed, and the tests of code this item removes go with it; no other assertion is weakened or dropped.
Model: opus-5-5