Skip to content

fix: improve project favicon detection for monorepos#1024

Open
ponbac wants to merge 1 commit intopingdotgg:mainfrom
ponbac:favicon-recursive
Open

fix: improve project favicon detection for monorepos#1024
ponbac wants to merge 1 commit intopingdotgg:mainfrom
ponbac:favicon-recursive

Conversation

@ponbac
Copy link

@ponbac ponbac commented Mar 13, 2026

What Changed

Improve project favicon detection without introducing a broad recursive search.
Closes #1020.

Rules, in order:

  • Check well-known favicon paths in the requested project root.
    Example: /repo/favicon.svg or /repo/public/favicon.ico.
  • If none exist, look for <link rel="icon" ... href="..."> tags or object-style { href, rel: "icon" } declarations in a small set of common source files, then resolve that target.
    Example: /repo/index.html points to /brand/logo.svg, so the route first tries /repo/public/brand/logo.svg and then /repo/brand/logo.svg.
  • If still nothing is found, repeat the same checks for first-level children of apps/ and packages/, plus other top-level directories in the requested root, using the same non-git directory ignore rules as workspaceEntries.
    Example: /repo/apps/web/public/favicon.png or /repo/frontend/public/favicon.png is found when the cwd is /repo.
  • Prefer a root match over nested workspace matches.
    Example: /repo/favicon.svg wins over /repo/apps/web/public/favicon.ico.
  • Fall back to the existing generated SVG when nothing is found.

I also extracted the shared gitignore probing into apps/server/src/gitIgnore.ts so both workspaceEntries and projectFaviconRoute use the same chunked git check-ignore --no-index -z --stdin filtering. I also extracted the shared workspace directory ignore policy into apps/server/src/workspaceIgnore.ts, so projectFaviconRoute now uses the same non-git skip rules as workspaceEntries when scanning nested roots instead of keeping a separate ignore list.

Why

The current behavior misses common monorepo layouts where the favicon lives under an app directory instead of the repo root.

There was already an earlier PR for this in the upstream repo: #690. That version was larger and messier. This keeps the rules simple on purpose, leaving more extensive changes to project icons for trusted maintainers.

UI Changes

Not applicable.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Fix project favicon detection to support monorepo layouts with gitignore awareness

  • Refactors tryHandleProjectFaviconRequest in projectFaviconRoute.ts to run as an Effect with a FileSystem service, replacing the previous synchronous handler.
  • Adds gitignore-aware path filtering via a new gitIgnore.ts module that uses git check-ignore --stdin batching to skip ignored candidates.
  • Searches monorepo roots (apps/, packages/, top-level dirs) and source files (index.html, src/root.tsx, app/root.tsx) to resolve favicons in nested apps, preferring the project root favicon first.
  • Extracts shared workspace ignore logic into workspaceIgnore.ts and updates workspaceEntries.ts to import from the new modules.

Macroscope summarized c396c88.

@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

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

Run ID: 96f43244-9595-411a-93bb-440dde774c18

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
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

Tip

CodeRabbit can use OpenGrep to find security vulnerabilities and bugs across 17+ programming languages.

OpenGrep is compatible with Semgrep configurations. Add an opengrep.yml or semgrep.yml configuration file to your project to enable OpenGrep analysis.

@github-actions github-actions bot added size:XL 500-999 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Mar 13, 2026
@ponbac ponbac force-pushed the favicon-recursive branch 2 times, most recently from 30cac2c to b936f17 Compare March 13, 2026 13:47
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a4a8d330eb

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ponbac ponbac force-pushed the favicon-recursive branch from b936f17 to c396c88 Compare March 13, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

monorepo projects do not resolve nested app favicons

1 participant