feat(review): 新增确定性检查前置与结论结构化内核
- checks.py:确定性检查(find_zero_length / find_duplicate_entities 传 window + 纯 Python 派生空文字、未闭合多段线)。问题带 source=deterministic,handle 来自 工具/数据本身,不依赖 LLM 回忆 - findings.py:解析 LLM 的 JSON 结论 + handle 交叉校验(引用未知 handle 时保留问题、 剥掉 handle、verified=False)+ findings 装配 - config.py:新增 DETERMINISTIC_CHECKS / VALIDATE_HANDLES / CHECK_UNCLOSED_POLYLINES 开关与 ZERO_LENGTH_TOLERANCE / DUP_TOLERANCE / DUP_GROUP_LIMIT 实机验证:find_zero_length / find_duplicate_entities 的 window 参数在基座上生效 (schema 未声明,C++ 侧 parseCommonQuery 实际支持)。
This commit is contained in:
1 parent
a0ea902b50
commit
f6d61f8d07
6 files changed
+884
No files matched your search
@@ -27,6 +27,26 @@ def test_read_env_missing_returns_empty(monkeypatch):
|
||||
assert config._read_env("CAD_TEST_DEFINITELY_MISSING_XYZ") == ""
|
||||
|
||||
|
||||
def test_read_bool_defaults_when_unset(monkeypatch):
|
||||
monkeypatch.delenv("CAD_TEST_BOOL_UNSET", raising=False)
|
||||
assert config._read_bool("CAD_TEST_BOOL_UNSET", True) is True
|
||||
assert config._read_bool("CAD_TEST_BOOL_UNSET", False) is False
|
||||
|
||||
|
||||
def test_read_bool_empty_string_uses_default(monkeypatch):
|
||||
monkeypatch.setenv("CAD_TEST_BOOL_EMPTY", " ")
|
||||
assert config._read_bool("CAD_TEST_BOOL_EMPTY", True) is True
|
||||
|
||||
|
||||
def test_read_bool_truthy_and_falsy(monkeypatch):
|
||||
for raw in ("1", "true", "TRUE", "Yes", "on"):
|
||||
monkeypatch.setenv("CAD_TEST_BOOL", raw)
|
||||
assert config._read_bool("CAD_TEST_BOOL", False) is True
|
||||
for raw in ("0", "false", "no", "off", "nope"):
|
||||
monkeypatch.setenv("CAD_TEST_BOOL", raw)
|
||||
assert config._read_bool("CAD_TEST_BOOL", True) is False
|
||||
|
||||
|
||||
def test_has_api_key_reflects_module_value(monkeypatch):
|
||||
monkeypatch.setattr(config, "API_KEY", "")
|
||||
assert config.has_api_key() is False
|
||||
@@ -50,6 +70,22 @@ def test_constants_have_expected_types():
|
||||
assert isinstance(config.CHECKLIST_PATH, type(config.PROJECT_ROOT))
|
||||
|
||||
|
||||
def test_credibility_constants_have_expected_types():
|
||||
assert isinstance(config.DETERMINISTIC_CHECKS, bool)
|
||||
assert isinstance(config.VALIDATE_HANDLES, bool)
|
||||
assert isinstance(config.CHECK_UNCLOSED_POLYLINES, bool)
|
||||
assert isinstance(config.ZERO_LENGTH_TOLERANCE, float)
|
||||
assert isinstance(config.DUP_TOLERANCE, float)
|
||||
assert isinstance(config.DUP_GROUP_LIMIT, int)
|
||||
|
||||
|
||||
def test_credibility_defaults_are_on():
|
||||
# 默认开启,保证默认拿到可信度收益
|
||||
assert config.DETERMINISTIC_CHECKS is True
|
||||
assert config.VALIDATE_HANDLES is True
|
||||
assert config.CHECK_UNCLOSED_POLYLINES is True
|
||||
|
||||
|
||||
def test_checklist_path_resolves_relative_to_root():
|
||||
assert config.CHECKLIST_PATH.name == "review_checklist.json"
|
||||
assert config.CHECKLIST_PATH.parent == config.PROJECT_ROOT
|
||||
|
||||
Reference in new issue
Block a user