Item 7 of 15 of #168: "Build the pipeline in main's fx graph, with the config as the only place defaults live". Starts when the item before it (removing the code nothing uses) is squash-merged to next.
Today (next at 989da78)
handlers.New builds the cache, fetcher, processor, session manager and encrypted-URL generator inside its OnStart hook (initImageService in internal/handlers/handlers.go), so Handlers holds a *database.Database only to hand it on, and its fields are nil until start. Defaults are declared three times: in internal/config (DefaultUpstreamConnectionsPerHost, DefaultUpstreamFetchTimeout, DefaultUpstreamMaxResponseSize and others), in httpfetcher.DefaultConfig() and as imageprocessor.DefaultMaxInputBytes. initImageService copies validated config into httpfetcher.Config field by field, with a positive-value guard the config already enforces, and NewService reads AllowHTTP and MaxResponseSize back out of that struct. "Disk cache off" is CacheMaxBytes == 0 in the config, CacheConfig.DisableDiskCache at the boundary, and Cache.disabled plus a zero-limit check inside.
Definition of done
The cache, the fetcher, the processor, the session manager, the encrypted-URL generator and the image service are each an fx provider taking the values it needs, in the fx graph internal/app builds; handlers.New receives them built, and no Handlers field is nil after construction.
Handlers holds no *database.Database it does not use itself.
Each setting's default is declared once, in internal/config. Constructors take explicit values, with no zero-means-default; httpfetcher.DefaultConfig() and imageprocessor.DefaultMaxInputBytes are gone, and tests that used them build their values explicitly.
initImageService and its field-by-field copy are gone; the image service does not read settings back out of the fetcher's config.
"Disk cache off" is one value carried from the config to the cache.
Startup, shutdown and every route behave as before.
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. 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 7 of 15 of https://git.eeqj.de/sneak/pixa/issues/168: "Build the pipeline in `main`'s fx graph, with the config as the only place defaults live". Starts when the item before it (removing the code nothing uses) is squash-merged to `next`.
## Today (`next` at `989da78`)
`handlers.New` builds the cache, fetcher, processor, session manager and encrypted-URL generator inside its `OnStart` hook (`initImageService` in `internal/handlers/handlers.go`), so `Handlers` holds a `*database.Database` only to hand it on, and its fields are nil until start. Defaults are declared three times: in `internal/config` (`DefaultUpstreamConnectionsPerHost`, `DefaultUpstreamFetchTimeout`, `DefaultUpstreamMaxResponseSize` and others), in `httpfetcher.DefaultConfig()` and as `imageprocessor.DefaultMaxInputBytes`. `initImageService` copies validated config into `httpfetcher.Config` field by field, with a positive-value guard the config already enforces, and `NewService` reads `AllowHTTP` and `MaxResponseSize` back out of that struct. "Disk cache off" is `CacheMaxBytes == 0` in the config, `CacheConfig.DisableDiskCache` at the boundary, and `Cache.disabled` plus a zero-limit check inside.
## Definition of done
- The cache, the fetcher, the processor, the session manager, the encrypted-URL generator and the image service are each an fx provider taking the values it needs, in the fx graph `internal/app` builds; `handlers.New` receives them built, and no `Handlers` field is nil after construction.
- `Handlers` holds no `*database.Database` it does not use itself.
- Each setting's default is declared once, in `internal/config`. Constructors take explicit values, with no zero-means-default; `httpfetcher.DefaultConfig()` and `imageprocessor.DefaultMaxInputBytes` are gone, and tests that used them build their values explicitly.
- `initImageService` and its field-by-field copy are gone; the image service does not read settings back out of the fetcher's config.
- "Disk cache off" is one value carried from the config to the cache.
- Startup, shutdown and every route behave as before.
## 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. 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:24 +02:00
clawbot
self-assigned this 2026-10-21 12:50:24 +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 7 of 15 of #168: "Build the pipeline in
main's fx graph, with the config as the only place defaults live". Starts when the item before it (removing the code nothing uses) is squash-merged tonext.Today (
nextat989da78)handlers.Newbuilds the cache, fetcher, processor, session manager and encrypted-URL generator inside itsOnStarthook (initImageServiceininternal/handlers/handlers.go), soHandlersholds a*database.Databaseonly to hand it on, and its fields are nil until start. Defaults are declared three times: ininternal/config(DefaultUpstreamConnectionsPerHost,DefaultUpstreamFetchTimeout,DefaultUpstreamMaxResponseSizeand others), inhttpfetcher.DefaultConfig()and asimageprocessor.DefaultMaxInputBytes.initImageServicecopies validated config intohttpfetcher.Configfield by field, with a positive-value guard the config already enforces, andNewServicereadsAllowHTTPandMaxResponseSizeback out of that struct. "Disk cache off" isCacheMaxBytes == 0in the config,CacheConfig.DisableDiskCacheat the boundary, andCache.disabledplus a zero-limit check inside.Definition of done
internal/appbuilds;handlers.Newreceives them built, and noHandlersfield is nil after construction.Handlersholds no*database.Databaseit does not use itself.internal/config. Constructors take explicit values, with no zero-means-default;httpfetcher.DefaultConfig()andimageprocessor.DefaultMaxInputBytesare gone, and tests that used them build their values explicitly.initImageServiceand its field-by-field copy are gone; the image service does not read settings back out of the fetcher's config.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. 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