docs: scope the foreign-script and surefire claims to what the code does

hasForeignScript detects by alphabet, so Latin-script leakage such as
the observed French "contiennent" is not caught. Say so in the javadoc
and admit the gap in the design doc rather than implying coverage.

failIfNoTests catches a misplaced or misnamed test class, not a
disabled one: an @Disabled class still reports as skipped and the
build stays green.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F3jSvSTrG4qsniLSr6TpC6
This commit is contained in:
marcos
2026-08-05 15:09:37 +00:00
parent 4f427659bb
commit 3d2150d2a6
3 changed files with 21 additions and 5 deletions
@@ -11,8 +11,8 @@ import java.util.regex.Pattern;
final class AiText {
/**
* Scripts that should never appear in a Portuguese answer. The model has
* been observed dropping single Chinese words mid-sentence.
* Non-Latin scripts that should never appear in a Portuguese answer. The
* model has been observed dropping single Chinese words mid-sentence.
*/
private static final Pattern FOREIGN = Pattern.compile(
"[\\p{IsHan}\\p{IsHiragana}\\p{IsKatakana}\\p{IsHangul}\\p{IsCyrillic}\\p{IsArabic}]");
@@ -20,6 +20,15 @@ final class AiText {
private AiText() {
}
/**
* True if the text contains a character from a non-Latin script.
*
* <p>This detects leakage by alphabet, so it catches only what a different
* alphabet makes visible. A foreign word written in Latin script is
* <b>not</b> caught: the French {@code contiennent}, observed in an
* otherwise Portuguese reply, passes this check. Catching that would need
* dictionary or language-identification work this method does not do.
*/
static boolean hasForeignScript(String text) {
return text != null && FOREIGN.matcher(text).find();
}