fix: enforce Revit roof views and orphan geometry gates
Some checks failed
ci / test (macos-latest, 3.10) (push) Has been cancelled
ci / test (macos-latest, 3.12) (push) Has been cancelled
ci / test (ubuntu-latest, 3.10) (push) Has been cancelled
ci / test (ubuntu-latest, 3.12) (push) Has been cancelled
ci / test (windows-latest, 3.10) (push) Has been cancelled
ci / test (windows-latest, 3.12) (push) Has been cancelled
ci / browser-smoke (push) Has been cancelled

This commit is contained in:
2026-07-21 13:10:04 +08:00
13 changed files with 857 additions and 67 deletions

View File

@@ -129,6 +129,81 @@ def test_unarmed_cross_evidence_gates_are_not_applicable() -> None:
assert audit_showcase_extraction.storey_count_gate(spec, {})["status"] == "NOT_APPLICABLE"
def test_multi_frame_source_requires_detector_ledger() -> None:
report = {
"files": [
{"file": "A212.dxf", "status": "ok", "plan_title_count": 2},
{"file": "A213.dxf", "status": "ok", "plan_title_count": 1},
]
}
assert cad_showcase.multi_frame_source_files(report) == ["A212.dxf"]
def test_frame_ledger_requires_distinct_floor_identity_even_when_roof_clips_overlap() -> None:
frames = [
{
"drawings": [
{
"file": "A212.dxf",
"floors": [
{
"key": "RF",
"name": "屋面平面图",
"clip": [0, 0, 100, 100],
"include_block_names": ["*-屋面平面图"],
},
{
"key": "PH",
"name": "机房小屋面",
"clip": [0, 0, 100, 100],
"include_block_names": ["*-机房小屋面"],
},
],
}
]
}
]
config = {
"drawings": [
{
"file": "A212.dxf",
"floors": [
{"key": "RF", "clip": [0, 0, 100, 100]},
{"key": "PH", "clip": [0, 0, 100, 100]},
],
}
]
}
gate = audit_showcase_extraction.frame_ledger_gate(config, frames)
assert gate["status"] == "FAIL"
assert "屋面平面图" in gate["detail"]
config["drawings"][0]["floors"][0]["include_block_names"] = ["*-屋面平面图"]
config["drawings"][0]["floors"][1]["include_block_names"] = ["*-机房小屋面"]
assert audit_showcase_extraction.frame_ledger_gate(config, frames)["status"] == "PASS"
def test_revit_view_block_selector_separates_overlapping_floor_views() -> None:
rf = {"include_block_names": ["*-屋面平面图"]}
drawing: dict = {}
assert derive_showcase_spec.block_matches_floor("墙族-123-屋面平面图", rf, drawing)
assert not derive_showcase_spec.block_matches_floor("墙族-456-机房小屋面", rf, drawing)
assert not derive_showcase_spec.block_matches_floor("", rf, drawing)
def test_disconnected_footprint_island_fails_until_explicitly_explained() -> None:
spec = minimal_spec()
spec["floors"]["F1"]["footprint"]["polygons"].append([[25.0, 0.0], [26.0, 0.0], [26.0, 1.0], [25.0, 1.0]])
failed = audit_showcase_extraction.disconnected_footprints_gate(spec, {})
assert failed["status"] == "FAIL"
assert "F1" in failed["detail"]
accepted = audit_showcase_extraction.disconnected_footprints_gate(
spec,
{"allowed_disconnected_footprints": [{"floor_key": "F1", "reason": "独立雨棚,有柱网证据"}]},
)
assert accepted["status"] == "PASS"
def test_annotation_is_waivable_warn_and_absent_glazing_is_not_applicable() -> None:
report = {
"spec_counts": {"F1": {"glazing": 0}},