Skip to content

fix(server): resolve a later local project favicon when an earlier icon link is not a local file - #42023

Merged
juliusmarminge merged 3 commits into
pingdotgg:mainfrom
only21mil:fix/server-favicon-fallback-later-icon-link
Nov 24, 2026
Merged

juliusmarminge merged 3 commits into
pingdotgg:mainfrom
only21mil:fix/server-favicon-fallback-later-icon-link

Conversation

@only21mil

Copy link
Copy Markdown
Contributor

Problem

When a project's index.html or root route file lists a data: icon, an https: icon, or a missing file before a local icon such as <link rel="icon" href="/brand/logo.svg">, the project shows its letter monogram instead of that icon. The resolver tried only the first icon href. A long base64 data: icon also made stat fail with ENAMETOOLONG, which errored the whole lookup.

Change

The resolver now collects every icon href in document order (HTML <link> tags first, then route object literals, as before) and uses the first one that names an existing file in the workspace, so an earlier existing icon still wins. Hrefs with a URL scheme (data:, https:) or a protocol-relative //host are skipped, since they never name a project file. A path that runs through a file (ENOTDIR) or a symlink loop now counts as missing, as NotFound already did, whether it is a candidate, a source file, or a cached icon checked again. That applies to every favicon candidate, not just source hrefs.

Scope

A small fix for an obvious server bug in ProjectFaviconResolver.ts, so it has no issue. No client or contract changes.

Verification

Setup: Linux, web client in T3 Code's Browser panel at 1280×800, light theme, a fresh dev server process (vp run dev --no-seed) and browser origin for each commit, server labelled "Test machine". The Brand Demo fixture's index.html lists a percent-encoded data: SVG icon, an https: icon, then /brand/logo.svg, with public/brand/logo.svg present and no favicon.* file.

Steps: add the fixture project → start a Replay (dev) thread in it → open the thread.

c9e22e5ff42 (main) ae84e41b005 (this PR)
Brand Demo shows its letter monogram in the sidebar and breadcrumb. Brand Demo shows its own logo.svg in the sidebar and breadcrumb.
Brand Demo shows its letter monogram in the sidebar and breadcrumb. Brand Demo shows its own logo.svg in the sidebar and breadcrumb.

An AI agent ran vp test run src/project/ProjectFaviconResolver.test.ts. The updated cases fail on c9e22e5ff42 (the HTML case with ENAMETOOLONG, the route case finds no icon) and pass 3 of 3 runs on ae84e41b005. They also pass on a local merge with main at a891304c84b, which merges cleanly and leaves both changed files identical. vp run check:changed passes.

What the tests cover
  • An index.html listing a 5,000-character base64 data: icon, an https: icon, a missing file, a //host icon that matches a local file, and a path through a file, then /brand/logo.svg and a later existing /brand/late.svg. It resolves logo.svg. When public then becomes a file, the next lookup falls back to web/favicon.png instead of failing.
  • A route literal with an https: icon before a local one.
  • A root-relative /brand:v2.svg, which stays a path (skipped on Windows, where : is not allowed in file names).
  • The tests fail if the scheme check, the // check or the ENOTDIR skip for a candidate, a source file or a cached icon is removed, if either href list stops at its first entry, if candidates are tried in reverse, or if the scheme check runs after the leading / is stripped.

Links

Not shown

  • The ENAMETOOLONG error from a long base64 data: icon is shown by the test only.
  • Desktop and mobile clients load the same server-resolved icon.

Generated with Claude Opus 5.5 in T3 Code Nightly

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 24, 2026
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The favicon resolver now checks multiple icon hrefs in order, ignores external URLs, and treats BadResource errors as missing resources. Tests cover icon selection, cached-path fallback, and route-metadata resolution.

Changes: Favicon Resolution

Layer / File(s) Summary
Ordered icon resolution and missing-resource handling
apps/server/src/project/ProjectFaviconResolver.ts, apps/server/src/project/ProjectFaviconResolver.test.ts
The resolver extracts icon hrefs and checks local candidates in order while skipping external and protocol-relative URLs. It treats BadResource errors during candidate lookup, source access, and cached-path validation as missing resources. Tests cover candidate selection, fallback, and route metadata.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge, bramley-jetcharge

Merge Risk: Minimal · up to f4ebe

This fixes favicon selection so that a later local icon is used when an earlier icon link is not a local file. No concrete merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the resolver now picks a later local favicon when an earlier icon link is not a local file. It matches the objectives and the raw summary, which describe collecting ev…
Description check Passed The description follows the template. It has Problem, Change, Scope, and Verification sections, and each one has real content. The Verification section lists the tests, the before and after comparison…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the resolver now picks a later local favicon when an earlier icon link is not a local file. It matches the objectives and the raw summary, which describe collecting every icon href and skipping URL-scheme hrefs.

Full details: Description check

Explanation

The description follows the template. It has Problem, Change, Scope, and Verification sections, and each one has real content. The Verification section lists the tests, the before and after comparison, the commit hashes, and the checks that were run. The author also states what was not shown. The template comment asks for a model and harness line, and the description includes one (Claude Opus 5.5 in T3 Code Nightly).

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between ae84e41 and f4ebe39.

Files selected for processing: 2

  • apps/server/src/project/ProjectFaviconResolver.test.ts
  • apps/server/src/project/ProjectFaviconResolver.ts
Files with no reviewable changes: 1

  • apps/server/src/project/ProjectFaviconResolver.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 24, 2026
juliusmarminge and others added 2 commits November 24, 2026 09:03
Keeps the exported optionOnNotFound unchanged for AssetAccess and drops a
colon-path test the scheme check could not break.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:S 10-29 changed lines (additions + deletions). labels Nov 24, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Scenario: Later local icons survive earlier unsupported icon links

Created the three reported synthetic git projects, each containing the same red/yellow SVG. Seeded Replay (dev) multi-turn threads, opened each thread, inspected sidebar and breadcrumb icons, then opened the Projects picker. Environment: Linux Chromium, 1280×800, light theme, fresh isolated databases on both commits.

Proven: the scenario fails on base 110ed776c9 and passes on head f4ebe39f47.

Before — 110ed776c9 After — f4ebe39f47
Result HI/RI monograms; assertion failed Local logos; passed
HTML later icon Before: HTML later icon After: HTML later icon
Root-route later icon Before: root-route later icon After: root-route later icon
Control first icon Before: control first icon After: control first icon
Project picker Before: project picker After: project picker
Failure capture Base assertion failure

Scenario source

Before recording · After recording

Not shown:

  • ENAMETOOLONG from a long data URL and ENOTDIR from a path through a file were not exercised; the scenario follows the reported three-project reproduction.
  • Missing-file fallback and priority among multiple existing local candidates were not exercised; each reproduced project contains only one declared local icon candidate.
  • Desktop, mobile, remote/relay and tunnel clients were not exercised; evidence covers the real local web client and server.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 24, 2026
@juliusmarminge
juliusmarminge merged commit 6f15610 into pingdotgg:main Nov 24, 2026
54 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants