From 63813f7fa6674a1cdb9d5c797ea56ac72bb31bae Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:36:26 -0400 Subject: [PATCH 01/18] Apply suggested fix to tests/test_shaker.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- tests/test_shaker.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_shaker.py b/tests/test_shaker.py index fd3bd9e..612d2d3 100644 --- a/tests/test_shaker.py +++ b/tests/test_shaker.py @@ -67,6 +67,7 @@ def test_collects_call_in_nested_module_body(self, tmp_path): def test_collects_function_call_inside_module(self, tmp_path): names = collect_called_names(parse(tmp_path, "module foo(s) { cube(scale(s)); }")) + assert "cube" in names assert "scale" in names assert "cube" in names From 776771b1d4199a2912fa62cf172ffbd53c87df28 Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:36:26 -0400 Subject: [PATCH 02/18] Apply suggested fix to tests/test_shaker.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- tests/test_shaker.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_shaker.py b/tests/test_shaker.py index 612d2d3..346a657 100644 --- a/tests/test_shaker.py +++ b/tests/test_shaker.py @@ -1,13 +1,14 @@ """Unit tests for openscad_packer.shaker.""" from pathlib import Path from typing import Any +from typing import Any from openscad_parser.ast import getASTfromFile from openscad_parser.ast.nodes import FunctionDeclaration, ModuleDeclaration from openscad_packer.shaker import collect_called_names, compute_reachable - +def parse(tmp_path: Path, content: str) -> list[Any]: def parse(tmp_path: Path, content: str) -> list[Any]: f = tmp_path / "test.scad" f.write_text(content) From c27f053662c2105e25d746042c1bf83c92043a27 Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:41:43 -0400 Subject: [PATCH 03/18] Fix corrupted test_shaker.py from bad Copilot Autofix patches Remove duplicate `def parse` header that caused an IndentationError (breaking all 23 tests), duplicate `from typing import Any` import, and duplicate `assert "cube" in names` assertion. Co-Authored-By: Claude Sonnet 4.6 --- tests/test_shaker.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/test_shaker.py b/tests/test_shaker.py index 346a657..fd3bd9e 100644 --- a/tests/test_shaker.py +++ b/tests/test_shaker.py @@ -1,14 +1,13 @@ """Unit tests for openscad_packer.shaker.""" from pathlib import Path from typing import Any -from typing import Any from openscad_parser.ast import getASTfromFile from openscad_parser.ast.nodes import FunctionDeclaration, ModuleDeclaration from openscad_packer.shaker import collect_called_names, compute_reachable -def parse(tmp_path: Path, content: str) -> list[Any]: + def parse(tmp_path: Path, content: str) -> list[Any]: f = tmp_path / "test.scad" f.write_text(content) @@ -68,7 +67,6 @@ def test_collects_call_in_nested_module_body(self, tmp_path): def test_collects_function_call_inside_module(self, tmp_path): names = collect_called_names(parse(tmp_path, "module foo(s) { cube(scale(s)); }")) - assert "cube" in names assert "scale" in names assert "cube" in names From 878e7e1bee46cb6b8b8e9e42c50b374a77f33e66 Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:43:11 -0400 Subject: [PATCH 04/18] Potential fixes for 2 code quality findings (#13) * Apply suggested fix to tests/test_shaker.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> * Apply suggested fix to tests/test_shaker.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> * Fix corrupted test_shaker.py from bad Copilot Autofix patches Remove duplicate `def parse` header that caused an IndentationError (breaking all 23 tests), duplicate `from typing import Any` import, and duplicate `assert "cube" in names` assertion. Co-Authored-By: Claude Sonnet 4.6 --------- Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 From eac65d56cc7dc7c07d55e751be5168c6217184bd Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:46:14 -0400 Subject: [PATCH 05/18] Apply suggested fix to tests/test_shaker.py from Copilot Autofix (#14) Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- tests/test_shaker.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_shaker.py b/tests/test_shaker.py index fd3bd9e..c867809 100644 --- a/tests/test_shaker.py +++ b/tests/test_shaker.py @@ -15,7 +15,10 @@ def parse(tmp_path: Path, content: str) -> list[Any]: def make_pool(tmp_path: Path, content: str) -> dict[str, list]: - """Parse content and return a list-valued pool dict (mirrors _add_to_pool logic).""" + """Parse content and return a list-valued pool dict. + + This mirrors the private ``_add_to_pool`` behavior in ``openscad_packer.shaker``. + """ nodes = parse(tmp_path, content) pool: dict[str, list] = {} for node in nodes: From 7b776baffa0e6ae89310c38dae17d1acbbbcdded Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:47:38 -0400 Subject: [PATCH 06/18] Apply suggested fix to tests/test_shaker.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- tests/test_shaker.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_shaker.py b/tests/test_shaker.py index c867809..4153b54 100644 --- a/tests/test_shaker.py +++ b/tests/test_shaker.py @@ -98,8 +98,9 @@ def test_collects_chained_calls(self, tmp_path): def test_does_not_collect_non_identifier_primary_calls(self, tmp_path): # (function(x) x*2)(5) — PrimaryCall where left is a FunctionLiteral, not Identifier names = collect_called_names(parse(tmp_path, "y = (function(x) x*2)(5);")) - # No Identifier on the left side, so nothing collected from the call itself + # No Identifier on the left side, so nothing should be collected assert "function" not in names + assert names == set() class TestComputeReachable: From 5a4dcc11f424d04edfcff11736cde4e3a4d0f877 Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:47:38 -0400 Subject: [PATCH 07/18] Apply suggested fix to tests/test_shaker.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- tests/test_shaker.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_shaker.py b/tests/test_shaker.py index 4153b54..dbe9983 100644 --- a/tests/test_shaker.py +++ b/tests/test_shaker.py @@ -9,9 +9,9 @@ def parse(tmp_path: Path, content: str) -> list[Any]: - f = tmp_path / "test.scad" - f.write_text(content) - return getASTfromFile(str(f), process_includes=False) or [] + test_file = tmp_path / "test.scad" + test_file.write_text(content) + return getASTfromFile(str(test_file), process_includes=False) or [] def make_pool(tmp_path: Path, content: str) -> dict[str, list]: From 2b4d0173876dedaf17198b4c335a194fe05b8a61 Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:54:16 -0400 Subject: [PATCH 08/18] Fix docstring module reference and redundant assertion in test_shaker.py Correct _add_to_pool module reference from openscad_packer.shaker to openscad_packer.packer, remove the redundant assert that was fully subsumed by the equality check, and clarify why the result is empty. Co-Authored-By: Claude Sonnet 4.6 --- tests/test_shaker.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_shaker.py b/tests/test_shaker.py index dbe9983..75ed3f4 100644 --- a/tests/test_shaker.py +++ b/tests/test_shaker.py @@ -17,7 +17,7 @@ def parse(tmp_path: Path, content: str) -> list[Any]: def make_pool(tmp_path: Path, content: str) -> dict[str, list]: """Parse content and return a list-valued pool dict. - This mirrors the private ``_add_to_pool`` behavior in ``openscad_packer.shaker``. + This mirrors the private ``_add_to_pool`` behavior in ``openscad_packer.packer``. """ nodes = parse(tmp_path, content) pool: dict[str, list] = {} @@ -98,8 +98,9 @@ def test_collects_chained_calls(self, tmp_path): def test_does_not_collect_non_identifier_primary_calls(self, tmp_path): # (function(x) x*2)(5) — PrimaryCall where left is a FunctionLiteral, not Identifier names = collect_called_names(parse(tmp_path, "y = (function(x) x*2)(5);")) - # No Identifier on the left side, so nothing should be collected - assert "function" not in names + # The callee is a FunctionLiteral (not an Identifier), so the call site + # contributes nothing. The body x*2 has no inner calls either, so the + # full result must be empty. assert names == set() From 25a4ff8acf817f72724556522657486360a3eab6 Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:43:11 -0400 Subject: [PATCH 09/18] Potential fixes for 2 code quality findings (#13) * Apply suggested fix to tests/test_shaker.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> * Apply suggested fix to tests/test_shaker.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> * Fix corrupted test_shaker.py from bad Copilot Autofix patches Remove duplicate `def parse` header that caused an IndentationError (breaking all 23 tests), duplicate `from typing import Any` import, and duplicate `assert "cube" in names` assertion. Co-Authored-By: Claude Sonnet 4.6 --------- Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 From 1adc7369cd345d58e2fc8f96df44de570654d2b0 Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:59:07 -0400 Subject: [PATCH 10/18] Apply suggested fix to tests/test_shaker.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- tests/test_shaker.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/test_shaker.py b/tests/test_shaker.py index 75ed3f4..4d20e80 100644 --- a/tests/test_shaker.py +++ b/tests/test_shaker.py @@ -26,10 +26,17 @@ def make_pool(tmp_path: Path, content: str) -> dict[str, list]: name = node.name.name if name not in pool: pool[name] = [] + # Keep at most one declaration per (name, declaration type). + # If another declaration of the same type appears later, it replaces + # the earlier one (latest-wins), while a different type is kept too + # (for example, both a function and a module named "foo"). + replace_at: int | None = None for i, existing in enumerate(pool[name]): if isinstance(existing, type(node)): - pool[name][i] = node + replace_at = i break + if replace_at is not None: + pool[name][replace_at] = node else: pool[name].append(node) return pool From 6da76098d6814285cc18f0675db2738a9de150b0 Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:59:07 -0400 Subject: [PATCH 11/18] Apply suggested fix to tests/test_shaker.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- tests/test_shaker.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_shaker.py b/tests/test_shaker.py index 4d20e80..c728e47 100644 --- a/tests/test_shaker.py +++ b/tests/test_shaker.py @@ -14,13 +14,15 @@ def parse(tmp_path: Path, content: str) -> list[Any]: return getASTfromFile(str(test_file), process_includes=False) or [] -def make_pool(tmp_path: Path, content: str) -> dict[str, list]: +def make_pool( + tmp_path: Path, content: str +) -> dict[str, list[FunctionDeclaration | ModuleDeclaration]]: """Parse content and return a list-valued pool dict. This mirrors the private ``_add_to_pool`` behavior in ``openscad_packer.packer``. """ nodes = parse(tmp_path, content) - pool: dict[str, list] = {} + pool: dict[str, list[FunctionDeclaration | ModuleDeclaration]] = {} for node in nodes: if isinstance(node, (FunctionDeclaration, ModuleDeclaration)): name = node.name.name From abab61949732309516acc842dd0baa5c887c0c62 Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:36:26 -0400 Subject: [PATCH 12/18] Apply suggested fix to tests/test_shaker.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- tests/test_shaker.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_shaker.py b/tests/test_shaker.py index 75ed3f4..d51d06b 100644 --- a/tests/test_shaker.py +++ b/tests/test_shaker.py @@ -70,6 +70,7 @@ def test_collects_call_in_nested_module_body(self, tmp_path): def test_collects_function_call_inside_module(self, tmp_path): names = collect_called_names(parse(tmp_path, "module foo(s) { cube(scale(s)); }")) + assert "cube" in names assert "scale" in names assert "cube" in names From 3d27e4b7f631a742afcfd3062c1314e841e02bb4 Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:36:26 -0400 Subject: [PATCH 13/18] Apply suggested fix to tests/test_shaker.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- tests/test_shaker.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_shaker.py b/tests/test_shaker.py index d51d06b..fd718e3 100644 --- a/tests/test_shaker.py +++ b/tests/test_shaker.py @@ -1,13 +1,14 @@ """Unit tests for openscad_packer.shaker.""" from pathlib import Path from typing import Any +from typing import Any from openscad_parser.ast import getASTfromFile from openscad_parser.ast.nodes import FunctionDeclaration, ModuleDeclaration from openscad_packer.shaker import collect_called_names, compute_reachable - +def parse(tmp_path: Path, content: str) -> list[Any]: def parse(tmp_path: Path, content: str) -> list[Any]: test_file = tmp_path / "test.scad" test_file.write_text(content) From 48b20552b71f128923212c1feb768826548773c9 Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:41:43 -0400 Subject: [PATCH 14/18] Fix corrupted test_shaker.py from bad Copilot Autofix patches Remove duplicate `def parse` header that caused an IndentationError (breaking all 23 tests), duplicate `from typing import Any` import, and duplicate `assert "cube" in names` assertion. Co-Authored-By: Claude Sonnet 4.6 --- tests/test_shaker.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/test_shaker.py b/tests/test_shaker.py index fd718e3..75ed3f4 100644 --- a/tests/test_shaker.py +++ b/tests/test_shaker.py @@ -1,14 +1,13 @@ """Unit tests for openscad_packer.shaker.""" from pathlib import Path from typing import Any -from typing import Any from openscad_parser.ast import getASTfromFile from openscad_parser.ast.nodes import FunctionDeclaration, ModuleDeclaration from openscad_packer.shaker import collect_called_names, compute_reachable -def parse(tmp_path: Path, content: str) -> list[Any]: + def parse(tmp_path: Path, content: str) -> list[Any]: test_file = tmp_path / "test.scad" test_file.write_text(content) @@ -71,7 +70,6 @@ def test_collects_call_in_nested_module_body(self, tmp_path): def test_collects_function_call_inside_module(self, tmp_path): names = collect_called_names(parse(tmp_path, "module foo(s) { cube(scale(s)); }")) - assert "cube" in names assert "scale" in names assert "cube" in names From 3de68027056680aba6cd8dd7a63bc69fa3e85dab Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:43:11 -0400 Subject: [PATCH 15/18] Potential fixes for 2 code quality findings (#13) * Apply suggested fix to tests/test_shaker.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> * Apply suggested fix to tests/test_shaker.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> * Fix corrupted test_shaker.py from bad Copilot Autofix patches Remove duplicate `def parse` header that caused an IndentationError (breaking all 23 tests), duplicate `from typing import Any` import, and duplicate `assert "cube" in names` assertion. Co-Authored-By: Claude Sonnet 4.6 --------- Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 From c14f131ea6ed131f75035637d0ff3d237864070d Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:43:11 -0400 Subject: [PATCH 16/18] Potential fixes for 2 code quality findings (#13) * Apply suggested fix to tests/test_shaker.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> * Apply suggested fix to tests/test_shaker.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> * Fix corrupted test_shaker.py from bad Copilot Autofix patches Remove duplicate `def parse` header that caused an IndentationError (breaking all 23 tests), duplicate `from typing import Any` import, and duplicate `assert "cube" in names` assertion. Co-Authored-By: Claude Sonnet 4.6 --------- Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 From 3e9c64f952fc3949712f30eaab8fcd7f4e3f9b6b Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:59:07 -0400 Subject: [PATCH 17/18] Apply suggested fix to tests/test_shaker.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- tests/test_shaker.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/test_shaker.py b/tests/test_shaker.py index 75ed3f4..4d20e80 100644 --- a/tests/test_shaker.py +++ b/tests/test_shaker.py @@ -26,10 +26,17 @@ def make_pool(tmp_path: Path, content: str) -> dict[str, list]: name = node.name.name if name not in pool: pool[name] = [] + # Keep at most one declaration per (name, declaration type). + # If another declaration of the same type appears later, it replaces + # the earlier one (latest-wins), while a different type is kept too + # (for example, both a function and a module named "foo"). + replace_at: int | None = None for i, existing in enumerate(pool[name]): if isinstance(existing, type(node)): - pool[name][i] = node + replace_at = i break + if replace_at is not None: + pool[name][replace_at] = node else: pool[name].append(node) return pool From d1832a55e0921564bfe192cb3ffd57b360b990eb Mon Sep 17 00:00:00 2001 From: Torgny Bjers Date: Sat, 6 Jun 2026 20:59:07 -0400 Subject: [PATCH 18/18] Apply suggested fix to tests/test_shaker.py from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- tests/test_shaker.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_shaker.py b/tests/test_shaker.py index 4d20e80..c728e47 100644 --- a/tests/test_shaker.py +++ b/tests/test_shaker.py @@ -14,13 +14,15 @@ def parse(tmp_path: Path, content: str) -> list[Any]: return getASTfromFile(str(test_file), process_includes=False) or [] -def make_pool(tmp_path: Path, content: str) -> dict[str, list]: +def make_pool( + tmp_path: Path, content: str +) -> dict[str, list[FunctionDeclaration | ModuleDeclaration]]: """Parse content and return a list-valued pool dict. This mirrors the private ``_add_to_pool`` behavior in ``openscad_packer.packer``. """ nodes = parse(tmp_path, content) - pool: dict[str, list] = {} + pool: dict[str, list[FunctionDeclaration | ModuleDeclaration]] = {} for node in nodes: if isinstance(node, (FunctionDeclaration, ModuleDeclaration)): name = node.name.name