Skip to content

fix(desktop): keep the alpha channel every generated icon needs - #5356

Merged
lidge-jun merged 1 commit into
devfrom
codex/260921-icon-rgba
Sep 20, 2026
Merged

lidge-jun merged 1 commit into
devfrom
codex/260921-icon-rgba

Conversation

@lidge-jun

Copy link
Copy Markdown
Owner

Summary

  • feat(desktop): draw the app icon and menu bar mark from the brand artwork #5355 gave the app icon an opaque backdrop, which is what Apple's guidance asks for. librsvg then noticed that nothing in the render is transparent and dropped the alpha channel, so fifteen of the sixteen committed rasters came out as truecolour PNGs. Only tray/icon.png, which has real transparency, kept its alpha.
  • That is a valid PNG and a broken icon. tauri::generate_context! refuses a window icon that is not RGBA, so the desktop app stops compiling: error: proc macro panicked ... icon .../icons/icon.png is not RGBA.
  • Nothing in the repository could see it. The icon tests read dimensions and container structure, and no test or hosted job builds the Tauri bundle, so the first thing that notices is a release build or someone building locally — which is where it turned up.
  • generate-icons.ts now re-encodes a truecolour render as truecolour-with-alpha before writing it: inflate the IDAT, undo the scanline filters, widen each pixel to four bytes with alpha 255, and emit a fresh IHDR/IDAT/IEND. A render that already carries alpha is returned untouched. This also stops the committed bytes depending on whether the local librsvg felt like optimising the channel away.
  • The regression test asserts the colour type of every committed raster, including the tray image, rather than trusting the renderer.

Verification

  • cd desktop && bun run icons then bun run icons:check — 18 artifacts regenerated, 18 matching.
  • Colour type of all sixteen committed rasters read straight out of the IHDR: every one is 6 (truecolour with alpha), and icon.png's minimum alpha is 255, so the visible artwork is unchanged.
  • bun test tests/ci-workflows/build-desktop-icon-set.test.ts — 8 pass, 0 fail.
  • cd desktop && bun run build:local — the bundle build that failed on the previous head is the check this change exists for; its result is recorded on the PR.
  • Full suite and typecheck were NOT run here; hosted CI is the gate for those.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

The new backdrop is opaque, and librsvg drops the alpha channel when nothing in a
render is transparent. The result is a valid PNG and a broken icon: tauri::generate_context!
refuses a window icon that is not RGBA, so the desktop app stops compiling with
"icon .../icon.png is not RGBA". Fifteen of the sixteen committed rasters came out as
truecolour; only the tray asset, which has real transparency, kept its alpha.

Nothing in the repository could see this. The icon tests read dimensions and container
structure, and no test or hosted job builds the Tauri bundle, so the first thing that
notices is a release build or someone building locally.

The generator now re-encodes a truecolour render as truecolour-with-alpha before writing
it, which also stops the committed bytes depending on whether the local librsvg felt like
optimising the channel away. The regression test asserts the colour type of every
committed raster rather than trusting the renderer.
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner September 20, 2026 16:34
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 20, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-20T16:38:11.259015Z fcac448 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Sep 20, 2026
@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Repository: lidge-jun/opencodex/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: c4896945-5012-4a82-8927-a78ee17486f1

📥 Commits

Reviewing files that changed from the base of the PR and between a2d35a6 and fcac448.

⛔ Files ignored due to path filters (16)
  • desktop/src-tauri/icons/128x128.png is excluded by !**/*.png
  • desktop/src-tauri/icons/128x128@2x.png is excluded by !**/*.png
  • desktop/src-tauri/icons/32x32.png is excluded by !**/*.png
  • desktop/src-tauri/icons/64x64.png is excluded by !**/*.png
  • desktop/src-tauri/icons/Square107x107Logo.png is excluded by !**/*.png
  • desktop/src-tauri/icons/Square142x142Logo.png is excluded by !**/*.png
  • desktop/src-tauri/icons/Square150x150Logo.png is excluded by !**/*.png
  • desktop/src-tauri/icons/Square284x284Logo.png is excluded by !**/*.png
  • desktop/src-tauri/icons/Square30x30Logo.png is excluded by !**/*.png
  • desktop/src-tauri/icons/Square310x310Logo.png is excluded by !**/*.png
  • desktop/src-tauri/icons/Square44x44Logo.png is excluded by !**/*.png
  • desktop/src-tauri/icons/Square71x71Logo.png is excluded by !**/*.png
  • desktop/src-tauri/icons/Square89x89Logo.png is excluded by !**/*.png
  • desktop/src-tauri/icons/StoreLogo.png is excluded by !**/*.png
  • desktop/src-tauri/icons/icon.ico is excluded by !**/*.ico
  • desktop/src-tauri/icons/icon.png is excluded by !**/*.png
📒 Files selected for processing (3)
  • desktop/scripts/generate-icons.ts
  • desktop/src-tauri/icons/icon.icns
  • tests/ci-workflows/build-desktop-icon-set.test.ts
 _____________________________________________________________________________________________
< Use the power of command shells. Use the shell when graphical user interfaces don't cut it. >
 ---------------------------------------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lidge-jun
lidge-jun merged commit 5794348 into dev Sep 20, 2026
23 of 26 checks passed
@lidge-jun
lidge-jun deleted the codex/260921-icon-rgba branch September 20, 2026 16:35
@lidge-jun

Copy link
Copy Markdown
Owner Author

리뷰 · 우선순위 73 / 80

이 PR은 #5355 뒤에 데스크톱 빌드가 깨진 이유를 고칩니다. 앱 아이콘에 불투명 배경을 넣었더니, librsvg가 “투명 픽셀이 없다”고 보고 알파 채널을 빼 버립니다. PNG는 그대로 열려도, Tauri의 generate_context!는 창 아이콘이 RGBA가 아니면 거절합니다. 그래서 icon ... is not RGBA로 컴파일이 멈춥니다. 커밋된 래스터 16장 중 15장이 truecolour(색 타입 2)였고, 진짜 투명이 있는 tray/icon.png만 알파를 남겼습니다. 기존 아이콘 테스트는 크기·컨테이너만 보고, 호스티드 CI도 Tauri 번들을 안 돌려서, 로컬·릴리즈 빌드에서야 처음 드러난 구멍입니다. 이번 고침은 generate-icons.tsrender 직후에 toRgba를 돌립니다. 색 타입이 이미 6이면 그대로 두고, 2이면 IDAT를 풀어 스캔라인 필터를 되돌린 뒤 알파 255를 붙여 다시 IHDR/IDAT/IEND로 씁니다. 커밋된 PNG·ico·icns도 다시 만들었고, 회귀 테스트는 커밋된 모든 래스터(트레이 포함)의 IHDR 색 타입이 6인지 봅니다. base는 dev입니다. 같은 주제의 다른 열린 PR은 보이지 않습니다. types/config 분할과는 무관합니다.

라인 desktop/scripts/generate-icons.ts toRgba - inflate한 raw 길이가 height * (1 + width*3)인지 검사하지 않습니다. rsvg 출력이면 보통 맞지만, IDAT가 짧거나 깨지면 짧은 행을 그대로 읽어 잘못된 RGBA를 만들 수 있습니다. 한 줄 expect/throw면 충분합니다.

라인 같은 함수의 청크 루프 - length가 남은 바이트보다 커도 subarray가 조용히 잘립니다. CRC도 안 봅니다. 신뢰하는 로컬 렌더러 전제라면 괜찮고, 범용 PNG 디코더로는 약합니다.

라인 tests/ci-workflows/build-desktop-icon-set.test.ts - 색 타입을 bytes[25]로만 읽습니다. IHDR이 첫 청크라는 PNG 규칙에는 맞지만, 옆 테스트처럼 "IHDR" 글자를 한 번 확인한 뒤 data[9]를 보면 더 읽기 쉽습니다.

라인 손수 만든 PNG 인코더(~110줄) - 의존성 없이 끝낸 선택은 이해됩니다. 다만 필터·CRC·청크 경계가 앞으로 손댈 때마다 깨질 수 있는 면입니다.

메인테이너의 판단이 필요한 지점

inflate 길이 검사만 이 PR에 더 넣을지, 아니면 지금 회귀(색 타입 6)만으로 머지하고 디코더 방어는 후속으로 둘지. 손수 PNG 대신 이미 쓰는 이미지 도구가 있으면 그걸 쓸지도 정하면 됩니다. 호스티드 잡이 Tauri 번들을 안 돌리는 한계는 PR이 이미 적어 두었고, 이번 테스트가 CI에서 그 구멍을 대신 막는 역할입니다.

너의 추천

원인·고침·커밋된 산출물·색 타입 회귀가 한 줄로 맞습니다. bun test tests/ci-workflows/build-desktop-icon-set.test.ts와 관련 CI가 초록이면 dev에 머지하세요. 여력이 있으면 inflate 길이 검사만 더하고, 그 외 PNG 디코더 강화나 번들 빌드 CI는 후속으로 남겨도 됩니다. 무효·중복으로 닫을 다른 열린 PR은 없습니다.

이 댓글은 grok-bot이 작성했습니다

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant