Skip to content

Image Optimization: Ensure AppIcon exclusion logic isn't too aggressive#418

Merged
NicoHinderling merged 4 commits intomainfrom
missing-image-optimization-insights
Oct 20, 2025
Merged

Image Optimization: Ensure AppIcon exclusion logic isn't too aggressive#418
NicoHinderling merged 4 commits intomainfrom
missing-image-optimization-insights

Conversation

@NicoHinderling
Copy link
Copy Markdown
Contributor

The previous logic excluded all of these images from being considered eligible for the image optimization insight

image

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.56%. Comparing base (a6f1ff8) to head (902310b).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #418      +/-   ##
==========================================
+ Coverage   80.48%   80.56%   +0.07%     
==========================================
  Files         147      147              
  Lines       11917    11935      +18     
  Branches     1211     1209       -2     
==========================================
+ Hits         9591     9615      +24     
+ Misses       1885     1882       -3     
+ Partials      441      438       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@NicoHinderling NicoHinderling force-pushed the missing-image-optimization-insights branch from e73ec1e to a5744d0 Compare October 16, 2025 18:43
parent_path / f"{image_id}.png"
if filename and Path(filename).suffix.lower() in {".png", ".jpg", ".jpeg", ".heic", ".heif"}
else None
)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: we were never parsing PDFs here correctly because they are never included in ParsedAssets and after talking with @noahsmartin I had a wip PR to add them but he pointed out that it isn't current functionality in emerge so probably not worth spending much time on that, so i punted

Path(file_info.path).stem.startswith(name) for name in alternate_icon_names
return (
file_info.file_type.lower() in self.OPTIMIZABLE_FORMATS
and Path(file_info.path).stem in alternate_icon_names
Copy link
Copy Markdown
Contributor Author

@NicoHinderling NicoHinderling Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont include images just because "AppIcon" is a prefix in the image's name

return not Path(file_info.path).name.startswith(("AppIcon", "iMessage App Icon"))

stem = Path(file_info.path).stem
return stem != primary_icon_name and stem not in alternate_icon_names
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't include any images that should be considered for the "alternative icon" insight for the "image optimization" insight

Comment thread src/launchpad/artifacts/apple/zipped_xcarchive.py
return False
return not any(part.endswith(".stickerpack") for part in file_info.path.split("/"))

if not from_asset_catalog:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is from_asset_catalog needed? Seems like an edge case if someone put in a top-level AppIcon

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, otherwise I can remove it actually. I don't think we need the app icon check anymore since I've included the primary_icon_name and alternate_icon_names values into the context, but ill keep the imessage one just in case, since i guess imessage apps are structured slightly differently and don't have a guarantee of a CFBundlePrimaryIcon value in their info.plist

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

turns out we do need to keep this actually. found some corner cases between testing patreon and hackernews.

Comment thread src/launchpad/size/insights/apple/image_optimization.py Outdated
Comment thread tests/unit/test_alternate_icons_optimization.py
@NicoHinderling NicoHinderling merged commit 7e3d1ba into main Oct 20, 2025
21 checks passed
@NicoHinderling NicoHinderling deleted the missing-image-optimization-insights branch October 20, 2025 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants