Repository navigation
feat(mesh-ops): read-only inspect_mesh and suggest_fixes ops (T-A2) - #376
Merged
Merged
Conversation
inspect_mesh diagnoses a mesh without modifying it: watertight, manifold, winding, holes, degenerate and self-intersecting faces, parts, bounds, area, volume, UVs/normals, and a printable verdict. suggest_fixes derives registry op calls (repair, decimate) from that report, and lists the problems no op can fix yet as notes. Topology is checked on a position-merged copy, so UV seams do not read as holes. Self-intersections go through pymeshlab; when they are not checked, printable is null rather than a claim. Normals are read from the file itself, since trimesh computes them on demand. MeshOpResult.file_path is now optional so analysis ops return only their report. Both ops are exposed to the agent and the MCP server. Closes #296
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #296
Summary
Adds two read-only operations to the
mesh_opsregistry so the agent can diagnose a mesh before acting on it — "Is this mesh printable?" now returns an accurate diagnostic without modifying anything.inspect_mesh— watertight, manifold, consistent winding, holes (count, open edges, largest hole), non-manifold edges, degenerate faces, self-intersecting faces, disconnected parts, bounds/dimensions, surface area, volume (only when closed), UVs/normals, and aprintableverdict with a list of issues.suggest_fixes— derives registry op calls from the report (repairwith flags matching the detected problems and amax_hole_sizesized to the largest hole,decimateabove 500k faces). Problems no op can fix yet (winding, self-intersections, stray parts) are returned asnotesinstead of invented fixes.Changes
api/services/mesh_ops/inspection.py— new module; both ops registered inbuiltin.pyunder theanalysiscategory (non-destructive).MeshOpResult.file_pathis now optional: analysis ops produce no file./optimize/op/{id}returns the bare report for them; the workflow processor rejects them explicitly.inspect_meshandsuggest_fixestools, and a prompt rule to inspect rather than guess.modly_inspect_meshandmodly_suggest_fixes.Design notes
repairdependency), in memory. They can be skipped withcheck_self_intersections: false;printableis thennullinstead of a claim.NORMALattribute, OBJvn, PLYnx), since trimesh always computes them on demand.Testing
npm run test:py— 240 tests pass (4 skipped). 15 new inspection tests on real exported meshes (closed/open box, UV seams, multi-node scene, overlapping parts, normals per format, input never modified), plus router and agent tests.Follow-ups
repairis needed but has no tool to run it (onlydecimate/smooth) — a generic "run registry op" tool belongs to a later Epic A ticket.