Commit Graph

7 Commits

Author SHA1 Message Date
Vladimir Bryzgalov a70785beca feat(classifier): label 'drop' via hard-rule + score threshold (-5 default)
- Add DEFAULT_THRESHOLDS['drop'] = -5 and DEFAULT_HARD_DROP_RULES const
- Add evaluate_hard_drop(): fires when no positive signals + short latin name OR ≥3 placeholder fields
- Wire into classify(): drop overrides all other labels; synthetic reason explains trigger
- Add drop_reason_label() and 'drop' => ' авто-дроп' to MessageFormatter::LABEL_MAP
- Update ClassifierTest/MessageFormatterTest to extend Cf7stgTestCase (filter isolation)
- Adjust pre-existing assertions that now correctly yield 'drop' instead of 'spam'
2026-04-21 16:14:49 +05:00
Vladimir Bryzgalov 18a07c9b1b test(classifier): exact-count assertions for placeholder fixture; document SERVICE_FIELD_KEYS prefix semantics
Fixes issues from code review in commit 249f195:

1. Tighten fixture assertions to exact counts (assertSame instead of assertGreaterThanOrEqual):
   - test_count_placeholder_fields_screenshot_1_exact_count: expect 5 placeholders
   - test_count_placeholder_fields_screenshot_2_exact_count: expect 5 placeholders
   - test_count_placeholder_fields_screenshot_3_exact_count: expect 1 placeholder

2. Document SERVICE_FIELD_KEYS prefix-matching semantics in comment:
   clarify that keys starting with _wpcf7 are skipped via strpos prefix match,
   so explicit enumeration of every _wpcf7_* variant is unnecessary.

Test results: 75/75 green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 16:08:57 +05:00
Vladimir Bryzgalov 249f195257 feat(classifier): count_placeholder_fields() helper for drop-logic
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 16:06:32 +05:00
Vladimir Bryzgalov 1168a733a4 test(classifier): boundary + array-value tests for has_short_latin_name; @return tags
- Add @return bool to has_valid_email_anywhere docblock
- Add @return bool to has_short_latin_name docblock
- Add Cyrillic note to has_short_latin_name docblock
- Add test_has_short_latin_name_true_for_single_letter_boundary (lower bound)
- Add test_has_short_latin_name_false_for_four_letters_boundary (upper bound)
- Add test_has_short_latin_name_false_for_array_value_with_space_join (regression)

Addresses code review feedback from commit 660a0d2.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 16:04:18 +05:00
Vladimir Bryzgalov 660a0d2b7c feat(classifier): has_short_latin_name() helper for drop-logic 2026-04-21 16:01:58 +05:00
Vladimir Bryzgalov b5c939e9e4 fix(classifier): iterate all email candidates per field; document method contract
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 15:59:12 +05:00
Vladimir Bryzgalov eae8fafb32 feat(classifier): has_valid_email_anywhere() helper for drop-logic 2026-04-21 15:56:14 +05:00