Backtestshugorun-20260930-140149#12536
images: Opacity problem with Resize + Padding with PNG output
Worse
The merged fix was judged better than our patch.
In this judgment, Patch B = our agent, Patch A = the merged fix.
Patch A fixes the likely root causes. First, hex colors with alpha were parsed as premultiplied `color.RGBA`, so a transparent padding color had components greater than alpha. That is an invalid color, and it gets corrupted when drawn. A parses hex as `color.NRGBA` and normalizes the hex/luminance code to match. Second, the source palette was clamped back onto the output after filters ran. Since Padding runs through `Filter`, the transparent padding was lost when the result went back to the original indexed palette. A skips palette re-application for the filter action. It also makes `AddColorToPalette` compare by color value, so NRGBA and RGBA versions of the same color match. It updates the hex parsing and formatting unit tests with transparent cases that would fail before the change, and regenerates golden images, including `padding-transparent-chained`. Patch B only adds a hard-to-read condition around palette application, based on `bgColor`, `hasAlpha` and `IsOpaque(src)`. It leaves the invalid premultiplied color parsing untouched, adds no tests, and its logic is fragile: the palette is still applied whenever `bgColor` is set, and it is unclear whether it covers the Padding case at all. A's broader change (filters no longer clamp to the source palette) adds some risk, but it is justified and reflected in the updated golden files.
The judge saw only the two patches, labelled A and B in random order, with issue links and version numbers removed. The reasoning above is shown verbatim.
Solve
5m 53s16 turns
Wall-clock time in the container
Full test suite
No new failures
3,751 passed · 99 skipped · 3,852 total
Contamination audit
Clean
No sign the agent saw the real fix
Patch size
5vs 58 merged
Changed lines, ours vs merged