From f420bfcc26a582f24b1a66e2602e137f0a5010a8 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Tue, 13 Oct 2026 08:10:39 +0000 Subject: [PATCH] fix(pii): give extend_to_previous_word its own settings order It shared order 215 with extend_to_next_word, so the settings UI had no defined order between the two. Move it to 216 and shift the protected terms fields. Pin that a number in front of a hit is never taken. Assisted-by: Claude Code:claude-sonnet-5-5 Signed-off-by: Ettore Di Giacinto --- core/config/meta/registry.go | 6 +++--- core/services/routing/pii/extend_previous_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/config/meta/registry.go b/core/config/meta/registry.go index 14bf794b7..ea900d79e 100644 --- a/core/config/meta/registry.go +++ b/core/config/meta/registry.go @@ -1067,21 +1067,21 @@ func DefaultRegistry() map[string]FieldMetaOverride { Label: "Extend To Previous Word", Description: "Entity groups (e.g. LASTNAME) whose detections also cover the word right before them on the same line, with the same action, when that word consists of letters only. Use it when the model tags a surname reliably but scores the first name before it below the threshold.", Component: "string-list", - Order: 215, + Order: 216, }, "pii_detection.protected_terms": { Section: "pii", Label: "Protected Terms", Description: "Values that must pass the filter unchanged even when the model tags them, e.g. known business names a name model reads as surnames. Hidden from the detector behind a placeholder and restored afterwards; matched whole-word and case-insensitively, minimum three characters.", Component: "string-list", - Order: 216, + Order: 217, }, "pii_detection.protected_terms_files": { Section: "pii", Label: "Protected Terms Files", Description: "Files inside the models path with one protected term per line ('#' starts a comment). Re-read when they change, so an external process can keep the list current without a restart. A missing file is skipped with a warning.", Component: "string-list", - Order: 217, + Order: 218, }, // --- Cloud passthrough proxy --- diff --git a/core/services/routing/pii/extend_previous_test.go b/core/services/routing/pii/extend_previous_test.go index 02a521b2c..89c6e0ad0 100644 --- a/core/services/routing/pii/extend_previous_test.go +++ b/core/services/routing/pii/extend_previous_test.go @@ -45,7 +45,7 @@ var _ = Describe("ExtendToPreviousWord", func() { }) It("never swallows a word with digits (amounts, dates, codes stay intact)", func() { - for _, text := range []string{"Betrag 12,50 Waldmeister", "am 11.08.2026 Waldmeister", "Zimmer 4711 Waldmeister", "Code A1b Waldmeister"} { + for _, text := range []string{"Betrag 12,50 Waldmeister", "am 11.08.2026 Waldmeister", "Zimmer 4711 Waldmeister", "Code A1b Waldmeister", "12 Waldmeister"} { det := &stubNERDetector{entities: []NEREntity{ent(text, "Waldmeister", "LASTNAME", 0.9)}} res, err := RedactNER(ctx, text, []NERConfig{{Detector: det, DefaultAction: ActionMask, ExtendToPreviousWord: []string{"LASTNAME"}}}) Expect(err).NotTo(HaveOccurred())