Files
breakpilot-compliance/ai-compliance-sdk/internal/iace/pattern_domain_gates_test.go
T
Benjamin Admin 7b3a6f0dcd
CI / loc-budget (push) Successful in 15s
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / detect-changes (push) Successful in 6s
CI / branch-name (push) Has been skipped
CI / guardrail-integrity (push) Has been skipped
CI / secret-scan (push) Has been skipped
CI / dep-audit (push) Has been skipped
CI / sbom-scan (push) Has been skipped
CI / build-sha-integrity (push) Failing after 4s
CI / validate-canonical-controls (push) Successful in 12s
CI / nodejs-build (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go (push) Failing after 37s
CI / iace-gt-coverage (push) Successful in 23s
CI / test-python-backend (push) Has been skipped
CI / test-python-document-crawler (push) Has been skipped
CI / test-python-dsms-gateway (push) Has been skipped
fix(iace): close domain-gate gaps — generic patterns with press/welding/glass text
Observed on a real Kistenhubgeraet (lift) project: generic mechanical patterns
(e.g. HP1000 "Quetschen Arm zwischen Pressenteilen") carry NO machine type and
only generic tags (crush_point, rotating_part), so they fired for a lift; the
narrow domain-gate terms missed their press/welding/glass wording.

Broadens domainGateTerms (pressenteil, pressraum, blechbearbeitung,
punktschweiss, schweisselektrod, elektrodenspalt) and adds a dom_glass domain
(glasschneid/glasbearbeitung/...) with its emit keywords. New test pins that the
four observed leakers now require a dom_* tag. Ghost=0, Leakage=0, coverage held
on both GTs.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-09 16:08:02 +02:00

42 lines
1.1 KiB
Go

package iace
import (
"strings"
"testing"
)
// TestDomainGate_NamedLeakersGated pins the concrete cross-domain leakers that
// were observed firing for a Kistenhubgeraet (lift) project: generic patterns
// whose text names a press/welding/glass machine but which carry no machine
// type and only generic tags. After applyDomainGates they MUST require a dom_*
// tag, so they no longer fire for unrelated machines.
func TestDomainGate_NamedLeakersGated(t *testing.T) {
leakers := []string{
"Quetschen Arm zwischen Pressenteilen",
"Quetschen durch Punktschweisselektroden",
"Laerm bei Glasschneidemaschine",
"Laerm bei Blechbearbeitung (Stanzen)",
}
byName := map[string]HazardPattern{}
for _, p := range collectAllPatterns() {
byName[p.NameDE] = p
}
for _, n := range leakers {
p, ok := byName[n]
if !ok {
t.Errorf("leaker pattern %q not found in library", n)
continue
}
hasDom := false
for _, tag := range p.RequiredComponentTags {
if strings.HasPrefix(tag, "dom_") {
hasDom = true
break
}
}
if !hasDom {
t.Errorf("%s (%q) not domain-gated; RequiredComponentTags=%v", p.ID, n, p.RequiredComponentTags)
}
}
}