Skip to content

Share mesh topology assertions across test suites - #149

Open
officialasishkumar wants to merge 1 commit into
vycdev:developfrom
officialasishkumar:test/issue-129-mesh-assertions
Open

officialasishkumar wants to merge 1 commit into
vycdev:developfrom
officialasishkumar:test/issue-129-mesh-assertions

Conversation

@officialasishkumar

Copy link
Copy Markdown

Several test files carried their own copies of the same slicer-safety checks (#129). This moves them into tests/helpers/meshAssertions.ts and imports them from each suite. Every existing assertion is kept, so coverage doesn't weaken.

Shared helpers

  • assertClosedIndexedSurface(mesh, { label, volume }) replaces assertClosedIndexedSurface in meshingOptions.test.ts and assertClosedVoxelSurface in voxelMesh.test.ts. Both checked that each edge has two faces with opposite winding, that each vertex has a single triangle fan, and that there are no degenerate or duplicate triangles. The label prefixes every message. With volume, the enclosed volume must match it, as the voxel cases required. Without it, the volume must be positive, as the meshing-options cases required.
  • assertHealthyMesh(label, mesh, { capWinding }) replaces the copies in meshing.test.ts and flatPaint.test.ts. Cap winding is checked only when asked. Every meshing.test.ts call asks for it and the Flat Paint calls don't, as before.
  • reportForMessage and inspectCapWinding move with them. reportForMessage was identical in meshing.test.ts and export3mf.test.ts. flatPaint.test.ts had a shorter copy, so Flat Paint failures now print the full integrity report.

Left as they are

As the issue suggests, I reviewed the related helpers and merged only the ones that really match:

  • assertStlLayerIsManifold and assertExportLayerHasOutwardNormals in export3mf.test.ts use a looser edge tolerance and assert each count separately. They now use the shared reportForMessage.
  • assertClosedPositiveMesh in paletteProofGeometry.test.ts reads three.js geometry and checks edge counts only.
  • assertClosedOutwardMatrixMeshes in stackMatrixCalibration.test.ts works on parsed 3MF coordinates and checks winding per cuboid.

No changelog entry, because this is a test-only refactor that doesn't change behavior or coverage.

Fixes #129

Validation:

  • npm test: 1112 passed, 1 skipped, 0 failed.
  • node --test on meshing, flatPaint, voxelMesh, meshingOptions, and export3mf: 192 passed.
  • A throwaway test (not committed) confirmed that the shared helpers still reject an open mesh, a wrong expected volume, and flipped winding, and that labels appear in the messages.
  • npx tsc -p tsconfig.test.json --noEmit, npx eslint tests --max-warnings=0, and Prettier on the new helper and meshing.test.ts: passed.

Four suites carried their own copies of the same slicer-safety checks:

- assertClosedIndexedSurface (meshingOptions.test.ts) and
  assertClosedVoxelSurface (voxelMesh.test.ts) were the same closed
  index-topology check (two oppositely wound faces per edge, one
  triangle fan per vertex, no degenerate or duplicate triangles). They
  differed only in message labels and the final volume assertion.
- assertHealthyMesh was duplicated in meshing.test.ts and
  flatPaint.test.ts; the meshing copy also checked cap winding.
- reportForMessage was identical in meshing.test.ts and
  export3mf.test.ts, and flatPaint.test.ts had a shorter copy.

Move them into tests/helpers/meshAssertions.ts and import them from
each suite. Every assertion is kept:

- assertClosedIndexedSurface(mesh, { label, volume }) prefixes its
  messages with the label and checks the exact enclosed volume when
  one is given (the voxel cases), or a positive volume otherwise.
- assertHealthyMesh(label, mesh, { capWinding }) checks cap winding
  only when asked, which every meshing.test.ts call does and the Flat
  Paint calls do not, as before. Flat Paint failures now print the full
  integrity report.

The other mesh checks in export3mf.test.ts, paletteProofGeometry.test.ts
and stackMatrixCalibration.test.ts stay where they are: they use a
different edge tolerance, read three.js geometry, or check per-cuboid
winding of parsed 3MF vertices, so they are not the same checks.

Fixes vycdev#129
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-13T10:23:26.067632Z
We couldn’t complete this review. Comment @codex review to try again.
1e51f67 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant