Skip to content

sanity_check_attributes bodies are mostly empty across visuals #23

@jeromeetienne

Description

@jeromeetienne

Short tracking issue — most sanity_check_attributes / sanity_check_attributes_buffer static methods across the visuals/geometry/material/texture classes are either pass or limited to isinstance(x, Buffer) checks. As a result, malformed input (wrong dtype, wrong shape, mismatched counts) crashes deep in numpy at render time instead of failing clearly at construction or at the buffer boundary.

Audit (as of mesh_ng):

  • gsp/visuals/mesh.pysanity_check_attributes is pass; _buffer form only delegates.
  • gsp/visuals/markers.py — both pass.
  • gsp/visuals/paths.py — both pass.
  • gsp/geometry/mesh_geometry.py — both pass.
  • gsp/visuals/pixels.py, points.py, segments.py, texts.py_buffer only has shallow isinstance(_, Buffer) checks; no shape/dtype/count validation.
  • gsp/visuals/image.py, gsp/core/texture.py — partial type checks only.
  • gsp/materials/mesh_basic_material.py_buffer now enforces rgba8 on face/edge colors (Matplotlib mesh: 6 confirmed bugs + 2 to verify (vs. matplotlib_scenegraph) #20 Bug 5); the non-buffer form is still pass.

What good would look like (per class):

  • Buffer BufferType matches the expected encoding (e.g. positions → vec3, indices → uint32, colors → rgba8).
  • Buffer count consistency between related attributes (e.g. material color count ∈ {1, vertex_count, face_count}).
  • Optionally O(N) range checks (e.g. max(indices) < vertex_count) at the buffer boundary.

Related: this is the larger Bug 6 from #20, broadened beyond Mesh.

This is just a placeholder to come back to — no fix scoped yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions