Leak gates: cross-evidence nets for unseen-project conventions
Mechanical pattern tools WILL miss new dialects; these gates are ledger/cross-evidence INVARIANTS that hold for conventions never seen: - frame_ledger (audit --frames <detect out-config>): every detected plan frame must be used by the config or listed in discarded_frames with a reason — silently ignored frames are where wings vanish - area_declared (config declared_areas_m2): model footprint area vs 经济技术指标表 within ±15% — 1#B lost half the building and only the site plan exposed it - storey_count (config expected_storeys_above_ground): above-ground F<n> count vs 总图 labels / elevation ladder - unknown_layer_dialect (read report): plan file with no *WALL*/*墙* layer = unfamiliar institute convention, map layers consciously All three gates SKIP when unarmed (zero impact on existing projects); regression suite +8 checks, all green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import fnmatch
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
@@ -313,6 +314,21 @@ def file_warnings(item: dict) -> list[str]:
|
||||
"This file holds a whole sheet set — never model it as a single floor and never stack frames "
|
||||
"without per-floor offsets. Run scripts/detect_sheet_frames.py to generate clip/offset config."
|
||||
)
|
||||
# Unfamiliar layer dialect: a plan file whose layers match NO known wall
|
||||
# naming (*WALL*/*墙*/QIANG) means a design institute convention this
|
||||
# pipeline has never seen — the layer mapping must be built consciously,
|
||||
# or extraction silently captures nothing (patterns age, invariants don't).
|
||||
wall_dialects = ("*WALL*", "*墙*", "*QIANG*")
|
||||
layer_names = [l["name"] for l in item.get("layers", []) if l.get("entity_count", 0) > 0]
|
||||
if (plan_titles >= 1 and (entities or 0) >= 400
|
||||
and layer_names
|
||||
and not any(fnmatch.fnmatch(n.upper(), p.upper()) for n in layer_names for p in wall_dialects)):
|
||||
tops = ", ".join(l["name"] for l in item.get("top_layers", [])[:8])
|
||||
warnings.append(
|
||||
f"unknown_layer_dialect: {plan_titles} plan title(s) but no wall-like layer "
|
||||
f"(*WALL*/*墙*) among {len(layer_names)} populated layers — an unfamiliar design-institute "
|
||||
f"convention. Map layers consciously before modeling (top layers: {tops})."
|
||||
)
|
||||
cached = item.get("insert_block_content") or []
|
||||
cached_total = sum(b["entities"] for b in cached)
|
||||
if entities < NEAR_EMPTY_ENTITY_THRESHOLD and cached_total >= 200:
|
||||
|
||||
Reference in New Issue
Block a user