Files
Conflict_Checker/tests/test_review_findings.py
T
woogi d37ac8c1c7
Docker Release / build-and-push (push) Successful in 1m8s
Docker Release / release (push) Skipped
feat: refocus on drawings — code/ADA gated off, drawing-integrity wave, Brain-directed clarification
- ENABLE_CODE_REVIEW flag (default off): skips code/ADA/jurisdiction review
  path in both pipelines; nothing deleted, one env flag to restore.
- Per-sheet Drawing Integrity QA wave (agent + classic, default on):
  dangling refs, on-sheet contradictions, dimension sanity, missing sheet
  essentials, tag hygiene. New DrawingIntegrityAgent + classic stage.
- Broadened conflict critic: intra-sheet + same-discipline contradictions,
  not just cross-discipline.
- Wave 6.5 Brain-directed clarification (bounded hub-and-spoke): Brain names
  uncertain findings, verify_evidence requests route through the wave-5b
  verifier; refuted findings suppressed. One planning call + capped verifies,
  single iteration. Shared _build_verify_scopes across 5b and 6.5.
- Config knobs, .env.example, frontend copy, tests (182 passing).
2026-08-20 15:10:32 -05:00

70 lines
2.6 KiB
Python

"""Regression tests for defects found in the Aug 2026 agent-mode code review.
R2 - text_coverage._SHEET_ID_RE could not match hyphenated sheet ids (C-001),
leaving civil/landscape pages sheet_number=None and producing false
"declared but not in set" reconciliation warnings.
R3 - config bool knobs mixed `== "true"` with the 1/true/yes set, so setting
EXTRACT_TEXT_RETRY_ENABLED=1 silently DISABLED the retry ladder.
See also tests/agents/test_verifier.py for the verifier's "corrected"
semantics, which are intentional and pinned there.
"""
import importlib
import os
from unittest import mock
from backend.sheet_reconcile import declared_sheet_list, reconcile_sheets
from backend.text_coverage import recover_sheet_number
# --- R2: hyphenated sheet ids ----------------------------------------------
def test_recover_sheet_number_handles_hyphenated_civil_id():
page_text = ("GENERAL NOTES\n" * 40) + "PROJECT NO 2024-118\nSHEET\nC-001\n"
assert recover_sheet_number(page_text) == "C-001"
def test_recover_sheet_number_still_handles_plain_ids():
page_text = ("NOTES\n" * 40) + "SHEET\nS302\n"
assert recover_sheet_number(page_text) == "S302"
def test_recovered_hyphenated_id_reconciles_against_declared_index():
"""The whole point: a recovered C-001 must not read as a missing sheet."""
declared = declared_sheet_list({1: "SHEET LIST\nC-001 CIVIL\nA102 PLAN\n"})
assert declared == ["C-001", "A102"]
recovered = recover_sheet_number(("X\n" * 40) + "SHEET\nC-001\n")
recon = reconcile_sheets(
[{"sheet_number": recovered}, {"sheet_number": "A102"}], declared)
assert recon["declared_not_in_set"] == []
assert recon["in_set_not_declared"] == []
# --- R3: boolean env knob parsing ------------------------------------------
def test_numeric_one_enables_ladder_knobs():
with mock.patch.dict(os.environ, {
"EXTRACT_TEXT_RETRY_ENABLED": "1",
"EXTRACT_FALLBACK_ENABLED": "yes",
}):
cfg = importlib.reload(importlib.import_module("backend.config"))
try:
assert cfg.EXTRACT_TEXT_RETRY_ENABLED is True
assert cfg.EXTRACT_FALLBACK_ENABLED is True
finally:
importlib.reload(cfg)
def test_false_values_still_disable_ladder_knobs():
with mock.patch.dict(os.environ, {
"EXTRACT_TEXT_RETRY_ENABLED": "false",
"EXTRACT_FALLBACK_ENABLED": "0",
}):
cfg = importlib.reload(importlib.import_module("backend.config"))
try:
assert cfg.EXTRACT_TEXT_RETRY_ENABLED is False
assert cfg.EXTRACT_FALLBACK_ENABLED is False
finally:
importlib.reload(cfg)