Files
breakpilot-compliance/ai-compliance-sdk/internal/iace/pattern_domain_gates_test.go
T
Benjamin Admin a48e919caa
CI / detect-changes (push) Successful in 6s
CI / branch-name (push) Has been skipped
CI / guardrail-integrity (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / nodejs-build (push) Has been skipped
CI / test-go (push) Failing after 37s
CI / iace-gt-coverage (push) Successful in 23s
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 11s
CI / loc-budget (push) Successful in 14s
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / test-python-backend (push) Has been skipped
CI / test-python-dsms-gateway (push) Has been skipped
CI / test-python-document-crawler (push) Has been skipped
fix(iace): scan ZoneDE in domain gate (catches zone-only domain hints)
A "Splitterflug bei Werkzeugbruch" pattern leaked into a lift re-seed because
its press hint ("Pressraum") lives in ZoneDE, which applyDomainGates did not
scan. Add ZoneDE to the gated text. Leakage stays 0, ghosts 0, coverage held.

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

48 lines
1.6 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) {
// Confirmed cross-domain leakers observed firing for a lift project. (Note:
// "Splitterflug bei Werkzeugbruch" has two patterns sharing the name; the
// one that leaked carries a "Pressraum" zone and is gated via the zone
// scan — verified empirically by the project re-seed, not pinned here to
// avoid catching the unrelated high-pressure plastics variant HP514.)
leakers := map[string]bool{
"Quetschen Arm zwischen Pressenteilen": true,
"Quetschen durch Punktschweisselektroden": true,
"Laerm bei Glasschneidemaschine": true,
"Laerm bei Blechbearbeitung (Stanzen)": true,
}
seen := map[string]bool{}
for _, p := range collectAllPatterns() {
if !leakers[p.NameDE] {
continue
}
seen[p.NameDE] = true
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, p.NameDE, p.RequiredComponentTags)
}
}
for n := range leakers {
if !seen[n] {
t.Errorf("leaker pattern %q not found in library", n)
}
}
}