Remove dead abstractions in imgcache: unimplemented Purge and three interfaces with no implementers #73
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Verified against
mainat61f42e6.1.
Purgeis declared but not implemented.internal/imgcache/imgcache.go:137-138putsPurgein theImageCacheinterface;internal/imgcache/service.go:376-379is:This is the only
TODO/FIXME/not implementedin non-test code in the entire repo. No route exposes it, so it is unreachable in production — it is interface surface promising a capability that does not exist.2. Three interfaces have no implementers and do not match the real types.
internal/imgcache/imgcache.go:158-182:Allowlist.IsAllowlisted— the real type isallowlist.HostAllowList.IsAllowed; names do not match, so nothing satisfies the interface.Storage— its methods takectxandstring; the realContentStorage/VariantStoragetake neither.SignatureValidator— no implementer.These are leftovers from an earlier design. They cost nothing at runtime but they actively mislead: someone reading
imgcache.gofor the package's shape sees three abstractions that describe nothing in the codebase.Definition of done
Purge: either implement it (delete variant file +.metasidecar + accounting row, transactionally consistent with #51's eviction path, and expose it on a route with authentication) or remove it from the interface and delete the stub. Recommend removing — nothing needs it today, #51 handles reclamation, and an unauthenticated-by-accident purge endpoint is a liability. If removed, note in the PR that it can be reintroduced deliberately when a use case exists.Allowlist,Storage, andSignatureValidatorfromimgcache.gounless a concrete implementer is added in the same change.Purgeis removed, one interface-method removal.make checkgreen.Coordination
internal/imgcacheinto focused packages) — the dead interfaces are exactly the kind of thing that should not survive into the split. Doing this before #39'surlparserextraction keeps that diff smaller.Purgeis implemented rather than removed, it must be consistent with PR #55's eviction and sidecar handling — do it after #55 merges.