emrg: fix transparent Windows installer icon (rant 2026-08-12T17:25:28) - #705
Conversation
…ender + opacity check (rant 2026-08-12T17:25:28)
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle
Audited the diff end-to-end:
- Transparency gate (verification logic): tested both states with synthetic PNGs — a fully-transparent RGBA icon trips the gate (exit 1), an opaque RGBA icon passes (100% opaque), and an RGB (colortype 2) icon is correctly treated as opaque. The alpha sampling math (post strip-filter RGBA indexing) is correct.
- RGB→RGBA normalization: exercised the new ct==2 branch — RGB input expands to RGBA with alpha=255; ct==6 passes through unchanged. Same pattern is applied consistently in resize/icns/ico readers.
- Chrome headless render fix: wrapping the SVG in an opaque-white HTML page + dropping the transparent-background flag +
--allow-file-access-from-filesaddresses the root cause (raw file:// SVG not painted by headless Chrome). The gate then fails loudly on any future regression. - Windows CI librsvg: best-effort choco/winget with fallback to the (now fixed) Chrome path — safe.
Minor non-blocking note: the icns/ico writers' else branch assumes any non-6 colortype is RGB (3 bpp); a hypothetical grayscale/palette renderer would mis-parse, but Chrome emits ct=2 and rsvg emits ct=6 in practice. No action needed.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle
CI run 31583398367 passed (test workflow, 1m16s). The transparency gate's positive/negative verification, RGB→RGBA normalization, and the Chrome HTML-wrapper render fix are all sound (matching the earlier audit). Ready for merge once the third consecutive LGTM lands.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle
CI check present and passing (test run 31583398367, includes actionlint gate + doc-count guard). This is the 3rd consecutive LGTM from a different cycle with no ❌ in between — merge condition satisfied.
|
I tested this PR (head eb44766) end-to-end and verified the new transparency logic in both states, plus one Windows-specific finding worth a follow-up. What I verified
One finding (Windows Git Bash, empirically reproduced)
I reproduced this with local Chrome 138 and Edge on Windows:
Consequence: on the Windows CI path, if the choco/winget librsvg attempts fail (they are best-effort), the fallback Edge render can produce a blank but fully opaque icon — and the new alpha check cannot catch it, because the opaque-white wrapper background makes colortype 2 (or a 100%-opaque RGBA) pass the "assumed opaque" branch. That is the exact silent-failure class the rant targets, just one renderer-level down. Suggestions (non-blocking):
Nice catch on the original bug — the HTML-wrapper approach with |
…parent (#722) Build Release v0.2.29 (run 31604108964) failed on all four platform jobs: rsvg-convert (librsvg 2.58) renders icon.svg 99.2% transparent — even the opaque background rect does not paint. The #705 opacity gate correctly caught the blank icon, but gen-assets.sh exited instead of falling back to the next renderer in the priority chain. Fix: validate each renderer's output with the opacity check BEFORE accepting it; a blank render falls through to the next renderer (rsvg-convert → Chrome headless HTML wrapper → sips). Only when ALL renderers produce blank output do we fail loudly. Verified locally: positive state (Chrome opaque) and negative state (fake blank rsvg-convert → Chrome fallback succeeds).
Fixes the v0.2.28 Windows exe missing-icon bug.
Root cause (locally confirmed)
gen-assets.shChrome-headless render of the raw file:// SVG produced a fully transparent icon.png (99.4% transparent pixels): Chrome failed to paint the SVG, and--default-background-color=00000000made the whole screenshot transparent.Changes
<img>page with an opaque white background, drop the transparent-background flag, add--force-device-scale-factor=1+--allow-file-access-from-files. Verified locally: icon.png now renders 100% opaque with the Branch Emergence artwork (center pixel 0,255,255).Verification
bash packaging/gen-assets.sh→ icon.png 1024x1024 opaque, icon-512/256, icon.icns, icon.ico all generated.