Apply the finding engine to schematic and PCB reviews.

FACT, REQUIREMENT, and INFERENCE are separate fields; datasheet provenance
lives in the rule DB so Recommended cannot stay ERROR; LLM output is REVIEW.
Designer decisions persist across rescans. Schematic and PCB share one library
and the same finding object in the report UI.
This commit is contained in:
2026-09-20 08:38:59 +02:00
parent 8f4ebc645c
commit dc65e96a22
16 changed files with 797 additions and 211 deletions
+23
View File
@@ -57,6 +57,29 @@ def test_new_fields_round_trip_json():
assert again.variant == "DNP"
def test_engine_fields_round_trip():
f = Finding(
designator="U1",
finding="x",
status="WARNING",
facts="net GND",
requirement="PSEL high",
inference="intentional?",
provenance="RECOMMENDED",
finding_class="RISK",
confidence=0.4,
evidence_status="SUFFICIENT",
calculation="n/a",
assumptions=["firmware unknown"],
action="leave PSEL low",
)
again = Finding.model_validate(json.loads(f.model_dump_json()))
assert again.facts == "net GND"
assert again.provenance == "RECOMMENDED"
assert again.finding_class == "RISK"
assert again.assumptions == ["firmware unknown"]
def test_unknown_extra_keys_do_not_break_legacy_payloads():
f = Finding.model_validate(
{