Skip to content

feat(server): expand project favicon resolution with PWA manifest and directory scan - #4637

Closed
Brechard wants to merge 2 commits into
pingdotgg:mainfrom
Brechard:feat/expand-project-favicon-resolution
Closed

Brechard wants to merge 2 commits into
pingdotgg:mainfrom
Brechard:feat/expand-project-favicon-resolution

Conversation

@Brechard

@Brechard Brechard commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Closes #4636

What Changed

Two new resolution stages in ProjectFaviconResolver, both framework-agnostic and both tried only after every existing check fails:

  1. PWA manifests — parses manifest.json, public/manifest.json, site.webmanifest and public/site.webmanifest, resolving each icons[].src on disk and preferring the largest declared sizes.
  2. Directory scan fallback — walks common asset folders (public, app, src, src/app, assets, src/assets, assets/icons, assets/icon, static, resources, images, img, media, app-icon, .idea) for well-known basenames (favicon, icon, logo, apple-touch-icon, app-icon, brand, app), picking by directory → name → extension priority.

ProjectFaviconResolutionError gains read-manifest and scan-directory operations. Paths stay guarded inside the workspace root.

Why

The resolver is good at React-shaped repos and falls back to the generic folder glyph for almost everything else. That's the complaint in #4304 ("works well for React projects and poorly for others"), #1020 and #4935, and it's what the reporter on #2561 pushed back with after it was closed: "auto detect doesn't work for most projects, for example BE, cli databases or some specific monorepos."

The two stages here are deliberately not per-framework. A Flutter app is the motivating case: no package.json, no index.html, icon at assets/icons/icon.png referenced only from flutter_launcher_icons.yaml. Nothing in the current resolver — or in any of the open favicon PRs — finds it, but a prioritized scan of asset directories does, and the same scan covers Android, Go, Rust, CLI and backend repos without teaching the resolver about any of them.

How this differs from the other open favicon PRs

These are complementary, not competing — each works a different axis:

Note on custom icons

t3.json already supports iconPath and it is checked before everything here, so a project that wants an explicit icon has an escape hatch today. This PR only changes what happens when nothing is declared.

Verification

  • npx vitest run src/project/ProjectFaviconResolver.test.ts — 20/20 pass, covering manifest selection, multi-size strings, scan priority ordering, unreadable directories, permission failures, and manifest→scan fallback.
  • npx tsc --noEmit clean.
  • Built and installed the desktop app; verified against real repos including a Flutter project that previously showed the folder glyph.

Additive behind the same resolvePath API, and the added filesystem reads only happen on the path that currently returns null. Cursor Bugbot reviewed 709dbde as Low Risk.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5ba2110f-891d-4d6b-9b94-488541dd1683

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XXL 1,000+ changed lines (additions + deletions). labels Jul 27, 2026
… directory scan

Adds PWA manifest.json/site.webmanifest icon parsing with size-aware
selection and a directory-scan fallback over common asset folders.
Includes tests for manifest and directory-scan detection paths.
@Brechard
Brechard force-pushed the feat/expand-project-favicon-resolution branch from 197f718 to 12e6e2b Compare July 27, 2026 12:51
@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:XXL 1,000+ changed lines (additions + deletions). labels Jul 27, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 12e6e2b. Configure here.

Comment thread apps/server/src/project/ProjectFaviconResolver.ts
Comment thread apps/server/src/project/ProjectFaviconResolver.ts Outdated
Comment thread apps/server/src/project/ProjectFaviconResolver.ts
Comment thread apps/server/src/project/ProjectFaviconResolver.ts
Comment thread apps/server/src/project/ProjectFaviconResolver.ts Outdated
Comment thread apps/server/src/project/ProjectFaviconResolver.ts
@macroscopeapp

macroscopeapp Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

3 blocking correctness issues found. This PR introduces significant new capability (PWA manifest parsing and directory scanning for favicon resolution) with 396 lines of new code. New features that add user-facing behavior warrant human review. Additionally, there are unresolved review comments identifying potential bugs in the new logic.

You can customize Macroscope's approvability policy. Learn more.

- parseIconSize now scans every size token and returns the largest
- candidatePriority keys include the directory so directory order wins
- resolveManifestIcon tolerates valid JSON null/non-object manifests
- directory scan skips unreadable directories instead of aborting
@t3dotgg t3dotgg added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. and removed vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Aug 24, 2026
@t3dotgg

t3dotgg commented Aug 28, 2026

Copy link
Copy Markdown
Member

Note

🤖 GPT-5.6 Sol responding on behalf of Theo

We're closing this PR as we clean up the T3 Code backlog. Thank you for taking the time to put this together.

This adds PWA manifest parsing and a broad directory scan with many filename, extension, folder, and priority rules for favicon discovery. #4424 provides a narrower monorepo favicon repair without the general repository scan.

If you believe we closed this in error, please reopen the PR and leave a comment explaining what we missed.

@t3dotgg t3dotgg closed this Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expand project favicon resolution to support PWA manifests and directory scanning monorepo projects do not resolve nested app favicons

3 participants