fix(ai): drop image from icon resolver noise list — it's a real lucide key

Why: my prior C3 resolver fix added `image` to ICON_NOISE_WORDS so
"Image Placeholder Path" (a non-icon container name) wouldn't collapse
to a circle. That was overcorrecting — `image` is also the canonical
Lucide icon key for the picture/photo glyph, and the model frequently
emits "Image Icon" meaning exactly that. With image stripped, "Image
Icon" tokenised to [] and the resolver returned without writing the
matched lucide:image path.

What: remove `image` from ICON_NOISE_WORDS, with an inline note that
the multi-word "Image Placeholder Path" pattern still resolves through
the prefix fallback (`image` covers >= 50% of `imageplaceholder` so
findPrefixFallback picks it up). Add a regression test for "Image Icon"
→ /image/.

1070 / 1070 AI tests pass (was 1069; +1).
This commit is contained in:
Fini 2026-05-09 20:59:31 +08:00
parent 38dcca0cfe
commit cf00c7c590
2 changed files with 11 additions and 1 deletions

View file

@ -166,6 +166,12 @@ describe('applyIconPathResolution — opt-in marker gate', () => {
['Dismiss Icon', /x/],
['Cancel Icon', /x/],
['Remove Icon', /x/],
// `image` must NOT be in the noise word list — "Image Icon" is the
// standard lucide:image lookup and the user almost certainly means
// a picture icon, not "no signal". (`Image SVG` alone has no icon
// marker word so it bypasses the resolver entirely — that's correct
// because the path could be a real SVG file ref.)
['Image Icon', /image/],
])('resolves multi-word path name "%s" to %s', (name, expectedIconId) => {
const node = makePath({ name });
applyIconPathResolution(node);

View file

@ -68,7 +68,11 @@ const ICON_NOISE_WORDS = new Set([
'fill',
'svg',
'graphic',
'image',
// Note: `image` is INTENTIONALLY not a noise word. It's a real lucide
// icon key, and "Image Icon" / "Image SVG" should resolve to lucide:image
// — not collapse to empty after stripping. Multi-word name patterns like
// "Image Placeholder Path" still resolve via the prefix fallback (`image`
// covers >= 50% of `imageplaceholder`).
]);
function tokenizeName(name: string): string[] {