feat(iace): narrative relevance filter + zone normalization for precision
Build + Deploy / build-admin-compliance (push) Successful in 1m56s
Build + Deploy / build-backend-compliance (push) Successful in 3m14s
Build + Deploy / build-ai-sdk (push) Successful in 1m18s
Build + Deploy / build-developer-portal (push) Successful in 1m8s
Build + Deploy / build-tts (push) Successful in 1m35s
Build + Deploy / build-document-crawler (push) Successful in 47s
Build + Deploy / build-dsms-gateway (push) Successful in 35s
Build + Deploy / build-dsms-node (push) Successful in 19s
CI / branch-name (push) Has been skipped
CI / guardrail-integrity (push) Has been skipped
CI / loc-budget (push) Failing after 19s
CI / secret-scan (push) Has been skipped
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / nodejs-build (push) Successful in 2m28s
CI / dep-audit (push) Has been skipped
CI / sbom-scan (push) Has been skipped
CI / test-go (push) Successful in 44s
CI / test-python-backend (push) Successful in 38s
CI / test-python-document-crawler (push) Successful in 26s
CI / test-python-dsms-gateway (push) Successful in 21s
CI / validate-canonical-controls (push) Successful in 13s
Build + Deploy / trigger-orca (push) Successful in 2m54s

- isPatternRelevant() filters patterns whose zone/scenario mentions
  machine-specific terms (extruder, stanzpresse, spielplatz, etc.)
  absent from the actual machine narrative
- normalizeZoneKey() clusters similar zones for smarter dedup
  (e.g. "Schaltschrank, Sammelschiene" = "Schaltschrank-Innenraum")
- machineSpecificTerms list with 40+ terms for generic filtering

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-05-13 09:51:00 +02:00
parent c702260ec1
commit 1bd892afbf
2 changed files with 104 additions and 4 deletions
@@ -151,12 +151,24 @@ func (h *IACEHandler) InitializeProject(c *gin.Context) {
}
}
// Build component name set for relevance filtering
compNames := make([]string, 0, len(comps))
for name := range compByName {
compNames = append(compNames, name)
}
created := 0
seenCatZone := make(map[string]bool)
for _, mp := range matchOutput.MatchedPatterns {
// Narrative relevance filter: skip patterns whose zone/scenario
// mentions machine-specific terms that don't appear in our components
if !isPatternRelevant(mp, narrativeText, compNames) {
continue
}
for _, cat := range mp.HazardCats {
// Dedup by category + zone (allows multiple hazards per category at different zones)
zoneKey := mp.ZoneDE
// Dedup by category + normalized zone
zoneKey := normalizeZoneKey(mp.ZoneDE)
if zoneKey == "" {
zoneKey = mp.PatternID
}
@@ -170,12 +182,10 @@ func (h *IACEHandler) InitializeProject(c *gin.Context) {
if name == "" {
name = cat
}
// Append zone to name for specificity
if mp.ZoneDE != "" && !containsSubstring(name, mp.ZoneDE) {
name = name + " (" + mp.ZoneDE + ")"
}
// Find matching component by zone name
compID := defaultCompID
if mp.ZoneDE != "" {
zoneNorm := iace.NormalizeDEPublic(mp.ZoneDE)