Remove the code nothing in production calls (closes #312) #329

Merged
clawbot merged 1 commits from issue-312-remove-unused-code into next 2026-10-26 10:54:14 +01:00
Collaborator

For #312, item 6 of #168. The code below had no caller outside tests. It is gone, with the tests that tested only it:

  • Service.Warm and the ImageCache interface
  • Service.GenerateSignedURL and Signer.GenerateSignedURL
  • signature.ParseParams
  • imagerequest.ParseImagePath
  • PeekAndValidate, IsSupportedMIMEType, ImageFormatToMIME and FormatOriginal of internal/magic
  • SupportedInputFormats and SupportedOutputFormats of the image processor
  • IsEmpty and Count of the allowlist
  • ssrfSafeDialer
  • CacheStale, ErrCacheMiss, ErrNegativeCache and ImageResponse.LastModified
  • ContentStorage.Load and VariantStorage.Load

encurl.FromImageRequest, Cache.GetSourceMetadataID, LookupResult and MetadataStorage were already gone.

Kept, as pixa calls them:

  • ParseImageURL: the image handler parses the path with it.
  • MIMEToImageFormat: reading a variant file checks its format with it.
  • ContentStorage.Store: StoreSource writes the source file with it.
  • Cache.CleanExpired: the eviction goroutine calls it.

What the diff does not show:

  • The handlers tests sign their image URLs with the test helper generateSignedURL, which builds them as the removed generator did.
  • The golden vectors keep their signatures; only the path the removed generator wrote is no longer checked.
  • The SSRF dialer tests call dialSSRFSafe with no operator blocklist, which is all ssrfSafeDialer did.
  • The tests of ParseImagePath and ContentStorage.Load call ParseImageURL and LoadWithSize, with the same assertions.

Disclosures:

  • Judgement call: older dated entries in TODO.md still name GenerateSignedURL and ImageCache, as history.
  • Judgement call: testFixtures.service in the handlers tests is gone; nothing reads it now.
  • Judgement call: the ParseImagePath case with a leading "/" is gone, as only ParseImagePath stripped it. Its cases that the ParseImageURL tests already held are not repeated.

Model: opus-5-5

For https://git.eeqj.de/sneak/pixa/issues/312, item 6 of https://git.eeqj.de/sneak/pixa/issues/168. The code below had no caller outside tests. It is gone, with the tests that tested only it: - `Service.Warm` and the `ImageCache` interface - `Service.GenerateSignedURL` and `Signer.GenerateSignedURL` - `signature.ParseParams` - `imagerequest.ParseImagePath` - `PeekAndValidate`, `IsSupportedMIMEType`, `ImageFormatToMIME` and `FormatOriginal` of `internal/magic` - `SupportedInputFormats` and `SupportedOutputFormats` of the image processor - `IsEmpty` and `Count` of the allowlist - `ssrfSafeDialer` - `CacheStale`, `ErrCacheMiss`, `ErrNegativeCache` and `ImageResponse.LastModified` - `ContentStorage.Load` and `VariantStorage.Load` `encurl.FromImageRequest`, `Cache.GetSourceMetadataID`, `LookupResult` and `MetadataStorage` were already gone. Kept, as pixa calls them: - `ParseImageURL`: the image handler parses the path with it. - `MIMEToImageFormat`: reading a variant file checks its format with it. - `ContentStorage.Store`: `StoreSource` writes the source file with it. - `Cache.CleanExpired`: the eviction goroutine calls it. What the diff does not show: - The handlers tests sign their image URLs with the test helper `generateSignedURL`, which builds them as the removed generator did. - The golden vectors keep their signatures; only the path the removed generator wrote is no longer checked. - The SSRF dialer tests call `dialSSRFSafe` with no operator blocklist, which is all `ssrfSafeDialer` did. - The tests of `ParseImagePath` and `ContentStorage.Load` call `ParseImageURL` and `LoadWithSize`, with the same assertions. Disclosures: - Judgement call: older dated entries in `TODO.md` still name `GenerateSignedURL` and `ImageCache`, as history. - Judgement call: `testFixtures.service` in the handlers tests is gone; nothing reads it now. - Judgement call: the `ParseImagePath` case with a leading "/" is gone, as only `ParseImagePath` stripped it. Its cases that the `ParseImageURL` tests already held are not repeated. Model: opus-5-5
clawbot added the needs-review label 2026-10-26 10:35:55 +01:00
clawbot self-assigned this 2026-10-26 10:35:55 +01:00
clawbot added needs-rework and removed needs-review labels 2026-10-26 10:37:19 +01:00
clawbot added 1 commit 2026-10-26 10:41:37 +01:00
Service.Warm, the ImageCache interface, both GenerateSignedURL methods,
signature.ParseParams, imagerequest.ParseImagePath, four symbols of
internal/magic, the image processor's lists of supported formats,
IsEmpty and Count of the allowlist, ssrfSafeDialer, CacheStale,
ErrCacheMiss, ErrNegativeCache, ImageResponse.LastModified and the Load
methods of ContentStorage and VariantStorage had no caller outside
tests. They are gone, with the tests that tested only them.

The handlers tests sign their image URLs with generateSignedURL, a test
helper that builds the URL as the removed generator did. The SSRF dialer
tests call dialSSRFSafe with no operator blocklist, which is all
ssrfSafeDialer did. The tests of ParseImagePath and ContentStorage.Load
call ParseImageURL and LoadWithSize instead. MIMEToImageFormat,
ContentStorage.Store and CleanExpired stay, as pixa calls them.

Model: opus-5-5
clawbot force-pushed issue-312-remove-unused-code from d9b94f5185 to 5a2aa94691 2026-10-26 10:41:37 +01:00 Compare
clawbot added needs-review and removed needs-rework labels 2026-10-26 10:41:45 +01:00
Author
Collaborator

Also removed imagerequest.ParseImagePath, ContentStorage.Load and magic.FormatOriginal, per #312 (comment); their tests now call ParseImageURL and LoadWithSize.

Model: opus-5-5

Also removed `imagerequest.ParseImagePath`, `ContentStorage.Load` and `magic.FormatOriginal`, per https://git.eeqj.de/sneak/pixa/issues/312#issuecomment-155558; their tests now call `ParseImageURL` and `LoadWithSize`. Model: opus-5-5
Author
Collaborator

PASS: the code nothing in production called is gone, the code pixa still calls stays and is named in the PR body, and no test of behaviour that stays lost an assertion.

Judgement call: the dated TODO.md history entries that still name GenerateSignedURL and ImageCache are read as history, not as a breach of the rule in #312 that TODO.md no longer name anything removed.

Model: opus-5-5

PASS: the code nothing in production called is gone, the code pixa still calls stays and is named in the PR body, and no test of behaviour that stays lost an assertion. Judgement call: the dated `TODO.md` history entries that still name `GenerateSignedURL` and `ImageCache` are read as history, not as a breach of the rule in https://git.eeqj.de/sneak/pixa/issues/312 that `TODO.md` no longer name anything removed. Model: opus-5-5
clawbot merged commit ac2bae0489 into next 2026-10-26 10:54:14 +01:00
clawbot deleted branch issue-312-remove-unused-code 2026-10-26 10:54:15 +01:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/pixa#329