[UC-3697] Establish Quad-Agent architecture, WASM link hygiene, and binding safety - #15
[UC-3697] Establish Quad-Agent architecture, WASM link hygiene, and binding safety#15Jelle Spijker (jellespijker) wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a repository-level pre-commit configuration to enforce basic hygiene checks and introduce secret/path scanning prior to commits, supporting UC-3697 by reducing the chance of committing sensitive data or environment-specific paths.
Changes:
- Introduces
.pre-commit-config.yamlconfiguring standardpre-commit-hookschecks (YAML/JSON validation, whitespace fixes, large-file checks). - Adds Talisman hook configuration to scan commits for potential secrets, with explicit exclude patterns.
- Adds a local
pygrephook to block absolute local path references (e.g.,/home/...,/Users/...) with documented exclusions.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| README.md| | ||
| docs/.*| | ||
| \.github/.* | ||
| )$ |
🛡️ Adversarial Security Audit & Quad-Agent Review Summary
|
Establish full Quad-Agent development architecture and governance for libUvula across Claude Code, Antigravity, OpenCode, and Copilot. Includes: - Lifecycle hooks and pre-commit verification gates (Talisman credential scanning, path protection, file-size ratchet, complexity budget, upstream alignment, and multi-intent scope check). - Domain rules tailored to libUvula: C++20 core architecture (Rule 21), library consumer contracts (Rule 34), WebAssembly Embind boundaries and Three.js matrix conventions (Rule 35), Python pybind11 buffer safety (Rule 36), and package identity across Conan 2 and npm (Rule 37). - Updated package workflow (.github/workflows/package.yml) to trigger on UC-* branches for Digital Factory / Neoprep integration testing. - Verified orientation documents (AGENTS.md, DESIGN.md) and full platform parity synchronization.
…a GIL release Harden WebAssembly and Python bindings against runtime crashes, out-of-bounds array reads, and thread contention. - UvulaJS/CMakeLists.txt: Removed unused FORCE_FILESYSTEM=1 to reduce WASM binary size, removed ERROR_ON_UNDEFINED_SYMBOLS=0 to catch undefined symbols at link time, and formatted --emit-tsd flag. - UvulaJS/UvulaJS.cpp: Removed redundant UInt32Array val type declaration, added modulo length validation (% 3, % 2) in Geometry constructor, unwrap(), and project() to prevent out-of-bounds memory accesses on invalid flat typed arrays, and added try/catch exception wrappers returning structured error fallbacks to prevent uncaught C++ exceptions from aborting Web Workers. - pyUvula/pyUvula.cpp: Added numpy 2D buffer dimension and shape validation in pyProject(), and wrapped doProject() inside a scoped block releasing the Python GIL (py::gil_scoped_release) to prevent thread contention during viewport stroke projections in Cura.
2aab792 to
5d7c047
Compare
| if (stroke_polygon_buffer.ndim != 2 || mesh_vertices_buffer.ndim != 2 || mesh_indices_buffer.ndim != 2 || mesh_uv_buffer.ndim != 2 || mesh_faces_connectivity_buffer.ndim != 2) | ||
| { | ||
| throw std::runtime_error("Invalid array dimensions for projection inputs (expected 2D arrays)."); | ||
| } |
There was a problem hiding this comment.
The check causes an exception when called from Cura's paintTool code:
https://github.com/Ultimaker/Cura/blob/5068661cd448b954328483a499fe4ff419b695b5/plugins/PaintTool/PaintTool.py#L369
Exception: Error when adding paint stroke
Invalid array dimensions for projection inputs (expected 2D arrays).
Potentially due to:
https://github.com/Ultimaker/Cura/blob/5068661cd448b954328483a499fe4ff419b695b5/plugins/PaintTool/PaintTool.py#L265-L266
Something like the change below might work, but also requires updating the shape[0] entries for stroke_polygon and the other consts that follow it.
| if (stroke_polygon_buffer.ndim != 2 || mesh_vertices_buffer.ndim != 2 || mesh_indices_buffer.ndim != 2 || mesh_uv_buffer.ndim != 2 || mesh_faces_connectivity_buffer.ndim != 2) | |
| { | |
| throw std::runtime_error("Invalid array dimensions for projection inputs (expected 2D arrays)."); | |
| } | |
| if (stroke_polygon_buffer.size % 2 != 0 || mesh_vertices_buffer.size % 3 != 0 || mesh_indices_buffer.size % 3 != 0 || mesh_uv_buffer.size % 2 != 0 || mesh_faces_connectivity_buffer.size % 3 != 0) | |
| { | |
| throw std::runtime_error("Invalid array dimensions for projection inputs (expected 2D arrays)."); | |
| } |
Jira ticket: UC-3697
Why
libUvulais a core geometry library serving dual critical consumers:UvulaJS/@ultimaker/uvulajs) executed in browser Web Workers for live 3D viewport paint stroke projections and UV unwrapping.pyUvula) via Conan 2 packages.To support high-velocity, reliable multi-agent development and resolve build hygiene/memory safety vulnerabilities identified during adversarial red-teaming, this PR establishes the complete Quad-Agent developer environment and hardens the WebAssembly and Python binding interfaces.
What
UvulaJS) & Python (pyUvula) Hardening:-s FORCE_FILESYSTEM=1and removed-s ERROR_ON_UNDEFINED_SYMBOLS=0from Emscripten link options.try/catchexception boundary guards inUvulaJS.cpp.py::gil_scoped_release) during intensive viewport projections inpyUvula.cpp.UC-*push branches in.github/workflows/package.yml.AGENTS.mdand settled all 9 bootstrap proposals.How
1. WebAssembly Boundary & Memory Safety (
UvulaJS/)UvulaJS/CMakeLists.txt: Removed virtual filesystem code from in-memory geometry compilation and enforced strict symbol resolution at link time.UvulaJS/UvulaJS.cpp:% 3 == 0and% 2 == 0length guards inGeometryconstructor,unwrap(), andproject()to protect against buffer over-reads from malformed typed arrays.try ... catchblocks returning structured fallbacks to prevent uncaught C++ exceptions from terminating host Web Workers.2. Python Concurrency & Buffer Validation (
pyUvula/)pyUvula/pyUvula.cpp:buffer.ndim == 2for polygon and mesh inputs, and exact sizes (16 for projection matrix, 3 for camera normal).doProject()so heavy mesh projection computations do not block multi-threaded Cura operations.3. Agentic Lifecycle Hooks & Verification Gates (
.agents/hooks/)clang-format, Talisman credential scanning, path protection, file-size ratchet (400 lines), cyclomatic complexity budget (10/function), rule numbering integrity, and multi-intent scope check.stderrwith mappings forultimaker-neoprep-development,ultimaker-cura-development,cpp-pro, andcmake.Verification & Validation (V&V)
Pre-Commit Quality Gate (20/20 Passed):
Pre-PR Adversarial Quality Audit:
PR Checklist