fix: make CAD conversion recovery deterministic
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:49:18 +08:00
parent 9d7d3cb973
commit a3be794e19
7 changed files with 159 additions and 6 deletions

View File

@@ -549,6 +549,34 @@ def test_no_convert_cannot_hide_dwg_sources(tmp_path: Path) -> None:
assert "unconverted.dwg" in report["gate"]["detail"]
def test_report_refuses_to_delete_input_inside_generated_work_dir(tmp_path: Path) -> None:
work = tmp_path / "work"
source_dir = work / "dxf_raw"
source_dir.mkdir(parents=True)
source = source_dir / "roof.dxf"
ezdxf.new("R2010").saveas(source)
proc = subprocess.run(
[
sys.executable,
str(ROOT / "scripts" / "cad_dxf_report.py"),
"--input",
str(source_dir),
"--work",
str(work),
"--output",
str(tmp_path / "report"),
"--no-convert",
],
text=True,
capture_output=True,
)
assert proc.returncode != 0
assert "would be deleted before inspection" in proc.stderr
assert source.exists()
def test_variants_manifest_is_versioned(tmp_path: Path) -> None:
spec_path = tmp_path / "spec.json"
spec_path.write_text(json.dumps(minimal_spec()), encoding="utf-8")