6a3e96d54c
Two-part nachhaltiger fix replacing the previous "fill to 5 mitigations no matter what" behavior that the GT-Bremse benchmark proved unfaithful (e.g. HP1625 "scharfe Kanten" returning M005 "Rotations- bewegung vermeiden" via category fallback; HP1651 "Wiederanlauf Roboter" returning M054 "Sichere thermische Auslegung" via mismatched pattern reference). PART A — Set-based category filter (handlers package): - acceptableMeasureCategories: replaces 1:1 patternCatToMeasureCat with a curated set per pattern category, so e.g. safety_function_failure now accepts software_control measures (watchdogs, plausibility checks) and emc_hazard accepts both electrical and software_control measures - isCategoryCompatible: gate every measure id against the accepted set before creating a mitigation; mismatches log MEASURE-SKIP - The old category fallback is REMOVED. A hazard whose pattern has no category-compatible measure is now created with zero mitigations and logged as COVERAGE-GAP — the operator must consult an expert. No more silent invention of generic defaults. PART B — 235 pattern author-error fixes across 26 files: - HP040-HP044 (AI): M101/M102/M103 (Auffangwanne/Absauganlage) -> M133 Anomalieerkennung + M214 Plausibilitaet + M213 Sensor-Redundanz + M044 Zweikanalige Steuerung + others - HP011-HP015, HP104-HP109, HP1085-HP1095, HP1281-HP1334 (electrical): M001-M005/M054/M061 placeholders -> M481/M482 Isolation + M511-M522 PE/Schutzleiter/RCD/Hauptschalter - HP110-HP1331 (material_environmental): M101-M103 -> M384-M395 Brandschutz/Laserschutz + M533/M408 SDB/PSA - HP800-HP858, HP1178-HP1264 (software/sensor/hmi): M101/M104 -> M105/M106/M107/M214 SPS/Watchdog/Plausibilitaet - HP026, HP611-HP1690 (ergonomic): M001/M082 -> M353-M360 + M530-M532 Hebehilfe/ergonomische Hoehe - HP201-HP1697 (mechanical): M054/M051 -> M002/M008/M061/M141 + M487/M488 Tueroeffnung-Stillsetzung/Wiederanlauf - Plus EMF/Strahlung/Brand/Lärm/Vibration/Kommunikation/Cyber Coverage shift (Pattern-Author-Fehler bei aktiviertem Set-Filter): start: 237 patterns with zero category-compatible measures after Stufe 1A: 5 (AI) after Stufe 1B: 20 (mechanical Bestand) after Stufe 1C: 35 (electrical Bestand) after Stufe 1D: 29 (material_environmental) after Stufe 1E: 29 (software/sensor/hmi) after Stufe 1F: 20 (ergonomic) after Stufe 1G: 80 (thermal/comm/radiation/fire/safety) final: 0 (28 extended.go/extended2.go duplicates fixed) New regression tests: - TestEveryPattern_HasCategoryCompatibleMeasure: every pattern in collectAllPatterns() must reference at least one category-compatible measure; gaps must be explicitly listed in AllowlistKnownGaps (currently empty). Fails CI for any new pattern that drifts. - TestAcceptableMeasureCategories: pins the set-mapping for the 7 most-bug-prone pattern categories. - TestIsCategoryCompatible_EmptyMeasureCat: protects legacy entries. A separate task #11 tracks 58 HP-ID duplicates between extended.go/extended2.go and cobot.go/press.go/operational.go — patterns are semantically different and TestGetBuiltinHazardPatterns_- UniqueIDs misses them because it only checks HP001-HP044. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
335 lines
14 KiB
Go
335 lines
14 KiB
Go
package iace
|
|
|
|
// GetExtendedHazardPatterns returns 58 additional patterns
|
|
// derived from the Rule Library documents (R051-R1550).
|
|
// These supplement the 44 built-in patterns in hazard_patterns.go.
|
|
// Patterns HP045-HP073 are defined here; HP074-HP102 in hazard_patterns_extended2.go.
|
|
func GetExtendedHazardPatterns() []HazardPattern {
|
|
return append(getExtendedHazardPatternsA(), getExtendedHazardPatternsB()...)
|
|
}
|
|
|
|
// getExtendedHazardPatternsA returns patterns HP045-HP073.
|
|
func getExtendedHazardPatternsA() []HazardPattern {
|
|
return []HazardPattern{
|
|
{
|
|
ID: "HP045", NameDE: "Aktor — elektrisch", NameEN: "Actuator — electrical",
|
|
RequiredComponentTags: []string{"actuator_part"},
|
|
RequiredEnergyTags: []string{"electrical_energy"},
|
|
RequiredLifecycles: []string{"maintenance"},
|
|
GeneratedHazardCats: []string{"mechanical_hazard"},
|
|
SuggestedMeasureIDs: []string{"M141"},
|
|
SuggestedEvidenceIDs: []string{"E21"},
|
|
Priority: 80,
|
|
// Source: R341
|
|
},
|
|
{
|
|
ID: "HP046", NameDE: "Aktor — mechanisch", NameEN: "Actuator — mechanical",
|
|
RequiredComponentTags: []string{"actuator_part"},
|
|
RequiredEnergyTags: []string{"kinetic"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"mechanical_hazard"},
|
|
SuggestedMeasureIDs: []string{"M141"},
|
|
SuggestedEvidenceIDs: []string{"E08"},
|
|
Priority: 80,
|
|
// Source: R340
|
|
},
|
|
{
|
|
ID: "HP047", NameDE: "KI-Steuerung — Software", NameEN: "Ai Controller — software",
|
|
RequiredComponentTags: []string{"has_ai", "has_software", "programmable"},
|
|
RequiredEnergyTags: []string{},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"ai_misclassification"},
|
|
SuggestedMeasureIDs: []string{"M133", "M227", "M141"},
|
|
SuggestedEvidenceIDs: []string{"E15"},
|
|
Priority: 75,
|
|
// Source: R590, R1090
|
|
},
|
|
{
|
|
ID: "HP048", NameDE: "Kabelbaum — elektrisch", NameEN: "Cable Harness — electrical",
|
|
RequiredComponentTags: []string{"electrical_part"},
|
|
RequiredEnergyTags: []string{"electrical_energy"},
|
|
RequiredLifecycles: []string{"installation", "operation"},
|
|
GeneratedHazardCats: []string{"electrical_hazard"},
|
|
SuggestedMeasureIDs: []string{"M481", "M141"},
|
|
SuggestedEvidenceIDs: []string{"E20"},
|
|
Priority: 80,
|
|
// Source: R065, R570, R1070
|
|
},
|
|
{
|
|
ID: "HP049", NameDE: "Kabelsystem — elektrisch", NameEN: "Cable System — electrical",
|
|
RequiredComponentTags: []string{"electrical_part"},
|
|
RequiredEnergyTags: []string{"electrical_energy"},
|
|
RequiredLifecycles: []string{"installation", "operation"},
|
|
GeneratedHazardCats: []string{"electrical_hazard"},
|
|
SuggestedMeasureIDs: []string{"M481", "M141"},
|
|
SuggestedEvidenceIDs: []string{"E20"},
|
|
Priority: 80,
|
|
// Source: R317, R318
|
|
},
|
|
{
|
|
ID: "HP050", NameDE: "Kamerasystem — elektrisch", NameEN: "Camera System — electrical",
|
|
RequiredComponentTags: []string{"sensor_part"},
|
|
RequiredEnergyTags: []string{"electrical_energy"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"ai_misclassification"},
|
|
SuggestedMeasureIDs: []string{"M133", "M227", "M141"},
|
|
SuggestedEvidenceIDs: []string{"E20"},
|
|
Priority: 75,
|
|
// Source: R074, R328
|
|
},
|
|
{
|
|
ID: "HP051", NameDE: "Druckluftleitung — pneumatisch", NameEN: "Compressed Air Line — pneumatic",
|
|
RequiredComponentTags: []string{"pneumatic_part"},
|
|
RequiredEnergyTags: []string{"pneumatic_pressure"},
|
|
RequiredLifecycles: []string{"maintenance"},
|
|
GeneratedHazardCats: []string{"pneumatic_hydraulic"},
|
|
SuggestedMeasureIDs: []string{"M021"},
|
|
SuggestedEvidenceIDs: []string{"E20"},
|
|
Priority: 70,
|
|
// Source: R070
|
|
},
|
|
{
|
|
ID: "HP052", NameDE: "Kompressor — pneumatisch", NameEN: "Compressor — pneumatic",
|
|
RequiredComponentTags: []string{"high_pressure", "noise_source", "pneumatic_part"},
|
|
RequiredEnergyTags: []string{"pneumatic_pressure"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"pneumatic_hydraulic"},
|
|
SuggestedMeasureIDs: []string{"M022"},
|
|
SuggestedEvidenceIDs: []string{"E14"},
|
|
Priority: 70,
|
|
// Source: R578, R1078
|
|
},
|
|
{
|
|
ID: "HP053", NameDE: "Schaltschrank — elektrisch", NameEN: "Control Cabinet — electrical",
|
|
RequiredComponentTags: []string{"electrical_part", "high_voltage"},
|
|
RequiredEnergyTags: []string{"electrical_energy"},
|
|
RequiredLifecycles: []string{"maintenance", "operation"},
|
|
GeneratedHazardCats: []string{"electrical_hazard"},
|
|
SuggestedMeasureIDs: []string{"M481", "M482", "M141"},
|
|
SuggestedEvidenceIDs: []string{"E10", "E20"},
|
|
Priority: 80,
|
|
// Source: R061, R062, R315, R316, R566, R567, R1066, R1067
|
|
},
|
|
{
|
|
ID: "HP054", NameDE: "Steuerungsschnittstelle — Software", NameEN: "Control Interface — software",
|
|
RequiredComponentTags: []string{"has_software", "user_interface"},
|
|
RequiredEnergyTags: []string{},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"software_fault"},
|
|
SuggestedMeasureIDs: []string{"M101", "M113"},
|
|
SuggestedEvidenceIDs: []string{"E14"},
|
|
Priority: 70,
|
|
// Source: R080, R334
|
|
},
|
|
{
|
|
ID: "HP055", NameDE: "Steuerung — elektrisch", NameEN: "Controller — electrical",
|
|
RequiredComponentTags: []string{"has_software", "programmable"},
|
|
RequiredEnergyTags: []string{"electrical_energy"},
|
|
RequiredLifecycles: []string{"restart"},
|
|
GeneratedHazardCats: []string{"mechanical_hazard"},
|
|
SuggestedMeasureIDs: []string{"M061", "M141"},
|
|
SuggestedEvidenceIDs: []string{"E08"},
|
|
Priority: 80,
|
|
// Source: R339, R598, R1098
|
|
},
|
|
{
|
|
ID: "HP056", NameDE: "Foerderband — mechanisch", NameEN: "Conveyor Belt — mechanical",
|
|
RequiredComponentTags: []string{"entanglement_risk", "moving_part", "rotating_part"},
|
|
RequiredEnergyTags: []string{"kinetic"},
|
|
RequiredLifecycles: []string{"automatic_operation", "cleaning", "operation"},
|
|
GeneratedHazardCats: []string{"mechanical_hazard"},
|
|
SuggestedMeasureIDs: []string{"M061", "M002", "M141"},
|
|
SuggestedEvidenceIDs: []string{"E20", "E21"},
|
|
Priority: 80,
|
|
// Source: R053, R054, R556, R557, R1056, R1057
|
|
},
|
|
{
|
|
ID: "HP057", NameDE: "Foerdersystem — mechanisch", NameEN: "Conveyor System — mechanical",
|
|
RequiredComponentTags: []string{"entanglement_risk", "moving_part", "rotating_part"},
|
|
RequiredEnergyTags: []string{"kinetic"},
|
|
RequiredLifecycles: []string{"cleaning", "operation"},
|
|
GeneratedHazardCats: []string{"mechanical_hazard"},
|
|
SuggestedMeasureIDs: []string{"M061", "M002", "M141"},
|
|
SuggestedEvidenceIDs: []string{"E20", "E21"},
|
|
Priority: 80,
|
|
// Source: R305, R306
|
|
},
|
|
{
|
|
ID: "HP058", NameDE: "Kuehlgeraet — thermisch", NameEN: "Cooling Unit — thermal",
|
|
RequiredComponentTags: []string{"high_temperature"},
|
|
RequiredEnergyTags: []string{"thermal"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"thermal_hazard"},
|
|
SuggestedMeasureIDs: []string{"M141"},
|
|
SuggestedEvidenceIDs: []string{"E14"},
|
|
Priority: 70,
|
|
// Source: R581, R1081
|
|
},
|
|
{
|
|
ID: "HP059", NameDE: "Kupplung — mechanisch", NameEN: "Coupling — mechanical",
|
|
RequiredComponentTags: []string{"rotating_part"},
|
|
RequiredEnergyTags: []string{"kinetic"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"mechanical_hazard"},
|
|
SuggestedMeasureIDs: []string{"M012"},
|
|
SuggestedEvidenceIDs: []string{"E08"},
|
|
Priority: 80,
|
|
// Source: R056, R564, R1064
|
|
},
|
|
{
|
|
ID: "HP060", NameDE: "Diagnosemodul — Software", NameEN: "Diagnostic Module — software",
|
|
RequiredComponentTags: []string{"has_software", "safety_device"},
|
|
RequiredEnergyTags: []string{},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"software_fault"},
|
|
SuggestedMeasureIDs: []string{"M105", "M141"},
|
|
SuggestedEvidenceIDs: []string{"E14"},
|
|
Priority: 70,
|
|
// Source: R596, R1096
|
|
},
|
|
{
|
|
ID: "HP061", NameDE: "Firewall — Software", NameEN: "Firewall — software",
|
|
RequiredComponentTags: []string{"networked", "security_device"},
|
|
RequiredEnergyTags: []string{},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"unauthorized_access"},
|
|
SuggestedMeasureIDs: []string{"M188", "M186", "M141"},
|
|
SuggestedEvidenceIDs: []string{"E16"},
|
|
Priority: 85,
|
|
// Source: R587, R1087
|
|
},
|
|
{
|
|
ID: "HP062", NameDE: "Firmware — Software", NameEN: "Firmware — software",
|
|
RequiredComponentTags: []string{"has_software", "programmable"},
|
|
RequiredEnergyTags: []string{},
|
|
RequiredLifecycles: []string{"software_update"},
|
|
GeneratedHazardCats: []string{"update_failure"},
|
|
SuggestedMeasureIDs: []string{"M188", "M186", "M141"},
|
|
SuggestedEvidenceIDs: []string{"E18"},
|
|
Priority: 70,
|
|
// Source: R338, R597, R1097
|
|
},
|
|
{
|
|
ID: "HP063", NameDE: "Ofen — thermisch", NameEN: "Furnace — thermal",
|
|
RequiredComponentTags: []string{"high_temperature"},
|
|
RequiredEnergyTags: []string{"thermal"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"thermal_hazard"},
|
|
SuggestedMeasureIDs: []string{"M141"},
|
|
SuggestedEvidenceIDs: []string{"E20"},
|
|
Priority: 70,
|
|
// Source: R326, R580, R1080
|
|
},
|
|
{
|
|
ID: "HP064", NameDE: "Ofenkammer — thermisch", NameEN: "Furnace Chamber — thermal",
|
|
RequiredComponentTags: []string{"high_temperature"},
|
|
RequiredEnergyTags: []string{"thermal"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"thermal_hazard"},
|
|
SuggestedMeasureIDs: []string{"M141"},
|
|
SuggestedEvidenceIDs: []string{"E20"},
|
|
Priority: 70,
|
|
// Source: R072
|
|
},
|
|
{
|
|
ID: "HP065", NameDE: "Getriebe — mechanisch", NameEN: "Gearbox — mechanical",
|
|
RequiredComponentTags: []string{"pinch_point", "rotating_part"},
|
|
RequiredEnergyTags: []string{"kinetic"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"mechanical_hazard"},
|
|
SuggestedMeasureIDs: []string{"M004"},
|
|
SuggestedEvidenceIDs: []string{"E08"},
|
|
Priority: 80,
|
|
// Source: R055, R563, R1063
|
|
},
|
|
{
|
|
ID: "HP066", NameDE: "Heizelement — thermisch", NameEN: "Heating Element — thermal",
|
|
RequiredComponentTags: []string{"high_temperature"},
|
|
RequiredEnergyTags: []string{"thermal"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"thermal_hazard"},
|
|
SuggestedMeasureIDs: []string{"M141"},
|
|
SuggestedEvidenceIDs: []string{"E10"},
|
|
Priority: 70,
|
|
// Source: R071, R325, R579, R1079
|
|
},
|
|
{
|
|
ID: "HP067", NameDE: "HMI-Bedienterminal — elektrisch", NameEN: "Hmi — electrical",
|
|
RequiredComponentTags: []string{"has_software", "user_interface"},
|
|
RequiredEnergyTags: []string{"electrical_energy"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"hmi_error"},
|
|
SuggestedMeasureIDs: []string{"M131"},
|
|
SuggestedEvidenceIDs: []string{"E20"},
|
|
Priority: 70,
|
|
// Source: R333
|
|
},
|
|
{
|
|
ID: "HP068", NameDE: "HMI-Panel — elektrisch", NameEN: "Hmi Panel — electrical",
|
|
RequiredComponentTags: []string{"has_software", "user_interface"},
|
|
RequiredEnergyTags: []string{"electrical_energy"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"hmi_error"},
|
|
SuggestedMeasureIDs: []string{"M131"},
|
|
SuggestedEvidenceIDs: []string{"E20"},
|
|
Priority: 70,
|
|
// Source: R079, R591, R1091
|
|
},
|
|
{
|
|
ID: "HP069", NameDE: "Hydraulikzylinder — hydraulisch", NameEN: "Hydraulic Cylinder — hydraulic",
|
|
RequiredComponentTags: []string{"high_force", "high_pressure", "hydraulic_part", "moving_part"},
|
|
RequiredEnergyTags: []string{"hydraulic_pressure"},
|
|
RequiredLifecycles: []string{"maintenance", "operation"},
|
|
GeneratedHazardCats: []string{"mechanical_hazard"},
|
|
SuggestedMeasureIDs: []string{"M021", "M022"},
|
|
SuggestedEvidenceIDs: []string{"E08", "E11", "E20"},
|
|
Priority: 80,
|
|
// Source: R066, R319, R320, R572, R1072
|
|
},
|
|
{
|
|
ID: "HP070", NameDE: "Hydraulikschlauch — hydraulisch", NameEN: "Hydraulic Hose — hydraulic",
|
|
RequiredComponentTags: []string{"high_pressure", "hydraulic_part"},
|
|
RequiredEnergyTags: []string{"hydraulic_pressure"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"pneumatic_hydraulic"},
|
|
SuggestedMeasureIDs: []string{"M051"},
|
|
SuggestedEvidenceIDs: []string{"E11"},
|
|
Priority: 70,
|
|
// Source: R067, R321, R573, R1073
|
|
},
|
|
{
|
|
ID: "HP071", NameDE: "Hydraulikpumpe — hydraulisch", NameEN: "Hydraulic Pump — hydraulic",
|
|
RequiredComponentTags: []string{"high_pressure", "hydraulic_part"},
|
|
RequiredEnergyTags: []string{"hydraulic_pressure"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"pneumatic_hydraulic"},
|
|
SuggestedMeasureIDs: []string{"M021", "M022"},
|
|
SuggestedEvidenceIDs: []string{"E11", "E14"},
|
|
Priority: 70,
|
|
// Source: R068, R322, R571, R1071
|
|
},
|
|
{
|
|
ID: "HP072", NameDE: "Hydrauliksystem — hydraulisch", NameEN: "Hydraulic System — hydraulic",
|
|
RequiredComponentTags: []string{"high_pressure", "hydraulic_part"},
|
|
RequiredEnergyTags: []string{"hydraulic_pressure"},
|
|
RequiredLifecycles: []string{"maintenance"},
|
|
GeneratedHazardCats: []string{"mechanical_hazard"},
|
|
SuggestedMeasureIDs: []string{"M021"},
|
|
SuggestedEvidenceIDs: []string{"E20"},
|
|
Priority: 80,
|
|
// Source: R575, R1075
|
|
},
|
|
{
|
|
ID: "HP073", NameDE: "Hydraulikventil — hydraulisch", NameEN: "Hydraulic Valve — hydraulic",
|
|
RequiredComponentTags: []string{"high_pressure", "hydraulic_part"},
|
|
RequiredEnergyTags: []string{"hydraulic_pressure"},
|
|
RequiredLifecycles: []string{"operation"},
|
|
GeneratedHazardCats: []string{"pneumatic_hydraulic"},
|
|
SuggestedMeasureIDs: []string{"M522", "M539", "M141"},
|
|
SuggestedEvidenceIDs: []string{"E14"},
|
|
Priority: 70,
|
|
// Source: R574, R1074
|
|
},
|
|
}
|
|
}
|