[PR #5881] [MERGED] fix(mobile): bound illustration previews through large PNG metadata #6979

Closed
opened 2026-10-23 04:15:25 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5881
Author: @SpicyMarinara
Created: 9/6/2026
Status: ✅ Merged
Merged: 9/6/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/5870-bounded-mobile-images


📝 Commits (2)

  • 8134168 chore: track iPhone image decode follow-up
  • c247211 fix(mobile): bound decoded previews through large PNG metadata

📊 Changes

4 files changed (+159 additions, -87 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 e2e/illustration-arrival.e2e.ts (+93 -64)
📝 packages/server/src/services/image/image-thumbnail.ts (+22 -10)
📝 scripts/regressions/gallery-previews.regression.ts (+42 -13)

📄 Description

Linked issue

Refs #5870. Keep the issue open for physical-iPhone confirmation.

Why

The maintainer confirmed that the installed iPhone Home Screen app still reloads or stays black around Illustrator image arrival on Docker build 36f5379b2e7d. No appearance-setting workaround is acceptable. Inspection found two reproducible gaps in the previous mitigation: width-only previews leave portrait/tall images oversized, and static PNGs with more than 64 KiB of metadata before IDAT fall back to the full original.

What changed

  • Reuse the existing thumbnailer to fit both dimensions inside the existing 320/1024 preview bounds, preserving aspect ratio, EXIF orientation and small images.
  • Read bounded PNG chunk headers and skip metadata payloads; keep APNG originals, including animation headers after large metadata.
  • Invalidate old width-only disk previews with the v3 cache key.
  • Extend existing regression and browser tests. No new dependencies, helpers, settings, recovery timers, provider changes, or original-image mutations.
  • Include an Unreleased changelog entry.

Automated evidence

  • Red/green Node proof: the old dimensions fail; after fixing dimensions alone, large-metadata PNGs still fail by returning original PNG bytes instead of a preview. Both pass with the full patch.
  • Old production Docker + new mobile WebKit test: fails (naturalWidth 1024 instead of 683). Patched production Docker: 21/21 selected browser checks pass across desktop Chromium, mobile Chromium and mobile WebKit, including saved automatic arrival before the remaining agent stream closes and saved-result recovery after reopening.
  • Portrait 1024×1536 → inline 683×1024; tall 1024×4096 → inline 256×1024. Gallery tiles fit inside 320×320. Fixtures include 200 KB ancillary PNG metadata and 20-message chats; Reduced paint effects remains off.
  • Desktop/lightbox use originals; original downloads are byte-identical. Animation, ownership/traversal/media validation, range/HEAD, no enlargement, orientation and cache-hit/invalidation regressions pass.
  • pnpm check passes. Local gallery regressions (6/6) and Roleplay swipe-media regression pass. Production Docker API smoke with normal rate limits passes health/SPA/upload/preview/original checks. Local Docker is Linux/arm64; CI additionally builds Linux/amd64.
  • GitHub project validation, 207/207 Node regressions, the complete desktop Chromium/mobile Chromium/mobile WebKit matrix, Docker build and CodeQL passed. CodeRabbit completed review of c247211d7 with no actionable findings.

Validation / manual test plan

  • Manually verify manual and automatic Illustrator in the iPhone Home Screen app, using existing appearance settings and Messages per page = 20.
  • Manually verify the app stays usable after image arrival and after reopening, with the result visible under the message and in Gallery.
  • Manually verify desktop/mobile original image opening and downloads retain their quality.

Proof boundaries and risk

The physical iPhone black-screen/GPU/process failure was not reproduced or profiled here. These tests prove reduced decoded dimensions and corrected delivery paths, not that every WebKit black screen is eliminated. The user's original GPT Image output was unavailable; large-metadata fixtures are synthetic. Paid provider calls were not made. Animated/unsupported images and deliberately opened originals retain the existing full-size behavior. Shared compact background/game-asset thumbnails also use the dimension bound; scene backgrounds and sprites are not changed.

UI evidence

Before/after mobile WebKit screenshots and detailed runtime evidence. Synthetic content only; download/open proof.html to view the embedded images. Screenshots retain the existing layout; assertions demonstrate the reduced decoded pixel sizes.

Docs and release notes

  • Review the Unreleased changelog entry.
  • Confirm no release-version or translated-document changes are needed.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/5881 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/6/2026 **Status:** ✅ Merged **Merged:** 9/6/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/5870-bounded-mobile-images` --- ### 📝 Commits (2) - [`8134168`](https://github.com/Pasta-Devs/Marinara-Engine/commit/81341686393f80b20f1b2cbc129adfa61502ac17) chore: track iPhone image decode follow-up - [`c247211`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c247211d743ad87bb354d3c1aa296006a70199c8) fix(mobile): bound decoded previews through large PNG metadata ### 📊 Changes **4 files changed** (+159 additions, -87 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `e2e/illustration-arrival.e2e.ts` (+93 -64) 📝 `packages/server/src/services/image/image-thumbnail.ts` (+22 -10) 📝 `scripts/regressions/gallery-previews.regression.ts` (+42 -13) </details> ### 📄 Description ## Linked issue Refs #5870. Keep the issue open for physical-iPhone confirmation. ## Why The maintainer confirmed that the installed iPhone Home Screen app still reloads or stays black around Illustrator image arrival on Docker build `36f5379b2e7d`. No appearance-setting workaround is acceptable. Inspection found two reproducible gaps in the previous mitigation: width-only previews leave portrait/tall images oversized, and static PNGs with more than 64 KiB of metadata before IDAT fall back to the full original. ## What changed - Reuse the existing thumbnailer to fit both dimensions inside the existing 320/1024 preview bounds, preserving aspect ratio, EXIF orientation and small images. - Read bounded PNG chunk headers and skip metadata payloads; keep APNG originals, including animation headers after large metadata. - Invalidate old width-only disk previews with the v3 cache key. - Extend existing regression and browser tests. No new dependencies, helpers, settings, recovery timers, provider changes, or original-image mutations. - Include an Unreleased changelog entry. ## Automated evidence - Red/green Node proof: the old dimensions fail; after fixing dimensions alone, large-metadata PNGs still fail by returning original PNG bytes instead of a preview. Both pass with the full patch. - Old production Docker + new mobile WebKit test: fails (`naturalWidth` 1024 instead of 683). Patched production Docker: **21/21 selected browser checks pass** across desktop Chromium, mobile Chromium and mobile WebKit, including saved automatic arrival before the remaining agent stream closes and saved-result recovery after reopening. - Portrait 1024×1536 → inline 683×1024; tall 1024×4096 → inline 256×1024. Gallery tiles fit inside 320×320. Fixtures include 200 KB ancillary PNG metadata and 20-message chats; Reduced paint effects remains off. - Desktop/lightbox use originals; original downloads are byte-identical. Animation, ownership/traversal/media validation, range/HEAD, no enlargement, orientation and cache-hit/invalidation regressions pass. - `pnpm check` passes. Local gallery regressions (6/6) and Roleplay swipe-media regression pass. Production Docker API smoke with normal rate limits passes health/SPA/upload/preview/original checks. Local Docker is Linux/arm64; CI additionally builds Linux/amd64. - GitHub project validation, **207/207 Node regressions**, the complete desktop Chromium/mobile Chromium/mobile WebKit matrix, Docker build and CodeQL passed. CodeRabbit completed review of `c247211d7` with no actionable findings. ## Validation / manual test plan - [ ] Manually verify manual and automatic Illustrator in the iPhone Home Screen app, using existing appearance settings and Messages per page = 20. - [ ] Manually verify the app stays usable after image arrival and after reopening, with the result visible under the message and in Gallery. - [ ] Manually verify desktop/mobile original image opening and downloads retain their quality. ## Proof boundaries and risk The physical iPhone black-screen/GPU/process failure was **not reproduced or profiled** here. These tests prove reduced decoded dimensions and corrected delivery paths, not that every WebKit black screen is eliminated. The user's original GPT Image output was unavailable; large-metadata fixtures are synthetic. Paid provider calls were not made. Animated/unsupported images and deliberately opened originals retain the existing full-size behavior. Shared compact background/game-asset thumbnails also use the dimension bound; scene backgrounds and sprites are not changed. ## UI evidence [Before/after mobile WebKit screenshots and detailed runtime evidence](https://gist.github.com/SpicyMarinara/511d44f4c8d0389ef9b99cdf0e94b5fc). Synthetic content only; download/open `proof.html` to view the embedded images. Screenshots retain the existing layout; assertions demonstrate the reduced decoded pixel sizes. ## Docs and release notes - [ ] Review the Unreleased changelog entry. - [ ] Confirm no release-version or translated-document changes are needed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:15:25 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#6979
No description provided.