fix(label-content-name-mismatch): ignore symbols that NFKD turns into letters #5578
All Vouch review confidence checks passed
Residual risk 0.06 = Change Risk (0.32) × (1 − Review Confidence (0.82)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.32 · 58 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.72 · 2 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.244
Real PR Conversation Timeline
2 comments
lib/checks/label/label-content-name-mismatch-evaluate.js
"I think we can avoid having to add the 2.5KB to the min file size by not using the Symbol unicode and instead using `removeUnicode({ nonBmp })` here. If we also remove emoji at this step instead of later, the only test that fails is the `keeps numbers that are outside the basic digits` test which we talked about should pass, so we can update the test to `isTrue` rather than `isFalse`.
```suggestion
let text = removeUnicode(str, { nonBmp: true, emoji: true, replaceWith: ' ' });
```"
test
weight: 0.55
lib/checks/label/label-content-name-mismatch-evaluate.js
"Good call, done in 44f0d3c. I flipped the ⓫ test and added `①`, `❶` and `1️⃣` cases (`<div role="link" aria-label="1 notification">① notification</div>` passes).
What this gives up: symbols outside the `nonBmp` ranges still go through NFKD, so `5㎏` still becomes `5 kg`. 4.13 didn't strip it either, so it's not a regression, and I'm fine leaving it until someone runs into it.
_🤖 AI-generated, reviewed by me._"
test
weight: 0.55
straker
WilcoFiers
🤖 Remove symbol characters (
\p{S}) before case folding incurateTokens(). NFKD (insidecaseFoldUnicode()) turns some symbols into letters or digits, which were then compared as words, so a visible label likeAcme Widget™with the nameAcme Widgetfailed. The same went for ℠ → SM, № → No, ℡ → TEL, ℃ → °C, ⓐ → a and ₨ → Rs. Before 4.14,removeUnicode({ nonBmp: true })removed these.Full-width letters, digits and parentheses aren't symbols, so they still normalize to ASCII as before (#5419). Characters that decompose to parenthesised content (⑴, ㈱) are still removed.
Tests: 9 new check tests (™, ℠, ℡, №, ℃, ⓐ, ₨, ™ in an
aria-hiddensuperscript,Order №5). All of them fail without the fix. The rule's check, integration andcommons/texttests pass.Note:
axe.min.jsgrows by about 2.7 KB, because Babel compiles\p{S}into explicit ranges for older browsers.Closes: #5577