refactor(classifier): single-pass hard-drop trigger; cleaner drop reason rendering

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Vladimir Bryzgalov
2026-04-21 16:20:28 +05:00
parent a70785beca
commit f415f429ed
3 changed files with 46 additions and 32 deletions
+6
View File
@@ -108,6 +108,12 @@ final class MessageFormatter
if (!$reasons) return '—';
$parts = [];
foreach ($reasons as $r) {
// Drop reasons use sign='×' weight=0 as a sentinel — render text only
// to avoid the meaningless "×0 hard-rule: ..." prefix.
if (($r['sign'] ?? '') === '×' && (int)($r['weight'] ?? 0) === 0) {
$parts[] = (string)$r['text'];
continue;
}
$parts[] = $r['sign'] . $r['weight'] . ' ' . $r['text'];
}
return esc_html(implode(', ', $parts));