fix(correctness-bundle): I16 correctness fixes + dead code removal + ruff clean

N1: COM hatch non-associative (AddHatch associativity=False)
N2: ezdxf refuses DWG saves with clear error; server.py derives fmt from extension
R19: dimension_aligned dist→distance; dimension_angular correct add_angular_dim_2l args (base/line1/line2/location)
R9: polar array 360° no-duplicate (divisor=n when fill_angle%360<ε)
R13: entity_offset side_x/side_y honored in ezdxf via cross-product (LINE) and distance-to-center (CIRCLE)
R18: drawing_new bootstrap failure surfaces status="degraded" instead of swallowing silently
Dead code: engineering/section.py, gear.generate_tooth_profile, CommandResult, _ACI_NAMES, set_layer_active, ensure_linetypes, ComBackend._batch_mode instance attr, engineering/__init__ build-seam comment
Ruff: 38 auto-fixed + 5 manual → codebase is now ruff-clean; CI lint is now blocking

184 tests pass.
This commit is contained in:
Umutcan Edizsalan
2026-06-18 11:34:30 +03:00
parent 702af0d6e1
commit 0c7f64ceb6
51 changed files with 2494 additions and 2865 deletions
+8 -5
View File
@@ -287,10 +287,11 @@ async def drawing_new(
)
lt_status = await ensure_standard_linetypes(backend)
layer_status = await ensure_engineering_layers(backend)
result["bootstrap"] = {"linetypes": lt_status, "layers": layer_status}
result["bootstrap"] = {"ok": True, "linetypes": lt_status, "layers": layer_status}
except Exception as exc:
await ctx.warning(f"Engineering bootstrap skipped: {exc}")
result["bootstrap"] = {"error": str(exc)}
await ctx.warning(f"Engineering bootstrap failed: {exc}")
result["bootstrap"] = {"ok": False, "error": str(exc)}
result["status"] = "degraded"
return result
@@ -2263,7 +2264,7 @@ async def titleblock_apply_iso_a3(
ctx: Context = None,
) -> dict:
"""ISO 7200 / A3 (420x297 mm) title block. Title text is used verbatim."""
from engineering import apply_iso_a3_titleblock, TitleBlockMetadata
from engineering import TitleBlockMetadata, apply_iso_a3_titleblock
backend = _backend(ctx)
metadata = TitleBlockMetadata(
title=title, drawing_no=drawing_no, part_no=part_no, material=material,
@@ -2296,7 +2297,9 @@ async def drawing_finalize(
if save_path:
validated = validate_path(save_path, allow_write=True)
await backend.drawing_save_as(str(validated))
from pathlib import Path as _P
_fmt = _P(str(validated)).suffix.lstrip(".").lower() or "dxf"
await backend.drawing_save_as(str(validated), fmt=_fmt)
if screenshot_path:
validated_shot = validate_path(screenshot_path, allow_write=True)