feat(iace): cross-domain precision overhaul + component review + schema reconcile
Engine precision (stop foreign-machine patterns leaking into a project):
- Wire project.MachineType into the engine machine-type gate (empty input no
longer fires every machine class — press/cnc/excavator/crane/medical...).
- Capability-domain gating extended by 7 domains (outdoor, ventilation,
machining, bulk, palletizer, playground, fitness) so domain-specific hazards
only fire when the narrative names that domain; emitted via keyword_dictionary.
- Relevance backstop moved into iace (single gating contract, testable), and its
dominant false-anchor class removed (a long pattern word no longer matches a
short common token; prepositions/leitung added to the generic stoplist).
- New guard tests: TestCrossDomainPrecision (full pipeline, 0 foreign per GT) and
TestPatternReachability now asserts 0 dead patterns. Both GTs keep coverage 1.0.
Reachability fix: the 51 dead patterns required electrical/pneumatic/hydraulic
tags nothing produced — renamed to the canonical electrical_energy/
pneumatic_pressure/hydraulic_pressure/hydraulic_part.
Component review (negation is best-effort + expert-correctable):
- Parser surfaces negated components (ComponentMatch.Negated) instead of dropping
them; negated contribute no tags/energy → no phantom hazards.
- presence_status (vorhanden|nicht_vorhanden|geloescht) + ce_marked on components;
only `vorhanden` feed matching. CE+safety-relevant flags the PL/SIL obligation.
- Force re-seed preserves the expert's component decisions instead of wiping them.
- Tag-based component→hazard assignment (was: all on the first component).
- Negation-aware narrative parsing ("keine Pneumatik" no longer extracts it).
Local-dev DB: ai-sdk sets search_path=compliance,core,public; reconcile migrations
152-156 bring the consolidated local iace tables to the current schema + add the
presence_status/ce_marked columns. Machine-type vocabulary endpoint for the form.
[migration-approved]
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -57,6 +57,28 @@ var domainGateTerms = map[string]string{
|
||||
"maehdrescher": "dom_agri", "ballenpresse": "dom_agri", "feldhaecksler": "dom_agri",
|
||||
// Roll-/Fahrtreppe
|
||||
"rolltreppe": "dom_escalator", "fahrtreppe": "dom_escalator",
|
||||
// Aussen-/Witterungs-/Bioarbeit (Forst, Bau im Freien)
|
||||
"zecke": "dom_outdoor", "zeckenstich": "dom_outdoor", "fsme": "dom_outdoor",
|
||||
"borreliose": "dom_outdoor", "im freien": "dom_outdoor", "freigelaende": "dom_outdoor",
|
||||
"aussengelaende": "dom_outdoor", "ausseneinsatz": "dom_outdoor", "witterung": "dom_outdoor",
|
||||
"winterarbeit": "dom_outdoor", "nagerkot": "dom_outdoor", "hantavirus": "dom_outdoor",
|
||||
// Lueftung/Feuchte (Schimmel)
|
||||
"schimmel": "dom_ventilation", "schimmelspor": "dom_ventilation",
|
||||
"lueftungsanlage": "dom_ventilation", "lueftungskanal": "dom_ventilation",
|
||||
// Zerspanung / Kuehlschmierstoff
|
||||
"kuehlschmierstoff": "dom_machining", "kss-kreislauf": "dom_machining",
|
||||
"kss-aufbereitung": "dom_machining", "kuehlturm": "dom_machining",
|
||||
"bearbeitungszentrum": "dom_machining",
|
||||
// Schuettgut / Silo / Gaerbehaelter (Confined Space mit Schuettgut)
|
||||
"silo": "dom_bulk", "schuettgut": "dom_bulk", "gaerbehaelter": "dom_bulk",
|
||||
"getreidesilo": "dom_bulk", "mehlsilo": "dom_bulk",
|
||||
// Palettierer
|
||||
"palettierer": "dom_palletizer", "palettieranlage": "dom_palletizer",
|
||||
// Spielplatz / Spielgeraet
|
||||
"klettergeraet": "dom_playground", "spielplatz": "dom_playground", "spielgeraet": "dom_playground",
|
||||
// Fitness / Kraftgeraet
|
||||
"gewichtstapel": "dom_fitness", "langhantel": "dom_fitness", "bankdrueck": "dom_fitness",
|
||||
"kniebeug": "dom_fitness", "kraftstation": "dom_fitness",
|
||||
}
|
||||
|
||||
// applyDomainGates appends a domain capability tag to every pattern whose own
|
||||
|
||||
Reference in New Issue
Block a user