From e9a5bc0f93be9527ac9183038711a9ba9295f04e Mon Sep 17 00:00:00 2001 From: Marco Wittwer Date: Sat, 3 Oct 2026 00:58:56 +0200 Subject: [PATCH 1/4] Tests: drop redundant tests, sharpen the weak ones Follow-up to an over-engineering audit of the suite. Removed, because another test or the shipped code already pins the same: - TestConfigDefaults: ten literal checks. A changed default is a deliberate edit; what can drift is a second copy of the defaults, so test_app_render now checks that the web app starts with Config's values. - three file_hash tests implied by test_known_content, the selection_key and is_rotation_axis mapping tests (both branches run through AppTest and quantize_axis_value), the unused cylinder fixtures, two no-throw dilate tests, a decimation test that only checked "no error", the signature check for individual_recess_positions and five unused imports. Sharpened, because they could not fail for the reason they exist: - TestEffectiveWorkers pins os.cpu_count: on the 4-core CI runner min(100, 4) is 4 with or without the RAM cap. - Removed build_inlay keywords are checked by calling - a signature check misses a **kwargs swallowing them. Binding fails before the body runs, so the test needs no fixture any more. - The rotation order test rebuilt the implementation's own matrices; it now pins where the unit vectors land (order and direction). - normalize: "de.UTF-8" and "de.utf8" are the only inputs that need the split at "." and no case covered them. - DYNAMIC_KEYS lost four keys app.py now passes as literals. New: format_int per language; a coarser rotation step snaps slider, number field and stored value together; the gap's number field sets the gap. Co-Authored-By: Claude Opus 5.5 --- tests/conftest.py | 17 ------------ tests/test_app_helpers.py | 36 ------------------------ tests/test_app_render.py | 49 ++++++++++++++++++++++++++++++++ tests/test_build_inlay.py | 54 +++++++++++------------------------- tests/test_config.py | 48 ++++---------------------------- tests/test_dilate.py | 8 ------ tests/test_i18n.py | 20 ++++++++----- tests/test_parallel.py | 31 +++++++++++++++------ tests/test_pipeline.py | 3 -- tests/test_prepare_figure.py | 8 ------ tests/test_rotation.py | 37 ++++++++++++++---------- 11 files changed, 129 insertions(+), 182 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index ad371bf..e96034b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,11 +2,9 @@ from __future__ import annotations -import os import sys from pathlib import Path -import numpy as np import pytest import trimesh @@ -108,18 +106,3 @@ def dilated_sphere(sphere_stl_path, fast_test_config): prepared = inlayer.prepare_figure(sphere_stl_path, fast_test_config) return inlayer.dilate(prepared, fast_test_config.clearance, fast_test_config) - - -@pytest.fixture(scope="session") -def cylinder_mesh() -> trimesh.Trimesh: - """Watertighter Zylinder (Radius 4 mm, Hoehe 12 mm).""" - return trimesh.creation.cylinder(radius=4.0, height=12.0) - - -@pytest.fixture(scope="session") -def cylinder_stl_path(tmp_path_factory, cylinder_mesh) -> str: - """Schreibt den Zylinder als STL und liefert den Pfad zurueck.""" - p = tmp_path_factory.mktemp("meshes") / "cylinder.stl" - cylinder_mesh.export(file_obj=str(p), file_type="stl") - return str(p) - diff --git a/tests/test_app_helpers.py b/tests/test_app_helpers.py index a97a7ff..88effd1 100644 --- a/tests/test_app_helpers.py +++ b/tests/test_app_helpers.py @@ -108,24 +108,6 @@ def test_empty_file(self, tmp_path): expected = hashlib.sha256(b"").hexdigest()[:16] assert app_helpers.file_hash(str(p)) == expected - def test_hash_length(self, tmp_path): - p = tmp_path / "x.bin" - p.write_bytes(b"x" * 100) - assert len(app_helpers.file_hash(str(p))) == 16 - - def test_identical_files_same_hash(self, tmp_path): - data = b"identical-bytes" * 1000 # ueber Chunk-Grenze hinaus - p1, p2 = tmp_path / "a.bin", tmp_path / "b.bin" - p1.write_bytes(data) - p2.write_bytes(data) - assert app_helpers.file_hash(str(p1)) == app_helpers.file_hash(str(p2)) - - def test_different_content_different_hash(self, tmp_path): - p1, p2 = tmp_path / "a.bin", tmp_path / "b.bin" - p1.write_bytes(b"alpha") - p2.write_bytes(b"beta") - assert app_helpers.file_hash(str(p1)) != app_helpers.file_hash(str(p2)) - def test_chunked_read_matches_whole_file(self, tmp_path): # Datei deutlich groesser als die Chunk-Groesse: das stueckweise Lesen # muss dasselbe Ergebnis liefern wie ein Hash ueber den Gesamtinhalt. @@ -140,24 +122,6 @@ def test_missing_file_raises(self, tmp_path): app_helpers.file_hash(str(tmp_path / "gibtsnicht.bin")) -class TestSelectionKey: - def test_rotation_axes_use_rot_selection(self): - for axis in ("rot_x", "rot_y", "rot_z"): - assert app_helpers.selection_key(axis) == "selected_rot_fig" - - def test_position_axes_use_pos_selection(self): - for axis in ("offset_x", "offset_y", "offset_z"): - assert app_helpers.selection_key(axis) == "selected_fig" - - -class TestIsRotationAxis: - def test_rotation_axes(self): - assert app_helpers.is_rotation_axis("rot_x") - - def test_offset_axes(self): - assert not app_helpers.is_rotation_axis("offset_x") - - class TestQuantizeAxisValue: def test_position_snaps_to_step(self): assert app_helpers.quantize_axis_value("offset_x", 12.4, 10.0) == 10.0 diff --git a/tests/test_app_render.py b/tests/test_app_render.py index 64e26e9..8fafc2d 100644 --- a/tests/test_app_render.py +++ b/tests/test_app_render.py @@ -21,6 +21,7 @@ from streamlit.testing.v1 import AppTest import i18n +import inlayer APP = str(Path(__file__).resolve().parent.parent / "app.py") @@ -115,6 +116,21 @@ def test_hide_and_show_keeps_step_and_angle(self): assert next(s for s in at.sidebar.slider if s.key == "_sl_rot_x").value == 350.0 assert at.button, "the run button must still render" + def test_a_coarser_step_snaps_the_shown_value(self): + """Slider, number field and the stored value snap to the new step + together. A new step makes Streamlit rebuild the widgets, so a value + that is not set before they exist falls back to the slider's minimum - + hence 100° -> 90°, not a value that lands on 0°.""" + at = _run("en") + _checkbox(at, "app.manual_rotations.label").check().run() + _widget(at, "selectbox", "_w_rot_step").set_value(10.0).run() + _widget(at, "slider", "_sl_rot_x").set_value(100.0).run() + _widget(at, "selectbox", "_w_rot_step").set_value(45.0).run() + assert not at.exception, [str(e.value) for e in at.exception] + assert _widget(at, "slider", "_sl_rot_x").value == 90.0 + assert _widget(at, "number_input", "_ni_rot_x").value == 90.0 + assert at.session_state["fig_offsets_dict"]["__fallback__"]["rot_x"] == 90.0 + @pytest.mark.parametrize("lang", sorted(i18n.LANGUAGES)) def test_app_renders_without_exception(lang): @@ -346,6 +362,39 @@ def test_until_the_user_sets_a_gap(self): assert _widget(at, "slider", "_sl_figure_gap").value == 3.0 assert at.session_state["figure_gap"] == 3.0 + def test_the_number_field_sets_it_too(self): + at = _two_figures() + _widget(at, "number_input", "_ni_figure_gap").set_value(3.5).run() + _widget(at, "slider", "wall_thickness").set_value(5.0).run() + assert _widget(at, "slider", "_sl_figure_gap").value == 3.5 + assert at.session_state["figure_gap"] == 3.5 + + + +def test_widgets_start_with_the_pipeline_defaults(): + """Web app and CLI start from the same values, Config's defaults. The app + used to repeat them as literals that nothing kept in sync.""" + cfg = inlayer.Config() + at = _two_figures() + assert _widget(at, "checkbox", "finger_enabled").value == cfg.enable_finger_recesses + assert _widget(at, "checkbox", "parallel").value == cfg.enable_parallel + _widget(at, "checkbox", "finger_enabled").check().run() + for kind, key, field in [ + ("slider", "clearance", "clearance"), + ("slider", "wall_thickness", "wall_thickness"), + ("slider", "depth_fraction", "depth_fraction"), + ("slider", "voxel_pitch", "voxel_pitch"), + ("number_input", "decimate_faces", "decimate_faces"), + ("number_input", "scale", "stl_unit_to_mm"), + ("slider", "finger_radius", "finger_radius"), + ("selectbox", "_w_finger_axis", "finger_recess_axis"), + ("slider", "finger_z_offset", "finger_recess_z_offset"), + ("selectbox", "_w_box_shape", "box_shape"), + ("selectbox", "_w_layout_style", "layout_style"), + ("slider", "_sl_figure_gap", "effective_figure_gap"), + ]: + assert _widget(at, kind, key).value == getattr(cfg, field), key + class TestResult: @staticmethod diff --git a/tests/test_build_inlay.py b/tests/test_build_inlay.py index 1656c9c..30d8828 100644 --- a/tests/test_build_inlay.py +++ b/tests/test_build_inlay.py @@ -3,7 +3,7 @@ from __future__ import annotations import dataclasses -import inspect +from typing import Any import numpy as np import pytest @@ -136,36 +136,23 @@ def test_offset_moves_the_cavity_inside_a_fixed_box(self, dilated_cube, fast_tes class TestBuildInlaySignature: - """Absicherung gegen wiederkehrende tote Parameter. - - `individual_rotations` war frueher Teil der Signatur, wurde aber nie - ausgewertet (Rotationen sind zum Aufrufzeitpunkt bereits in den Meshes - eingerechnet). Der Parameter ist entfernt; dieser Test haelt das fest. + """Guards against dead parameters coming back. + + `individual_rotations` was part of the signature but never evaluated + (rotations are already baked into the meshes at call time). Box sizing + used to be split between the caller (`stable_global_bounds`) and + build_inlay; the documented call without them got neither the XY + compensation nor room for the finger recesses. Both are gone, and a caller + still passing them has to fail instead of being silently ignored. Calling + is what pins that - a signature check misses a `**kwargs` swallowing them. """ - def test_no_individual_rotations_parameter(self): - params = inspect.signature(inlayer.build_inlay).parameters - assert "individual_rotations" not in params - - def test_no_stable_global_bounds_parameter(self): - """build_inlay dimensions the box itself, from the real cavities. - - Box sizing used to be split between the caller (stable bounds) and - build_inlay; the documented call without them got neither the XY - compensation nor room for the finger recesses. - """ - params = inspect.signature(inlayer.build_inlay).parameters - assert "stable_global_bounds" not in params - - def test_rejects_individual_rotations_keyword(self, dilated_cube, fast_test_config): - # Ein Aufrufer, der den alten Parameter uebergibt, soll scheitern statt - # stillschweigend eine wirkungslose Rotation zu "akzeptieren". - with pytest.raises(TypeError): - inlayer.build_inlay( - dilated_cube, fast_test_config, - # Der Parameter ist bewusst weg – der Typfehler ist hier der Test. - individual_rotations=[(90.0, 45.0, 30.0)], # type: ignore[unexpected-keyword] - ) + @pytest.mark.parametrize("keyword", ["individual_rotations", "stable_global_bounds"]) + def test_removed_keyword_is_rejected(self, keyword): + # Arguments are bound before the body runs, so no figure is needed + removed: dict[str, Any] = {keyword: None} + with pytest.raises(TypeError, match=keyword): + inlayer.build_inlay([], **removed) class TestBuildInlayMultiMesh: @@ -629,12 +616,3 @@ def test_out_of_range_entry_raises_before_the_csg_run(self, dilated_cube): inlayer.build_inlay( dilated_cube, Config(**self.CFG), individual_recess_positions=[1.5] ) - - def test_accepts_the_keyword(self): - """The parameter is part of the public signature.""" - params = inspect.signature(inlayer.build_inlay).parameters - assert "individual_recess_positions" in params - - - - diff --git a/tests/test_config.py b/tests/test_config.py index 7b1f1ba..1c5fa49 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1,4 +1,9 @@ -"""Tests fuer die Config-Dataclass (Default-Werte und Validierung).""" +"""Tests for the Config dataclass: value validation and its messages. + +The default values themselves are not pinned here - a changed default is a +deliberate edit. What can drift is a second copy of them, which is why +tests/test_app_render.py checks that the web app starts with these values. +""" from __future__ import annotations @@ -10,47 +15,6 @@ from inlayer import Config -class TestConfigDefaults: - """Default-Werte der Pipeline-Parameter.""" - - def test_default_clearance(self): - assert Config().clearance == 0.4 - - def test_default_wall_thickness(self): - assert Config().wall_thickness == 2.0 - - def test_default_depth_fraction(self): - assert Config().depth_fraction == 0.7 - - def test_default_voxel_pitch(self): - assert Config().voxel_pitch == 0.4 - - def test_default_decimate_faces(self): - assert Config().decimate_faces == 20000 - - def test_default_stl_unit(self): - assert Config().stl_unit_to_mm == 1.0 - - def test_box_overrides_default_none(self): - c = Config() - assert c.box_width is None - assert c.box_depth is None - assert c.box_height is None - - def test_offsets_default_zero(self): - c = Config() - assert c.offset_x == 0.0 - assert c.offset_y == 0.0 - assert c.offset_z == 0.0 - - def test_layout_style_default_compact(self): - assert Config().layout_style == "compact" - - def test_enable_parallel_default_false(self): - # Multi-Threading ist opt-in (Speicherbedarf steigt mit Worker-Anzahl) - assert Config().enable_parallel is False - - class TestConfigValidation: """__post_init__ wirft ValueError fuer ungueltige Bereiche.""" diff --git a/tests/test_dilate.py b/tests/test_dilate.py index e8827f1..8407e20 100644 --- a/tests/test_dilate.py +++ b/tests/test_dilate.py @@ -11,14 +11,6 @@ class TestDilateBasic: - def test_returns_trimesh(self, prepared_cube, fast_test_config): - m = inlayer.dilate(prepared_cube, fast_test_config.clearance, fast_test_config) - assert isinstance(m, trimesh.Trimesh) - - def test_result_has_faces(self, prepared_cube, fast_test_config): - m = inlayer.dilate(prepared_cube, fast_test_config.clearance, fast_test_config) - assert len(m.faces) > 0 - def test_result_is_watertight(self, prepared_cube, fast_test_config): m = inlayer.dilate(prepared_cube, fast_test_config.clearance, fast_test_config) assert m.is_watertight diff --git a/tests/test_i18n.py b/tests/test_i18n.py index d474aec..8164fd9 100644 --- a/tests/test_i18n.py +++ b/tests/test_i18n.py @@ -22,17 +22,13 @@ REPO_ROOT = Path(__file__).resolve().parent.parent SOURCE_FILES = ("app.py", "inlayer.py", "app_helpers.py") -# Keys, die im Code nur dynamisch zusammengesetzt werden (f-Strings wie -# t(f"app.layout.{x}")). Der AST-Scan kann sie nicht aufloesen, deshalb stehen -# sie hier explizit und werden ebenso auf Existenz geprueft. +# Keys the code only assembles at runtime (f-strings such as +# t(f"app.layout.{x}")). The AST scan cannot resolve them, so they are listed +# here and checked for existence just the same. DYNAMIC_KEYS = ( - "app.box.shape.box", - "app.box.shape.cylinder", "app.layout.compact", "app.layout.horizontal", "app.layout.vertical", - "app.finger.axis.x", - "app.finger.axis.y", # inlayer.describe_violation: t_(f"check.{kind}") "check.side", "check.floor", @@ -153,6 +149,9 @@ class TestNormalize: ("de-AT", "de"), ("en_US.UTF-8", "en"), ("de_DE.UTF-8", "de"), + # No territory: only the split at "." strips the encoding + ("de.UTF-8", "de"), + ("de.utf8", "de"), ("fr", i18n.DEFAULT_LANGUAGE), ("klingon", i18n.DEFAULT_LANGUAGE), ("", i18n.DEFAULT_LANGUAGE), @@ -240,6 +239,13 @@ def test_parallel_log_follows_language(self, capsys, lang, needle): inlayer._parallel_map(lambda x: x, range(4), Config(enable_parallel=True), what="X") assert needle in capsys.readouterr().out + @pytest.mark.parametrize("lang,expected", [("en", "12,345,678"), ("de", "12.345.678")]) + def test_thousands_separator_follows_language(self, lang, expected): + """German reads "12,345" as a decimal number.""" + i18n.set_language(lang) + assert i18n.format_int(12345678) == expected + + class TestThreadPropagation: """ThreadPoolExecutor-Worker erben ContextVars nicht — _parallel_map muss diff --git a/tests/test_parallel.py b/tests/test_parallel.py index 43e1afb..a91ed5d 100644 --- a/tests/test_parallel.py +++ b/tests/test_parallel.py @@ -20,18 +20,31 @@ class TestEffectiveWorkers: - """_effective_workers begrenzt die Thread-Anzahl nach unten und oben.""" + """_effective_workers caps the thread count by items, cores and memory. - def test_mindestens_ein_worker(self): - assert inlayer._effective_workers(0) == 1 - assert inlayer._effective_workers(1) == 1 + The core count is pinned in every test: the CI runner has 4 cores - as + many as MAX_PARALLEL_WORKERS - so with the real count a missing RAM cap + went unnoticed there (min(100, 4) is 4 either way). + """ + + @staticmethod + def _cores(monkeypatch, n): + monkeypatch.setattr(inlayer.os, "cpu_count", lambda: n) + + def test_ram_cap_holds_on_a_large_machine(self, monkeypatch): + # Voxel grids grow O(n³) in memory, so the cap is hard + self._cores(monkeypatch, 64) + assert inlayer._effective_workers(100) == inlayer.MAX_PARALLEL_WORKERS - def test_nicht_mehr_worker_als_items(self): - assert inlayer._effective_workers(2) <= 2 + def test_no_more_workers_than_items(self, monkeypatch): + self._cores(monkeypatch, 64) + assert inlayer._effective_workers(2) == 2 - def test_ram_cap_greift(self): - # Voxelgitter skalieren O(n³) im Speicher → harte Obergrenze - assert inlayer._effective_workers(100) <= inlayer.MAX_PARALLEL_WORKERS + def test_no_more_workers_than_cores(self, monkeypatch): + self._cores(monkeypatch, 2) + assert inlayer._effective_workers(8) == 2 + self._cores(monkeypatch, None) # os.cpu_count() cannot always tell + assert inlayer._effective_workers(8) == 1 class TestParallelMap: diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py index 193eb01..1ed71ac 100644 --- a/tests/test_pipeline.py +++ b/tests/test_pipeline.py @@ -2,18 +2,15 @@ from __future__ import annotations -import os import re import subprocess import sys from pathlib import Path -import numpy as np import pytest import trimesh import inlayer -from inlayer import Config REPO_ROOT = Path(__file__).resolve().parent.parent diff --git a/tests/test_prepare_figure.py b/tests/test_prepare_figure.py index 72315db..6987991 100644 --- a/tests/test_prepare_figure.py +++ b/tests/test_prepare_figure.py @@ -228,14 +228,6 @@ def test_default_scale_is_identity(self, cube_stl_path, fast_test_config): class TestPrepareFigureDecimation: - def test_no_decimation_when_below_target(self, cube_stl_path): - # Cube hat ~12 Faces; bei decimate_faces=1000 darf NICHT dezimiert werden. - # Nach Voxel-Closing + Marching Cubes hat das Ergebnis aber mehr Faces. - # Der Test prueft hier nur, dass der Pfad ohne Fehler durchlaeuft. - cfg = Config(voxel_pitch=1.0, decimate_faces=1000) - m = inlayer.prepare_figure(cube_stl_path, cfg) - assert len(m.faces) > 0 - def test_decimation_when_above_target(self, sphere_stl_path): # Eine subdiv=2 Ikosphaere hat 320 Faces. # Mit decimate_faces=50 muss dezimiert werden. diff --git a/tests/test_rotation.py b/tests/test_rotation.py index cd971e9..1c19ab8 100644 --- a/tests/test_rotation.py +++ b/tests/test_rotation.py @@ -1,8 +1,9 @@ -"""Tests fuer den Euler-Rotations-Helper aus inlayer.py.""" +"""Tests for the Euler rotation helper in inlayer.py.""" from __future__ import annotations import numpy as np +import pytest import trimesh import inlayer @@ -33,16 +34,24 @@ def test_volumen_bleibt_erhalten(self, cube_mesh): rotated = inlayer.apply_euler_rotation(cube_mesh, 30.0, 45.0, 60.0) assert np.isclose(rotated.volume, cube_mesh.volume, rtol=1e-6) - def test_reihenfolge_rz_ry_rx(self): - """Verifiziert die dokumentierte Reihenfolge Rz·Ry·Rx gegen eine - manuelle Referenzberechnung.""" - box = trimesh.creation.box(extents=[6.0, 4.0, 2.0]) - result = inlayer.apply_euler_rotation(box, 15.0, 25.0, 35.0) - - ref = box.copy() - Rx = trimesh.transformations.rotation_matrix(np.radians(15.0), [1, 0, 0]) - Ry = trimesh.transformations.rotation_matrix(np.radians(25.0), [0, 1, 0]) - Rz = trimesh.transformations.rotation_matrix(np.radians(35.0), [0, 0, 1]) - ref.apply_transform(trimesh.transformations.concatenate_matrices(Rz, Ry, Rx)) - - assert np.allclose(result.vertices, ref.vertices, atol=1e-9) + @pytest.mark.parametrize( + "angles, images", + [ + # Right-handed: +90° about Z turns X into Y + ((0.0, 0.0, 90.0), [[0, 1, 0], [-1, 0, 0], [0, 0, 1]]), + # X before Y, Y before Z, X before Z - the reverse order of each + # pair sends the unit vectors elsewhere + ((90.0, 90.0, 0.0), [[0, 0, -1], [1, 0, 0], [0, -1, 0]]), + ((0.0, 90.0, 90.0), [[0, 0, -1], [-1, 0, 0], [0, 1, 0]]), + ((90.0, 0.0, 90.0), [[0, 1, 0], [0, 0, 1], [1, 0, 0]]), + ], + ) + def test_order_and_direction(self, angles, images): + """X first, then Y, then Z (Rz·Ry·Rx), each counter-clockwise. + + Pinned by where the unit vectors land rather than by rebuilding the + matrices: a reference built like the implementation shares its mistakes. + """ + axes = trimesh.Trimesh(vertices=np.eye(3), faces=[[0, 1, 2]], process=False) + rotated = inlayer.apply_euler_rotation(axes, *angles) + np.testing.assert_allclose(rotated.vertices, images, atol=1e-12) From 02cfb7b7b17c2d3a06fe8364234f71596b080fca Mon Sep 17 00:00:00 2001 From: Marco Wittwer Date: Sat, 3 Oct 2026 01:00:33 +0200 Subject: [PATCH 2/4] Simplify app and pipeline plumbing; the app starts from Config's defaults MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - app.py read its start values from literals of its own (value=0.4, 2.0, ...) while the CLI reads Config's defaults - nothing kept the two in sync. Every widget with a Config counterpart now starts at inlayer.Config., like the CLI; test_app_render checks it and AGENTS.md records it. - The per-axis plain session key (offset_x, rot_z, ...) is gone. Only _requantize_axes read it, to rewrite the slider and number field from it; it now rewrites them from the slider itself. The stored per-figure values stay the source, and rewriting the keys on every run is what keeps them while their section is hidden - documented in the docstring. - One gap callback with args instead of two mirrored ones; GAP_KEYS names the three keys that move together. - Single-use aliases _file_hash and _selection_key inlined. - apply_euler_rotation uses trimesh's euler_matrix ("sxyz" is Rz·Ry·Rx, identical to the hand-built product); the zero-rotation branch went too, apply_transform skips an identity matrix anyway. - Each range rule carries its message; the parallel _RANGE_MESSAGES dict is gone. _is_manifold (one caller) is inlined. Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 2 +- app.py | 103 ++++++++++++++++++++++++++--------------------------- inlayer.py | 37 ++++++++----------- 3 files changed, 66 insertions(+), 76 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index e93613c..542f4b2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -40,7 +40,7 @@ High-signal context for OpenCode sessions in this repo. - `inlayer.py` is the pipeline library module. It exposes a frozen `Config` dataclass plus pipeline functions (`apply_euler_rotation`, `prepare_figure`, `dilate`, `build_inlay`, `wall_thickness_stats_3d`; `arrange_footprints` is the layout `build_inlay` uses). All parameters flow through `Config`. - `app_helpers.py` holds the **Streamlit-free** helpers of the web app (`file_hash`/`bytes_hash`, `quantize_axis_value`, `resolve_selection`, `applied_figure_params`, `figure_labels`, `load_preview_mesh`, `preview_copy`, `scene_layout`, `selection_key`, plus `decimate_mesh` re-exported from `inlayer`). `app.py` imports and thinly wraps them (caching decorators, session-state lookups). Reason: `app.py` calls `st.set_page_config()` and builds the whole sidebar at import time, so it cannot be imported in tests — anything pure belongs in `app_helpers.py` so the suite tests the shipped code instead of a copy. Do not re-inline this logic into `app.py`. (`tests/test_app_render.py` does run `app.py` through Streamlit's `AppTest`, which catches render errors — but that is an integration check, not a licence to move logic back into the frontend.) -- `app.py` is a Streamlit frontend. It builds an `inlayer.Config` from the sidebar widgets and passes it into the pipeline functions (no global mutation). +- `app.py` is a Streamlit frontend. It builds an `inlayer.Config` from the sidebar widgets and passes it into the pipeline functions (no global mutation). Its widgets start at `Config`'s defaults (`inlayer.Config.`, read the way the CLI reads them), never at literals of their own: `tests/test_app_render.py` checks that both entry points start from the same values. - `i18n.py` holds the **bilingual UI** (English/German). `t(key, **kwargs)` looks up `TRANSLATIONS` and fills named placeholders; unknown keys return the key itself rather than raising, so a missing string can never abort a running computation. Keys are namespaced `app.*` / `cli.*` / `pipeline.*` / `config.*` / `error.*` / `check.*` (wall-check findings, shared by CLI and app through `inlayer.describe_violation`). - **The current language is a `ContextVar`, not a module global.** Streamlit runs each session's script in its own thread; a shared global would let one session's language selection bleed into another's. Do not "simplify" this into a plain variable. - **`ThreadPoolExecutor` workers do not inherit ContextVars.** `_parallel_map` captures the language before submitting and re-applies it inside each worker — without that, parallel steps log in the default language. `tests/test_i18n.py` pins this behaviour *and* the assumption behind it. Any new thread pool that logs needs the same treatment. diff --git a/app.py b/app.py index dfcceed..7f29122 100644 --- a/app.py +++ b/app.py @@ -120,8 +120,6 @@ def _cached_dilate( return inlayer.dilate(_mesh, clearance, config) -_file_hash = app_helpers.file_hash - # Face budget of the inlay in the result view INLAY_PREVIEW_FACES = 30000 @@ -299,15 +297,16 @@ def _requantize_axes(axes: tuple[str, ...]): Runs on every rerun, before the sliders exist: that keeps what the sliders show and what the pipeline reads identical, and keeps each value inside - its slider's range whatever step it was stored with. + its slider's range whatever step it was stored with. Writing the display + keys on every run also keeps them while their section is hidden - + Streamlit only drops the state of a hidden widget that nothing set. """ for offsets in stored.values(): for axis in axes: offsets[axis] = _quantize_axis(axis, offsets.get(axis, 0.0)) for axis in axes: - if axis in st.session_state: - val = _quantize_axis(axis, st.session_state[axis]) - st.session_state[axis] = val + if f"_sl_{axis}" in st.session_state: + val = _quantize_axis(axis, st.session_state[f"_sl_{axis}"]) st.session_state[f"_sl_{axis}"] = val st.session_state[f"_ni_{axis}"] = val @@ -316,7 +315,6 @@ def _requantize_axes(axes: tuple[str, ...]): # Widget key of the recess position: one slider for every figure, loaded with # the selected figure's stored value. RECESS_POS_KEY = "_sl_finger_recess_position" -_selection_key = app_helpers.selection_key def _targets(sel_key: str) -> list[str]: @@ -328,10 +326,8 @@ def _targets(sel_key: str) -> list[str]: def _load_axes(ref: str, axes: tuple[str, ...]): for axis in axes: - value = stored[ref][axis] - st.session_state[axis] = value - st.session_state[f"_sl_{axis}"] = value - st.session_state[f"_ni_{axis}"] = value + st.session_state[f"_sl_{axis}"] = stored[ref][axis] + st.session_state[f"_ni_{axis}"] = stored[ref][axis] def _load_recess(ref: str): @@ -339,13 +335,12 @@ def _load_recess(ref: str): def _store_axis_value(axis: str, val: float): - """Quantizes the value, mirrors it into all its widget keys and stores it - for the currently selected figure(s).""" + """Quantizes the value, mirrors it into both widgets of its row and stores + it for the currently selected figure(s).""" val = _quantize_axis(axis, val) - st.session_state[axis] = val st.session_state[f"_sl_{axis}"] = val st.session_state[f"_ni_{axis}"] = val - for fid in _targets(_selection_key(axis)): + for fid in _targets(app_helpers.selection_key(axis)): stored[fid][axis] = val @@ -402,61 +397,64 @@ def _figure_select(label: str, sel_key: str): st.sidebar.markdown("---") st.sidebar.markdown(t("app.printer.heading")) +# Start values are the pipeline's defaults, read from Config like the CLI +# does - a second set of literals here could drift unnoticed. clearance = st.sidebar.slider( - t("app.clearance.label"), min_value=0.1, max_value=2.0, value=0.4, step=0.1, - help=t("app.clearance.help"), key="clearance", + t("app.clearance.label"), min_value=0.1, max_value=2.0, step=0.1, + value=inlayer.Config.clearance, help=t("app.clearance.help"), key="clearance", ) wall_thickness = st.sidebar.slider( - t("app.wall_thickness.label"), min_value=1.0, max_value=5.0, value=2.0, step=0.5, - help=t("app.wall_thickness.help"), key="wall_thickness", + t("app.wall_thickness.label"), min_value=1.0, max_value=5.0, step=0.5, + value=inlayer.Config.wall_thickness, help=t("app.wall_thickness.help"), key="wall_thickness", ) depth_fraction = st.sidebar.slider( - t("app.depth_fraction.label"), min_value=0.3, max_value=1.0, value=0.7, step=0.05, - help=t("app.depth_fraction.help"), key="depth_fraction", + t("app.depth_fraction.label"), min_value=0.3, max_value=1.0, step=0.05, + value=inlayer.Config.depth_fraction, help=t("app.depth_fraction.help"), key="depth_fraction", ) voxel_pitch = st.sidebar.slider( - t("app.voxel_pitch.label"), min_value=0.2, max_value=1.0, value=0.4, step=0.1, - help=t("app.voxel_pitch.help"), key="voxel_pitch", + t("app.voxel_pitch.label"), min_value=0.2, max_value=1.0, step=0.1, + value=inlayer.Config.voxel_pitch, help=t("app.voxel_pitch.help"), key="voxel_pitch", ) decimate_faces = st.sidebar.number_input( - t("app.decimate_faces.label"), min_value=5000, max_value=50000, value=20000, step=5000, - help=t("app.decimate_faces.help"), key="decimate_faces", + t("app.decimate_faces.label"), min_value=5000, max_value=50000, step=5000, + value=inlayer.Config.decimate_faces, help=t("app.decimate_faces.help"), key="decimate_faces", ) scale = st.sidebar.number_input( - t("app.scale.label"), min_value=0.01, max_value=100.0, value=1.0, step=0.1, - help=t("app.scale.help"), key="scale", + t("app.scale.label"), min_value=0.01, max_value=100.0, step=0.1, + value=inlayer.Config.stl_unit_to_mm, help=t("app.scale.help"), key="scale", ) # --- Finger recesses: position per figure ----------------------------------- enable_finger_recesses = st.sidebar.checkbox( t("app.finger.enable.label"), - value=False, + value=inlayer.Config.enable_finger_recesses, help=t("app.finger.enable.help"), key="finger_enabled", ) -finger_radius = 8.0 -finger_recess_axis = "x" -finger_recess_z_offset = 0.0 +finger_radius = inlayer.Config.finger_radius +finger_recess_axis = inlayer.Config.finger_recess_axis +finger_recess_z_offset = inlayer.Config.finger_recess_z_offset if enable_finger_recesses: finger_radius = st.sidebar.slider( t("app.finger.radius.label"), min_value=5.0, max_value=15.0, - value=8.0, + value=inlayer.Config.finger_radius, step=0.5, help=t("app.finger.radius.help"), key="finger_radius", ) finger_recess_axis = _select( t("app.finger.axis.label"), - {"x": t("app.finger.axis.x"), "y": t("app.finger.axis.y")}, "finger_axis", "x", + {"x": t("app.finger.axis.x"), "y": t("app.finger.axis.y")}, "finger_axis", + inlayer.Config.finger_recess_axis, help=t("app.finger.axis.help"), ) finger_recess_z_offset = st.sidebar.slider( t("app.finger.z_offset.label"), min_value=0.0, max_value=30.0, - value=0.0, + value=inlayer.Config.finger_recess_z_offset, step=0.5, help=t("app.finger.z_offset.help"), key="finger_z_offset", @@ -480,7 +478,7 @@ def _figure_select(label: str, sel_key: str): st.sidebar.markdown(t("app.performance.heading")) enable_parallel = st.sidebar.checkbox( t("app.parallel.label"), - value=False, + value=inlayer.Config.enable_parallel, help=t("app.parallel.help", workers=inlayer.MAX_PARALLEL_WORKERS), key="parallel", ) @@ -489,7 +487,8 @@ def _figure_select(label: str, sel_key: str): st.sidebar.markdown(t("app.box.heading")) box_shape = _select( t("app.box.shape.label"), - {"box": t("app.box.shape.box"), "cylinder": t("app.box.shape.cylinder")}, "box_shape", "box", + {"box": t("app.box.shape.box"), "cylinder": t("app.box.shape.cylinder")}, "box_shape", + inlayer.Config.box_shape, help=t("app.box.shape.help"), ) use_custom_box = st.sidebar.checkbox(t("app.box.custom.label"), value=False, key="use_custom_box") @@ -510,17 +509,16 @@ def _figure_select(label: str, sel_key: str): st.sidebar.markdown(t("app.position.heading")) -def _sync_gap_from_slider(): - val = st.session_state["_sl_figure_gap"] - st.session_state["figure_gap"] = val - st.session_state["_ni_figure_gap"] = val - st.session_state["_gap_user_set"] = True +# The gap value itself plus its slider and number field +GAP_KEYS = ("figure_gap", "_sl_figure_gap", "_ni_figure_gap") -def _sync_gap_from_input(): - val = st.session_state["_ni_figure_gap"] - st.session_state["figure_gap"] = val - st.session_state["_sl_figure_gap"] = val +def _sync_gap(source: str): + """Copies the edited gap widget into the gap and the other widget. From + then on the gap no longer follows the wall thickness.""" + val = st.session_state[source] + for key in GAP_KEYS: + st.session_state[key] = val st.session_state["_gap_user_set"] = True @@ -530,9 +528,9 @@ def _sync_gap_from_input(): # user sets one of their own - as the help text and the CLI say. It used # to be copied once, so changing the wall thickness left the gap behind. if not st.session_state.get("_gap_user_set"): - for _key in ("figure_gap", "_sl_figure_gap", "_ni_figure_gap"): + for _key in GAP_KEYS: st.session_state[_key] = float(wall_thickness) - for _key in ("_sl_figure_gap", "_ni_figure_gap"): + for _key in GAP_KEYS[1:]: st.session_state.setdefault(_key, float(st.session_state["figure_gap"])) # One caption for slider and number field (both label_visibility="collapsed"). @@ -548,7 +546,7 @@ def _sync_gap_from_input(): min_value=0.5, max_value=40.0, step=0.5, key="_sl_figure_gap", - on_change=_sync_gap_from_slider, + on_change=_sync_gap, args=("_sl_figure_gap",), label_visibility="collapsed", help=t("app.gap.help") ) @@ -558,7 +556,7 @@ def _sync_gap_from_input(): min_value=0.5, max_value=40.0, step=0.5, key="_ni_figure_gap", - on_change=_sync_gap_from_input, + on_change=_sync_gap, args=("_ni_figure_gap",), label_visibility="collapsed", ) figure_gap = float(st.session_state["figure_gap"]) @@ -567,9 +565,10 @@ def _sync_gap_from_input(): layout_style = _select( t("app.layout.label"), - {x: t(f"app.layout.{x}") for x in ("compact", "horizontal", "vertical")}, "layout_style", "compact", + {x: t(f"app.layout.{x}") for x in ("compact", "horizontal", "vertical")}, "layout_style", + inlayer.Config.layout_style, help=t("app.layout.help"), -) if multi_mode else "compact" +) if multi_mode else inlayer.Config.layout_style def _axis_row(axis: str, label: str, lo: float, hi: float, step: float, hint: str): @@ -699,7 +698,7 @@ def _params_snapshot() -> dict: elif os.path.exists(fallback_path): input_paths = [fallback_path] file_names = [fallback_path] - file_hashes = [_file_hash(fallback_path)] + file_hashes = [app_helpers.file_hash(fallback_path)] else: st.error(t("app.error.no_input", path=fallback_path)) st.stop() diff --git a/inlayer.py b/inlayer.py index 9aa35ec..0fd8481 100644 --- a/inlayer.py +++ b/inlayer.py @@ -62,12 +62,11 @@ def _non_negative(value: float) -> bool: # each rule has exactly one message: "-c -0.5" used to say "must be > 0" # although 0 is allowed. _RANGE_RULES: Final = ( - (_positive, ("wall_thickness", "voxel_pitch", "stl_unit_to_mm", "finger_radius", - "box_width", "box_depth", "box_height", "box_diameter", "figure_gap")), - (_non_negative, ("clearance", "finger_recess_z_offset")), + (_positive, "config.must_be_positive", + ("wall_thickness", "voxel_pitch", "stl_unit_to_mm", "finger_radius", + "box_width", "box_depth", "box_height", "box_diameter", "figure_gap")), + (_non_negative, "config.must_be_non_negative", ("clearance", "finger_recess_z_offset")), ) -_RANGE_MESSAGES: Final = {_positive: "config.must_be_positive", - _non_negative: "config.must_be_non_negative"} @dataclass(frozen=True) @@ -112,11 +111,11 @@ def __post_init__(self) -> None: value = getattr(self, field.name) if isinstance(value, float) and not math.isfinite(value): raise ValueError(t_("config.must_be_finite", name=field.name, value=value)) - for rule, names in _RANGE_RULES: + for rule, message, names in _RANGE_RULES: for name in names: value = getattr(self, name) if value is not None and not rule(value): - raise ValueError(t_(_RANGE_MESSAGES[rule], name=name, value=value)) + raise ValueError(t_(message, name=name, value=value)) if not 0.0 < self.depth_fraction <= 1.0: raise ValueError(t_("config.must_be_fraction", name="depth_fraction", value=self.depth_fraction)) @@ -304,19 +303,16 @@ def _grid_to_mesh(matrix: np.ndarray, transform: np.ndarray) -> trimesh.Trimesh: def apply_euler_rotation( mesh: trimesh.Trimesh, rot_x: float, rot_y: float, rot_z: float ) -> trimesh.Trimesh: - """Dreht eine Kopie des Meshes um die XYZ-Achsen (Winkel in Grad). + """Rotates a copy of the mesh about the X, Y and Z axes (angles in degrees). - Reihenfolge der Anwendung: erst X, dann Y, dann Z (Rz·Ry·Rx). Gibt das - Mesh bei Nullrotation unveraendert (als Kopie) zurueck. + Applied in that order - first X, then Y, then Z (Rz·Ry·Rx), each about + the fixed world axes ("sxyz"). Without rotation the copy is unchanged: + apply_transform skips an identity matrix. """ - if rot_x == 0.0 and rot_y == 0.0 and rot_z == 0.0: - return mesh.copy() m = mesh.copy() - Rx = trimesh.transformations.rotation_matrix(np.radians(rot_x), [1, 0, 0]) - Ry = trimesh.transformations.rotation_matrix(np.radians(rot_y), [0, 1, 0]) - Rz = trimesh.transformations.rotation_matrix(np.radians(rot_z), [0, 0, 1]) - R = trimesh.transformations.concatenate_matrices(Rz, Ry, Rx) - m.apply_transform(R) + m.apply_transform(trimesh.transformations.euler_matrix( + *np.radians([rot_x, rot_y, rot_z]), axes="sxyz" + )) return m @@ -633,11 +629,6 @@ def arrange_footprints( return positions -def _is_manifold(m: trimesh.Trimesh) -> bool: - """True for a watertight mesh with at least one face.""" - return m.is_watertight and len(m.faces) > 0 - - def _to_manifold(mesh: trimesh.Trimesh) -> Manifold: """Same conversion trimesh.boolean uses for engine='manifold'.""" return Manifold(Mesh( @@ -909,7 +900,7 @@ def solidify_logged(i: int) -> trimesh.Trimesh: solidify_logged, range(n), config, what=t_("pipeline.what.solidify") ) for label, solid in zip(labels, solids): - if not _is_manifold(solid): + if not (solid.is_watertight and len(solid.faces) > 0): raise ValueError(t_("error.not_manifold", label=label)) recesses: list[list[trimesh.Trimesh]] = [[] for _ in range(n)] From 4843a52e4ff3e6d4b8ca89921ee11a28819bbc41 Mon Sep 17 00:00:00 2001 From: Marco Wittwer Date: Sat, 3 Oct 2026 01:01:51 +0200 Subject: [PATCH 3/4] German thousands separator in pipeline logs; show the gap's help text - The pipeline formatted triangle counts with f"{n:,}" in every language, so the German CLI printed "1,448 Dreiecke" - a decimal number to a German reader. The ten counts now go through i18n.format_int, like the app's triangle metric already did. - The gap slider carried the help text, but Streamlit only shows a tooltip next to a visible label and that slider's label is collapsed - the text was never displayed. It now sits on the caption above slider and number field. Co-Authored-By: Claude Opus 5.5 --- app.py | 8 +++++--- inlayer.py | 21 +++++++++++---------- tests/test_app_render.py | 7 +++++++ tests/test_i18n.py | 7 +++++++ 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/app.py b/app.py index 7f29122..df50c64 100644 --- a/app.py +++ b/app.py @@ -534,10 +534,13 @@ def _sync_gap(source: str): st.session_state.setdefault(_key, float(st.session_state["figure_gap"])) # One caption for slider and number field (both label_visibility="collapsed"). - # No fixed colour: the text has to follow the theme's text colour. + # No fixed colour: the text has to follow the theme's text colour. The help + # sits on the caption: Streamlit drops a widget's tooltip together with a + # collapsed label, so on the slider it was never shown. st.sidebar.markdown( f'{t("app.gap.label")}', - unsafe_allow_html=True + unsafe_allow_html=True, + help=t("app.gap.help"), ) _g1, _g2 = st.sidebar.columns([3, 1]) with _g1: @@ -548,7 +551,6 @@ def _sync_gap(source: str): key="_sl_figure_gap", on_change=_sync_gap, args=("_sl_figure_gap",), label_visibility="collapsed", - help=t("app.gap.help") ) with _g2: st.number_input( diff --git a/inlayer.py b/inlayer.py index 0fd8481..3d148c8 100644 --- a/inlayer.py +++ b/inlayer.py @@ -431,7 +431,7 @@ def prepare_figure(path: str, config: Config = _DEFAULT_CFG) -> trimesh.Trimesh: m = load_mesh(path, name=path) if config.stl_unit_to_mm != 1.0: m.apply_scale(config.stl_unit_to_mm) - _log(t_("pipeline.loaded", faces=f"{len(m.faces):,}", extents=m.extents.round(2)), t) + _log(t_("pipeline.loaded", faces=i18n.format_int(len(m.faces)), extents=m.extents.round(2)), t) _check_grid_size(m.extents, config.voxel_pitch / 2, name=path) # Repair only when there is something to repair. pymeshfix is the most @@ -443,7 +443,7 @@ def prepare_figure(path: str, config: Config = _DEFAULT_CFG) -> trimesh.Trimesh: # hits the interior instead of running outwards. t = _log(t_("pipeline.repair")) if m.is_watertight and m.is_winding_consistent: - _log(t_("pipeline.repair_skipped", faces=f"{len(m.faces):,}"), t) + _log(t_("pipeline.repair_skipped", faces=i18n.format_int(len(m.faces))), t) else: mf = pymeshfix.MeshFix(m.vertices, m.faces) # pymeshfix's default removes every shell but the one with the most @@ -452,15 +452,15 @@ def prepare_figure(path: str, config: Config = _DEFAULT_CFG) -> trimesh.Trimesh: # part survived depended on an unrelated hole anywhere in the file. mf.repair(remove_smallest_components=False) m = trimesh.Trimesh(vertices=mf.points, faces=mf.faces) - _log(t_("pipeline.repaired", faces=f"{len(m.faces):,}"), t) + _log(t_("pipeline.repaired", faces=i18n.format_int(len(m.faces))), t) - t = _log(t_("pipeline.decimate", target=f"{config.decimate_faces:,}")) + t = _log(t_("pipeline.decimate", target=i18n.format_int(config.decimate_faces))) current_faces = len(m.faces) if current_faces > config.decimate_faces: m = decimate_mesh(m, config.decimate_faces) - _log(t_("pipeline.decimated", faces=f"{len(m.faces):,}"), t) + _log(t_("pipeline.decimated", faces=i18n.format_int(len(m.faces))), t) else: - _log(t_("pipeline.decimate_skipped", faces=f"{current_faces:,}"), t) + _log(t_("pipeline.decimate_skipped", faces=i18n.format_int(current_faces)), t) t = _log(t_("pipeline.voxelize_closing")) vox = _voxelize_surface(m, config.voxel_pitch) @@ -474,7 +474,7 @@ def prepare_figure(path: str, config: Config = _DEFAULT_CFG) -> trimesh.Trimesh: closed = binary_closing(padded, iterations=iters) m = _grid_to_mesh(closed, _padded_transform(vox.transform, iters)) - _log(t_("pipeline.result", faces=f"{len(m.faces):,}", extents=m.extents.round(2)), t) + _log(t_("pipeline.result", faces=i18n.format_int(len(m.faces)), extents=m.extents.round(2)), t) return m @@ -554,7 +554,8 @@ def dilate( # iters=0 leaves the transform unchanged, so one call serves both cases. result = _grid_to_mesh(dilated, _padded_transform(vox.transform, iters)) _log( - t_("pipeline.result", faces=f"{len(result.faces):,}", extents=result.extents.round(2)), t + t_("pipeline.result", faces=i18n.format_int(len(result.faces)), + extents=result.extents.round(2)), t ) return result @@ -893,7 +894,7 @@ def solidify_logged(i: int) -> trimesh.Trimesh: # The Z offset is applied afterwards; fill far enough that the cavity # still reaches past the top face once it has moved. solid = _solidify_figure(local[i], config, top_z=CUT_OVERSHOOT_MM - offsets[i][2]) - _log(t_("pipeline.solidified", faces=f"{len(solid.faces):,}"), t) + _log(t_("pipeline.solidified", faces=i18n.format_int(len(solid.faces))), t) return solid solids = _parallel_map( @@ -987,7 +988,7 @@ def solidify_logged(i: int) -> trimesh.Trimesh: raise RuntimeError(t_("error.csg_failed")) from exc if len(inlay.faces) == 0: raise ValueError(t_("error.csg_empty")) - _log(t_("pipeline.csg_result", faces=f"{len(inlay.faces):,}"), t) + _log(t_("pipeline.csg_result", faces=i18n.format_int(len(inlay.faces))), t) wall_check = _wall_check(box_m, cutters, inlay_m, config, apothem) diff --git a/tests/test_app_render.py b/tests/test_app_render.py index 8fafc2d..d925ccc 100644 --- a/tests/test_app_render.py +++ b/tests/test_app_render.py @@ -369,6 +369,13 @@ def test_the_number_field_sets_it_too(self): assert _widget(at, "slider", "_sl_figure_gap").value == 3.5 assert at.session_state["figure_gap"] == 3.5 + def test_help_sits_on_the_visible_caption(self): + """Streamlit drops a tooltip together with a collapsed label: on the + slider the help text was never shown.""" + at = _two_figures() + label = i18n.TRANSLATIONS["app.gap.label"]["en"] + caption = next(m for m in at.sidebar.markdown if label in m.value) + assert caption.proto.help == i18n.TRANSLATIONS["app.gap.help"]["en"] def test_widgets_start_with_the_pipeline_defaults(): diff --git a/tests/test_i18n.py b/tests/test_i18n.py index 8164fd9..6f03937 100644 --- a/tests/test_i18n.py +++ b/tests/test_i18n.py @@ -245,6 +245,13 @@ def test_thousands_separator_follows_language(self, lang, expected): i18n.set_language(lang) assert i18n.format_int(12345678) == expected + def test_pipeline_counts_use_the_language_separator(self, capsys, cube_stl_path): + """The triangle counts in the pipeline log used to keep the English + separator in every language.""" + i18n.set_language("de") + inlayer.prepare_figure(cube_stl_path, Config(voxel_pitch=1.0, decimate_faces=20000)) + out = capsys.readouterr().out + assert "20.000" in out and "20,000" not in out class TestThreadPropagation: From ce8a0d4f10d013c5a3e240ba18af6905c369155a Mon Sep 17 00:00:00 2001 From: Marco Wittwer Date: Sat, 3 Oct 2026 01:01:51 +0200 Subject: [PATCH 4/4] Packaging: drop a stale .dockerignore entry, fix a requirements comment - .dockerignore listed docker-compose.yml, a file the repo never had (it ships compose.yaml). The note on why the Dockerfile stays in the build context now closes the file instead of sitting above an unrelated entry. - requirements.txt still said build_inlay calls trimesh.boolean with engine='manifold'; it calls manifold3d directly. Co-Authored-By: Claude Opus 5.5 --- .dockerignore | 3 +-- requirements.txt | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.dockerignore b/.dockerignore index 4e2878d..3f4b12b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,9 +5,8 @@ __pycache__ *.pyc data *.md +.dockerignore # Dockerfile stays IN the context on purpose: tests/test_streamlit_config.py # reads it to check that the runtime stage copies .streamlit/, so the test # stage has to copy it in. No stage does `COPY . .`, so it only ever lands # where it is named explicitly - never in the runtime image. -docker-compose.yml -.dockerignore \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 035d5f7..6d2fb78 100644 --- a/requirements.txt +++ b/requirements.txt @@ -27,7 +27,8 @@ trimesh==4.12.2 # Voxel-Schritt fehl. Deshalb explizit hier. scikit-image==0.26.0 -# CSG-Engine: build_inlay ruft trimesh.boolean.* mit engine='manifold' auf. +# CSG engine: build_inlay calls manifold3d directly - for the boolean cut and +# for the wall check, which needs the Manifold objects. manifold3d==3.5.2 # Mesh-Reparatur bzw. Dezimierung in prepare_figure.