April 7: Correctness Triage
Short day — cleaned up three processing-engine correctness bugs that had been sitting in the tech-debt queue (#1019, #1023, #969) and centralized the duplicate MAX_FITS_FILE_SIZE_BYTES constant that was defined in three places.
Developer Journal
Processing engine correctness triage (#1046)
Three bugs, same PR because they were all small and in the same call graph:
#1019 — the composite normalization was computing max across channels before masking NaN pixels, so any channel with a single NaN at a bright spot would return NaN for the max and poison the whole normalization. Fixed by applying the NaN mask before the reduction.
#1023 — the reproject cache key included the target WCS but not the source WCS, so two sources with the same target but different source footprints collided in the cache and returned the wrong reprojected array. Added source WCS hash to the cache key. The symptom was subtle — occasional tile misalignment — and had been sitting unexplained for a while.
#969 — the asinh stretch was using np.arcsinh(x / β) where β was the scaled soft threshold, but the docstring claimed β was the raw threshold. Either the code or the docstring was wrong depending on your reading. Picked the code-correct interpretation (β is pre-scaled because it needs to be in stretched-value space), updated the docstring and variable name to match, and added a test that locked in the expected output for a known input.
Centralize MAX_FITS_FILE_SIZE_BYTES (#1045)
The 10 GB file size cap was hardcoded in three places: the FastAPI upload validator, the .NET gateway that proxies uploads, and the composite service that re-validates on pull. Three places, three different literal values (they agreed at the moment of writing but nothing enforced that). Moved it to a single config entry loaded from MAX_FITS_FILE_SIZE_MB, converted at boot, and referenced everywhere else.
Tracking issue #972 was the one that first flagged the duplication. Closed with this PR.
What shipped
| PR | Title |
|---|---|
| #1046 | fix: processing engine correctness bugs (#1019, #1023, #969) |
| #1045 | fix: centralize duplicate MAX_FITS_FILE_SIZE_BYTES constant (#972) |