From 434bfb2d96a7656f1217c7ba860f952bc057e9af Mon Sep 17 00:00:00 2001 From: tomvanmele Date: Tue, 1 Dec 2026 19:26:27 +0100 Subject: [PATCH] Keep cross-package initiative records in COMPAS Hub --- README.md | 4 +- .../decisions/001-terminology.md | 77 -- .../decisions/002-mesh-representations.md | 67 - .../decisions/003-strategy-objects.md | 114 -- .../decisions/004-error-contracts.md | 127 -- .../decisions/005-output-topology.md | 91 -- .../decisions/006-tessellation-api.md | 89 -- .../decisions/007-triangulation-operations.md | 94 -- .../008-triangle-interoperability.md | 68 - .../decisions/009-trimmed-surfaces.md | 59 - .../decisions/010-metadata-provenance.md | 90 -- .../011-planar-triangulation-contract.md | 136 -- .../decisions/012-plugin-boundaries.md | 78 -- .../decisions/013-compatibility.md | 83 -- ...014-continuous-geometry-materialization.md | 83 -- .../decisions/015-continuous-bounds.md | 89 -- .../decisions/016-capability-discovery.md | 86 -- .../decisions/017-mixed-face-triangulation.md | 102 -- .../018-robust-polygon-triangulation.md | 132 -- .../019-twisted-polygon-triangulation.md | 114 -- .../decisions/020-planar-delaunay-naming.md | 75 -- .../021-default-tessellation-strategy.md | 81 -- ...ion-terminology-and-producer-boundaries.md | 268 ---- .../decisions/023-brep-deflection-defaults.md | 94 -- ...sentation-preserving-mesh-triangulation.md | 158 --- .../geometry-tessellation/decisions/README.md | 184 --- .../geometry-tessellation/definitions.md | 33 - .../geometry-tessellation/inventory.md | 323 ----- .../geometry-tessellation/objective.md | 249 ---- initiatives/geometry-tessellation/proposal.md | 762 ----------- initiatives/plugin-implementations/README.md | 29 - .../decisions/001-authoritative-discovery.md | 42 - .../decisions/002-registration-boundary.md | 43 - .../decisions/003-contract-and-direct-apis.md | 42 - .../decisions/004-optional-runtimes.md | 42 - .../005-verification-and-evidence.md | 44 - .../decisions/006-rollout-scope.md | 52 - .../decisions/README.md | 27 - .../plugin-implementations/inventory.md | 244 ---- .../plugin-implementations/objective.md | 89 -- .../plugin-implementations/proposal.md | 214 --- .../repository-modernisation/baseline.md | 386 ------ .../repository-modernisation/compas-gmsh.md | 242 ---- .../decisions/001-repository-profiles.md | 42 - .../002-pyproject-source-of-truth.md | 37 - .../decisions/003-uv-and-lockfiles.md | 39 - .../decisions/004-command-interface.md | 42 - .../decisions/005-ruff-standard.md | 35 - .../decisions/006-mkdocs-standard.md | 37 - .../decisions/007-shared-action-boundary.md | 38 - .../decisions/008-release-and-artifacts.md | 37 - .../decisions/009-python-platform-support.md | 38 - .../decisions/010-workflow-security.md | 35 - .../decisions/011-quality-gate-adoption.md | 53 - .../decisions/012-external-build-sources.md | 39 - ...framework-integration-and-release-order.md | 41 - .../decisions/014-gmsh-runtime-and-support.md | 83 -- .../decisions/015-gmsh-license-boundary.md | 58 - .../016-gmsh-verification-and-release.md | 83 -- .../017-shapeop-python-stable-abi-matrix.md | 73 -- ...eop-native-dependencies-and-portability.md | 91 -- ...apeop-distribution-and-quality-contract.md | 101 -- .../decisions/020-framework-host-extras.md | 169 --- ...21-cross-repository-candidate-artifacts.md | 186 --- .../decisions/README.md | 52 - .../repository-modernisation/inventory.md | 307 ----- .../repository-modernisation/objective.md | 209 --- .../repository-modernisation/proposal.md | 274 ---- .../shapeop-modernisation-proposal.md | 207 --- .../scene-viewer-visualisation/README.md | 11 - .../decisions/001-ownership-boundaries.md | 86 -- .../decisions/002-indexed-buffer-geometry.md | 75 -- .../003-viewer-state-and-selection.md | 76 -- .../decisions/004-transform-refresh-undo.md | 76 -- .../decisions/005-annotations-and-overlays.md | 92 -- .../006-viewer-integration-facade.md | 88 -- .../decisions/007-scope-and-verification.md | 89 -- .../008-scene-nodes-and-runtime-adapters.md | 180 --- .../decisions/009-scene-state-fields.md | 113 -- ...010-scene-description-and-item-bundling.md | 144 --- .../011-node-first-scene-adapters.md | 102 -- .../012-explicit-node-backed-adapter-state.md | 79 -- ...hierarchy-nodes-and-stable-sceneobjects.md | 125 -- .../014-context-keyed-scene-operations.md | 128 -- ...015-contextual-scene-form-contributions.md | 119 -- .../016-scene-form-field-bindings.md | 121 -- ...017-lazy-datastructure-attribute-tables.md | 106 -- .../018-datastructure-attribute-editing.md | 93 -- .../019-configured-viewer-identity.md | 74 -- .../020-viewer-config-lifecycle-and-audit.md | 116 -- .../021-durable-annotation-ownership.md | 94 -- .../decisions/022-distance-dimension-units.md | 105 -- .../decisions/023-annotation-clean-break.md | 78 -- ...24-measurement-outcomes-and-persistence.md | 80 -- .../025-scale-and-legend-overlays.md | 102 -- ...measurement-interaction-and-acquisition.md | 204 --- .../027-viewer-measurement-settings.md | 110 -- .../decisions/028-dimension-anchor-modes.md | 101 -- ...persistent-annotation-collection-and-ui.md | 152 --- .../030-always-visible-dimension-rendering.md | 73 -- .../decisions/031-spatial-object-deletion.md | 94 -- .../032-three-domain-viewer-sidebar.md | 167 --- .../decisions/033-scene-inspector-details.md | 120 -- .../decisions/034-hidden-vertex-snapping.md | 97 -- .../035-distance-dimension-spatial-layout.md | 244 ---- ...viewport-text-ownership-and-persistence.md | 102 -- .../037-annotation-label-backgrounds.md | 141 -- .../038-contextual-delete-selected.md | 88 -- .../decisions/039-scene-add-menu.md | 90 -- .../040-default-toolbar-view-shortcuts.md | 262 ---- .../041-grid-and-units-system-section.md | 127 -- ...042-selected-area-and-volume-inspection.md | 142 -- .../043-built-in-compas-viewer-theme.md | 211 --- ...044-editing-persistent-dimension-format.md | 158 --- .../045-default-viewport-content-contrast.md | 103 -- .../decisions/046-viewer-content-palette.md | 117 -- ...47-editable-parametric-shape-resolution.md | 138 -- .../decisions/048-referenced-data-domain.md | 118 -- .../decisions/049-viewer-settings-surface.md | 188 --- .../050-read-only-data-item-inspection.md | 157 --- .../051-scene-object-details-boundary.md | 156 --- ...ewer-documentation-and-example-coverage.md | 194 --- .../decisions/README.md | 228 ---- .../scene-viewer-visualisation/inventory.md | 441 ------- .../scene-viewer-visualisation/objective.md | 113 -- .../scene-viewer-visualisation/proposal.md | 1142 ----------------- initiatives/scene-viewer-visualisation/ui.md | 67 - initiatives/typing-alignment/README.md | 66 - .../decisions/001-supported-baseline.md | 42 - .../decisions/002-numeric-array-inputs.md | 61 - .../decisions/003-array-guarantees.md | 50 - .../decisions/004-tessellation-buffers.md | 51 - .../decisions/005-native-normalization.md | 55 - .../decisions/006-plugin-conformance.md | 52 - .../decisions/007-backend-substitutability.md | 49 - .../decisions/008-return-normalization.md | 59 - .../decisions/009-typed-distribution.md | 49 - .../decisions/010-verification-ratchet.md | 64 - .../decisions/011-brep-query-truthfulness.md | 81 -- ...012-structural-triangle-mesh-boundaries.md | 93 -- ...-algorithms-and-discretization-controls.md | 94 -- .../014-discrete-curvature-contracts.md | 87 -- ...t-triangulation-and-discretization-apis.md | 470 ------- .../016-core-structural-type-vocabulary.md | 496 ------- ...tive-binding-stubs-and-public-contracts.md | 192 --- .../typing-alignment/decisions/README.md | 79 -- initiatives/typing-alignment/inventory.md | 316 ----- initiatives/typing-alignment/objective.md | 121 -- initiatives/typing-alignment/proposal.md | 377 ------ pyproject.toml | 2 +- 150 files changed, 3 insertions(+), 19312 deletions(-) delete mode 100644 initiatives/geometry-tessellation/decisions/001-terminology.md delete mode 100644 initiatives/geometry-tessellation/decisions/002-mesh-representations.md delete mode 100644 initiatives/geometry-tessellation/decisions/003-strategy-objects.md delete mode 100644 initiatives/geometry-tessellation/decisions/004-error-contracts.md delete mode 100644 initiatives/geometry-tessellation/decisions/005-output-topology.md delete mode 100644 initiatives/geometry-tessellation/decisions/006-tessellation-api.md delete mode 100644 initiatives/geometry-tessellation/decisions/007-triangulation-operations.md delete mode 100644 initiatives/geometry-tessellation/decisions/008-triangle-interoperability.md delete mode 100644 initiatives/geometry-tessellation/decisions/009-trimmed-surfaces.md delete mode 100644 initiatives/geometry-tessellation/decisions/010-metadata-provenance.md delete mode 100644 initiatives/geometry-tessellation/decisions/011-planar-triangulation-contract.md delete mode 100644 initiatives/geometry-tessellation/decisions/012-plugin-boundaries.md delete mode 100644 initiatives/geometry-tessellation/decisions/013-compatibility.md delete mode 100644 initiatives/geometry-tessellation/decisions/014-continuous-geometry-materialization.md delete mode 100644 initiatives/geometry-tessellation/decisions/015-continuous-bounds.md delete mode 100644 initiatives/geometry-tessellation/decisions/016-capability-discovery.md delete mode 100644 initiatives/geometry-tessellation/decisions/017-mixed-face-triangulation.md delete mode 100644 initiatives/geometry-tessellation/decisions/018-robust-polygon-triangulation.md delete mode 100644 initiatives/geometry-tessellation/decisions/019-twisted-polygon-triangulation.md delete mode 100644 initiatives/geometry-tessellation/decisions/020-planar-delaunay-naming.md delete mode 100644 initiatives/geometry-tessellation/decisions/021-default-tessellation-strategy.md delete mode 100644 initiatives/geometry-tessellation/decisions/022-operation-terminology-and-producer-boundaries.md delete mode 100644 initiatives/geometry-tessellation/decisions/023-brep-deflection-defaults.md delete mode 100644 initiatives/geometry-tessellation/decisions/024-representation-preserving-mesh-triangulation.md delete mode 100644 initiatives/geometry-tessellation/decisions/README.md delete mode 100644 initiatives/geometry-tessellation/definitions.md delete mode 100644 initiatives/geometry-tessellation/inventory.md delete mode 100644 initiatives/geometry-tessellation/objective.md delete mode 100644 initiatives/geometry-tessellation/proposal.md delete mode 100644 initiatives/plugin-implementations/README.md delete mode 100644 initiatives/plugin-implementations/decisions/001-authoritative-discovery.md delete mode 100644 initiatives/plugin-implementations/decisions/002-registration-boundary.md delete mode 100644 initiatives/plugin-implementations/decisions/003-contract-and-direct-apis.md delete mode 100644 initiatives/plugin-implementations/decisions/004-optional-runtimes.md delete mode 100644 initiatives/plugin-implementations/decisions/005-verification-and-evidence.md delete mode 100644 initiatives/plugin-implementations/decisions/006-rollout-scope.md delete mode 100644 initiatives/plugin-implementations/decisions/README.md delete mode 100644 initiatives/plugin-implementations/inventory.md delete mode 100644 initiatives/plugin-implementations/objective.md delete mode 100644 initiatives/plugin-implementations/proposal.md delete mode 100644 initiatives/repository-modernisation/baseline.md delete mode 100644 initiatives/repository-modernisation/compas-gmsh.md delete mode 100644 initiatives/repository-modernisation/decisions/001-repository-profiles.md delete mode 100644 initiatives/repository-modernisation/decisions/002-pyproject-source-of-truth.md delete mode 100644 initiatives/repository-modernisation/decisions/003-uv-and-lockfiles.md delete mode 100644 initiatives/repository-modernisation/decisions/004-command-interface.md delete mode 100644 initiatives/repository-modernisation/decisions/005-ruff-standard.md delete mode 100644 initiatives/repository-modernisation/decisions/006-mkdocs-standard.md delete mode 100644 initiatives/repository-modernisation/decisions/007-shared-action-boundary.md delete mode 100644 initiatives/repository-modernisation/decisions/008-release-and-artifacts.md delete mode 100644 initiatives/repository-modernisation/decisions/009-python-platform-support.md delete mode 100644 initiatives/repository-modernisation/decisions/010-workflow-security.md delete mode 100644 initiatives/repository-modernisation/decisions/011-quality-gate-adoption.md delete mode 100644 initiatives/repository-modernisation/decisions/012-external-build-sources.md delete mode 100644 initiatives/repository-modernisation/decisions/013-framework-integration-and-release-order.md delete mode 100644 initiatives/repository-modernisation/decisions/014-gmsh-runtime-and-support.md delete mode 100644 initiatives/repository-modernisation/decisions/015-gmsh-license-boundary.md delete mode 100644 initiatives/repository-modernisation/decisions/016-gmsh-verification-and-release.md delete mode 100644 initiatives/repository-modernisation/decisions/017-shapeop-python-stable-abi-matrix.md delete mode 100644 initiatives/repository-modernisation/decisions/018-shapeop-native-dependencies-and-portability.md delete mode 100644 initiatives/repository-modernisation/decisions/019-shapeop-distribution-and-quality-contract.md delete mode 100644 initiatives/repository-modernisation/decisions/020-framework-host-extras.md delete mode 100644 initiatives/repository-modernisation/decisions/021-cross-repository-candidate-artifacts.md delete mode 100644 initiatives/repository-modernisation/decisions/README.md delete mode 100644 initiatives/repository-modernisation/inventory.md delete mode 100644 initiatives/repository-modernisation/objective.md delete mode 100644 initiatives/repository-modernisation/proposal.md delete mode 100644 initiatives/repository-modernisation/shapeop-modernisation-proposal.md delete mode 100644 initiatives/scene-viewer-visualisation/README.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/001-ownership-boundaries.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/002-indexed-buffer-geometry.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/003-viewer-state-and-selection.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/004-transform-refresh-undo.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/005-annotations-and-overlays.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/006-viewer-integration-facade.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/007-scope-and-verification.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/008-scene-nodes-and-runtime-adapters.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/009-scene-state-fields.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/010-scene-description-and-item-bundling.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/011-node-first-scene-adapters.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/012-explicit-node-backed-adapter-state.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/013-hierarchy-nodes-and-stable-sceneobjects.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/014-context-keyed-scene-operations.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/015-contextual-scene-form-contributions.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/016-scene-form-field-bindings.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/017-lazy-datastructure-attribute-tables.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/018-datastructure-attribute-editing.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/019-configured-viewer-identity.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/020-viewer-config-lifecycle-and-audit.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/021-durable-annotation-ownership.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/022-distance-dimension-units.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/023-annotation-clean-break.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/024-measurement-outcomes-and-persistence.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/025-scale-and-legend-overlays.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/026-measurement-interaction-and-acquisition.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/027-viewer-measurement-settings.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/028-dimension-anchor-modes.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/029-persistent-annotation-collection-and-ui.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/030-always-visible-dimension-rendering.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/031-spatial-object-deletion.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/032-three-domain-viewer-sidebar.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/033-scene-inspector-details.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/034-hidden-vertex-snapping.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/035-distance-dimension-spatial-layout.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/036-viewport-text-ownership-and-persistence.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/037-annotation-label-backgrounds.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/038-contextual-delete-selected.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/039-scene-add-menu.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/040-default-toolbar-view-shortcuts.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/041-grid-and-units-system-section.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/042-selected-area-and-volume-inspection.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/043-built-in-compas-viewer-theme.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/044-editing-persistent-dimension-format.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/045-default-viewport-content-contrast.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/046-viewer-content-palette.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/047-editable-parametric-shape-resolution.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/048-referenced-data-domain.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/049-viewer-settings-surface.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/050-read-only-data-item-inspection.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/051-scene-object-details-boundary.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/052-executable-viewer-documentation-and-example-coverage.md delete mode 100644 initiatives/scene-viewer-visualisation/decisions/README.md delete mode 100644 initiatives/scene-viewer-visualisation/inventory.md delete mode 100644 initiatives/scene-viewer-visualisation/objective.md delete mode 100644 initiatives/scene-viewer-visualisation/proposal.md delete mode 100644 initiatives/scene-viewer-visualisation/ui.md delete mode 100644 initiatives/typing-alignment/README.md delete mode 100644 initiatives/typing-alignment/decisions/001-supported-baseline.md delete mode 100644 initiatives/typing-alignment/decisions/002-numeric-array-inputs.md delete mode 100644 initiatives/typing-alignment/decisions/003-array-guarantees.md delete mode 100644 initiatives/typing-alignment/decisions/004-tessellation-buffers.md delete mode 100644 initiatives/typing-alignment/decisions/005-native-normalization.md delete mode 100644 initiatives/typing-alignment/decisions/006-plugin-conformance.md delete mode 100644 initiatives/typing-alignment/decisions/007-backend-substitutability.md delete mode 100644 initiatives/typing-alignment/decisions/008-return-normalization.md delete mode 100644 initiatives/typing-alignment/decisions/009-typed-distribution.md delete mode 100644 initiatives/typing-alignment/decisions/010-verification-ratchet.md delete mode 100644 initiatives/typing-alignment/decisions/011-brep-query-truthfulness.md delete mode 100644 initiatives/typing-alignment/decisions/012-structural-triangle-mesh-boundaries.md delete mode 100644 initiatives/typing-alignment/decisions/013-explicit-algorithms-and-discretization-controls.md delete mode 100644 initiatives/typing-alignment/decisions/014-discrete-curvature-contracts.md delete mode 100644 initiatives/typing-alignment/decisions/015-exact-triangulation-and-discretization-apis.md delete mode 100644 initiatives/typing-alignment/decisions/016-core-structural-type-vocabulary.md delete mode 100644 initiatives/typing-alignment/decisions/017-native-binding-stubs-and-public-contracts.md delete mode 100644 initiatives/typing-alignment/decisions/README.md delete mode 100644 initiatives/typing-alignment/inventory.md delete mode 100644 initiatives/typing-alignment/objective.md delete mode 100644 initiatives/typing-alignment/proposal.md diff --git a/README.md b/README.md index bd1e9c8..96d5549 100644 --- a/README.md +++ b/README.md @@ -41,8 +41,8 @@ candidate manifest. `--only-group dev --no-install-project` installs only repository tools; it does not install `compas_occ`, `compas_cgal`, `compas_libigl`, or the other framework runtime packages. -The COMPAS Hub tracks cross-package initiative plans and handoffs. In the -local COMPAS workspace, start at `Hub/initiatives/README.md`. +The COMPAS Hub tracks cross-package initiative plans, decision records, and +handoffs. In the local COMPAS workspace, start at `Hub/initiatives/README.md`. ## Documentation diff --git a/initiatives/geometry-tessellation/decisions/001-terminology.md b/initiatives/geometry-tessellation/decisions/001-terminology.md deleted file mode 100644 index f8c91ce..0000000 --- a/initiatives/geometry-tessellation/decisions/001-terminology.md +++ /dev/null @@ -1,77 +0,0 @@ -# Title: What terminology should govern geometry discretization APIs? - -## Status - -Accepted - -## Context - -The objective requires consistent distinctions among sampling, discretization, -polygonization, tessellation, triangulation, refinement, remeshing, and -simplification. Current APIs mix related terms: -`Surface.compute_tessellation()` produces triangles, -`Mesh.to_vertices_and_faces(triangulated=True)` converts polygonal faces, and -`Mesh.quads_to_triangles()` mutates topology. These operations have different -inputs, guarantees, and mutation behavior. - -Relevant existing code includes -`../compas/src/compas/geometry/surfaces/surface.py`, -`../compas/src/compas/datastructures/mesh/mesh.py`, and -`../compas/src/compas/geometry/trimesh/remeshing.py`. - -## Options - -1. Preserve current terminology independently in each subsystem. This avoids - migration but perpetuates ambiguity across packages. -2. Use “tessellation” as an umbrella for every triangle-producing operation. - This is simple but erases the distinction between approximating continuous - geometry and partitioning existing polygonal domains. -3. Adopt the proposal's normative vocabulary. Sampling evaluates points; - discretization is the broad umbrella for finite representations; - polygonization discretizes a surface as connected polygonal faces; - tessellation produces the canonical ephemeral triangular result; - triangulation partitions existing discrete domains/faces; refinement, - remeshing, and simplification describe changes to existing discretizations. - -## Recommendation - -Adopt option 3. Reserve resolution for counts, deflection for kernel-specific -approximation controls, quality for mesh targets, and tolerance for numerical -comparison and cleanup. Documentation must distinguish requested targets, -estimated errors, and guaranteed bounds. - -The accepted operation terms are: - -- **Discretization** is the broad category for representing continuous - geometry with finite samples or connected elements. -- **Polygonization** is a surface discretization producing a persistent - `PolygonalSurface` with connected polygonal faces. -- **Tessellation** is the canonical surface operation producing an ephemeral - triangular `Tessellation`. -- **Triangulation** partitions existing discrete faces, domains, or point sets - into triangles. - -The operation-oriented `polygonize`/`tessellate` pair avoids mixing -`to_polygonal_surface` conversion naming with `to_tessellation` operation-result -naming. `to_mesh()` remains an explicit conversion of an existing discrete -representation into half-edge `Mesh`. - -## Consequences - -- New public names and docs gain a consistent semantic basis. -- Existing names that contradict the vocabulary are replaced rather than kept - as permanent aliases. This is intentionally breaking. -- Tests must assert operation semantics, including mutation and vertex - insertion, rather than only output face counts. -- All package documentation must use the same glossary. -- API docs must present `polygonize` and `tessellate` as operations and - `to_mesh` as a representation conversion. - -## Affected packages - -`compas`, `compas_occ`, `compas_cgal`, `compas_libigl`, `compas_gmsh`, -`compas_model`, and `compas_framework`. - -## Dependencies - -None. diff --git a/initiatives/geometry-tessellation/decisions/002-mesh-representations.md b/initiatives/geometry-tessellation/decisions/002-mesh-representations.md deleted file mode 100644 index 5559dda..0000000 --- a/initiatives/geometry-tessellation/decisions/002-mesh-representations.md +++ /dev/null @@ -1,67 +0,0 @@ -# Title: What lightweight triangle representation should COMPAS standardize on? - -## Status - -Accepted - -## Context - -Core already assigns different roles to three representations: - -- `Tessellation` is an ephemeral, zero-copy-oriented indexed-triangle result - (`../compas/src/compas/geometry/tessellation.py`). -- `PolygonalSurface` is a serializable lightweight polygon buffer - (`../compas/src/compas/geometry/polygonal_surface.py`). -- `Mesh` is a serializable mutable half-edge datastructure - (`../compas/src/compas/datastructures/mesh/mesh.py`). - -`Mesh.is_trimesh()` and `Mesh.is_quadmesh()` classify existing topology. No -dedicated `TriangleSurface`, `TriangleMesh`, `QuadMesh`, or -`TessellationResult` type currently exists. The distinct `Tessellation` name -communicates that the object is an ephemeral operation result. It avoids -implying the persistent surface semantics of `PolygonalSurface` or the editable -half-edge topology and serialization contract of `Mesh`. - -## Options - -1. Add persistent `TriangleMesh` and `QuadMesh` siblings/subclasses of `Mesh`. - Face arity becomes explicit, but topology, attributes, serialization, keys, - and algorithms are duplicated or tightly coupled. -2. Add `TriangleSurface` or a compact `TriangleMesh` beside `Tessellation`. - This may sound specific but creates two nearly identical triangle-buffer - containers and risks confusion with `PolygonalSurface` or `Mesh`. -3. Replace/rename `Tessellation` as `TriangleMesh`. This aligns the name with - plugin terminology but wrongly suggests a persistent or topological mesh - and loses the useful operation-result distinction. -4. Preserve `Tessellation` as the sole ephemeral indexed-triangle result while - retaining `PolygonalSurface` and `Mesh` in their distinct persistent roles. - -## Recommendation - -Choose option 4. Retain `Tessellation` as the canonical ephemeral triangle -representation and operation result. Its distinct name is intentional: it -does not imply serialization, persistent surface identity, editable half-edge -topology, or mesh keys/attributes. Preserve its zero-copy vertex/triangle and -same-index attribute semantics. Keep `PolygonalSurface` for persistent polygon -buffers and `Mesh` for rich topology. Do not add `TriangleSurface`, -`TriangleMesh`, `QuadMesh`, or universal `TessellationResult` containers. - -## Consequences - -- `Tessellation` remains the public zero-copy-oriented ephemeral result. -- Ephemeral triangle buffers, persistent polygon storage, and rich topology - remain visibly distinct in both naming and behavior. -- Triangle/quad requirements are enforced at conversion or operation - boundaries rather than by nominal class identity. -- Plugins use `Tessellation` directly rather than depending on a hierarchy. -- Documentation must clearly explain which representation to use. -- Tests must cover representation equivalence and conversion independence. - -## Affected packages - -`compas`, `compas_occ`, `compas_cgal`, `compas_libigl`, `compas_model`, and -`compas_framework`. - -## Dependencies - -- [001 — Terminology](001-terminology.md) diff --git a/initiatives/geometry-tessellation/decisions/003-strategy-objects.md b/initiatives/geometry-tessellation/decisions/003-strategy-objects.md deleted file mode 100644 index 4f95c86..0000000 --- a/initiatives/geometry-tessellation/decisions/003-strategy-objects.md +++ /dev/null @@ -1,114 +0,0 @@ -# Title: How should tessellation policies be represented and serialized? - -## Status - -Accepted - -## Context - -Current controls are unrelated scalar parameters: U/V counts on surfaces and -shapes, OCC linear/angular deflection, CGAL edge-length and partial quality -controls, and Gmsh sizing options. No common strategy object exists. The -objective asks for lightweight serializable configuration compatible with -COMPAS `Data`, while backend algorithms must remain owned by their producers. - -Existing count APIs are in -`../compas/src/compas/geometry/surfaces/surface.py` and -`../compas/src/compas/geometry/shapes/shape.py`; OCC deflection is in -`../compas_occ/src/compas_occ/brep/brep.py`. - -## Options - -1. Keep scalar keywords on every producer. This minimizes new types but keeps - inconsistent names, weak cache keys, and broad signatures. -2. Introduce executable strategy objects with `apply(geometry)`. This enables - injection but creates double dispatch and unclear algorithm ownership. -3. Introduce immutable, serializable policy configurations implemented by each - producer through one common `TessellationStrategy` base. -4. Create one broad strategy containing every possible control. This appears - uniform but encourages ignored fields and false equivalence. - -## Recommendation - -Choose option 3. Every strategy inherits the common -`TessellationStrategy(compas.data.Data)` base, remains algorithm-free, -validates its values, and is serializable through the normal COMPAS data -contract. The accepted public configurations are: - -```python -class TessellationStrategy(Data): - pass - - -class Native(TessellationStrategy): - pass - - -class UGrid(TessellationStrategy): - u: int - - -class UVGrid(TessellationStrategy): - u: int - v: int - - -class Deflection(TessellationStrategy): - linear: float - angular: float - - -class Adaptive(TessellationStrategy): - max_deviation: float | None = None - max_angle: float | None = None - max_edge_length: float | None = None -``` - -- `Native` has no fields and requests fixed natural topology. -- `UGrid.u` is a positive integer and controls one-parameter shapes. -- `UVGrid.u` and `UVGrid.v` are positive integers. Domain restrictions are not - part of `UVGrid`; it controls two-parameter surfaces and shapes. -- `Deflection.linear` is expressed in model units. `Deflection.angular` is - public degrees. Both are positive and finite; `angular` is at most 180 - degrees. Backends convert degrees to radians where required. -- `Adaptive` requires at least one non-`None` field. Every provided value is - positive and finite. `max_angle` is public degrees. There is no public - maximum-depth or recursion-control field. -- A producer raises an error for any requested strategy parameter it does not - support; unsupported fields are never ignored. - -Initial type/strategy support is explicit: - -- `Box` supports `Native`. -- `Cylinder` and `Cone` support `UGrid`. -- `Capsule`, `Sphere`, `Torus`, and general parametric surfaces support - `UVGrid`. - -Invalid type/strategy combinations raise an error. A producer never ignores an -extra sampling dimension to make an invalid strategy appear to work. - -The strategy is a required tessellation argument. Producers do not hide -approximation policy behind stored or backend-specific defaults. - -## Consequences - -- Strategies can be serialized, compared, cached, and documented consistently. -- Each backend must publish supported strategy types and fields through the - capability contract in ADR 004. -- Public tessellation APIs accept the strategy object only; legacy scalar - controls are removed instead of normalized through parallel call forms. -- Backend implementation code may unpack strategy values internally, but those - scalars are not a second public API. -- Unit tests must cover serialization, validation, equality, cache identity, - public degree units, backend radian conversion, absence of domain/depth - controls, fixed/one-/two-parameter support, and errors for unsupported - dimensions or strategy combinations. - -## Affected packages - -`compas`, `compas_occ`, `compas_cgal`, optionally `compas_gmsh`, and -`compas_framework`. - -## Dependencies - -- [001 — Terminology](001-terminology.md) diff --git a/initiatives/geometry-tessellation/decisions/004-error-contracts.md b/initiatives/geometry-tessellation/decisions/004-error-contracts.md deleted file mode 100644 index 73c551d..0000000 --- a/initiatives/geometry-tessellation/decisions/004-error-contracts.md +++ /dev/null @@ -1,127 +0,0 @@ -# Title: How should adaptive requests and approximation guarantees be expressed? - -## Status - -Accepted — superseded by ADR 016 - -ADR 016 removes the runtime capability-discovery method and the unused -capability/error schemas selected here. This record remains as historical -rationale and is no longer implementation authority for those APIs. - -## Context - -Uniform core sampling has no error bound. OCC accepts kernel deflection values -but the wrapper performs no independent measurement. CGAL refinement exposes -maximum edge length while its native minimum-angle input is not currently -wired into criteria. No common API distinguishes a target, post hoc estimate, -or mathematically guaranteed bound. - -The objective requires error-controlled strategies without overstating -guarantees. The proposal introduces `Adaptive` as request vocabulary but does -not assume a core adaptive algorithm already exists. - -## Options - -1. Treat every requested deviation/angle as a guaranteed bound. This is simple - but inaccurate for current implementations. -2. Expose controls without describing their strength. This preserves backend - freedom but gives callers no reliable contract. -3. Classify supported controls as target, estimated, or guaranteed, and reject - unsupported fields. Introduce the `Adaptive` contract before or separately - from any implementation. -4. Block all strategy work until one universal adaptive algorithm exists. This - delays compatible count/deflection improvements unnecessarily. - -## Recommendation - -Choose option 3. Approve the interoperable `Adaptive` configuration contract, -but make the first adaptive implementation a separately reviewed slice. -Producers must state capability and guarantee level; unsupported requests must -fail rather than degrade silently. - -Define the following error-contract values: - -```python -class ErrorContract(Enum): - NONE = "none" - TARGET = "target" - ESTIMATED = "estimated" - GUARANTEED = "guaranteed" -``` - -Define two serializable `compas.data.Data` metadata types: - -```python -class TessellationCapability(Data): - strategy: str - supported_parameters: tuple[str, ...] - error_contract: ErrorContract - - -class ApproximationError(Data): - linear: float | None = None - angular: float | None = None - contract: ErrorContract = ErrorContract.ESTIMATED - method: str | None = None -``` - -`TessellationCapability.strategy` is the COMPAS dtype string of the supported -strategy. `supported_parameters` names exactly the public strategy fields the -producer implements. `ApproximationError.linear` is in model units; -`ApproximationError.angular` is in public degrees. When present, `method` -identifies how the value was assessed. - -`ApproximationError` reports achieved or assessed error and is distinct from -the requested strategy. `TARGET` normally belongs on -`TessellationCapability`, because a target is not an achieved-error -measurement. `GUARANTEED` is used only when the backend actually guarantees -the stated bound. `NONE` states that no error contract is offered, while -`ESTIMATED` identifies a non-guaranteed assessment. - -Every surface-like geometry instance exposes exactly one discovery method: - -```python -geometry.tessellation_capabilities() -> tuple[TessellationCapability, ...] -``` - -Discovery is instance-level because the concrete geometry type and active -backend may change which `TessellationStrategy` subclasses and parameters are -supported. `TessellationCapability.strategy` stores the COMPAS dtype string of -that strategy. There is no parallel `supports_tessellation(...)` or other -convenience predicate; callers inspect the returned capability tuple. - -If a future `TessellationReport` combines these metadata types with a -`Tessellation`, the report remains ephemeral because `Tessellation` is -ephemeral. ADR 010 defers such enriched-result APIs from the initial -implementation. - -## Consequences - -- APIs and docs cannot use “tolerance” or “guarantee” loosely. -- Error metadata has stable serializable fields, public model-unit/degree - conventions, an assessment method, and an explicit contract class. -- Capability discovery is serializable and names strategy support without - implying that requested values were achieved. -- Capability discovery is instance-specific and has one canonical method, - avoiding duplicated convenience APIs with potentially inconsistent answers. -- Tests need backend-appropriate monotonicity and measurement assertions rather - than identical connectivity. -- A later adaptive implementation needs dedicated singularity, trim, and error - fixtures and does not block base interoperability work. -- Tests must prevent `TARGET` from being presented as achieved error and must - reserve `GUARANTEED` for backends with a documented guarantee. -- No required `TessellationReport` API or persistent report serialization is - authorized by this ADR. -- Tests must cover backend/type-dependent capability tuples, COMPAS dtype - strings, exact supported-parameter names, and the absence of a second - convenience discovery method. - -## Affected packages - -`compas`, `compas_occ`, `compas_cgal`, optionally `compas_gmsh`, and -`compas_framework`. - -## Dependencies - -- [001 — Terminology](001-terminology.md) -- [003 — Strategy objects](003-strategy-objects.md) diff --git a/initiatives/geometry-tessellation/decisions/005-output-topology.md b/initiatives/geometry-tessellation/decisions/005-output-topology.md deleted file mode 100644 index 339c56b..0000000 --- a/initiatives/geometry-tessellation/decisions/005-output-topology.md +++ /dev/null @@ -1,91 +0,0 @@ -# Title: Should output topology be part of the tessellation strategy or a separate choice? - -## Status - -Accepted - -## Context - -`Surface.compute_faces()` produces a quad grid while -`Surface.compute_tessellation()` splits that grid into triangles. Shapes may -produce mixed triangle/quad topology, and trimmed BReps naturally produce -triangles. The objective asks to separate tessellation from triangulation and -consider output topology independently from approximation policy. - -Returning triangles, quads, or polygons from one method based on a flag or -strategy would make return semantics and downstream validation unstable. - -## Options - -1. Put topology inside each strategy and allow `compute_tessellation()` to - return unrelated representation types. This is flexible but complicates - typing, caching, and consumers. -2. Make every tessellator return triangles and remove polygon-preserving - conversions. This simplifies plugins but discards useful source topology. -3. Keep triangle tessellation as the stable computational interchange and add - a separate topology-preserving `polygonize(strategy)` operation returning - `PolygonalSurface`, followed by triangulation when needed. -4. Add separate triangle and quad strategy hierarchies. This makes topology - explicit but duplicates sampling policy. - -## Recommendation - -Choose option 3. Sampling policy and output topology are conceptually separate, -and both public operations have stable return types: - -```python -geometry.polygonize(strategy) -> PolygonalSurface -geometry.tessellate(strategy) -> Tessellation -``` - -`polygonize(strategy)` is a fresh, non-mutating, topology-preserving operation -for continuous surface-like geometry. It returns an independent, persistent, -serializable `PolygonalSurface`; it never returns `Mesh`. There is no cached -property, scalar-control alternative, or topology flag. A caller that needs -half-edge topology explicitly calls `.to_mesh()` on the polygonal result. - -The operation applies to analytical `Shape`, parametric `Surface`, untrimmed -`NurbsSurface`, and `BrepFace`/`Brep` when the backend can provide a polygonal -result. Curves are excluded because their discrete connected result is a -`Polyline`, not a `PolygonalSurface`. - -`polygonize` reuses the same `TessellationStrategy` objects as `tessellate`. -It preserves the natural face cells produced by the geometry/backend: - -- `Native` preserves fixed natural topology, for example on `Box`. -- `UGrid` controls one-parameter analytical shapes such as `Cylinder` and - `Cone`. -- `UVGrid` on regular parametric surfaces guarantees quadrilateral cells. -- `Capsule`, `Sphere`, `Torus`, and general parametric surfaces use both - `UVGrid` dimensions. -- Analytical shapes may naturally produce mixed triangle/quad topology. -- `Deflection` and `Adaptive` do not guarantee quadrilateral output. -- Unsupported geometry/strategy/backend combinations raise an error and are - never silently approximated with a different policy. Dimensions are never - ignored to make an invalid combination appear supported. - -## Consequences - -- Triangle-oriented plugins receive a predictable representation. -- Quad, mixed, and source-natural topology remain available through a - predictable persistent representation without union return types. -- A workflow may intentionally have two steps: create a topology-preserving - polygonal discretization, then triangulate it. -- Documentation must distinguish a topology-preserving conversion from a - triangle conversion. -- Tests must verify result independence, serialization, non-mutation, explicit - `.to_mesh()` conversion, curve exclusion, strategy support errors, and the - topology guarantees of each strategy/producer family. -- Regression tests must ensure original boundaries are not confused with - generated diagonals. - -## Affected packages - -`compas`, `compas_occ`, `compas_cgal`, `compas_libigl`, `compas_model`, and -`compas_framework`. - -## Dependencies - -- [001 — Terminology](001-terminology.md) -- [002 — Mesh representations](002-mesh-representations.md) -- [003 — Strategy objects](003-strategy-objects.md) diff --git a/initiatives/geometry-tessellation/decisions/006-tessellation-api.md b/initiatives/geometry-tessellation/decisions/006-tessellation-api.md deleted file mode 100644 index d47e2dc..0000000 --- a/initiatives/geometry-tessellation/decisions/006-tessellation-api.md +++ /dev/null @@ -1,89 +0,0 @@ -# Title: What polygonization and tessellation operations should continuous geometry expose? - -## Status - -Accepted - -## Context - -Current naming includes cached `.tessellation`, fresh -`compute_tessellation()`, OCC `to_tessellation()`, legacy misspelled -`to_tesselation()`, `to_viewmesh()`, and several mesh conversions. Surface and -shape override names also differ (`nu`/`nv` versus `u`/`v`). The objective asks -to distinguish operations from representation conversions. - -The existing `Tessellation` return type and its zero-copy semantics are tested -in `../compas/tests/compas/geometry/test_tessellation.py`. - -## Options - -1. Use direct `tessellate(strategy) -> Tessellation` for canonical triangles - and the separate `polygonize(strategy) -> PolygonalSurface` operation from - ADR 005 for topology-preserving polygonal output. Require callers to use the - semantically correct operation rather than a topology flag or universal - conversion alias. -2. Standardize only on `to_triangle_mesh()`. This unifies conversion but hides - the fact that continuous geometry is approximated by an operation. -3. Keep cached `.tessellation`, fresh `compute_tessellation()`, and - `to_triangle_mesh()` together. This preserves existing distinctions but - exposes three overlapping ways to obtain the same triangle result. -4. Keep all existing names, including OCC aliases and the misspelling. This - avoids breakage but leaves no coherent contract. - -## Recommendation - -Choose option 1. Continuous geometry exposes exactly -`tessellate(strategy) -> Tessellation`. It performs a fresh operation; there is -no public cached `.tessellation` property and no parallel -`compute_tessellation()`, `to_tessellation()`, `to_tesselation()`, or -`to_viewmesh()` or `to_triangle_mesh()` spelling. Discrete polygonal geometry -uses `triangulated(strategy)` from ADR 007. Topology-preserving polygonal -output uses the accepted `polygonize(strategy) -> PolygonalSurface` operation -from ADR 005, with no topology flag or scalar/cached alternative. - -The operation-oriented `polygonize`/`tessellate` pair avoids the mixed -`to_polygonal_surface`/`to_tessellation` conversion naming. `to_mesh()` remains -an explicit conversion of an existing discrete representation. - -`tessellate` is the direct canonical triangle operation and need not be -implemented as `polygonize(...).triangulated(...)`. For the same tessellation -strategy, direct and two-step paths must be geometrically consistent, but -connectivity may differ. Backends must document their seam and boundary -behavior for each path. - -Callers who care about the face-triangulation policy use the explicit two-step -workflow: - -```python -geometry.polygonize(strategy).triangulated(triangulation_strategy) -``` - -## Consequences - -- Continuous producers share two non-overlapping operations with stable result - types: persistent polygonal discretization and ephemeral triangle - tessellation. -- Removing public cached tessellations eliminates cache identity and invalidation - from the API contract; implementations may cache privately if results remain - observationally correct. -- The required strategy makes approximation policy explicit; tessellation must - not mutate the source geometry. -- Direct and two-step results may differ in connectivity without violating the - contract, so tests compare geometric consistency and documented boundary/ - seam behavior rather than exact triangle indices. -- Existing surface, shape, and OCC method/property names break and are removed, - including the BRep misspelling and aliases. -- Tests and examples must cover both `tessellate(strategy)` and the explicit - polygonize-then-triangulate workflow and must no longer assert public - cached-result identity. - -## Affected packages - -`compas`, `compas_occ`, `compas_cgal`, `compas_libigl`, and -`compas_framework`. - -## Dependencies - -- [002 — Mesh representations](002-mesh-representations.md) -- [003 — Strategy objects](003-strategy-objects.md) -- [005 — Output topology](005-output-topology.md) diff --git a/initiatives/geometry-tessellation/decisions/007-triangulation-operations.md b/initiatives/geometry-tessellation/decisions/007-triangulation-operations.md deleted file mode 100644 index 43efd2e..0000000 --- a/initiatives/geometry-tessellation/decisions/007-triangulation-operations.md +++ /dev/null @@ -1,94 +0,0 @@ -# Title: What should the mutating and non-mutating triangulation APIs be? - -## Status - -Accepted - -## Context - -Current discrete triangulation policies differ. Non-mutating -`Mesh.to_vertices_and_faces(triangulated=True)` uses `(a, c)` for quads and a -centroid fan for n-gons. Mutating `Mesh.quads_to_triangles()` uses `(b, d)`. -`PolygonalSurface.triangles` uses Earcut for non-triangular faces. These -algorithms differ in mutation, diagonal, vertex insertion, and source-index -preservation. - -## Options - -1. Keep only conversion flags and the existing mutating special case. This - preserves compatibility but does not provide a coherent operation model. -2. Make `triangulate()` non-mutating, following some geometry libraries. This - conflicts with the common COMPAS pattern of past-tense non-mutating names. -3. Add mutating `triangulate(strategy=...)` and non-mutating - `triangulated(strategy=...)`, with explicit strategies such as fixed - diagonal, shortest diagonal, and Earcut. -4. Pick one universal triangulation algorithm. This would silently change - established topology and performance. - -## Recommendation - -Choose option 3 with one strict convention: `triangulate(strategy)` mutates and -returns `None`, while `triangulated(strategy)` leaves the source unchanged and -returns `Tessellation`. Mutable topological types expose both; non-mutable types -expose only `triangulated`. Existing conversion flags and -`quads_to_triangles()` are removed rather than retained as parallel APIs. - -Face triangulation strategies inherit `compas.data.Data` through a common -`TriangulationStrategy` base: - -```python -class TriangulationStrategy(Data): - pass - - -class DiagonalSplit(TriangulationStrategy): - diagonal: Literal["shortest", "02", "13"] = "shortest" - - -class EarClipping(TriangulationStrategy): - pass -``` - -`DiagonalSplit` accepts triangular and quadrilateral faces. Triangles pass -through unchanged. For quads, `"02"` and `"13"` select the corresponding -vertex-index diagonals. `"shortest"` compares geometric diagonal lengths and -uses `"02"` for an exact tie, making the result deterministic. - -`EarClipping` accepts planar polygonal faces, preserves the input vertices, and -does not insert Steiner points. Invalid or nonplanar faces raise an error. It -uses the standard COMPAS tolerance for geometric comparisons; tolerance is not -a strategy field. - -Mutation transfers source face attributes to generated faces. It does not -promise preservation of face keys. Vertex keys are preserved unless a strategy -explicitly permits vertex insertion; neither initial face strategy inserts -vertices. - -## Consequences - -- Mutation becomes explicit and consistent with COMPAS conventions. -- Existing implicit diagonal and centroid-fan defaults are not preserved as an - API constraint; the selected strategy defines the behavior explicitly. -- Face attributes and provenance need defined transfer behavior for mutation. -- Generated mutable faces inherit source face attributes, while face-key - preservation is explicitly not guaranteed. The initial strategies preserve - vertex keys because neither inserts vertices. -- Tests must cover both explicit diagonals, shortest-diagonal ties, triangle - pass-through, n-gons, planarity failures, standard tolerance behavior, - attributes, key guarantees, source immutability, and invalid strategy/face - combinations. -- Documentation must separate domain triangulation (Earcut/Delaunay) from - topology-local face splitting. -- Existing callers of `triangulated=True`, `.triangles`, and - `quads_to_triangles()` require source changes. - -## Affected packages - -`compas`, `compas_model`, and `compas_framework`; plugin packages consume the -resulting triangle representation. - -## Dependencies - -- [001 — Terminology](001-terminology.md) -- [002 — Mesh representations](002-mesh-representations.md) -- [005 — Output topology](005-output-topology.md) diff --git a/initiatives/geometry-tessellation/decisions/008-triangle-interoperability.md b/initiatives/geometry-tessellation/decisions/008-triangle-interoperability.md deleted file mode 100644 index d2b277b..0000000 --- a/initiatives/geometry-tessellation/decisions/008-triangle-interoperability.md +++ /dev/null @@ -1,68 +0,0 @@ -# Title: How should heterogeneous geometry be adapted and validated as triangle meshes? - -## Status - -Accepted - -## Context - -Core `MeshType` is a raw tuple. CGAL and libigl mostly tuple-unpack and -independently coerce NumPy arrays; CGAL geodesics alone accepts `Mesh` through -a local helper. OCC's shell conversion accepts rich `Mesh` and checks -`is_trimesh()`. `Tessellation`, `PolygonalSurface`, and `Mesh` therefore have no -shared triangle-input boundary. - -Native operations also require different topology guarantees: some need only -triangle arity, while volume or boolean operations may require closed, -oriented, manifold input. - -## Options - -1. Require raw `(V, F)` everywhere. This is fast and familiar but structurally - weak and forces callers to repeat conversion. -2. Require rich `Mesh` everywhere. This gives topology but adds allocation and - loses zero-copy native-buffer opportunities. -3. Use a runtime protocol over arbitrary triangle providers. This is extensible - but makes the primary contract less concrete and pushes validation into - every implementation. -4. Make `Tessellation` the sole public triangle-buffer contract. Continuous - sources produce it with `tessellate(strategy)` and discrete polygonal - sources with `triangulated(strategy)`. Do not add a universal conversion - function or public accepted-input union. Keep raw tuples and NumPy arrays - behind backend implementation boundaries. - -## Recommendation - -Choose option 4. Geometry-processing plugin APIs accept `Tessellation`, not a -public union of tuples and rich objects. Callers explicitly use -`tessellate(strategy)` or `triangulated(strategy)` before invoking a plugin; -there is no redundant `to_triangle_mesh()` facade. Core validates -`Tessellation` buffer shape, triangle arity, indices, and finiteness. -Closedness, manifoldness, and orientation remain explicit operation-specific -checks. NumPy dtype and contiguity remain backend-owned internals. - -## Consequences - -- Existing representations become interoperable through one canonical result - type and semantically explicit producer operations. -- Already compatible `Tessellation` buffers can retain zero-copy behavior. -- Polygonal inputs may allocate, triangulate, or add vertices; this must be - documented. -- Public raw tuple inputs are removed from CGAL/libigl high-level operations; - their internal bindings may still use arrays and tuples. -- CGAL/libigl consolidate repeated conversion while keeping native dtype - choices local. -- Tests must cover copies/identity, invalid buffers, topology layers, source - immutability, and cross-representation equivalence. - -## Affected packages - -`compas`, `compas_occ`, `compas_cgal`, `compas_libigl`, and -`compas_framework`. - -## Dependencies - -- [002 — Mesh representations](002-mesh-representations.md) -- [005 — Output topology](005-output-topology.md) -- [006 — Tessellation API](006-tessellation-api.md) -- [007 — Triangulation operations](007-triangulation-operations.md) diff --git a/initiatives/geometry-tessellation/decisions/009-trimmed-surfaces.md b/initiatives/geometry-tessellation/decisions/009-trimmed-surfaces.md deleted file mode 100644 index 6e70d9a..0000000 --- a/initiatives/geometry-tessellation/decisions/009-trimmed-surfaces.md +++ /dev/null @@ -1,59 +0,0 @@ -# Title: Which abstraction owns tessellation of trimmed NURBS surfaces? - -## Status - -Accepted - -## Context - -Core `NurbsSurface` stores the underlying parametric surface but no trim loops. -`BrepFace` owns ordered boundary loops, orientation, and the supported surface. -OCC's BRep mesher tessellates actual trimmed faces, whereas -`OCCBrep.to_meshes(u, v)` samples underlying rectangular surface domains and -does not visibly apply trims. - -Relevant sources are -`../compas/src/compas/geometry/surfaces/nurbs.py`, -`../compas/src/compas/geometry/brep/face.py`, and -`../compas_occ/src/compas_occ/brep/brep.py`. - -## Options - -1. Add trim loops to `NurbsSurface`. This gives one surface API but conflates - geometry with BRep topology and changes serialization across backends. -2. Pass optional trim loops to generic surface tessellation. This is flexible - but creates an unowned trim representation and difficult orientation rules. -3. Keep standalone `NurbsSurface` explicitly untrimmed; place trim-aware - tessellation on `BrepFace`/`Brep`, using their topology and orientation. -4. Introduce a new `TrimmedSurface` abstraction first. This may eventually be - useful but is a larger unproven hierarchy change. - -## Recommendation - -Choose option 3. Add/standardize trim-aware tessellation on BRep owners and -document that extracting the underlying NURBS surface loses trimming context. -Do not invent generic trimmed-surface ownership in this initiative. - -## Consequences - -- OCC can use its native trimmed-face mesher without flattening topology into a - surface object. -- Generic `NurbsSurface.tessellate(strategy)` remains a rectangular-domain - operation. -- BRep results must preserve face winding and relevant boundary polylines. - Trim/source provenance is deferred by ADR 010 and requires a future ADR and - separately named operation-specific API. -- Tests need holes, curved trims, reversed faces, boundaries, seams, and - watertightness assumptions. -- Documentation must warn that underlying-surface conversion is not - trim-preserving. - -## Affected packages - -`compas`, `compas_occ`, `compas_model`, and `compas_framework`. - -## Dependencies - -- [003 — Strategy objects](003-strategy-objects.md) -- [004 — Error contracts](004-error-contracts.md) -- [006 — Tessellation API](006-tessellation-api.md) diff --git a/initiatives/geometry-tessellation/decisions/010-metadata-provenance.md b/initiatives/geometry-tessellation/decisions/010-metadata-provenance.md deleted file mode 100644 index 14dbaed..0000000 --- a/initiatives/geometry-tessellation/decisions/010-metadata-provenance.md +++ /dev/null @@ -1,90 +0,0 @@ -# Title: Where should tessellation metadata, provenance, and error information live? - -## Status - -Accepted - -## Context - -`Tessellation` currently contains triangle buffers, optional same-index normals -and UVs, and independent polylines. It deliberately remains lightweight and -non-serializable. OCC could expose face/trim correspondence, and CGAL already -has operation-specific intersection-edge, source-face, and skeleton mappings. -Carrying every possible field into `Tessellation` would couple unrelated -producers and simple conversions. - -## Options - -1. Add universal strategy, provenance, mapping, and error fields to - `Tessellation`. This is discoverable but bloats a zero-copy interchange and - creates unstable optional semantics. -2. Always return a universal `TessellationResult`. This is uniform but burdens - simple callers and duplicates the existing container role. -3. Put metadata on persistent `Mesh`. This enables serialization but conflates - generated approximation data with editable topology and attributes. -4. Keep `Tessellation` minimal and defer every enriched result API from the - initial implementation. Require a separate future ADR and operation-specific - result type when a concrete consumer and backend data source exist. - -## Recommendation - -Choose option 4. The initial stable operations remain exactly: - -```python -geometry.tessellate(strategy) -> Tessellation -geometry.polygonize(strategy) -> PolygonalSurface -``` - -They do not accept detail/report flags and do not return unions. There is no -universal `TessellationReport` or `TessellationResult`, and no parallel -`tessellate_detailed()`-style method. - -`Tessellation` retains representation data only: vertices, triangles, optional -aligned vertex normals, optional aligned UV coordinates, and optional relevant -boundary polylines. These fields describe the produced representation; they -are not provenance. - -The initial implementation defers source-face and trim mappings, execution -reports, measured error, refinement histories, and backend diagnostics. -ADR 016 subsequently removes `TessellationCapability` and -`ApproximationError`: neither has a production consumer or operational backend -source. A future discovery or measured-error result requires its own ADR, -concrete consumer, and backend data rather than reusing a reserved schema. - -Any future enriched operation requires all of the following: - -- a separate ADR identifying a concrete consumer and backend data source; -- a separately named API, never a boolean result flag; -- an operation-specific stable result type, never a union return; -- no serializable references to source objects. - -An envelope containing ephemeral `Tessellation` is itself ephemeral. -Independently stable metadata values may be serializable through `Data`. - -## Consequences - -- Simple conversion and plugin paths remain lightweight. -- The initial API surface has one stable result type per operation and no - report-mode branching. -- Existing normals, UVs, and relevant boundary polylines remain representation - fields and must not be documented as source provenance. -- OCC and native backends do not expose source mappings, histories, diagnostics, - or measured error through the initial tessellation API. -- Capability discovery is available without implying that per-execution error - or provenance was reported. -- Tests must assert the absence of result flags and union returns and preserve - the ephemeral serialization boundary of `Tessellation`. -- Documentation must clearly label the deferred metadata categories and avoid - promising a universal enriched result. - -## Affected packages - -`compas`, `compas_occ`, `compas_cgal`, `compas_libigl`, `compas_model`, and -`compas_framework`. - -## Dependencies - -- [002 — Mesh representations](002-mesh-representations.md) -- [003 — Strategy objects](003-strategy-objects.md) -- [004 — Error contracts](004-error-contracts.md) -- [009 — Trimmed surfaces](009-trimmed-surfaces.md) diff --git a/initiatives/geometry-tessellation/decisions/011-planar-triangulation-contract.md b/initiatives/geometry-tessellation/decisions/011-planar-triangulation-contract.md deleted file mode 100644 index f67bf60..0000000 --- a/initiatives/geometry-tessellation/decisions/011-planar-triangulation-contract.md +++ /dev/null @@ -1,136 +0,0 @@ -# Title: What canonical contract should planar constrained triangulation use? - -## Status - -Accepted - -The operation names recorded below were subsequently made explicit by -[ADR 020](020-planar-delaunay-naming.md): `triangulate_planar_points` and -`triangulate_planar_domain`. The contract and strategy names are unchanged. - -## Context - -Core constrained Delaunay uses `boundary, polylines, polygons`; conforming adds -`angle, area`. CGAL uses `boundary, points, holes, curves` and does not accept -the core quality arguments. Positional dispatch can silently reinterpret data, -while keyword calls can fail plugin signature validation. Plain Delaunay also -returns only faces whereas constrained variants return `(V, F)`. - -Sources: -`../compas/src/compas/geometry/triangulation_delaunay.py` and -`../compas_cgal/src/compas_cgal/triangulation.py`. - -## Options - -1. Make CGAL mimic the current core names exactly. This repairs dispatch but - retains ambiguous `polylines`/`polygons` meanings and incomplete interior - point vocabulary. -2. Make core mimic current CGAL signatures. This exposes actual CGAL concepts - but omits a structured quality contract and breaks core keywords. -3. Adopt canonical keyword-only concepts: `boundary`, `holes`, `constraints`, - `points`, and `quality`; return `Tessellation` from every planar - triangulation operation and remove the incompatible legacy contracts. -4. Leave direct and dispatched APIs intentionally different. This avoids - migration but makes plugins unreliable through core. - -## Recommendation - -Choose option 3. Contracts must state projection/coordinate space, input-vertex -preservation, Steiner insertion, winding, hole/constraint behavior, and which -quality fields are supported. Arguments after `boundary` are keyword-only. -Plain, constrained, conforming, and refined planar triangulation all return -`Tessellation`, so vertices and triangle indices always travel together. - -Planar triangulation is a separate serializable `Data` strategy family from the -face strategies in ADR 007: - -```python -class Delaunay(Data): - pass - - -class ConstrainedDelaunay(Data): - pass - - -class ConformingDelaunay(Data): - quality: TriangulationQuality | None = None - - -class TriangulationQuality(Data): - min_angle: float | None = None - max_area: float | None = None - max_edge_length: float | None = None -``` - -`TriangulationQuality` requires at least one provided field. Every provided -value is positive and finite. `min_angle` is expressed in public degrees and -must be less than 60 degrees; `max_area` is in model-units squared; and -`max_edge_length` is in model units. A backend errors on unsupported fields; -it never ignores them. Quality values are triangulation targets and are -distinct from `Adaptive` tessellation controls and from estimated or guaranteed -error contracts in ADR 004. - -The canonical functions are: - -```python -def triangulate_points( - points, - *, - strategy: Delaunay, - frame: Frame | None = None, -) -> Tessellation: ... - - -def triangulate_domain( - boundary, - *, - holes=(), - constraints=(), - points=(), - strategy: ConstrainedDelaunay | ConformingDelaunay, - frame: Frame | None = None, -) -> Tessellation: ... -``` - -With `frame=None`, every input coordinate must lie in world XY within the -standard COMPAS tolerance. With an explicit `Frame`, every input coordinate -must lie on that frame's plane within the standard COMPAS tolerance. Inputs -outside the applicable tolerance are rejected. Projection to local XY is an -internal algorithm step only; implementations never silently discard Z. - -Coordinates of existing input vertices are preserved exactly in the returned -`Tessellation`. Generated Steiner vertices are lifted onto the specified plane -(world XY when `frame=None`, otherwise the explicit frame plane). All -parameters after `points` or `boundary` are keyword-only. - -`Delaunay` preserves the supplied point set. `ConstrainedDelaunay` preserves -input vertices subject to documented vertex insertion where constraints -intersect. `ConformingDelaunay` may insert Steiner vertices to pursue its -quality targets. - -## Consequences - -- Core and plugin signatures can be validated and safely dispatched. -- Existing keywords, positional calls, face-only arrays, and `(V, F)` returns - break; no alias or dual return mode is retained. -- Unsupported quality fields must fail rather than be mapped to non-equivalent - controls. -- Stable results always carry vertices with triangles. -- Tests must cover standard-tolerance acceptance/rejection for world XY and an - explicit frame, exact preservation of input coordinates, lifting of generated - Steiner vertices, permitted insertion, intersecting constraints, units and - validation of every quality field, and rejection of unsupported fields. -- Tests must exercise installed-plugin dispatch, not only direct imports. - -## Affected packages - -`compas`, `compas_cgal`, and `compas_framework`. - -## Dependencies - -- [001 — Terminology](001-terminology.md) -- [003 — Strategy objects](003-strategy-objects.md) -- [004 — Error contracts](004-error-contracts.md) -- [007 — Triangulation operations](007-triangulation-operations.md) -- [008 — Triangle interoperability](008-triangle-interoperability.md) diff --git a/initiatives/geometry-tessellation/decisions/012-plugin-boundaries.md b/initiatives/geometry-tessellation/decisions/012-plugin-boundaries.md deleted file mode 100644 index b690a26..0000000 --- a/initiatives/geometry-tessellation/decisions/012-plugin-boundaries.md +++ /dev/null @@ -1,78 +0,0 @@ -# Title: How should plugins discover and consume the unified triangle-mesh contract? - -## Status - -Accepted - -## Context - -COMPAS discovers plugins through the `compas.plugins` entry-point group. -`compas_occ` declares current entry points; `compas_cgal` retains an unused -legacy `__all_plugins__` list and lacks the inspected entry-point table. CGAL -and libigl also repeat native array conversion, with CGAL public aliases using -`int64` while wrappers commonly marshal `int32`. - -Relevant sources include `../compas/src/compas/plugins.py`, -`../compas_cgal/pyproject.toml`, `../compas_cgal/src/compas_cgal/types.py`, and -`../compas_libigl/src/compas_libigl`. - -## Options - -1. Keep package-local public input contracts and direct APIs. This minimizes - initial work but preserves multiple competing public surfaces. -2. Put NumPy-native array requirements in core. This centralizes conversion - but imposes backend storage policy on general geometry representations. -3. Use current entry-point discovery, exact compatible plugin signatures, core - `Tessellation` validation/buffer extraction, and package-local native - coercion/validation helpers. -4. Replace the plugin mechanism with a new strategy registry. This duplicates - existing infrastructure and expands scope. - -## Recommendation - -Choose option 3. CGAL must add current discovery metadata and register intended -decorated modules. Core owns validation and buffer extraction from -`Tessellation`; it does not own a heterogeneous representation adapter. CGAL -and libigl package helpers own NumPy dtype, layout, range checks, and conversion -to native inputs. Operation-specific topology validation remains explicit. The -core pluggable is the public API; backend functions implement that exact -signature and result contract but are not maintained as a second, divergent -high-level API. - -### Approved refinement — 2026-11-05 - -Native backend entry points must target lightweight, category-oriented plugin -registration modules. These modules define the decorated plugin functions but -import their implementation modules inside the function bodies. This preserves -direct backend APIs while preventing ordinary plugin discovery from loading -compiled extensions or their implementation modules. - -This refinement is required because `PluginManager` calls -`entry_point.load()` for every declared plugin module during discovery. Tests -must therefore verify both installed entry-point registration and, in a fresh -process, that discovery alone does not load native extensions. - -## Consequences - -- Plugin dispatch becomes testable through core APIs. -- Existing callers of divergent direct CGAL/libigl high-level functions must - move to the core API; backend modules may expose clearly low-level native - bindings, but not alternate semantic contracts. -- Runtime annotations must match actual native dtypes. -- Compatible buffers can avoid unnecessary copies, but coercion cannot promise - zero-copy when dtype/layout changes. -- Entry-point tests and optional-backend skip behavior become framework-level - contracts. -- Operation-specific enriched public results are deferred from the initial API - by ADR 010. Low-level internal native data may still exist, but it is not a - public contract. - -## Affected packages - -`compas`, `compas_cgal`, `compas_libigl`, `compas_occ`, and -`compas_framework`. - -## Dependencies - -- [008 — Triangle interoperability](008-triangle-interoperability.md) -- [011 — Planar triangulation contract](011-planar-triangulation-contract.md) diff --git a/initiatives/geometry-tessellation/decisions/013-compatibility.md b/initiatives/geometry-tessellation/decisions/013-compatibility.md deleted file mode 100644 index 37b58ed..0000000 --- a/initiatives/geometry-tessellation/decisions/013-compatibility.md +++ /dev/null @@ -1,83 +0,0 @@ -# Title: Should the unified architecture preserve legacy API compatibility? - -## Status - -Accepted - -## Context - -Public and downstream code already depends on scalar resolution controls, -tuple results, `.tessellation`, `compute_tessellation()`, OCC -`to_tessellation()`, misspelled `to_tesselation()`, `to_viewmesh()`, -`triangulated=True`, and direct native-package calls. Defaults also encode -specific diagonal, caching, seam, buffer identity, and serialization behavior. -The initiative now explicitly prioritizes the cleanest coherent target API -over backward compatibility. Retaining aliases and dual result forms would -make the new architecture harder to understand and test. - -The coordinated baseline is COMPAS 3.0. Affected plugin packages cannot safely -advertise compatibility with COMPAS 2.x while implementing these contracts. - -## Options - -1. Make a coordinated breaking replacement across affected packages. This - yields one coherent API but requires synchronized releases and caller edits. -2. Add new APIs indefinitely without deprecation. This is safe short-term but - leaves permanent ambiguity. -3. Stage additions, aliases, adapters, warnings, and eventual removals. This - reduces immediate breakage but temporarily or permanently doubles the API. -4. Change only documentation and preserve all behavior. This cannot resolve - plugin signature and interoperability defects. - -## Recommendation - -Choose option 1. Implement the approved target contracts together and remove -superseded public forms rather than shipping aliases. This includes scalar -tessellation controls; cached `.tessellation`; `compute_tessellation()`; -`to_tessellation()`; misspelled `to_tesselation()`; `to_viewmesh()`; -`triangulated=True`; `quads_to_triangles()`; legacy planar keywords and -positional forms; face-only and tuple triangulation results; public raw tuple -plugin inputs; and divergent direct backend APIs. Coordinate package versions -so the breaking set is internally consistent. `Tessellation` itself remains -the canonical ephemeral result. - -Release the core contract as COMPAS 3.0 and require affected plugin packages to -depend on `compas>=3.0.0`. Where a package already follows a major-version -upper-bound policy, advance that bound to `<4`; for example, CGAL uses -`compas>=3.0.0,<4`. This version floor is the synchronized breaking-release -baseline for the initiative. - -## Consequences - -- There is one target call form per operation; alias and normalization code is - unnecessary. -- This is a broad source-breaking change for core, OCC, CGAL, libigl, model, - examples, and downstream users. -- Geometry invariants that remain architecturally important—orientation, - seams, polygon/source boundaries, and `Tessellation` buffer semantics—still - require tests. Public cache identity and legacy connectivity defaults do not - survive merely for compatibility. -- A concise migration guide maps removed names and result forms to the new API, - but no deprecation period is required. -- A synchronized package version set and cross-package integration suite are - prerequisites for release. -- Package metadata and supported-version tests must enforce COMPAS 3.0 as the - minimum for affected plugins. Existing major upper-bound policies advance to - `<4` rather than being removed implicitly. -- Mixed COMPAS 2.x/3.x package sets are unsupported for this initiative's API. -- Accepting this ADR authorizes the architectural break, not merging or - publishing changes. - -## Affected packages - -`compas`, `compas_occ`, `compas_cgal`, `compas_libigl`, `compas_gmsh`, -`compas_model`, and `compas_framework`. - -## Dependencies - -- [006 — Tessellation API](006-tessellation-api.md) -- [007 — Triangulation operations](007-triangulation-operations.md) -- [009 — Trimmed surfaces](009-trimmed-surfaces.md) -- [010 — Metadata and provenance](010-metadata-provenance.md) -- [011 — Planar triangulation contract](011-planar-triangulation-contract.md) -- [012 — Plugin boundaries](012-plugin-boundaries.md) diff --git a/initiatives/geometry-tessellation/decisions/014-continuous-geometry-materialization.md b/initiatives/geometry-tessellation/decisions/014-continuous-geometry-materialization.md deleted file mode 100644 index 672dbf2..0000000 --- a/initiatives/geometry-tessellation/decisions/014-continuous-geometry-materialization.md +++ /dev/null @@ -1,83 +0,0 @@ -# Title: What discretization state should continuous geometry retain? - -## Status - -Accepted - -## Context - -`Shape` and `Surface` currently retain `resolution_u` and `resolution_v` and -cache derived vertices, edges, faces, points, lines, and polygons. Those values -are not part of the serialized analytic definition, are inconsistently used by -one- and two-parameter geometry, and create invalidation and placement-cache -contracts that are unrelated to the defining geometry. - -ADRs 003, 005, and 006 require explicit strategy objects and fresh -`polygonize(strategy)` and `tessellate(strategy)` operations. ADR 013 permits a -clean breaking API. The user explicitly approved removing the stored -resolution and caches until the discretization API is complete and consistent. - -## Options - -1. Keep stored resolutions and private derived-geometry caches, while requiring - explicit strategies only in the new operations. This retains two competing - sources of approximation policy and preserves invalidation complexity. -2. Remove stored resolutions and all derived discretization caches. Retain only - defining analytic state and materialize results through explicit operations. -3. Remove public resolution properties but retain undocumented caches keyed by - strategies and placement state. This reduces the public surface but commits - the initial implementation to cache correctness before its inputs are stable. - -## Recommendation - -Choose option 2. - -Continuous geometry stores only defining state: analytic parameters and frames, -or the control net, weights, knots, degrees, and periodicity of NURBS geometry. -Remove stored `resolution_u` and `resolution_v` and all cached derived -discretizations. Do not introduce private discretization caches initially. - -The public materialization operations are exclusively: - -```python -geometry.polygonize(strategy) # -> PolygonalSurface -geometry.tessellate(strategy) # -> Tessellation -``` - -Remove `Shape.to_vertices_and_faces()` and `Mesh.from_shape()`. The explicit -half-edge conversion is `shape.polygonize(strategy).to_mesh()`. Treat generic -shape and surface `compute_vertices`, `compute_edges`, `compute_faces`, and -surface `to_vertices_and_faces` as implementation machinery rather than a -parallel public discretization API. A future public point-grid sampling API, if -needed by a concrete consumer, requires a separate design. - -Preserve exact, shape-specific finite access such as `Box.points`. Exact box -corners are defining geometric information, not an approximate sampled -representation, and do not establish a generic `Shape.points` contract. - -## Consequences - -- Approximation policy is supplied once, explicitly, at each operation. -- Every polygonization and tessellation result is newly materialized and - independent of its source. -- Cache identity, invalidation, placement fingerprints, and resolution - synchronization disappear from the API and tests. -- Strategy equality remains useful for value semantics and possible future - caches, but no cache behavior is promised. -- Existing callers and examples using stored resolutions, - `to_vertices_and_faces()`, or `Mesh.from_shape()` must migrate to explicit - operations. -- Any later cache requires a new architectural decision after all effective - inputs and invalidation rules are known. - -## Affected packages - -`compas`, `compas_occ`, `compas_model`, and `compas_framework`; examples and -tests in `compas_cgal` that materialize shapes are also affected. - -## Dependencies - -- [003 — Strategy objects](003-strategy-objects.md) -- [005 — Output topology](005-output-topology.md) -- [006 — Tessellation API](006-tessellation-api.md) -- [013 — Compatibility](013-compatibility.md) diff --git a/initiatives/geometry-tessellation/decisions/015-continuous-bounds.md b/initiatives/geometry-tessellation/decisions/015-continuous-bounds.md deleted file mode 100644 index 9cee293..0000000 --- a/initiatives/geometry-tessellation/decisions/015-continuous-bounds.md +++ /dev/null @@ -1,89 +0,0 @@ -# Title: What guarantees should bounding boxes of continuous geometry provide? - -## Status - -Accepted - -## Context - -`Geometry.aabb` and `Geometry.obb` are abstract properties. `Shape` currently -implements both by applying point-cloud bounding-box algorithms to vertices -from its default discretization. Consequently the result depends on stored -resolution and may fail to enclose the continuous curved geometry. `Surface` -does not currently implement either property. - -The analytic parameters and frame provide exact world-axis extrema for `Box`, -`Cylinder`, `Cone`, `Sphere`, `Torus`, and `Capsule`, without tessellation. -Closed-form full-domain extrema are also available for the analytic surface -types, although partial domains are substantially more complex. A NURBS -surface needs a certified backend result or validated convex-hull assumptions; -ordinary UV sampling cannot guarantee containment. - -The existing oriented-bounding-box function promises minimum volume. A -deterministic box aligned with a shape's parameter frame is an exact enclosure, -but is not proven to be the global minimum-volume box for every shape. - -## Options - -1. Continue deriving bounds from an implicit default tessellation. This is - simple but resolution-dependent and cannot guarantee containment. -2. Define `aabb` as a strategy-free continuous enclosure, while retaining the - minimum-volume meaning of `obb` and reporting unsupported cases honestly. -3. Define both properties analytically, but redefine `obb` to mean the - deterministic parameter-frame enclosure. This is broadly implementable but - silently weakens the existing minimum-volume contract. -4. Require a discretization strategy for all bounds. This makes approximation - explicit but makes bounds approximate operations rather than properties of - the continuous geometry. - -## Recommendation - -Choose option 2. - -Define `aabb` as a strategy-free `Box` guaranteed to enclose the continuous -geometry and tight along world XYZ where an exact analytic implementation is -provided. It must never use an ordinary tessellation or sampling resolution. - -Implement exact parameter-derived AABBs for `Box`, `Cylinder`, `Cone`, -`Sphere`, `Torus`, and `Capsule`, including rotated frames and supported -degeneracies. Implement exact full-native-domain AABBs for `PlanarSurface`, -`CylindricalSurface`, `ConicalSurface`, `SphericalSurface`, and -`ToroidalSurface`. Do not add domain arguments to the property; partial-domain -bounds, if required, are a separate future operation. Unbounded domains must -raise a clear unsupported or unbounded error rather than being sampled. - -For `NurbsSurface`, return an AABB only when the implementation can certify a -continuous enclosure: through a backend-provided certified bound or a -control-net convex-hull bound whose required weight assumptions have been -validated. Such a result may be conservative and must be documented as such. -If no guarantee can be established, raise `NotImplementedError`. - -Retain the minimum-volume semantic meaning of `obb`. Initially implement it -only where the continuous minimum-volume result is established, such as `Box` -and `Sphere`; leave other continuous shapes and surfaces unsupported. Do not -fall back to hidden tessellation. If a parameter-frame enclosure gains a -concrete consumer, introduce it separately instead of weakening `obb`. - -## Consequences - -- Bounding results no longer depend on resolution or caches and cannot - under-bound curves merely because extrema fall between sample points. -- AABB tests must cover rotated frames, exact extrema, containment, parameter - changes, and permitted degeneracies. -- Surface tests must distinguish exact finite, unbounded, conservative, and - unsupported results. -- NURBS documentation must state tightness, containment guarantees, and weight - or backend assumptions. -- Existing sampled `Shape.obb` behavior is removed; several continuous types - initially have no `obb` implementation. -- Parameter-frame enclosures and partial-domain bounds remain separate future - APIs rather than being conflated with `obb` or tessellation. - -## Affected packages - -`compas` and geometry backends that can certify NURBS bounds, initially -`compas_occ`. - -## Dependencies - -- [014 — Continuous geometry materialization](014-continuous-geometry-materialization.md) diff --git a/initiatives/geometry-tessellation/decisions/016-capability-discovery.md b/initiatives/geometry-tessellation/decisions/016-capability-discovery.md deleted file mode 100644 index 2ae3a2c..0000000 --- a/initiatives/geometry-tessellation/decisions/016-capability-discovery.md +++ /dev/null @@ -1,86 +0,0 @@ -# Title: Should tessellation expose runtime capability and error-schema APIs before they have consumers? - -## Status - -Accepted - -## Context - -ADR 004 introduced `tessellation_capabilities()`, `TessellationCapability`, -`ErrorContract`, and `ApproximationError` so callers could discover supported -strategies and distinguish requested, estimated, and guaranteed error. - -The implementation audit found no production consumer of this API. Shape and -Surface operations validate strategies directly. The principal BRep backend, -`compas_occ`, does not implement the capability pluggable, so BRep discovery is -not operational outside isolated mocked tests. No tessellation operation -returns `ApproximationError`, and no backend currently supplies achieved-error -metadata through this schema. - -Keeping the types would preserve a speculative contract whose shape has not -been tested by a real caller or backend result. Backward compatibility is not a -priority for this initiative. - -## Options - -1. Keep the complete discovery and error-schema API in anticipation of future - consumers. This avoids later additions but commits COMPAS to an unused - abstraction and a nonfunctional BRep discovery boundary. -2. Keep capability discovery but remove the unused error schema. This retains - runtime discovery, although current producers already validate strategies - and no caller uses discovery. -3. Remove the complete speculative API without replacement. Producers validate - supplied strategies directly and document supported strategies statically. - Runtime discovery and measured-error results return only with a concrete - consumer and backend data. - -## Recommendation - -Choose option 3. - -Remove: - -- `Shape.tessellation_capabilities()` and - `Surface.tessellation_capabilities()`; -- BRep and BRepFace capability forwarding methods; -- the `brep_tessellation_capabilities` pluggable; -- `TessellationCapability`, `ErrorContract`, and `ApproximationError`; -- corresponding exports, tests, documentation, and framework assertions. - -Do not replace them with another discovery facade. Each producer accepts an -explicit strategy, validates it, and raises a precise `TypeError` or -`ValueError` when unsupported. Supported strategies are documented per -geometry type and backend. `Deflection` values remain requested targets and do -not imply measured or guaranteed error. - -Retain all accepted strategy types, including `Adaptive`. A future runtime -capability or enriched error-reporting API requires a concrete consumer, -available backend information, and a separate ADR. - -Upon acceptance, this decision supersedes the capability method and error -schema selected by ADR 004. ADR 010's broader rule remains: enriched operation -results are introduced only for a concrete operation and consumer, through a -separate decision. - -## Consequences - -- The public API becomes smaller and reflects only executable behavior. -- Strategy validation remains local to the operation that consumes it. -- Callers cannot query support in advance; they rely on documentation or handle - precise validation errors. -- No error-strength vocabulary is reserved before a backend can report it. -- Core, BRep, framework integration, tests, documentation, and public exports - require coordinated removal. -- There is no compatibility alias or deprecation period under ADR 013. - -## Affected packages - -`compas`, `compas_occ`, and `compas_framework` documentation and tests. - -## Dependencies - -- [003 — Strategy objects](003-strategy-objects.md) -- [004 — Error contracts](004-error-contracts.md), superseded in part if this - decision is accepted -- [010 — Metadata and provenance](010-metadata-provenance.md) -- [013 — Compatibility](013-compatibility.md) diff --git a/initiatives/geometry-tessellation/decisions/017-mixed-face-triangulation.md b/initiatives/geometry-tessellation/decisions/017-mixed-face-triangulation.md deleted file mode 100644 index 9161183..0000000 --- a/initiatives/geometry-tessellation/decisions/017-mixed-face-triangulation.md +++ /dev/null @@ -1,102 +0,0 @@ -# Title: How should mixed polygonal collections select face triangulation algorithms? - -## Status - -Accepted - -## Context - -`PolygonalSurface.triangulated`, `Mesh.triangulated`, `Mesh.triangulate`, and -`Polyhedron.triangulated` currently apply one leaf `TriangulationStrategy` to -every face. - -`DiagonalSplit` passes triangles through and splits quadrilaterals, including -warped quadrilaterals, but rejects faces with five or more vertices. -`EarClipping` handles planar triangles, quadrilaterals, and n-gons, but rejects -all non-planar faces. A single strategy can therefore triangulate a planar -mixed collection only by using ear clipping everywhere; it cannot combine an -explicit quad diagonal policy with ear clipping for general polygons. - -A non-planar n-gon does not define a unique continuous surface. Implicitly -projecting it and lifting triangle indices back to the original vertices would -choose an interpretation that the input did not specify. A warped quad is -different when a diagonal is explicitly selected: that diagonal defines one -of two possible piecewise-planar surfaces. - -## Options - -1. Continue applying one leaf strategy to all faces. This is simple but cannot - express different quad and n-gon policies. -2. Accept an ordered list of strategies and try them until one succeeds. This - conflates unsupported face arity with invalid geometry and may conceal a - non-planarity error. -3. Accept a mapping keyed by face size. This is flexible but unnecessarily - open-ended, difficult to validate, and awkward to serialize. -4. Introduce a serializable composite strategy with explicit quad and n-gon - policies and deterministic dispatch by face arity. - -## Recommendation - -Choose option 4. Introduce: - -```python -FaceTriangulation( - quad=DiagonalSplit("shortest"), - ngon=EarClipping(), -) -``` - -Dispatch by face arity: - -- fewer than three vertices: raise `ValueError`; -- three vertices: pass through unchanged; -- four vertices: apply `quad`; -- five or more vertices: apply `ngon`. - -Initially, `quad` accepts `DiagonalSplit` or `EarClipping`, and `ngon` accepts -`EarClipping`. Leaf strategies remain available for low-level single-face -triangulation, while collection-level operations require -`FaceTriangulation`. - -The non-planar contract is explicit: - -- triangles are accepted; -- `DiagonalSplit` accepts a warped quad because the chosen diagonal explicitly - defines its piecewise-planar surface; -- `EarClipping` rejects a warped quad; -- `EarClipping` rejects every non-planar n-gon; -- no triangulation strategy performs implicit projection of non-planar faces. - -Planarity initially uses the standard COMPAS tolerance. Strategy-specific -tolerance is deferred until required by a concrete use case. Correct the -low-level `earclip_polygon` documentation so it does not promise a best-fit -projection for non-planar input. - -## Consequences - -- Mixed triangles, quads, and n-gons can use the appropriate algorithms in one - atomic collection operation. -- Quad diagonal choice remains explicit and serializable. -- Invalid non-planar polygons cannot be hidden by fallback dispatch. -- Collection operations must stage all face results before mutating a `Mesh`. -- Face winding and existing vertex indices remain unchanged; no vertices are - inserted initially. -- `PolygonalSurface.triangulated` continues returning `Tessellation`; Mesh and - Polyhedron return types remain unchanged. -- Existing collection callers using a leaf strategy must wrap their policies - in `FaceTriangulation`; no compatibility alias is required under ADR 013. -- Tests must cover mixed topology, both quad diagonals, warped quad behavior, - non-planar n-gon rejection, serialization, and atomic mutation failure. - -## Affected packages - -`compas`, plus downstream callers in `compas_cgal`, `compas_libigl`, -`compas_model`, and `compas_framework` if searches identify collection-level -leaf-strategy calls. - -## Dependencies - -- [003 — Strategy objects](003-strategy-objects.md) -- [007 — Triangulation operations](007-triangulation-operations.md), - superseded in part if this decision is accepted -- [013 — Compatibility](013-compatibility.md) diff --git a/initiatives/geometry-tessellation/decisions/018-robust-polygon-triangulation.md b/initiatives/geometry-tessellation/decisions/018-robust-polygon-triangulation.md deleted file mode 100644 index 7f6917c..0000000 --- a/initiatives/geometry-tessellation/decisions/018-robust-polygon-triangulation.md +++ /dev/null @@ -1,132 +0,0 @@ -# Title: How should COMPAS triangulate polygons beyond valid planar face rings? - -## Status - -Accepted - -## Context - -Accepted ADR 017 separates quad and n-gon policies but preserves the existing -face-decomposition contract: triangles reference only the original face -vertices and no new topology is introduced. - -That contract covers valid simple planar rings. It does not cover every input -commonly called a polygon: - -- holes require multiple rings; -- self-intersections require a fill rule and intersection vertices; -- touching or retraced contours require arrangement and repair semantics; -- slightly warped rings require an explicit projection decision; -- arbitrary spatial loops do not define a unique surface. - -`PolygonalSurface` faces contain one index ring and cannot represent holes. -`PlanarRegion` represents an exterior ring plus holes. `Tessellation` can carry -new vertices, but the current face helper returns only indices into existing -vertices. Hiding repair and vertex insertion in a face strategy would leave -Mesh keys, attributes, shared-edge splitting, and crack prevention undefined. - -Mapbox Earcut is suitable for valid rings but does not guarantee arbitrary -invalid input. The current CGAL constrained-domain backend supports planar -boundaries, holes, and constraints, but does not yet provide an exact- -intersection contract for arbitrary self-intersecting arrangements. - -## Options - -1. Add one `Robust` face strategy that attempts projection, repair, - intersection, and triangulation. This is convenient but silently chooses - geometry semantics and breaks the no-insertion face contract. -2. Try progressively more permissive algorithms until one succeeds. This can - turn invalid geometry into an unnoticed reinterpretation. -3. Separate strict face decomposition, explicit near-planar projection, - planar-domain/arrangement tessellation, and spatial surface construction. - -## Recommendation - -Choose option 3. - -### Strict face triangulation - -Keep `FaceTriangulation` as the normal collection policy. `EarClipping` -accepts a valid simple planar ring, including concave polygons and supported -collinear boundary vertices, without inserting vertices. It rejects duplicate -coordinates, zero-length edges, zero area, self-intersection, and -non-planarity. `DiagonalSplit` retains its explicit warped-quad semantics. - -### Explicit near-planar faces - -Add a separately named leaf strategy: - -```python -ProjectedEarClipping(max_deviation=...) -``` - -It computes a documented best-fit plane, rejects vertices farther than -`max_deviation`, rejects degenerate or self-intersecting projections, -triangulates the projected simple ring, and returns indices into the original -3D vertices. Projection is never an implicit fallback. This strategy may be -used as `FaceTriangulation.ngon` and, when explicitly selected, as its quad -policy. - -### Planar regions with holes - -Use `PlanarRegion` and domain-level triangulation. Results are independent -`Tessellation` objects and may contain generated vertices when permitted by the -selected constrained or conforming strategy. - -### Self-intersecting planar contours - -Introduce a separate plugin operation: - -```python -triangulate_planar_arrangement( - contours, - plane=plane, - strategy=PlanarArrangement(fill_rule="even_odd"), -) -> Tessellation -``` - -The plane and fill rule are explicit. Initially support `even_odd` and -`nonzero`. The operation resolves proper intersections and touches, may insert -intersection vertices, and may produce multiple filled components and holes. -Generated vertices lie on the supplied plane. Unsupported coincident or -retraced segments and zero-area inputs raise precise errors. - -Do not expose this operation until a backend provides the stated robust -intersection contract. The existing inexact-construction CGAL implementation -is not sufficient evidence by itself; an exact-intersection implementation and -tests are required. - -### Arbitrary spatial loops - -Keep arbitrary non-planar loops outside polygon triangulation. They require a -separately named surface-patch or hole-filling operation with an explicit -objective or supplied support surface. Defer that API until there is a concrete -consumer and backend. - -## Consequences - -- “Robust” does not mean silently repairing or projecting invalid geometry. -- Normal `PolygonalSurface` and Mesh triangulation remains no-insertion and - atomic. -- Slightly warped imported faces have an explicit bounded-deviation policy. -- Holes, intersections, fill rules, multiple components, and generated - vertices use domain-level `Tessellation` results. -- Arrangement processing cannot be hidden inside per-face Mesh triangulation, - avoiding inconsistent shared-edge splits and cracks. -- Backend absence or insufficient robustness produces an explicit unavailable- - plugin error rather than a weaker fallback. -- Tests must cover concavity, collinear boundary vertices, projection - deviation, projected self-intersection, fill rules, intersection vertices, - components, holes, non-planar rejection, and backend absence. - -## Affected packages - -`compas`, `compas_cgal`, and documentation/examples in `compas_framework`. - -## Dependencies - -- [003 — Strategy objects](003-strategy-objects.md) -- [007 — Triangulation operations](007-triangulation-operations.md) -- [011 — Planar triangulation contract](011-planar-triangulation-contract.md) -- [012 — Plugin boundaries](012-plugin-boundaries.md) -- [017 — Mixed-face triangulation](017-mixed-face-triangulation.md) diff --git a/initiatives/geometry-tessellation/decisions/019-twisted-polygon-triangulation.md b/initiatives/geometry-tessellation/decisions/019-twisted-polygon-triangulation.md deleted file mode 100644 index 550f5ce..0000000 --- a/initiatives/geometry-tessellation/decisions/019-twisted-polygon-triangulation.md +++ /dev/null @@ -1,114 +0,0 @@ -# Title: How should COMPAS triangulate a heavily twisted 3D polygon without projection? - -## Status - -Accepted - -## Context - -ADR 017 defines `DiagonalSplit` and `EarClipping` as leaf policies used by the -composite `FaceTriangulation`. `EarClipping` is intentionally limited to planar -polygons. A heavily twisted ordered 3D boundary may have no intersection-free -planar projection, but can still be spanned combinatorially by triangles using -only its boundary vertices. - -No primary source was found for an algorithm named “Seitz–Belyaev Dynamic -Programming.” The established literature is the Barequet–Sharir dynamic -program for a single 3D polygon with additive per-triangle weights, followed by -the Barequet–Dickerson–Eppstein extension for adjacent-triangle weights. - -The existing helper is named `triangulate_face`, although it consumes one -ordered polygon boundary and is also used by `Polygon`. `triangulate_polygon` -describes that contract more directly. Delaunay strategies belong to separate -planar point/domain APIs and are not leaf polygon-decomposition strategies. - -## Options - -1. Add a strategy named `SeitzBelyaev`. This uses an unverifiable attribution - and leaves its optimization objective unspecified. -2. Add a configurable dynamic program supporting area, edge length, dihedral - angle, and combined costs. This is flexible but introduces speculative - complexity, multiple state formulations, and unclear defaults. -3. Add one explicitly named minimum-area dynamic-programming strategy with a - narrow, documented contract. - -## Recommendation - -Choose option 3. Add: - -```python -MinimumAreaTriangulation() -``` - -For ordered vertices `0 ... n - 1`, minimize the sum of triangle areas with -the recurrence: - -```text -W(i, j) = min over i < k < j of - area(i, k, j) + W(i, k) + W(k, j) -``` - -The strategy: - -- accepts one ordered 3D polygon boundary; -- performs no planar projection; -- inserts no vertices; -- returns exactly `n - 2` consistently oriented index triples; -- preserves the input boundary order; -- rejects fewer than three vertices, repeated boundary vertices, zero-length - boundary edges, and degenerate candidate triangles required by a result; -- uses deterministic lowest-index tie-breaking; -- takes `O(n^3)` time and `O(n^2)` space. - -The result is a combinatorially manifold disk, but is not guaranteed to be a -geometrically embedded or intersection-free surface. Document this limitation -prominently. Do not add an expensive intersection-free guarantee: deciding -whether a general 3D polygon has such a triangulation without additional -vertices is computationally intractable in the general case. - -Allow `MinimumAreaTriangulation` as both the `quad` and `ngon` policy of -`FaceTriangulation`. It is opt-in and never an implicit fallback from -`EarClipping`. - -Rename the internal helper: - -```python -triangulate_face(...) -> triangulate_polygon(...) -``` - -The helper remains distinct from Delaunay point/domain triangulation and -planar-arrangement operations. Collection-level callers continue using -`FaceTriangulation`. - -Do not implement adjacent-triangle or dihedral-angle objectives now. They need -an `O(n^4)`/`O(n^3)` dynamic-programming state and should be introduced only -for a concrete requirement through a separate decision. - -## Consequences - -- Twisted polygons gain a deterministic no-projection triangulation policy. -- The public strategy name communicates its actual optimization objective - rather than an uncertain attribution. -- The algorithm may return a self-intersecting geometric surface; callers that - require an embedded patch need a different operation and validation. -- Large polygons incur cubic runtime and quadratic memory; documentation must - state this cost. -- `FaceTriangulation` validation, serialization, exports, tests, and - documentation must accept the new leaf policy. -- Existing internal `triangulate_face` callers and tests migrate to - `triangulate_polygon` without a compatibility alias under ADR 013. -- References must cite Barequet–Sharir and - Barequet–Dickerson–Eppstein accurately. - -## Affected packages - -`compas` and integration documentation/tests in `compas_framework`. - -## Dependencies - -- [003 — Strategy objects](003-strategy-objects.md) -- [007 — Triangulation operations](007-triangulation-operations.md) -- [017 — Mixed-face triangulation](017-mixed-face-triangulation.md) -- [018 — Robust polygon triangulation](018-robust-polygon-triangulation.md), - related but not required; this decision does not implement planar repair or - an intersection-free spatial patch diff --git a/initiatives/geometry-tessellation/decisions/020-planar-delaunay-naming.md b/initiatives/geometry-tessellation/decisions/020-planar-delaunay-naming.md deleted file mode 100644 index b968ffb..0000000 --- a/initiatives/geometry-tessellation/decisions/020-planar-delaunay-naming.md +++ /dev/null @@ -1,75 +0,0 @@ -# Title: Should Delaunay triangulation operations state their planar contract in their names? - -## Status - -Accepted - -## Context - -The public operations `triangulate_points(...)` and -`triangulate_domain(...)` operate only on planar input. They use world XY or an -explicit `Frame`, validate that all input lies on that plane, and return a -planar `Tessellation`. Their unqualified names hide this material precondition -and are ambiguous beside polygon triangulation and any future 3D Delaunay or -tetrahedralization operation. - -The associated strategy classes are named `Delaunay`, `ConstrainedDelaunay`, -and `ConformingDelaunay`. These are standard algorithm names selected within an -already planar operation. - -## Options - -1. Keep all existing names and rely on documentation for the planar - precondition. -2. Add `Planar` to both operations and all strategy classes. This is explicit - but produces verbose, nonstandard algorithm names. -3. Rename the public operations and plugin selectors to state the planar - contract, while retaining the standard strategy class names. - -## Recommendation - -Choose option 3. Rename: - -```python -triangulate_points(...) -> triangulate_planar_points(...) -triangulate_domain(...) -> triangulate_planar_domain(...) -``` - -The names follow COMPAS's verb-object convention and expose the input contract -at the operation boundary. Rename the corresponding core pluggables and CGAL -plugin registrations because plugin dispatch is name-based. Rename private -Python backend adapters for consistency where practical. - -Keep: - -- `Delaunay` -- `ConstrainedDelaunay` -- `ConformingDelaunay` -- `TriangulationQuality` -- the `triangulation_delaunay` module name -- native C++ algorithm identifiers where they are internal - -The strategy names identify standard algorithms and gain their planar context -from the accepting operation. Do not add compatibility aliases under ADR 013. - -## Consequences - -- Planarity is visible at every public call site. -- The names remain unambiguous beside `triangulate_polygon` and any future 3D - tetrahedralization API. -- Core exports, `Mesh.from_points`, CGAL plugin registrations/adapters, tests, - API documentation, examples, and framework integration require coordinated - migration. -- Historical changelogs and inventory records may retain old names when clearly - historical. - -## Affected packages - -`compas`, `compas_cgal`, and `compas_framework`. - -## Dependencies - -- [003 — Strategy objects](003-strategy-objects.md) -- [011 — Planar triangulation contract](011-planar-triangulation-contract.md) -- [012 — Plugin boundaries](012-plugin-boundaries.md) -- [013 — Compatibility](013-compatibility.md) diff --git a/initiatives/geometry-tessellation/decisions/021-default-tessellation-strategy.md b/initiatives/geometry-tessellation/decisions/021-default-tessellation-strategy.md deleted file mode 100644 index 8ea0a1e..0000000 --- a/initiatives/geometry-tessellation/decisions/021-default-tessellation-strategy.md +++ /dev/null @@ -1,81 +0,0 @@ -# Title: Should shape and surface tessellation provide deterministic default strategies? - -## Status - -Accepted - -## Context - -ADRs 003, 006, and 014 require callers to supply every tessellation strategy -explicitly. This keeps approximation policy visible, but makes common ephemeral -tessellation unnecessarily verbose when a geometry type has one natural -strategy family. - -The strategy arity is fixed by geometry type: Box uses `Native`; Cylinder and -Cone use `UGrid`; Sphere, Torus, Capsule, and all current Surface types use -`UVGrid`. Grid dimensions count cells, not sample points. A value of 64 is valid -for every listed type, including Capsule's even-v requirement. - -BRep and BRepFace tessellation use `Deflection`. Existing OCC defaults are -inconsistent and historically express angular values in radians, while public -`Deflection.angular` values are degrees. There is no approved, -backend-independent default for that policy. - -## Options - -1. Keep every tessellation strategy mandatory. -2. Permit `None` everywhere and let backends choose, making results opaque and - backend-dependent. -3. Permit `None` only for Shape and Surface, with fixed core defaults. Keep - persistent polygonization and deflection-based BRep tessellation explicit. - -## Recommendation - -Choose option 3: - -```python -shape.tessellate(strategy=None) -surface.tessellate(strategy=None) -``` - -Resolve `None` at operation entry to: - -| Geometry | Default | -|---|---| -| `Box` | `Native()` | -| `Cylinder`, `Cone` | `UGrid(64)` | -| `Sphere`, `Torus`, `Capsule` | `UVGrid(64, 64)` | -| every `Surface` | `UVGrid(64, 64)` | - -An omitted argument and explicit `None` are equivalent. Explicit strategies -remain unchanged and validated. Defaults are operation policy, not stored -geometry state. Do not cache results; every call returns a fresh independent -`Tessellation` and leaves the source unchanged. - -Keep `polygonize(strategy)`, `Brep.tessellate(Deflection(...))`, and -`BrepFace.tessellate(Deflection(...))` explicit. A BRep default requires a -separate decision with fixed linear and degree-based angular values. - -## Consequences - -- Common ephemeral Shape and Surface tessellation becomes concise and - deterministic. -- UV defaults generally produce about 4,000 vertices and 8,000 triangles; - NURBS evaluation may be materially more expensive. -- `tessellate()` and `polygonize(strategy)` are intentionally asymmetric: - convenience applies only to the ephemeral result. -- Tests must compare omitted and explicit `None` with explicit defaults, - verify fresh non-mutating results and explicit overrides, and confirm BRep - and polygonization strategies remain mandatory. -- This supersedes the mandatory-strategy rule of ADRs 003, 006, and 014 only - for Shape and Surface `tessellate`. - -## Affected packages - -`compas` and integration documentation/tests in `compas_framework`. - -## Dependencies - -- [003 — Strategy objects](003-strategy-objects.md) -- [006 — Tessellation API](006-tessellation-api.md) -- [014 — Continuous geometry materialization](014-continuous-geometry-materialization.md) diff --git a/initiatives/geometry-tessellation/decisions/022-operation-terminology-and-producer-boundaries.md b/initiatives/geometry-tessellation/decisions/022-operation-terminology-and-producer-boundaries.md deleted file mode 100644 index 70063bc..0000000 --- a/initiatives/geometry-tessellation/decisions/022-operation-terminology-and-producer-boundaries.md +++ /dev/null @@ -1,268 +0,0 @@ -# Title: How should operation concepts map to public conversion APIs? - -## Status - -Accepted. - -## Context - -The user-authored [`definitions.md`](../definitions.md) provides new evidence -that the accepted architecture made polygonization and tessellation too -symmetrical. In particular, ADRs 005, 006, and 014 allow every continuous -surface-like producer to expose both operations, and ADR 005 permits BReps to -polygonize when a backend can return polygons. That obscures three materially -different operations: - -- structured discretization of a parameterized shape or surface; -- division of an existing discrete polygon, domain, or point set into - triangles; and -- precision-controlled approximation of trimmed surfaces and BReps. - -Typing-alignment ADRs 012 and 013 provide further accepted evidence. Numerical -backends need structural coordinate/index buffers rather than a compulsory -core representation, and named functions plus producer-owned controls are -clearer than nominal strategy objects. - -This ADR reconciles those decisions before Typing ADR 015 fixes the exact -signatures. The user has selected representation-oriented public names: -continuous geometry converts with `to_polygonal_surface` and -`to_tessellation`, while the operation concepts remain polygonization and -tessellation. Acceptance authorizes the coordinated implementation; it does -not claim that package source has already migrated. - -## Definitions - -- **Discretization** is the broad process of representing continuous geometry - with finite data. -- **Polygonization** discretizes a structured parametric `Shape` or untrimmed - `Surface` into a `PolygonalSurface`. It preserves quadrilateral cells where - the parameterization permits and uses triangles where the structure - requires them, for example at a sphere pole. Resolution controls are cell - counts, not geometric error bounds. -- **Triangulation** divides an existing polygon, collection of polygonal faces, - planar region, or planar point/domain input into triangles. Every operation - states whether it projects, inserts vertices, preserves source indices, and - mutates its source. -- **Tessellation** is precision-controlled triangle approximation of trimmed - surfaces, BRep faces, and BReps. Its controls are geometric approximation - criteria such as linear and angular deflection, not parameter-grid counts. - -The capitalized `Tessellation` remains a lightweight indexed-triangle -representation. A value of that type may be produced by either triangulation -or tessellation; the representation name does not redefine the operation that -created it. - -## Options - -1. **Use operation verbs as public methods.** Keep or refine `polygonize` and - `tessellate`. This exposes the process but makes continuous geometry naming - differ from established `to_mesh` and representation-conversion APIs. -2. **Expose only the primitive structured operation.** Shapes and untrimmed - surfaces provide `to_polygonal_surface`; callers explicitly invoke - `.triangulated()` afterward. This is minimal but removes the convenient - direct conversion to the visualization-oriented `Tessellation`. -3. **Use representation-oriented conversion names with producer-specific - availability.** Shapes and untrimmed surfaces expose both conversions; - BReps expose only `to_tessellation`; discrete inputs keep triangulation - verbs. The method documentation states whether polygonization or - tessellation performs the conversion. - -## Recommendation - -Choose option 3. - -### Shapes and untrimmed surfaces - -`Shape` and untrimmed `Surface` types expose the structured polygonization -conversion: - -```python -geometry.to_polygonal_surface(*, producer_specific_resolution) -> PolygonalSurface -``` - -Their resolution parameters are positive integer cell counts such as `nu` and -`nv`. They are supplied per operation, are not stored as defining geometry -state, and make no geometric-error guarantee. - -For direct scene and transfer use, the same producers also expose: - -```python -geometry.to_tessellation(*, producer_specific_resolution) -> Tessellation -``` - -This is not a precision-controlled tessellation operation or a second -approximation algorithm. Its vertices and triangle topology are exactly those -obtained through `to_polygonal_surface` with the same arguments and the -default no-insertion face triangulator. -Normals and texture coordinates may be attached only when one valid value -exists for every polygonized vertex in the same index order. The conversion -may not duplicate vertices or change connectivity; otherwise it omits the -attribute. Callers needing another diagonal or polygon algorithm use the -explicit two-step operation. - -Standalone `NurbsSurface` remains untrimmed and follows this structured -contract over its rectangular parameter domain. Extracting it from a BRep face -continues to lose trimming information. - -### BReps and trimmed faces - -`Brep` and `BrepFace` expose only the precision-controlled tessellation -conversion: - -```python -brep.to_tessellation( - *, - linear_deflection, - angular_deflection, -) -> Tessellation -``` - -They do not expose `to_polygonal_surface`, `polygonize`, or `tessellate`. A -BRep has no single underlying uniform parameter-grid structure to preserve as -a `PolygonalSurface`. The public conversion performs the BRep tessellation -operation. Converting its triangle result to another representation afterward -is a separate representation conversion, not BRep polygonization. - -Tessellation preserves face winding and relevant discretized boundary -polylines. Linear deflection is in model units and angular deflection has one -documented public angular unit. Whether those controls are required or have -deterministic public defaults is an independent decision in ADR 023. Exact -signatures, validation, and backend conversion belong to Typing ADR 015 after -that decision is accepted. - -### Discrete geometry and planar domains - -`Polygon`, `PolygonalSurface`, `Polyhedron`, and `Mesh` triangulate their -existing faces. `Mesh.triangulate` is mutating and returns `None`; -`triangulated` operations are non-mutating and return `Tessellation` where the -accepted representation contract requires it. Algorithm selection uses named -functions or a duck-typed callable, not strategy classes. - -`PlanarRegion` uses its own exterior-and-holes triangulation contract. Point -and domain Delaunay operations remain explicitly planar and return structural -coordinate/triangle buffers. Projection, source-coordinate preservation, and -Steiner insertion are stated by each named operation rather than inferred from -the result type. - -### Numerical and plugin boundaries - -Numerical triangle-mesh operations accept one structural coordinate/index -contract. Suitable Python sequences and NumPy arrays are first-class inputs. -They do not require `Tessellation`, `PolygonalSurface`, or `Mesh`, and do not -implicitly convert among those representations. A backend normalizes once at -its native ABI boundary and performs only the minimal safety checks required -for native access plus result-shape validation. - -Plugin wrappers and direct backend APIs implement the same semantic contract. -Lightweight registration modules may defer native imports, but discovery does -not change the operation terminology or input contract. - -### Representations - -Keep the three existing representation roles: - -| Representation | Role | -|---|---| -| `Tessellation` | Ephemeral indexed-triangle result with optional same-index attributes and boundary polylines. | -| `PolygonalSurface` | Serializable lightweight polygonal geometry with arbitrary face arity. | -| `Mesh` | Serializable mutable half-edge topology with keys and attributes. | - -Do not add `TriangleMesh`, `QuadMesh`, `TriangleSurface`, or a universal result -wrapper. Triangle and quad properties are structural/topological predicates, -not new nominal geometry classes. - -## Resolution, deflection, and tolerance - -- `nu` and `nv` are integer cell counts controlling structured polygonization. -- linear and angular deflection are approximation controls for BRep - tessellation and state their units explicitly. -- `max_edge_length` is a triangulation refinement target only where a named - operation supports it. -- `max_deviation` is an explicit projection acceptance bound for near-planar - polygon triangulation. -- `TOL` is reserved for numerical predicates, degeneracy, and planarity - comparisons. It is not a user-facing resolution or quality setting. - -No control is silently mapped to a non-equivalent quantity. - -## Superseded clauses if accepted - -This ADR preserves useful parts of the existing decisions but supersedes the -following clauses: - -| Earlier ADR | Superseded clause | -|---|---| -| 001 | Public operation verbs on continuous geometry. Polygonization and tessellation remain documented process concepts, while public continuous-geometry methods use representation-oriented `to_*` names. | -| 003 | The public `TessellationStrategy`, `Native`, `UGrid`, `UVGrid`, `Deflection`, and `Adaptive` hierarchy. Producer keywords and named operations replace it, consistent with accepted Typing ADR 013. | -| 005 | Public `polygonize`, `Brep`/`BrepFace` polygonal conversion, shared polygonization/tessellation strategies, and backend-dependent polygonization of unstructured BReps. Structured producers use `to_polygonal_surface`. | -| 006 | Public `polygonize`/`tessellate` verbs and independent shape/surface triangle connectivity. Structured producers expose both `to_*` conversions with exactly composed geometry/topology; BReps expose only `to_tessellation`. | -| 007, 017–019 | Nominal face strategy classes and their composite strategy. Their algorithmic, mutation, insertion, winding, and failure semantics remain, but selection moves to named functions and a callable aggregate boundary. | -| 008 | `Tessellation` as the compulsory input to numerical plugins. Accepted Typing ADR 012's structural buffers become authoritative. | -| 009 | Generic `NurbsSurface.tessellate(strategy)` as an independent rectangular-domain algorithm. It becomes `NurbsSurface.to_tessellation`, exactly composed from its structured `to_polygonal_surface` conversion; BRep ownership of trims remains unchanged. | -| 011, 020 | Delaunay strategy objects and `Tessellation`-only results. Named planar algorithms returning structural buffers become authoritative; planarity and insertion guarantees remain. | -| 012 | Core `Tessellation` extraction as the plugin boundary. Structural wrapper/hook parity and backend-local normalization replace it; lightweight discovery refinements remain. | -| 014 | Public operation verbs and two independent materialization paths for every continuous producer. Shape/surface conversions share one structured path; BRep `to_tessellation` directly performs tessellation. The no-cache decision remains. | -| 021 | Strategy-object defaults. Producer-owned `nu`/`nv` defaults replace Shape/Surface strategy defaults. BRep default policy is separated into ADR 023. | - -ADR 002's representation decision remains unchanged. ADR 009's BRep ownership -of trims, ADR 013's clean-break policy, ADR 015's continuous bounds, and ADR -016's removal of speculative capability discovery also remain unchanged. - -## Compatibility implications - -- Remove public `polygonize` and `tessellate` methods rather than retaining - aliases. Structured producers expose `to_polygonal_surface` and - `to_tessellation`; BReps expose only `to_tessellation`. -- Remove `Brep.polygonize`, `BrepFace.polygonize`, and both old BRep operation - hooks. The sole replacement hook is `brep_to_tessellation`. -- Remove public strategy classes, serialization, and exports without shims. -- Replace shape/surface `polygonize`/`tessellate` with the two `to_*` - conversions under the exact shared-path contract above; `to_tessellation` - may not select unrelated sampling or triangulation. -- Preserve `Tessellation` as a representation, but do not use it as a nominal - gate for numerical backends. -- Coordinate the breaking change across core, OCC, CGAL, libigl, model, - viewer, framework tests, examples, and documentation. - -## Verification - -- Assert exact conversion availability by producer family: both `to_*` - conversions for shapes/untrimmed surfaces, only `to_tessellation` for - BReps/BRepFaces, and triangulation verbs for discrete inputs/domains. -- Compare every shape/surface `to_tessellation` result with - `to_polygonal_surface(...).triangulated()` for identical vertices and - triangles. -- Verify sampled normals/UVs use the same vertex order without changing - connectivity, and are omitted where seams or creases require vertex - duplication. -- Assert that BRep polygonal conversion and old operation hooks are absent; - `brep_to_tessellation` respects documented deflection units and boundary - winding. -- Exercise Python and NumPy structural buffers directly through core dispatch - and backend APIs without constructing core geometry objects. -- Assert removed strategy classes and compatibility aliases are absent from - source exports, serialization, documentation, examples, and built packages. -- Run focused and full tests, Ruff, Pyright, strict documentation, distribution - checks, and cross-package integration before completion is claimed. - -## Affected packages - -`compas`, `compas_occ`, `compas_cgal`, `compas_libigl`, `compas_model`, -`compas_viewer`, and `compas_framework`. - -## Dependencies - -- [001 — Terminology](001-terminology.md), revisited by new evidence -- [002 — Mesh representations](002-mesh-representations.md) -- [009 — Trimmed surfaces](009-trimmed-surfaces.md) -- Typing-alignment ADR 012 — structural triangle-mesh boundaries -- Typing-alignment ADR 013 — explicit algorithms and producer controls - -## Decision - -Approved on 2026-11-05 as one coherent contract. The accepted choice keeps -public names representation-oriented, restricts BReps to -`to_tessellation`, removes overlapping operation verbs and strategy/input -abstractions without compatibility aliases, and preserves raw structural -numerical boundaries. The rationale is to keep the API simple, transparent, -and usable without requiring core geometry objects at numerical boundaries. diff --git a/initiatives/geometry-tessellation/decisions/023-brep-deflection-defaults.md b/initiatives/geometry-tessellation/decisions/023-brep-deflection-defaults.md deleted file mode 100644 index 1f84f3b..0000000 --- a/initiatives/geometry-tessellation/decisions/023-brep-deflection-defaults.md +++ /dev/null @@ -1,94 +0,0 @@ -# Title: Should BRep tessellation conversion require explicit deflection controls? - -## Status - -Accepted. - -## Context - -Accepted ADR 021 deliberately kept BRep and BRepFace deflection controls -mandatory because no backend-independent default had been approved. Accepted -Typing ADR 015 subsequently uses `None` to resolve deterministic defaults from -the core tolerance object. The user-authored terminology now makes BRep -tessellation the sole precision-controlled tessellation operation, which makes -the default policy more consequential rather than resolving it implicitly. - -The choice is independent of the accepted representation-oriented public -naming. `Brep.to_tessellation` performs the underlying tessellation operation. - -## Options - -1. **Require both controls.** Every call states its approximation request. - This is maximally explicit but makes generic scene conversion verbose and - forces every caller to select values without necessarily understanding the - model scale. -2. **Use deterministic core defaults when either keyword is omitted.** Resolve - `linear_deflection=None` from `TOL.lineardeflection` and - `angular_deflection=None` from the degree equivalent of - `TOL.angulardeflection` before plugin dispatch. This supports no-argument - visualization while keeping explicit overrides visible and backend - independent. -3. **Let each backend choose defaults.** This is convenient but makes the same - public call backend dependent and obscures units. - -## Recommendation - -Choose option 2: - -```python -brep.to_tessellation( - *, - linear_deflection: float | None = None, - angular_deflection: float | None = None, -) -> Tessellation -``` - -`BrepFace` exposes the same signature and delegates through `as_brep`. Core -resolves every `None` before dispatch to `brep_to_tessellation`. That plugin -hook receives concrete positive finite values and never chooses defaults. - -The defaults are operation policy, not a guarantee that either requested -deflection is an achieved error bound. Documentation must describe the backend -contract accurately. `TOL.temporary(...)` affects subsequent calls -deterministically and is covered by tests. - -## Consequences - -- Generic scene conversion can use `brep.to_tessellation()` without importing a - backend policy object. -- Explicit values and defaults use one public unit contract. -- Results may change inside an explicit `TOL.temporary(...)` context; there is - no caching contract. -- Backends cannot silently select different defaults. -- The defaults are conventional ambient policy, not values derived from BRep - dimensions or model scale. Applications working at materially different - scales pass explicit values or configure `TOL` deliberately. -- Users requiring reproducible values independent of ambient tolerance state - pass both keywords explicitly. - -## Verification - -- Compare omitted keywords with the corresponding explicit core tolerance - values. -- Cover one omitted and one explicit keyword independently. -- Verify `TOL.temporary(...)` resolution, fresh results, and source - non-mutation. -- Assert `brep_to_tessellation` rejects `None` and receives concrete - public-unit values. -- Verify OCC converts the angular value to radians exactly once. - -## Affected packages - -`compas`, `compas_occ`, and integration tests/documentation in -`compas_framework`. - -## Dependencies - -- [022 — Operation terminology and producer boundaries](022-operation-terminology-and-producer-boundaries.md) - -## Decision - -Approved on 2026-11-05. Deterministic core tolerance defaults support generic -no-argument visualization while keeping explicit overrides, public units, and -backend-independent behavior visible. Core resolves defaults before dispatch; -plugins never choose them. diff --git a/initiatives/geometry-tessellation/decisions/024-representation-preserving-mesh-triangulation.md b/initiatives/geometry-tessellation/decisions/024-representation-preserving-mesh-triangulation.md deleted file mode 100644 index 7055680..0000000 --- a/initiatives/geometry-tessellation/decisions/024-representation-preserving-mesh-triangulation.md +++ /dev/null @@ -1,158 +0,0 @@ -# Title: Should `Mesh.triangulated()` preserve the mesh representation? - -## Status - -Accepted. - -## Context - -Accepted ADR 007 and Typing ADR 015 currently make every aggregate -`triangulated(...)` operation return an ephemeral `Tessellation`. The user has -provided new evidence that this is wrong for `Mesh`: COMPAS mutating and -past-tense non-mutating pairs normally preserve the owning type, and converting -a rich half-edge datastructure to `Tessellation` discards its concrete class, -keys, attributes, defaults, and editable topology. - -This issue is specific to `Mesh`. `Polygon`, `PolygonalSurface`, `Polyhedron`, -and `PlanarRegion` do not have the same paired rich-topology mutation contract. - -## Options - -1. Keep `Mesh.triangulated(...) -> Tessellation` for uniform aggregate results. -2. Make `Mesh.triangulated(...) -> Self` while leaving the other aggregate - results unchanged. -3. Change every aggregate to return its own representation. -4. Add `TriangleMesh`, `Mesh.to_tessellation`, or another parallel conversion - API. - -## Recommendation - -Choose option 2: - -```python -def triangulate( - self, - triangulator: Triangulator | None = None, -) -> None: ... - -def triangulated( - self, - triangulator: Triangulator | None = None, -) -> Self: ... -``` - -The non-mutating method is semantically equivalent to: - -```python -result = self.copy() -result.triangulate(triangulator) -return result -``` - -An omitted triangulator and explicit `None` both use -`triangulate_polygon`. A supplied duck-typed callable is the only customization -path. Algorithm-specific arguments remain bound with tools such as -`functools.partial`. - -Keep these existing return contracts: - -```python -Polygon.triangulated(...) -> Tessellation -PolygonalSurface.triangulated(...) -> Tessellation -Polyhedron.triangulated(...) -> Tessellation -PlanarRegion.triangulated() -> Tessellation -``` - -Do not add `TriangleMesh`, `QuadMesh`, `Mesh.to_tessellation`, -`to_vertices_and_triangles`, or another alias. Triangle arity remains a -predicate on an ordinary `Mesh`. - -## Preservation contract - -The returned mesh: - -- has the same concrete type, expressed by `Self`; -- is independent from the source and follows standard `Data.copy()` identity - semantics, including a new GUID; -- preserves mesh attributes and default vertex, edge, and face attributes; -- preserves vertex keys and vertex attributes; -- preserves attributes on pre-existing edges, while new diagonals receive - defaults; -- preserves existing triangular faces, including their keys and attributes; -- replaces each non-triangular face with triangles inheriting that face's - attributes; -- makes no promise about keys or iteration order of generated faces; -- satisfies `is_trimesh()`; and -- leaves the source unchanged. - -The mutating method applies the same topology and attribute rules in place, -returns `None`, and stages and validates every replacement before modifying the -mesh. It does not invoke the custom triangulator for already-triangular faces. - -## Structural consumer path - -Numerical consumers explicitly extract the accepted structural boundary: - -```python -triangle_mesh = mesh.triangulated() -vertices, triangles = triangle_mesh.to_vertices_and_faces() -``` - -When an actual ephemeral representation is required, construction remains -explicit: - -```python -tessellation = Tessellation(vertices=vertices, triangles=triangles) -``` - -No implicit conversion is introduced. - -## Consequences - -- The past-tense Mesh operation preserves the information that defines a - Mesh. -- Raw numerical backends continue to accept structural buffers directly. -- Existing consumers expecting a `Tessellation` must extract vertices/faces or - explicitly construct one. -- The other aggregate return contracts remain stable and require independent - evidence before any later change. - -## Superseded clauses if accepted - -- ADR 007's universal `triangulated(...) -> Tessellation` clause is superseded - for `Mesh` only. -- ADR 022's discrete-geometry paragraph is clarified so `Mesh.triangulated` - is representation-preserving while the other accepted aggregate results - remain `Tessellation`. -- Typing ADR 015's shared aggregate return signature is split into the `Mesh` - signature above and the unchanged signatures for the other aggregates. -- ADR 002 remains authoritative that `Tessellation` is the sole ephemeral - indexed-triangle representation; not every operation producing triangle - topology must return it. - -## Verification - -- Verify `Self` typing and preservation of a concrete Mesh subclass. -- Verify source independence, new identity, and source immutability. -- Verify omitted/`None` equivalence, arbitrary callables, and - `functools.partial`. -- Verify existing triangle keys, split-face attribute inheritance, mesh and - default attributes, vertex data, source-edge data, and new diagonal defaults. -- Verify atomic failure for invalid callback output. -- Verify raw tuple extraction and explicit `Tessellation` construction. -- Verify unchanged `Tessellation` returns for the other aggregates. -- Migrate and test glTF, volume, CGAL, libigl, model, examples, typing fixtures, - and documentation. - -## Affected packages - -`compas`, `compas_cgal`, `compas_libigl`, `compas_model`, and -`compas_framework`. No current OCC or viewer call site requires a source -change, but integration tests must protect the unchanged aggregate contracts. - -## Dependencies - -- [002 — Mesh representations](002-mesh-representations.md) -- [007 — Triangulation operations](007-triangulation-operations.md) -- [022 — Operation concepts and conversion boundaries](022-operation-terminology-and-producer-boundaries.md) -- Typing ADR 015 — exact triangulation and discretization APIs diff --git a/initiatives/geometry-tessellation/decisions/README.md b/initiatives/geometry-tessellation/decisions/README.md deleted file mode 100644 index b433c00..0000000 --- a/initiatives/geometry-tessellation/decisions/README.md +++ /dev/null @@ -1,184 +0,0 @@ -# Geometry Tessellation Architecture Decisions - -This directory decomposes the architecture proposal into independently -reviewable decisions. ADRs 001–024 are **Accepted**. ADRs 022–024 reconcile the earlier -architecture with the user-authored operation definitions. The target -architecture prioritizes one clean, coherent API over backward compatibility; -breaking effects are recorded rather than mitigated through permanent aliases. - -## Decision index - -| Order | ADR | Status | Depends on | Consequential tradeoff | -|---:|---|---|---|---| -| 1 | [001 — Terminology](001-terminology.md) | Accepted | None | Consistency across packages versus preserving subsystem-specific vocabulary. | -| 2 | [002 — Mesh representations](002-mesh-representations.md) | Accepted | 001 | Retain distinctly ephemeral `Tessellation` versus adding mesh/surface containers that imply persistence or topology. | -| 3 | [003 — Strategy objects](003-strategy-objects.md) | Accepted | 001 | One serializable strategy hierarchy with explicit native, one-parameter, two-parameter, deflection, and adaptive policies. | -| 4 | [004 — Error contracts](004-error-contracts.md) | Superseded by 016 | 001, 003 | Historical capability/error design; removed after implementation showed no consumer or backend result source. | -| 5 | [005 — Output topology](005-output-topology.md) | Accepted | 001, 002, 003 | Fresh `polygonize(strategy) -> PolygonalSurface` preserves natural cells with explicit dimensional strategy support. | -| 6 | [006 — Tessellation API](006-tessellation-api.md) | Accepted | 002, 003, 005 | Symmetric `polygonize`/`tessellate` operations plus explicit polygonize-then-triangulate control, without cached/scalar/topology-flag alternatives. | -| 7 | [007 — Triangulation operations](007-triangulation-operations.md) | Accepted | 001, 002, 005 | Serializable diagonal/ear-clipping face strategies with explicit mutation, key, attribute, and vertex-insertion semantics. | -| 8 | [008 — Triangle interoperability](008-triangle-interoperability.md) | Accepted | 002, 005, 006, 007 | `Tessellation` as the sole plugin input versus a universal conversion facade or public input union. | -| 9 | [009 — Trimmed surfaces](009-trimmed-surfaces.md) | Accepted | 003, 004, 006 | BRep ownership of trims versus expanding standalone NURBS surface semantics. | -| 10 | [010 — Metadata and provenance](010-metadata-provenance.md) | Accepted | 002, 003, 004, 009 | Defer enriched results; keep stable simple returns and require a future ADR for operation-specific metadata APIs. | -| 11 | [011 — Planar triangulation contract](011-planar-triangulation-contract.md) | Accepted | 001, 003, 004, 007, 008 | Tolerance-checked planar APIs preserve input coordinates exactly and lift generated vertices onto the selected plane. | -| 12 | [012 — Plugin boundaries](012-plugin-boundaries.md) | Accepted | 008, 011 | Core `Tessellation` validation/extraction with backend-owned native coercion versus divergent direct package APIs. | -| 13 | [013 — Compatibility](013-compatibility.md) | Accepted | 006, 007, 009, 010, 011, 012 | COMPAS 3.0 synchronized breaking baseline versus staged aliases and mixed-version contracts. | -| 14 | [014 — Continuous geometry materialization](014-continuous-geometry-materialization.md) | Accepted | 003, 005, 006, 013 | Defining analytic state only, with explicit fresh operations and no stored resolution or derived caches. | -| 15 | [015 — Continuous bounds](015-continuous-bounds.md) | Accepted | 014 | Certified continuous enclosures versus sampled bounds; minimum-volume OBB semantics versus parameter-frame boxes. | -| 16 | [016 — Capability discovery](016-capability-discovery.md) | Accepted | 003, 004, 010, 013 | Remove unused runtime discovery and error schemas versus retaining speculative public contracts. | -| 17 | [017 — Mixed-face triangulation](017-mixed-face-triangulation.md) | Accepted | 003, 007, 013 | Composite quad/n-gon policy versus one algorithm, fallback lists, or arity maps. | -| 18 | [018 — Robust polygon triangulation](018-robust-polygon-triangulation.md) | Accepted | 003, 007, 011, 012, 017 | Tiered strict/projection/arrangement contracts versus one opaque universal strategy. | -| 19 | [019 — Twisted polygon triangulation](019-twisted-polygon-triangulation.md) | Accepted | 003, 007, 017 | Minimum-area 3D dynamic programming versus a misattributed or speculative multi-objective policy. | -| 20 | [020 — Planar Delaunay naming](020-planar-delaunay-naming.md) | Accepted | 003, 011, 012, 013 | Explicit planar operation names while retaining standard Delaunay strategy names. | -| 21 | [021 — Default tessellation strategy](021-default-tessellation-strategy.md) | Accepted | 003, 006, 014 | Deterministic Shape/Surface defaults versus mandatory policy or backend-chosen defaults. | -| 22 | [022 — Operation concepts and conversion boundaries](022-operation-terminology-and-producer-boundaries.md) | Accepted | 001, 002, 009; Typing 012–013 | Representation-oriented `to_*` APIs backed by structured polygonization, discrete triangulation, or BRep tessellation as appropriate. | -| 23 | [023 — BRep conversion deflection defaults](023-brep-deflection-defaults.md) | Accepted | 022 | Deterministic core tolerance defaults versus mandatory values or backend-owned defaults. | -| 24 | [024 — Representation-preserving Mesh triangulation](024-representation-preserving-mesh-triangulation.md) | Accepted | 002, 007, 022; Typing 015 | Preserve `Mesh` type, topology, keys, and attributes versus a universal ephemeral result. | - -## Dependency graph - -```text -001 <- none -002 <- 001 -003 <- 001 -004 <- 001, 003 -005 <- 001, 002, 003 -006 <- 002, 003, 005 -007 <- 001, 002, 005 -008 <- 002, 005, 006, 007 -009 <- 003, 004, 006 -010 <- 002, 003, 004, 009 -011 <- 001, 003, 004, 007, 008 -012 <- 008, 011 -013 <- 006, 007, 009, 010, 011, 012 -014 <- 003, 005, 006, 013 -015 <- 014 -016 <- 003, 004, 010, 013 -017 <- 003, 007, 013 -018 <- 003, 007, 011, 012, 017 -019 <- 003, 007, 017 -020 <- 003, 011, 012, 013 -021 <- 003, 006, 014 -022 <- 001, 002, 009, Typing 012, Typing 013 -023 <- 022 -024 <- 002, 007, 022, Typing 015 -``` - -## Recommended implementation and review sequence - -Apply and independently review the ADRs in numeric dependency order: - -1. **Conceptual foundation:** ADRs 001–004 establish vocabulary, - representation roles, serializable policies, and honest error semantics. -2. **Public geometry API:** ADRs 005–008 decide topology, public methods, - mutation conventions, and the common triangle boundary. -3. **Specialized geometry and metadata:** ADRs 009–010 decide trim ownership - and whether enriched results are optional envelopes. -4. **Cross-package integration:** ADRs 011–012 resolve the incompatible planar - contract and native plugin boundary. -5. **Breaking transition:** ADR 013 should be reviewed last because the exact - removals depend on all approved public contracts. -6. **Continuous-state cleanup and bounds:** implement ADR 014 after the explicit - strategy operations it depends on, then implement ADR 015 without restoring - any implicit discretization dependency. -7. **Capability cleanup:** ADR 016 supersedes the discovery and error-schema - portion of ADR 004; remove those speculative APIs after explicit operations - and validation are in place. -8. **Mixed-face triangulation:** ADR 017 supersedes the collection-level policy - portion of ADR 007 and introduces explicit quad/n-gon dispatch. -9. **Robust polygon triangulation:** ADR 018 authorizes strict and projected - face policies before any exact-intersection planar-arrangement plugin. -10. **Twisted polygons:** ADR 019 authorizes an opt-in minimum-area 3D leaf - strategy and renames the low-level polygon helper. -11. **Planar operation naming:** ADR 020 makes planarity explicit in Delaunay - operation names while retaining standard strategy names. -12. **Default tessellation:** ADR 021 relaxes the mandatory-strategy rule only - for ephemeral Shape and Surface tessellation. -13. **Terminology reconciliation:** implement accepted ADR 022 before further - triangulation/discretization integration. It supersedes the listed - operation, strategy, and plugin-input clauses while preserving the - unaffected representation, trim-ownership, bounds, and clean-break - decisions. -14. **BRep defaults:** implement accepted ADR 023 after ADR 022; exact accepted - Typing ADR 015 signatures depend on both. -15. **Mesh result correction:** implement Accepted ADR 024 after the aggregate - callable contract, preserving the concrete mesh representation, topology, - keys, attributes, identity semantics, and source immutability. - -## Highest-impact accepted decisions - -- Retain `Tessellation` because its distinct name communicates an ephemeral - operation result and avoids confusion with serializable `PolygonalSurface` - and half-edge `Mesh`; reject additional `TriangleSurface`, `TriangleMesh`, - `QuadMesh`, and universal `TessellationResult` containers (ADR 002). -- Public strategy hierarchies are removed. Shapes and untrimmed surfaces use - producer-owned cell-count keywords; BReps use explicit linear/angular - deflection keywords; numerical triangulation uses named functions and - structural buffers (ADR 022 and Typing ADR 015, superseding affected clauses - of ADR 003). -- Runtime capability discovery and its reserved error schemas are removed - without replacement. Producers validate explicit strategies directly and - document support; discovery or measured-error results return only for a - concrete future consumer and backend source (ADR 016, superseding ADR 004). -- Shapes and untrimmed surfaces expose fresh, non-mutating - `to_polygonal_surface(...)` and exact composed `to_tessellation(...)` - conversions. BReps expose only precision-controlled `to_tessellation(...)`; - public `polygonize` and `tessellate` verbs are removed (ADR 022, superseding - affected clauses of ADRs 005–006). -- Discrete triangulation uses named functions and an optional duck-typed - aggregate triangulator callable. Omitted and explicit `None` selectors use - the default polygon triangulator. Nominal face-strategy objects are removed - without aliases (Typing ADR 015, superseding affected clauses of ADR 007). -- Named strict/projected/minimum-area polygon functions retain the approved - algorithms for planar, near-planar, and twisted ordered rings without the - superseded nominal strategy classes (ADRs 017–019 and Typing ADR 015). -- Named Delaunay functions operate only on planar domains and return structural - vertex/triangle buffers. The `Delaunay`, `ConstrainedDelaunay`, and - `ConformingDelaunay` flag classes are removed (Typing ADR 015, superseding - the naming choice in ADR 020). -- Shape and Surface conversions resolve producer-owned cell-count defaults; - BRep/BRepFace conversions resolve omitted deflections from core tolerance - before plugin dispatch (ADRs 022–023, superseding affected clauses of ADR - 021). -- Trims remain owned by BRep faces/BReps instead of changing standalone - `NurbsSurface` (ADR 009). -- Enriched tessellation results are deferred: initial APIs have no report flag, - union return, universal report/result wrapper, or parallel detailed method. - Any future enriched operation requires its own ADR, concrete consumer/backend - source, named API, and operation-specific stable result type (ADR 010). -- Planar triangulation uses separate serializable Delaunay strategies, - validated model-unit/degree quality targets, tolerance-checked world/frame - planes, exact input-coordinate preservation, and on-plane generated Steiner - vertices (ADR 011). -- Numerical plugins accept core-owned structural buffers and normalize once at - native boundaries; `Tessellation` remains a useful representation but is not - a mandatory algorithm gate (Typing ADRs 012 and 015–017, superseding affected - clauses of Geometry ADRs 008 and 012). -- All superseded APIs are removed in the coordinated COMPAS 3.0 breaking - release without compatibility aliases or a deprecation period. Affected - plugins require `compas>=3.0.0`; existing major upper bounds advance to `<4` - where used (ADR 013). -- Continuous geometry retains no stored resolution or derived discretization - caches. Materialization occurs only through explicit fresh operations; exact - shape-specific finite data such as `Box.points` remains available (ADR 014). - -- Continuous bounds use exact parameter-derived AABBs for analytic shapes and - full-domain analytic surfaces, certified-only NURBS bounds, and retain - minimum-volume `obb` semantics with unsupported cases instead of sampled or - parameter-frame fallbacks (ADR 015). -- Runtime tessellation capability discovery and unused error schemas are - removed without replacement; explicit operations validate their strategies - directly (ADR 016, superseding ADR 004). - -## Status policy - -- **Proposed:** recommended but not explicitly approved. -- **Accepted:** explicitly approved and authoritative for implementation. -- **Superseded:** historically accepted, but no longer implementation authority - where a later Accepted ADR replaces it. -- **Rejected:** the architectural decision itself was explicitly rejected; - rejected alternatives inside an ADR do not change its status. - -The Accepted ADRs define the implementation architecture. Implementation, -review, merge, and publication remain subject to the ownership, testing, and -coordination rules in `AGENTS.md`. diff --git a/initiatives/geometry-tessellation/definitions.md b/initiatives/geometry-tessellation/definitions.md deleted file mode 100644 index 1af79a5..0000000 --- a/initiatives/geometry-tessellation/definitions.md +++ /dev/null @@ -1,33 +0,0 @@ -# Definitions - -## Poligonisation - -To divide into polygons. - -Polygonisation divides parametric surfaces and shapes into quads where possible, and triangles where necessary (for example, near the poles of a sphere). - -The objective is to create structured, discrete representations. - -The output is a `PolygonalSurface`. - -Since BReps don't have a clear underlying uniform structure, they cannot be converted to a polygonal representation in this way. - -## Triangulation - -To divide into triangles. - -Polygons can be divided into triangles using various strategies. - -Quads can be split along a diagonal. - -Ngons can be split using earclipping or through a delaunay triangulation, depending on the desired qualities of the result. - -Polygons that are near planar can still be processed in this way by projecting onto a bestfit plane. - -Polygons that are far from planar require more sophisticated approaches that may require the insertion of additional points. - -For general planar regions different delaunay strategies exist to generate (constrained) triangulations. - -## Tessellation - -Although technically, this means to populate a surface or shape with noon-overlapping tiles, in the context of computational geometry, it is often understood as a form of triangulation, usually for visualisation purposes, of BReps and trimmed (nurbs) surfaces, with a required precision, typically formulated through a linear and/or angular deflection criteria. diff --git a/initiatives/geometry-tessellation/inventory.md b/initiatives/geometry-tessellation/inventory.md deleted file mode 100644 index 4cab49e..0000000 --- a/initiatives/geometry-tessellation/inventory.md +++ /dev/null @@ -1,323 +0,0 @@ -# Geometry Discretization, Tessellation, and Triangulation Inventory - -Status: restarted reconnaissance complete (2026-11-01) - -This inventory was rebuilt from fresh, read-only investigations after the -initiative objective was expanded. The earlier initiative documents were not -used as authoritative sources. The investigation covered `compas`, -`compas_occ`, `compas_cgal`, `compas_libigl`, `compas_gmsh`, and the visible -`compas_model` working tree. No package source was modified and no tests were -run during reconnaissance. - -## Executive findings - -1. Core already has three different mesh-like representations: ephemeral - triangle buffers (`Tessellation`), persistent polygon buffers - (`PolygonalSurface`), and rich mutable topology (`Mesh`). A new mesh class - must justify overlap with all three. -2. Existing surface and shape tessellation is uniform and count-controlled. - There is no `UVGrid`, adaptive/error-controlled strategy, common strategy - base, or serialized tessellation configuration. -3. Trim-aware NURBS tessellation exists only at the OCC BRep level. A standalone - `NurbsSurface` has no trim loops; sampling an underlying surface does not - preserve face trims or holes. -4. Tessellation and triangulation are distinct in parts of the API, but naming, - mutation behavior, diagonal choice, vertex insertion, and results vary. -5. CGAL and libigl predominantly consume raw `(vertices, faces)` triangle - buffers. OCC instead converts a rich `Mesh`. No shared adapter or validation - boundary spans these representations. -6. Core and CGAL constrained/conforming Delaunay signatures are incompatible, - and CGAL lacks current plugin entry-point metadata. Direct CGAL tests miss - both problems. -7. `Tessellation` carries normals, UVs, and boundary polylines, but not strategy, - source-face/trim correspondence, error estimates, or validation status. - Plugin-specific results already carry richer provenance. -8. Framework-level integration coverage is absent. Trimmed faces, periodic - seams, approximation quality, plugin dispatch, native interoperability, and - strategy serialization remain major gaps. - -## Current representations - -### `compas.geometry.Tessellation` - -Source: `../compas/src/compas/geometry/tessellation.py`. - -- Frozen, slotted, lightweight result with required `vertices` and indexed - `triangles`. -- Optional same-index `vertex_normals` and `texture_coordinates`; independent - `polylines` are intended for BRep edges. -- Retains buffers without copying. Tests require exact input-buffer identity. -- Same-index attributes deliberately require duplicate vertices at seams. -- Explicitly ephemeral and non-serializable; it does not inherit `Data`. -- Converts to independent `PolygonalSurface` and `Mesh` objects. -- Does not validate shape, arity, bounds, finiteness, winding, manifoldness, or - attribute lengths. -- Carries no strategy, source geometry, source-face/trim mapping, error - estimate, or provenance status. - -This is already a compact triangle-buffer candidate, but it is not a persistent -mesh, serialized result, or validated native boundary. - -### `compas.geometry.PolygonalSurface` - -Source: `../compas/src/compas/geometry/polygonal_surface.py`. - -- Persistent, serializable indexed polygon storage without half-edge topology. -- Supports arbitrary face arity and exposes closed/manifold/orientable/oriented - queries. -- Its triangle view preserves triangles and Earcut-triangulates other faces - without adding vertices. -- Cached tessellation shares its internal vertex list; tuple conversion copies. -- Basic vertex/index validation exists, but getters expose internal mutable - lists, so in-place edits can bypass cache invalidation. - -### `compas.datastructures.Mesh` - -Source: `../compas/src/compas/datastructures/mesh/mesh.py`. - -- Persistent, mutable half-edge topology with attributes and algorithms. -- `to_vertices_and_faces(triangulated=True)` is non-mutating: triangles pass - through, quads split on `(a, c)`, and n-gons gain a centroid and fan. -- `quads_to_triangles()` mutates and splits on the opposite `(b, d)` diagonal - while preserving face attributes. -- `is_trimesh()` and `is_quadmesh()` classify topology, but no dedicated - `TriangleMesh` or `QuadMesh` runtime class exists. -- No general `triangulated()`, `triangulate()`, or `to_triangle_mesh()` method - was found. - -Core `MeshType` is only a tuple of coordinate and face-index sequences -(`../compas/src/compas/_typing.py`). It does not encode triangle arity, -topology, metadata, or rich objects. - -## Continuous geometry - -### Parametric surfaces - -Source: `../compas/src/compas/geometry/surfaces/surface.py`. - -- Stored U/V face-count defaults are 16 with minimum 1; per-call controls are - `nu`, `nv`, and optional domain subsets `du`, `dv`. -- Uniform tensor-product sampling yields `(nu + 1) * (nv + 1)` vertices, - `nu * nv` quads, and `2 * nu * nv` triangles. -- Tessellation splits cells on `(a, c)` and can add analytic normals and - normalized grid UVs. -- Polygon/mesh conversions preserve quads; `to_triangles()` returns coordinate - triples rather than indexed faces. -- Periodicity flags exist, but both endpoints are sampled and not welded. -- Singularities, coincident seams, reversed domains, watertightness, - manifoldness, and approximation error have no common handling. -- No adaptive refinement, deviation control, error estimate, or guarantee - exists. - -Core `NurbsSurface` inherits this generic path and stores control points, -weights, knots, degrees, domains, and periodic flags -(`../compas/src/compas/geometry/surfaces/nurbs.py`). It stores no trim loops or -holes. Trimming belongs to a BRep face, which exposes its underlying surface, -ordered loops, and orientation (`../compas/src/compas/geometry/brep/face.py`). - -### Analytical shapes and curves - -`Shape` (`../compas/src/compas/geometry/shapes/shape.py`) uses stored U/V -resolution with minimum 3 and per-call names `u`/`v`. Concrete shapes may ignore -one or both dimensions. Tessellation passes triangles, splits quads on `(a, c)`, -rejects other faces, and omits normals, UVs, strategy, error, and provenance. - -`Curve.to_points()` and `Curve.to_polyline()` uniformly sample parameter space -(`../compas/src/compas/geometry/curves/curve.py`). Counts have different -defaults/meanings and provide no arc-length or deviation guarantee. - -## BRep and OCC tessellation - -Core `brep_tessellate()`, misspelled `Brep.to_tesselation()`, and -`Brep.to_viewmesh()` return `(Mesh, list[Polyline])`. `Brep.to_meshes(u, v)` -forwards count-style keywords through a deflection-oriented plugin boundary. -See `../compas/src/compas/geometry/brep/operations.py` and `brep/brep.py`. - -`OCCBrep.compute_tessellation()` -(`../compas_occ/src/compas_occ/brep/brep.py`): - -- Calls OpenCASCADE incremental BRep meshing with linear/angular deflection on - actual trimmed face topology. -- Extracts face-local vertices, fixes reversed-face winding, and extracts - topological edge polylines with curve-sampling fallback. -- Returns core `Tessellation`; correctly spelled and legacy tuple-returning - methods coexist. -- Does not attach UVs, normals, source-face IDs, trim-loop IDs, selected - controls, or measured/guaranteed error. -- Uses truth-value defaults, so explicit `0.0` becomes the global default. -- Edge fallback sampling may use unrelated curve resolution. -- `to_meshes(u, v)` instead samples underlying NURBS surfaces and does not - visibly apply trim loops. - -Trim-aware NURBS tessellation is therefore a BRep operation, not a standalone -surface operation. - -## Algorithms and semantics - -### Local triangulation policies - -- Surface/shape tessellation: fixed `(a, c)` diagonal. -- Non-mutating `Mesh` conversion: `(a, c)` for quads and centroid fans for - n-gons, possibly adding vertices. -- Mutating `Mesh.quads_to_triangles()`: `(b, d)` diagonal. -- `PolygonalSurface`: Earcut for non-triangular faces without adding vertices. - -These differ in diagonal, allocation, vertex preservation, quality, and -mutation while using related terminology. - -### Earcut and Delaunay - -Core Earcut (`../compas/src/compas/geometry/triangulation_earclip.py`) supports -an exterior and holes, projects using the first usable exterior triple, -validates with Shapely, triangulates with Mapbox Earcut, and restores winding. -It preserves vertices but has no caller tolerance or coplanarity check. Its -documentation says best-fit plane although the implementation is not a -least-squares fit. - -The visible `compas_model` tree has a separate tolerance-aware Earcut result -and algorithm with duplicate/collinear cleanup, Newell-normal projection, -coverage checks, and ring offsets, with different source-index semantics. - -Core Delaunay (`../compas/src/compas/geometry/triangulation_delaunay.py`) uses -SciPy/XY for plain Delaunay and returns only faces. Constrained/conforming APIs -are plugin-only and return `(V, F)`; conforming controls are `angle` and `area`. - -CGAL uses `boundary, points, holes, curves`, works in XY, and sets constrained -output Z to zero. Its conforming implementation does not accept core quality -arguments. Refined meshing exposes `maxlength`; native minimum-angle input is -unused, concave-hole seeds use arithmetic means, and optional Lloyd optimization -is iteration-limited. - -### Refinement, remeshing, simplification - -- Core subdivision returns new meshes through named schemes; this is topology - refinement/smoothing, not a continuous-surface approximation strategy. -- Core also has a mutating heuristic triangle remesher, while geometry-level - remeshing pluggables return tuples. -- CGAL adds backend-only feature-protection controls. -- libigl isoline remeshing returns face labels beyond the core annotated pair. -- No common refinement strategy or general mesh decimation API was found. - -## Strategy and control inventory - -No shared `UVGrid`, `Adaptive`, strategy base, serializable tessellation -configuration, or common error model exists. Current controls are backend- and -operation-specific: - -- surface/shape U/V counts; -- OCC linear/angular deflection; -- CGAL planar maximum edge length and partially exposed angle/area concepts; -- Gmsh size and curvature options; -- remeshing targets and feature-protection flags. - -No common API separates requested policy from backend algorithm, estimated -error from guaranteed bounds, output topology from sampling policy, or numeric -cleanup tolerance from approximation controls. New serializable strategies -must follow COMPAS `Data` conventions without implying equivalent backend -capabilities. - -## Plugin and triangle-mesh interoperability - -- COMPAS discovers plugins through the `compas.plugins` entry-point group - (`../compas/src/compas/plugins.py`). OCC declares and tests current entries. -- CGAL retains legacy `__all_plugins__` but has no current entry-point table; - the list also omits decorated skeletonization functions. -- Core validates calls against implementation signatures. Core/CGAL - constrained and conforming Delaunay signatures are incompatible; positional - calls can misbind and keyword calls can fail. -- CGAL direct tests do not exercise discovery or core dispatch. -- CGAL and libigl mainly use `(vertices, triangular_faces)` and repeat NumPy - coercion. CGAL annotations say `int64` while wrappers usually use `int32`. -- CGAL geodesics is a useful precedent for accepting either `Mesh` or tuple via - one conversion helper. OCC instead requires a rich `Mesh` and `is_trimesh()`. -- Native wrappers do not consistently validate arity, bounds, finiteness, - orientation, closedness, or manifoldness. Required validation varies by - operation. -- CGAL operation-specific results may include intersection edges, source-face - mappings, or skeleton correspondence. A bare pair cannot represent all - provenance, but simple conversions should not require it. - -A shared interface must separate representation adaptation, backend dtype/ -layout coercion, and operation-specific topology validation. - -## Tests and documentation - -Existing tests protect: - -- `Tessellation` zero-copy identity, independent persistent conversions, - same-index attributes, winding, optional attributes, per-call non-mutation, - topology distinctions, and cache identity/invalidation; -- surface/shape counts, topology, placement, periodicity flags, finite domains, - and resolution limits; -- Earcut/regions/polygonal geometry winding, holes, validity, area, and indices; -- mesh conversion counts, mutation, face attributes, and tri/quad classification; -- OCC NURBS serialization/generic tessellation and basic BRep box tessellation; -- CGAL native dtype/layout, remeshing behavior, Delaunay forms, and equivalent - geodesic results from `Mesh` and tuple input; -- model rendering's distinction between fill triangles and source boundaries, - plus intentionally different collision/contact/sectioning policies. - -Major gaps: - -- strategy serialization, adaptive control, deviation measurement, and - guaranteed-error tests; -- trimmed/holed BRep tessellation behavior, trim orientation, and provenance; -- periodic seam topology, singularities, watertightness, and manifoldness; -- OCC deflection monotonicity, explicit-zero, global-tolerance cache behavior; -- CGAL discovery and dispatched signature compatibility; -- shared tuple/`Tessellation`/`PolygonalSurface`/`Mesh` adapter contracts; -- core/OCC-to-CGAL or libigl integration; -- any framework geometry coverage beyond the package version test. - -Core has no narrative terminology/strategy/metadata guide. CGAL examples teach -raw tuples; OCC lacks a focused trimmed-surface tessellation example. No -migration guide reconciles cached/computed/converted tessellations, the legacy -misspelling, raw tuples, persistent meshes, and mutation semantics. - -## Regression and compatibility constraints - -1. Preserve `Tessellation` buffer identity and independent conversions. -2. Keep polygon-preserving conversion distinct from triangle conversion. -3. Do not weld equal seam positions when normals or UVs differ. -4. Do not silently serialize an intentionally ephemeral result. -5. Keep per-call controls non-mutating and cache keys policy-complete. -6. State mutation, vertex insertion, source-index, and topology behavior. -7. Keep trim-aware BRep tessellation distinct from untrimmed surface sampling. -8. Do not equate counts, deflection, edge length, area, angle, cleanup - tolerance, estimates, or guaranteed bounds. -9. Preserve orientation, holes, source boundaries, attributes, and provenance. -10. Keep topological boundaries separate from generated internal diagonals. -11. Test native dtype/layout without imposing NumPy on core types. -12. Align plugin discovery and signatures before dispatch integration. -13. Reconcile the heavily modified `compas_model` worktree before editing it. - -## Architectural questions - -- Should existing `Tessellation` be the lightweight triangle interchange, or - does a compact `TriangleMesh` justify another container? -- Should output topology be independent from a serializable tessellation - strategy? -- Which strategies are portable configuration and which describe backend - capability? How are unsupported guarantees reported? -- Does optional metadata belong in a result envelope, operation-specific - result objects, or the mesh itself? -- How should trim-aware surface input be represented without pretending a - standalone `NurbsSurface` owns BRep loops? -- What are the canonical mutating/non-mutating triangulation verbs? -- What validation belongs in a shared adapter versus each operation? -- How should tuple-returning and misspelled BRep APIs migrate? - -## Affected packages - -- `compas`: shared terminology, strategies/results/interfaces, surface/shape/ - mesh APIs, triangulation pluggables, validation, tests, and docs. -- `compas_occ`: trim-aware BRep tessellation, deflection, provenance, caching, - compatibility APIs, tests, and examples. -- `compas_cgal`: discovery/signatures, native coercion, algorithms, - provenance, tests, and docs. -- `compas_libigl`: shared triangle-buffer adoption and result alignment. -- `compas_gmsh`: comparison of existing sizing controls without false - equivalence. -- `compas_model`: overlapping Earcut and regression-sensitive downstream uses. -- `compas_framework`: cross-package fixtures, integration, native-backend, - roundtrip, and performance coverage. diff --git a/initiatives/geometry-tessellation/objective.md b/initiatives/geometry-tessellation/objective.md deleted file mode 100644 index 2ec2a9a..0000000 --- a/initiatives/geometry-tessellation/objective.md +++ /dev/null @@ -1,249 +0,0 @@ -# Geometry Discretization, Tessellation, and Triangulation - -## Objective - -Modernize and unify the discretization, tessellation, and triangulation APIs across the core COMPAS packages. - -Establish consistent methods for converting parametric shapes, surfaces, quad and triangle surfaces, and polygonal meshes into discrete mesh representations. - -The resulting interfaces should be intuitive, extensible, and suitable for use by geometry-processing plugins such as `compas_cgal`, which operate on triangle mesh representations. - -The initiative should build on existing COMPAS abstractions and conventions, avoiding unnecessary duplication or architectural complexity. - -## Scope - -The initiative covers: - -- Discretization and tessellation of analytical and parametric shapes and surfaces. -- Tessellation of NURBS surfaces, including trimmed surfaces. -- Triangulation of quad meshes and general polygonal meshes. -- Unified conversion to triangle mesh representations. -- Tessellation and triangulation strategies. -- Evaluation of dedicated mesh representations. -- Integration with geometry-processing plugins. -- Consistent testing, documentation, and examples across affected packages. - -Relevant packages include `compas`, `compas_occ`, `compas_cgal`, and potentially other packages identified during the investigation. - -## Conceptual Terminology - -Establish a consistent distinction between the following operations: - -| Operation | Meaning | -|---|---| -| Sampling | Evaluating discrete points on continuous geometry | -| Discretization | Representing continuous geometry using discrete samples | -| Tessellation | Approximating continuous surfaces with polygonal meshes | -| Triangulation | Partitioning polygonal faces or domains into triangles | -| Refinement | Increasing mesh resolution | -| Remeshing | Reconstructing or modifying mesh discretization | -| Simplification | Reducing mesh complexity | - -These definitions should guide API naming and documentation while remaining compatible with established computational geometry terminology. - -## API Design Principles - -### 1. Consistent operations and conversions - -Investigate a unified set of methods across supported geometry representations. - -Candidate operations include: - -```python -surface.tessellate(...) -mesh.triangulate(...) -mesh.triangulated(...) -geometry.to_mesh(...) -geometry.to_triangle_mesh(...) -``` - -Distinguish between: - -- **Operations**, such as tessellation and triangulation. -- **Representation conversions**, such as `to_mesh()` and `to_triangle_mesh()`. -- **Mutating and non-mutating methods**, following existing COMPAS conventions. - -Avoid introducing redundant methods without a clear semantic distinction. - -### 2. Explicit tessellation strategies - -Separate the tessellation operation from the strategy controlling how the approximation is constructed. - -Investigate at least two strategy families: - -**Resolution-controlled tessellation** - -```python -surface.tessellate(strategy=UVGrid(nu=32, nv=16)) -``` - -**Error-controlled tessellation** - -```python -surface.tessellate( - strategy=Adaptive( - max_deviation=0.01, - max_angle=0.1, - ) -) -``` - -Strategies should be lightweight, serializable configuration objects, preferably compatible with the COMPAS `Data` infrastructure. - -Clearly distinguish resolution control, error estimation, and mathematically guaranteed error bounds. - -The strategy should describe the approximation policy without necessarily implementing the underlying geometry algorithm. - -### 3. Separate tessellation and triangulation - -Tessellation and triangulation should remain conceptually distinct. - -For example: - -```python -quadmesh = torus.tessellate(strategy=UVGrid(32, 16)) - -trimesh = quadmesh.triangulated() -``` - -Triangulation strategies may include diagonal splitting, ear clipping, and constrained triangulation where appropriate. - -Consider whether output topology should be specified independently from tessellation strategy. - -### 4. Unified triangle mesh interoperability - -Provide a consistent interface for obtaining triangle mesh representations from supported geometry objects, regardless of their underlying representation. - -Conceptually: - -```python -trimesh = geometry.to_triangle_mesh(...) -``` - -The implementation may internally perform tessellation, triangulation, or a combination of both. - -Geometry-processing plugins should not need to understand the specific source geometry representation. - -Investigate whether the interface should be implemented through instance methods, a common conversion function, protocols, or a combination of these. - -### 5. Dedicated mesh representations - -Evaluate the benefits of introducing specialized representations such as: - -- `TriangleMesh` -- `QuadMesh` -- `TessellationResult` - -Distinguish between rich topological mesh objects and lightweight computational representations based on vertices and faces. - -In particular, investigate whether a compact `TriangleMesh` would provide a useful common interchange representation for computational geometry plugins. - -Avoid introducing parallel mesh hierarchies without a clear need. - -### 6. Tessellation metadata and provenance - -Investigate whether tessellation results should optionally retain information such as: - -- UV coordinates of generated vertices. -- Correspondence with source surfaces and faces. -- Tessellation parameters and strategies. -- Approximation error estimates. -- Boundary and trimming information. - -Determine whether this information belongs on the mesh, in a dedicated result object, or in a separate mapping structure. - -Do not require additional metadata for simple conversions unless necessary. - -## Geometry and Topology Requirements - -The API design should explicitly address: - -- Periodic surfaces and parameter-space seams. -- Surface boundaries, trims, and holes. -- Degenerate surface regions and singularities. -- Vertex indexing and face orientation. -- Nonplanar polygon triangulation. -- Watertightness and manifoldness. -- Geometric approximation tolerances. -- Preservation of existing vertices and topology where appropriate. -- Compatibility with downstream geometry-processing algorithms. - -Clearly distinguish guarantees from assumptions and optional validation. - -## Testing and Documentation - -Testing and documentation are integral workstreams and should proceed alongside API design and implementation. - -### Testing - -- Establish shared behavioral contracts for supported conversions. -- Preserve and extend existing regression tests. -- Test geometric and topological edge cases. -- Verify approximation quality where applicable. -- Test serialization of strategy and result objects. -- Validate interoperability with `compas_cgal` and other relevant plugins. -- Run cross-package integration tests. - -### Documentation - -- Establish consistent terminology. -- Document method semantics, parameters, and return types. -- Explain available tessellation and triangulation strategies. -- Provide equivalent examples across geometry representations. -- Document limitations, guarantees, and compatibility changes. -- Include migration guidance where existing APIs are modified. - -## Implementation Approach - -This initiative will be coordinated through `compas_framework` using a multi-agent workflow. - -### Phase 1 — Reconnaissance - -Investigate existing implementations across the affected packages in parallel. - -Organize investigations by architectural concern rather than assigning one agent per package. - -Produce an inventory of existing APIs, algorithms, representations, dependencies, tests, and documentation. - -### Phase 2 — Architectural Proposal - -Develop a unified API proposal based on the inventory. - -Compare alternatives, identify tradeoffs, and define the intended responsibilities of geometry objects, strategy objects, conversion functions, and plugin interfaces. - -Produce a dependency-aware implementation plan. - -**Do not modify package source code before the architectural proposal is reviewed and approved.** - -### Phase 3 — Implementation - -After approval, divide implementation into independently verifiable tasks. - -Execute compatible tasks in parallel, with clear repository and file ownership. - -Develop tests and documentation alongside implementation. - -### Phase 4 — Integration and Review - -Perform independent code review, cross-package testing, compatibility verification, and documentation validation. - -Resolve integration issues before considering the initiative complete. - -## Definition of Done - -The initiative is complete when: - -1. A consistent vocabulary and API contract have been established. -2. Supported continuous and discrete geometry representations expose the approved conversion interfaces. -3. Tessellation and triangulation strategies are implemented where appropriate. -4. Triangle mesh representations can be consumed consistently by relevant geometry-processing plugins. -5. Geometric and topological behavior is covered by documented contracts and tests. -6. Cross-package integration tests pass. -7. Documentation and examples reflect the implemented interfaces. -8. Compatibility implications and migration requirements are documented. - -## Guiding Principle - -**Unify the interfaces and semantics without unnecessarily unifying the underlying algorithms or representations.** - -Different geometry types and computational backends may require different implementations. The goal is to provide a coherent and predictable public API while preserving the flexibility and capabilities of the COMPAS ecosystem. \ No newline at end of file diff --git a/initiatives/geometry-tessellation/proposal.md b/initiatives/geometry-tessellation/proposal.md deleted file mode 100644 index b782896..0000000 --- a/initiatives/geometry-tessellation/proposal.md +++ /dev/null @@ -1,762 +0,0 @@ -# Geometry Discretization, Tessellation, and Triangulation Proposal - -Status: historical proposal; superseded by the Accepted ADRs - -ADR 016 removes the proposal's runtime capability-discovery and reserved -error-schema APIs. Producers validate explicit strategies directly. This file -is retained as design history and is not implementation authority where it -differs from the Accepted ADRs. - -This proposal is based on the restarted objective and inventory. It changes no -package source and makes no claim that tests were run. - -## Decision summary - -Adopt an evolutionary architecture with stable representation roles: - -1. Keep `Mesh` as the rich persistent topological datastructure, - `PolygonalSurface` as the lightweight persistent polygon buffer, and - `Tessellation` as the ephemeral indexed-triangle result. -2. Do not add persistent `TriangleMesh` or `QuadMesh` classes. Add explicit - triangle/quad validation and conversion capabilities instead. -3. Do not add a synonymous `TessellationResult` as the default result. Add an - optional, operation-specific metadata envelope only where provenance or - measured error is actually requested or produced. -4. Standardize continuous geometry on fresh - `compute_tessellation(strategy=...) -> Tessellation` plus cached - `.tessellation` for the default strategy. Preserve polygon-topology - conversion through existing `compute_mesh`/`to_polygonal_surface` APIs. -5. Keep output topology separate from sampling policy, but do not make one - method return unrelated types. Triangle output is the canonical - tessellation interchange; a quad/polygon grid is requested through an - explicit polygonal conversion and can then be triangulated. -6. Add lightweight serializable strategy configuration objects. Initially - support uniform parameter resolution and backend deflection. Define an - adaptive/error request contract, but implement it only for producers that - can state whether the requested threshold is estimated or guaranteed. -7. Add canonical non-mutating `triangulated(...)` and mutating - `triangulate(...)` operations to polygonal/topological representations, - following COMPAS naming conventions. Do not silently replace existing - triangulation policies. -8. Add `to_triangle_mesh(...) -> Tessellation` as the common conversion for - supported continuous and discrete geometry, backed by a central adapter for - tuple, `Tessellation`, `PolygonalSurface`, and `Mesh` inputs. -9. Keep trim-aware NURBS tessellation owned by a trimmed face/BRep, not by a - standalone `NurbsSurface`. The result may optionally record face/trim - provenance. -10. Align plugin discovery, signatures, coercion, and validation before using - the common interface in CGAL/libigl integration tests. - -## Normative terminology - -- **Sampling** evaluates points on continuous geometry. It makes no statement - about connectivity. -- **Discretization** represents continuous geometry by finite samples such as - points, polylines, or parameter grids. -- **Tessellation** approximates a continuous surface or trimmed boundary by - connected polygonal cells. The canonical computational interchange in this - proposal is triangular. -- **Triangulation** partitions an existing polygonal face/domain or point set - into triangles. It must state whether it preserves input vertices, inserts - vertices, projects to a plane, and mutates the source. -- **Refinement** increases resolution of an existing discretization while - preserving its intended source relationship. -- **Remeshing** reconstructs or modifies an existing mesh discretization to - satisfy quality goals. -- **Simplification** reduces mesh complexity. -- **Resolution** is a sample/cell count. It is not an error bound. -- **Deflection** is a kernel-specific distance or angular approximation - control. -- **Quality constraint** is a requested mesh property such as maximum edge - length, maximum area, or minimum angle. -- **Tolerance** is reserved for numerical comparison, cleanup, and validity; - it is not a generic name for the preceding controls. -- **Estimated error** is measured or inferred after/between samples and may - miss unsampled extrema. -- **Guaranteed bound** is a backend/algorithm contract that the produced - approximation does not exceed a stated error under documented assumptions. - -Documentation and types must never label a request as a guaranteed bound when -the backend only uses it as a heuristic target. - -## Representation decisions - -### Keep the three existing roles - -| Representation | Role | Persistence | Face arity | Topology | -|---|---|---:|---|---| -| `Tessellation` | Computation/rendering interchange | Ephemeral | Triangles | Indexed buffers | -| `PolygonalSurface` | Lightweight polygon geometry | Serializable | Arbitrary | Derived queries | -| `Mesh` | Rich editable datastructure | Serializable | Arbitrary | Half-edge | - -This division is useful rather than accidental. Native plugins need compact -buffers, persistent geometry needs serialization, and editing algorithms need -topology and attributes. - -### `TriangleMesh` alternatives - -**A. Persistent subclass/sibling of `Mesh`.** Face arity becomes explicit and -triangle-specific methods have an obvious home. The cost is a parallel mesh -hierarchy, duplicated serialization/topology behavior, conversion churn, and -unclear ownership of attributes and keys. - -**B. New compact serializable buffer class.** This fits native plugins but -substantially overlaps `Tessellation` and `PolygonalSurface`; it also needs -buffer ownership, validation, attributes, and provenance decisions. - -**C. Type/capability over existing representations (recommended).** Define an -accepted-input union/protocol plus validation and conversion. Triangle arity is -enforced at the adapter/operation boundary, while persistence remains an -orthogonal concern. - -Decision: do not introduce `TriangleMesh` in this initiative. Reconsider only -if a later use case requires a persistent fixed-arity object with semantics -that cannot be expressed by `Mesh`, `PolygonalSurface`, or `Tessellation`. - -### `QuadMesh` alternatives - -A dedicated quad class makes arity explicit but does not represent mixed -triangle/quad shapes, trimmed domains, poles, or BRep output. `Mesh.is_quadmesh` -already classifies rich topology, and `PolygonalSurface` stores quad buffers. - -Decision: do not add `QuadMesh`. Add quad validation/capabilities and explicit -polygonal conversion where useful. - -### `TessellationResult` alternatives - -**A. Replace `Tessellation`.** Rejected: the existing public class already has -the intended ephemeral role and tested zero-copy semantics. - -**B. Always wrap every result.** Rejected: simple conversion callers would pay -an extra conceptual/container cost, and plugins would still need the triangle -buffers inside it. - -**C. Optional metadata envelope (recommended).** Keep `Tessellation` as the -simple result. Operations that produce provenance/error data may return or -expose a named operation-specific result containing a `tessellation` plus -metadata. Do not add all possible metadata fields to `Tessellation`. - -Illustrative, not final, shape: - -```python -@dataclass(frozen=True, slots=True) -class SurfaceTessellationResult: - tessellation: Tessellation - strategy: TessellationStrategy - provenance: TessellationProvenance | None = None - error: ApproximationError | None = None -``` - -Such result objects should be serializable only if every contained field has a -stable data contract. Native buffer identity and source-object references must -not be serialized implicitly. - -## Strategy model - -### Principles - -- Strategies are immutable, lightweight `Data` configurations. -- They describe requested policy, not executable geometry algorithms. -- Producers own the implementation and declare supported strategies. -- Unsupported strategies fail explicitly; they are never silently ignored or - approximately mapped to a different quantity. -- Strategy equality/hashing supports complete cache keys. -- `None` selects the producer's documented default strategy. -- Passing both a strategy and legacy scalar controls is an error after initial - compatibility normalization. - -### Initial strategies - -Names are provisional public API decisions: - -```python -class TessellationStrategy(Data): - pass - - -@dataclass(frozen=True) -class UVGrid(TessellationStrategy): - nu: int - nv: int - domain_u: tuple[float, float] | None = None - domain_v: tuple[float, float] | None = None - - -@dataclass(frozen=True) -class Deflection(TessellationStrategy): - linear: float - angular: float - relative: bool = False - - -@dataclass(frozen=True) -class Adaptive(TessellationStrategy): - max_deviation: float | None = None - max_normal_angle: float | None = None - max_edge_length: float | None = None - max_depth: int | None = None -``` - -Validation requires positive finite values and documented angular units. -`0.0` must never mean “use default.” `Adaptive` is a request vocabulary, not a -promise that core immediately implements a robust adaptive algorithm. - -### Capability and guarantees - -Each producer documents a support record conceptually equivalent to: - -```python -TessellationCapability( - strategy_type=Adaptive, - supported_fields={"max_deviation", "max_normal_angle"}, - error_contract="estimated", # "target", "estimated", or "guaranteed" -) -``` - -This need not be a public registry in the first implementation. A small helper -or documented class-level declaration is sufficient if it supports clear -errors and documentation generation. - -- Core parametric surfaces initially support `UVGrid` with exact count - semantics and no geometric error claim. -- Analytical shapes support `UVGrid`, documenting ignored/constrained axes. -- OCC BReps support `Deflection`, with guarantee wording matching OpenCASCADE's - actual contract. Wrapper-side measured error must be reported separately. -- CGAL planar refinement supports only the quality fields actually wired to the - native implementation. -- `Adaptive` implementation is a separate approved slice. Until implemented, - a producer rejects it rather than falling back to `UVGrid`. - -### Output topology is separate - -Sampling/refinement policy and cell topology are conceptually independent, but -one method should not return different unrelated types. Therefore: - -- `compute_tessellation(strategy=...)` and `to_triangle_mesh(...)` produce - triangle `Tessellation`. -- An explicit polygonal conversion, provisionally - `compute_polygonal_surface(strategy=...) -> PolygonalSurface`, preserves a - producer's natural quad/mixed cells where supported. -- Triangle generation from polygonal cells accepts a separate triangulation - strategy. - -This preserves predictable return types. A future generic topology request can -be added only if one common result representation is approved. - -## Public operation and conversion model - -### Continuous geometry - -Canonical lifecycle: - -```python -surface.compute_tessellation( - strategy: TessellationStrategy | None = None, - *, - triangulation: TriangulationStrategy | None = None, - include_normals: bool = True, - include_texture_coordinates: bool = True, -) -> Tessellation - -surface.tessellation # cached result for default strategy/options - -surface.to_triangle_mesh(...) -> Tessellation -surface.compute_polygonal_surface(strategy=...) -> PolygonalSurface -surface.to_mesh(...) -> Mesh -``` - -`compute_tessellation` emphasizes a fresh approximation operation; -`to_triangle_mesh` emphasizes obtaining a representation and may internally -tessellate or triangulate. For continuous geometry they may share an -implementation, but both names have distinct user intent. - -Avoid adding a third `tessellate()` spelling until COMPAS-wide naming policy is -settled. Existing `compute_tessellation` and cached `.tessellation` already have -tests and users. - -### Discrete polygonal geometry - -Recommended naming: - -```python -mesh.triangulated(strategy=None) -> Mesh # non-mutating -mesh.triangulate(strategy=None) -> None # mutating -mesh.to_triangle_mesh(strategy=None) -> Tessellation - -polygonal_surface.triangulated(strategy=None) -> PolygonalSurface -polygonal_surface.to_triangle_mesh(strategy=None) -> Tessellation -``` - -`triangulate`/`triangulated` follow the conventional mutating/non-mutating verb -pair. They must document preservation of keys, face attributes, source -vertices, and source-to-result mapping. Existing `quads_to_triangles()` remains -available during migration and retains its current diagonal/default behavior. - -`to_triangle_mesh` is a conversion and must not mutate the source. It returns -the lightweight triangle interchange, not a rich half-edge object. Users who -need topology call `.to_mesh()` on the returned `Tessellation` or use -`triangulated()`. - -### Triangulation strategies - -Use serializable policy objects where a choice exists: - -```python -class TriangulationStrategy(Data): ... - - -class FixedDiagonal(TriangulationStrategy): - diagonal: Literal["ac", "bd", "shortest"] = "ac" - - -class Earcut(TriangulationStrategy): - tolerance: float | None = None - - -class ConstrainedDelaunay(TriangulationStrategy): - quality: TriangleQuality | None = None -``` - -Do not force Delaunay point-set/domain triangulation into the same method as -face triangulation if their inputs and guarantees differ. Shared strategy data -may be reused, but functions remain explicit. - -Every strategy contract states projection/coplanarity behavior, whether it can -insert Steiner points, whether it preserves vertex indices, and winding/ -boundary guarantees. - -## Unified triangle-mesh interoperability - -### Public input concept and adapter - -Define a core accepted-input concept: - -```python -TriangleMeshInput = Tessellation | PolygonalSurface | Mesh | tuple[CoordinatesType, Sequence[Sequence[int]]] - - -def to_triangle_mesh( - geometry: TriangleMeshInput | SupportsTriangleMesh, - *, - strategy: TessellationStrategy | TriangulationStrategy | None = None, - validate: bool = True, -) -> Tessellation: ... -``` - -Also expose instance `to_triangle_mesh()` on supported core classes for -discoverability. Both paths delegate to one implementation per type. - -A supplemental protocol can support third-party objects: - -```python -class SupportsTriangleMesh(Protocol): - def to_triangle_mesh(self, **options) -> Tessellation: ... -``` - -The protocol is not the sole contract because raw tuples cannot implement it. - -### Validation layers - -Core conversion validates only representation-level invariants: - -- three finite coordinates per vertex; -- exactly three integer indices per face; -- indices in range; -- optional attribute lengths match vertices; -- no mutation of source buffers. - -Optional validators cover increasingly strong requirements: - -- nondegenerate triangles; -- consistent orientation; -- manifoldness; -- closed/watertight topology. - -Each operation requests only the level it requires. Volume/boolean operations -can demand closed oriented manifold input; slicing or rendering need not. - -Native packages then own dtype/layout coercion: - -```python -def _as_cgal_triangle_mesh(mesh, *, requirements=...): - tessellation = to_triangle_mesh(mesh, validate=True) - # float64 C-contiguous vertices, chosen integer dtype faces -``` - -Core must not require NumPy. CGAL/libigl annotations, actual integer widths, -and tests must agree. Conversion helpers state when a copy occurs and preserve -zero-copy paths for already-compatible arrays where safe. - -## Trimmed NURBS and BRep responsibility - -- `NurbsSurface` represents the underlying parametric surface only. It must not - acquire hidden trim loops from an owning BRep face. -- A trimmed-face/BRep object owns loops, holes, face orientation, and trim-aware - tessellation. -- `BrepFace.compute_tessellation(strategy=...)` is the natural face-level API; - `Brep.compute_tessellation(strategy=...)` aggregates faces. -- Converting `BrepFace.nurbssurface` remains explicitly untrimmed. -- Face aggregation preserves orientation and permits seam/face-local vertex - duplication. Watertight welding is a separate explicit operation and cannot - discard normal/UV seams. -- Optional provenance can include triangle-to-face, vertex-to-UV, boundary - polyline-to-edge/loop, strategy, and backend error data. -- A trim-aware generic strategy must operate on a trimmed face/domain input, - not accept free-floating trim arrays on `NurbsSurface` without an ownership - model. - -## Metadata, provenance, and error - -Keep simple `Tessellation` construction lightweight. Define optional immutable -metadata records for enriched operations: - -```python -class TessellationProvenance(Data): - triangle_sources: Sequence[int] | None - vertex_parameters: Sequence[tuple[float, float]] | None - boundary_sources: Sequence[BoundarySource] | None - - -class ApproximationError(Data): - metric: str - maximum: float | None - rms: float | None - contract: Literal["target", "estimated", "guaranteed"] - method: str | None -``` - -Rules: - -- Metadata is optional and requested/produced explicitly. -- Source IDs are stable scalar identifiers, not serialized object references. -- Error units and measurement method are mandatory when values are reported. -- A requested threshold is stored separately from a measured result. -- Backend-specific data remains in operation-specific records rather than an - unbounded dictionary on the mesh. -- Conversion to `Mesh`/`PolygonalSurface` documents which metadata is dropped - or mapped to attributes. - -## Plugin architecture - -### Discovery and signatures - -Before interoperability work: - -1. Add current `compas.plugins` entry points to CGAL and include all intended - plugin modules. -2. Add discovery tests that resolve functions through core COMPAS. -3. Align core and implementation signatures exactly. - -Canonical planar triangulation vocabulary should be explicit: - -- `boundary`: exterior closed ring; -- `holes`: closed interior rings; -- `constraints`: open constrained polylines; -- `points`: optional unconstrained interior points; -- `quality`: supported quality request. - -Deprecate positional parameters after `boundary`; keyword-only calls prevent -silent reinterpretation. Do not map maximum area to maximum edge length or -advertise native minimum angle until implemented. - -### CGAL and libigl - -- Adopt the core triangle-mesh adapter at every triangle input boundary. -- Centralize each package's NumPy coercion and native safety checks. -- Preserve operation-specific result metadata through named results or - compatibility adapters. -- Retain raw low-level tuple APIs where performance/users require them, but - make high-level APIs accept the common input concept. -- Align pluggable return annotations with actual result shapes, including - libigl face labels. - -### OCC - -- Map `Deflection` only to BRep/kernel tessellation. -- Expose trim-aware face and aggregate BRep results through the common triangle - representation. -- Define cache keys from effective strategy plus output options rather than - mutable global tolerance alone. -- Preserve compatibility tuple methods while downstream callers migrate. - -### Gmsh - -Treat Gmsh sizing options as a backend-specific meshing policy. Reuse common -names only where semantics match; do not claim that curvature sizing or element -size is the same as parametric UV resolution or OCC deflection. - -## Compatibility plan - -### Compatible additions - -- Serializable strategy types and capability errors. -- `to_triangle_mesh` function/methods. -- Core triangle input adapter and validators. -- Non-mutating `triangulated()` methods. -- Optional enriched result/provenance records. -- Trim-aware face-level tessellation where supported. - -### Behavior-preserving migration - -- Legacy `nu`/`nv`, `u`/`v`, and deflection arguments normalize into strategy - objects during a documented transition. -- Existing default connectivity and diagonal choices remain unchanged at first. -- Existing `Tessellation` identity, seam, and independent-conversion behavior - remains unchanged. -- Existing polygon-preserving conversions remain distinct. -- Raw tuple inputs and outputs remain supported through adapters initially. - -### Deprecation candidates - -Only after replacements and downstream migration: - -- misspelled `to_tesselation`; -- `to_viewmesh` where it is only a tessellation alias; -- positional constrained/conforming arguments after `boundary`; -- mismatched planar keyword names; -- `quads_to_triangles` only if `triangulate(FixedDiagonal(...))` fully preserves - its behavior and metadata. - -Do not deprecate `Mesh`, `PolygonalSurface`, `Tessellation`, polygon-preserving -conversion, or raw native buffers in this initiative. - -## Alternatives rejected - -### One universal executable strategy object - -An `apply(geometry)` strategy would enable injection but creates double -dispatch, unclear backend ownership, and a plugin system inside the existing -plugin system. Configuration-only strategies keep algorithms with producers. - -### One broad method with all controls - -A signature containing U/V counts, tolerance, deflection, angle, area, and edge -length conflates units/guarantees and encourages ignored arguments. Explicit -strategy types allow clear rejection. - -### One method whose return type depends on topology - -Returning `PolygonalSurface`, `Tessellation`, or `Mesh` based on a topology -flag harms typing and predictability. Use explicit conversions with stable -return types. - -### Immediate adaptive implementation in core - -The current code has no error estimator or singularity/trim model. Defining a -portable request contract is useful; claiming robust adaptive behavior before -algorithm/quality validation is not. - -## Tests - -Tests ship with each implementation slice. - -### Core unit contracts - -- Strategy validation, equality, hashing, `Data` JSON roundtrip, and rejection - of unsupported fields/strategies. -- Legacy scalar normalization and conflicting-form rejection. -- `to_triangle_mesh` equivalence for tuple, `Tessellation`, - `PolygonalSurface`, and `Mesh`, including copy/identity behavior. -- Validation of arity, indices, finiteness, degeneracy, orientation, - manifoldness, and closedness at the appropriate layers. -- Mutating/non-mutating triangulation, key/attribute preservation, source - immutability, diagonal choice, vertex insertion, and mappings. -- Periodic seam fixture with duplicate positions and distinct attributes. -- Singular poles, reversed domains, and nonplanar polygons. -- Existing default counts/connectivity and cache behavior remain unchanged. - -### OCC - -- Trimmed/holed face tessellation excludes holes and preserves orientation. -- Boundary polylines map to loops/edges when provenance is requested. -- Face aggregation and face-local seam behavior. -- Deflection validation, explicit-zero rejection, cache identity, and monotonic - refinement without requiring exact connectivity. -- Document/test whether deflection is a target, estimate, or guarantee. - -### CGAL/libigl - -- Real entry-point discovery and core-dispatched keyword calls. -- Equivalent tuple, `Mesh`, `PolygonalSurface`, and `Tessellation` inputs. -- Exact dtype/layout and zero-copy/copy behavior. -- Unsafe arity/index/topology failures occur before native calls. -- Holes, constraints, points, and quality parameters bind correctly. -- Unsupported quality fields fail rather than being ignored. -- Rich result provenance and libigl label outputs remain available. - -### Framework integration - -- Core shape/surface -> `Tessellation` -> CGAL and libigl operation. -- OCC trimmed face/BRep -> triangle interchange -> native consumer. -- Discovery and canonical keyword dispatch through installed packages. -- Cross-representation equivalence and source immutability. -- Strategy serialization and package-boundary roundtrip. -- Count/deflection/quality monotonic refinement with backend-appropriate - assertions. -- Persistent mesh serialization versus ephemeral tessellation behavior. -- Native backend absence/skip behavior and focused performance baselines. - -## Documentation and examples - -Create a core terminology and migration guide explaining: - -- operation versus conversion; -- sampling/discretization/tessellation/triangulation/refinement/remeshing; -- resolution, deflection, quality, cleanup tolerance, estimate, and guarantee; -- stable representation roles and buffer ownership; -- topology-preserving versus triangle conversion; -- seams, trims, singularities, orientation, and validation assumptions; -- legacy-to-new API mapping and deprecation timing. - -Examples: - -1. Parametric surface with `UVGrid`, normals/UVs, and a separate polygonal - quad conversion. -2. The same polygonal surface triangulated with two diagonal strategies. -3. Trimmed OCC face with `Deflection`, boundary polylines, and provenance. -4. A `Tessellation` passed unchanged to CGAL/libigl high-level APIs. -5. Polygon with holes using Earcut versus constrained Delaunay, explicitly - comparing vertex insertion and guarantees. -6. Adaptive request showing a supported backend and an explicit unsupported - strategy error elsewhere. - -## Affected packages and ownership - -- **`compas`:** terminology, strategy and metadata data types, adapters, - validators, conversion methods, triangulation naming, public exports, tests, - and core docs. -- **`compas_occ`:** trimmed face/BRep strategy mapping, provenance extraction, - cache semantics, compatibility wrappers, tests, and examples. -- **`compas_cgal`:** entry points, exact plugin signatures, common-input - adoption, native coercion/validation, result metadata, tests, and docs. -- **`compas_libigl`:** common-input adoption, result-shape alignment, tests, - and docs. -- **`compas_gmsh`:** capability comparison and optional strategy adaptation - where semantics genuinely align. -- **`compas_model`:** downstream migration and preservation of distinct - rendering/collision/contact/sectioning policies; no edits until its dirty - worktree is reconciled. -- **`compas_framework`:** cross-package fixtures, integration/native-backend/ - roundtrip/performance tests, and initiative records. - -## Dependency-aware implementation plan - -No task is authorized until proposal approval. - -### Phase 0: finalize public decisions (serial) - -Coordinator/architect, no package implementation: - -1. Approve representation decisions and stable return types. -2. Confirm strategy, metadata, adapter, and method names/modules. -3. Confirm whether `Adaptive` is contract-only initially or includes a first - implementation. -4. Confirm compatibility/deprecation version policy and supported package - matrix. - -All implementation depends on these decisions. - -### Phase 1: core foundations (coordinated ownership) - -One core implementer owns shared strategy/metadata types, typing modules, and -public exports to avoid concurrent conflicts. - -1. Add strategies, capability errors, serialization, and tests. -2. Add `to_triangle_mesh` adapter and layered validators with tests. -3. Add conversion/triangulation methods without changing defaults. -4. Clarify `Tessellation` docs while preserving its implementation contract. -5. Add terminology/migration docs in parallel once names stabilize. - -Adapter work and strategy work can be developed in parallel if public exports -are integrated by the same owner. - -### Phase 2: producer and discrete-operation slices (parallel) - -After core contracts are available: - -- Core surface/shape owner maps legacy counts to `UVGrid` and adds seam/ - singularity tests. -- Core mesh/polygon owner adds triangulation strategies and mutating/ - non-mutating operations. -- Core triangulation owner aligns planar vocabulary and legacy adapters. -- OCC owner implements trimmed face/BRep strategy mapping, provenance, caching, - and tests. -- CGAL owner fixes discovery/signatures and adopts the native adapter. -- libigl owner adopts the adapter and aligns result annotations. -- Documenter owns examples/narrative files only. - -Avoid concurrent edits to core public exports, shared typing, plugin -configuration, or the same geometry modules. - -### Phase 3: optional advanced strategy slice - -Only if separately approved after the base contracts: - -- implement and validate a first `Adaptive` backend; -- define an error measurement harness and fixtures; -- document singularity/trim limitations and target/estimate/guarantee status. - -This phase must not block basic interface and interoperability improvements. - -### Phase 4: integration and independent review - -Framework owner adds cross-package tests after compatible package versions are -available. Reviewer independently checks API consistency, compatibility, -native safety, geometry guarantees, docs, and executed test evidence. Findings -return to repository owners. Merge/publication require separate approval. - -## Parallel work graph - -```text -approved public decisions - | - v - core strategies + adapter + exports - | | | - | | +--> core mesh/triangulation APIs - | +-------------> OCC trimmed BRep adaptation - +------------------------> CGAL and libigl native adaptation - | - docs/examples -------------------+ (after names stabilize) - v - framework integration tests - | - v - independent review - - optional Adaptive implementation starts only after the base contract -``` - -## Open decisions requiring approval - -1. Approve retaining `Tessellation`, `PolygonalSurface`, and `Mesh` roles and - deferring dedicated `TriangleMesh`/`QuadMesh` classes. -2. Approve optional operation-specific result envelopes instead of a universal - `TessellationResult`. -3. Approve `UVGrid`, `Deflection`, and `Adaptive` as serializable configuration - names, with `Adaptive` rejected by unsupported producers. -4. Decide whether the first implementation includes an adaptive algorithm or - only its interoperable contract. Recommendation: contract first; algorithm - as a separately validated slice. -5. Approve stable triangle return types and separate explicit polygonal - conversion instead of a topology-dependent union return. -6. Approve `compute_tessellation`, cached `.tessellation`, and - `to_triangle_mesh`, without introducing `tessellate()` yet. -7. Approve `triangulate()`/`triangulated()` as the canonical mutating/ - non-mutating pair. -8. Approve BRep/BRepFace ownership of trimmed-surface tessellation and keep - standalone `NurbsSurface` explicitly untrimmed. -9. Approve canonical planar terms `boundary`, `holes`, `constraints`, `points`, - and `quality`, with keyword-only migration. -10. Approve the stated deprecation intent; exact release versions remain a - repository release decision. - -## Approval scope - -Approval authorizes implementation planning and the phased source/test/docs -work described above, with explicit repository/file ownership and preservation -of user changes. It does not authorize merging, publishing, deleting legacy -APIs, implementing an unapproved adaptive algorithm, consolidating the dirty -`compas_model` tree, or unrelated geometry behavior changes. - -Until approval is given, the initiative stops at this proposal. diff --git a/initiatives/plugin-implementations/README.md b/initiatives/plugin-implementations/README.md deleted file mode 100644 index 8e5b998..0000000 --- a/initiatives/plugin-implementations/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# Plugin Implementations - -This initiative standardizes how COMPAS packages declare, discover, load, -test, and document plugin implementations without introducing a new plugin -system. - -Current phase: **Waves 0–1 source migration substantially implemented; -coordinated artifact and remaining selection/parity gates incomplete**. - -- [Objective](objective.md) -- [Inventory](inventory.md) -- [Proposal](proposal.md) -- [Architecture decisions](decisions/README.md) - -The COMPAS Hub tracks the active rollout plan and handoff. - -ADRs 001–006 are **Accepted**. Implementation is authorized only for the six -packages in Waves 0–1. Subsequent modernization and typing work completed the -CGAL registration cleanup, the model optional-runtime boundary, graphics-free -viewer discovery, built-wheel metadata checks, and substantial wrapper/type -parity. Remaining initiative work includes the core requirement-selection -matrix, libigl's explicit compiled-runtime requirements, package-owned OCC -built-wheel discovery evidence, the coordinated model/viewer registry test, -and the final installed cross-package review. - -The approved initial implementation scope is limited to Waves 0–1: -`compas`, `compas_cgal`, `compas_libigl`, `compas_occ`, `compas_model`, and -`compas_viewer`. Optional backends, host integrations, and other ecosystem -packages require a later explicit scope amendment and approval. diff --git a/initiatives/plugin-implementations/decisions/001-authoritative-discovery.md b/initiatives/plugin-implementations/decisions/001-authoritative-discovery.md deleted file mode 100644 index e05122d..0000000 --- a/initiatives/plugin-implementations/decisions/001-authoritative-discovery.md +++ /dev/null @@ -1,42 +0,0 @@ -# ADR 001: Authoritative Discovery Mechanism - -## Status - -Accepted. - -## Context - -Current core discovers installed plugins through the `compas.plugins` package -entry-point group. It does not read `__all_plugins__`. Many ecosystem packages -still declare only the legacy list and are therefore undiscoverable. Restoring -scanning would create competing discovery paths and import side effects. - -## Options - -1. Use explicit package entry points only. -2. Support entry points and `__all_plugins__` concurrently. -3. Scan installed packages for plugin declarations. -4. Introduce a new centralized registry. - -## Recommendation - -Choose option 1. PEP 621 entry points are explicit, deterministic, installed -metadata that can be inspected without a global package scan. Remove legacy -lists only after contract inspection, compatible version requirements, and -replacement verification are complete. - -## Consequences - -- Core retains one discovery path. -- Legacy-only packages require deliberate migration. -- Metadata is not added to incompatible implementations merely to make them - discoverable. -- No compatibility scanner or fallback list is introduced. - -## Affected packages - -Core and every package that provides COMPAS plugins. - -## Dependencies - -None. diff --git a/initiatives/plugin-implementations/decisions/002-registration-boundary.md b/initiatives/plugin-implementations/decisions/002-registration-boundary.md deleted file mode 100644 index b309dfb..0000000 --- a/initiatives/plugin-implementations/decisions/002-registration-boundary.md +++ /dev/null @@ -1,43 +0,0 @@ -# ADR 002: Registration and Implementation Boundary - -## Status - -Accepted. - -## Context - -Core calls `entry_point.load()` during discovery. Entry points that target -implementation modules therefore import native, GUI, host, or adapter code -before any plugin is selected. CGAL, libigl, and OCC demonstrate that small -registration wrappers can avoid this cost. - -## Options - -1. Use lightweight category registration modules with function-local - implementation imports. -2. Point entry points directly at implementation modules. -3. Use one monolithic registration module in every package. -4. Use one registration module per implementation or native extension. - -## Recommendation - -Choose option 1. Registration modules contain decorated wrappers, runtime -decorator imports, and type-only contract imports. They import implementations -inside wrapper bodies and otherwise have no discovery-time side effects. -Very small packages may use one lightweight module where clearer. - -## Consequences - -- Discovery remains independent of optional runtimes. -- Modules follow core plugin categories rather than build artifacts. -- Direct implementations become undecorated. -- Moving decorators may change diagnostic plugin IDs. - -## Affected packages - -All migrated implementation packages, beginning with reference, model, and -viewer packages. - -## Dependencies - -- [ADR 001](001-authoritative-discovery.md) diff --git a/initiatives/plugin-implementations/decisions/003-contract-and-direct-apis.md b/initiatives/plugin-implementations/decisions/003-contract-and-direct-apis.md deleted file mode 100644 index bf0501b..0000000 --- a/initiatives/plugin-implementations/decisions/003-contract-and-direct-apis.md +++ /dev/null @@ -1,42 +0,0 @@ -# ADR 003: Contract Parity and Direct API Policy - -## Status - -Accepted. - -## Context - -Discovery metadata can activate wrappers whose signatures or results no longer -match core. Backend packages may also expose useful direct APIs, but a second -divergent high-level contract makes dispatch and documentation ambiguous. - -## Options - -1. Require exact core wrappers and retain semantically compatible direct APIs. -2. Permit backend-specific wrappers plus adapters. -3. Remove every direct backend API. -4. Introduce plugin-specific geometry representations. - -## Recommendation - -Choose option 1. Wrappers exactly match the core extension point in category, -name, parameters, defaults, structural inputs, result, and failure behavior. -Useful direct APIs remain undecorated. Clearly named low-level APIs may differ -only when their low-level contract is explicit. - -## Consequences - -- Contract migration precedes metadata for incompatible legacy plugins. -- Native normalization remains in implementation modules. -- Existing geometry, tessellation, triangulation, BRep, and scene contracts - remain authoritative. -- No new representation or generic adapter is introduced. - -## Affected packages - -Every plugin provider and the core extension points it implements. - -## Dependencies - -- [ADR 002](002-registration-boundary.md) -- Stable contracts from typing and geometry initiatives. diff --git a/initiatives/plugin-implementations/decisions/004-optional-runtimes.md b/initiatives/plugin-implementations/decisions/004-optional-runtimes.md deleted file mode 100644 index 55b361b..0000000 --- a/initiatives/plugin-implementations/decisions/004-optional-runtimes.md +++ /dev/null @@ -1,42 +0,0 @@ -# ADR 004: Optional Runtime Selection and Failure Behavior - -## Status - -Accepted. - -## Context - -Native, GUI, notebook, Rhino, Grasshopper, and Blender implementations must be -discoverable without importing their runtimes. A requirement that checks only -the plugin package may not prove that the actual optional runtime is usable. - -## Options - -1. Use the current requirement mechanism with accurate runtime requirements. -2. Import optional runtimes during discovery. -3. Suppress failed imports and silently skip implementations. -4. Add a new dependency-resolution layer. - -## Recommendation - -Choose option 1. Use module-name requirements when `find_spec` is sufficient -and callable requirements only when presence does not establish availability. -Registration stays lightweight. Current selection, core defaults, and -`PluginNotInstalledError` remain authoritative; implementation failures -propagate after selection. - -## Consequences - -- Missing optional runtimes do not block unrelated discovery. -- Requirements identify the actual runtime. -- No silent failure or dependency framework is added. -- Host packages need host-runtime verification. - -## Affected packages - -Native, GUI, notebook, and host integration packages. - -## Dependencies - -- [ADR 001](001-authoritative-discovery.md) -- [ADR 002](002-registration-boundary.md) diff --git a/initiatives/plugin-implementations/decisions/005-verification-and-evidence.md b/initiatives/plugin-implementations/decisions/005-verification-and-evidence.md deleted file mode 100644 index f71079d..0000000 --- a/initiatives/plugin-implementations/decisions/005-verification-and-evidence.md +++ /dev/null @@ -1,44 +0,0 @@ -# ADR 005: Verification and Evidence Gates - -## Status - -Accepted. - -## Context - -Source inspection or editable-install tests do not prove installed metadata, -built wheels, import isolation, optional selection, or runtime behavior. Host -packages cannot be validated by ordinary CPython CI alone. - -## Options - -1. Require common source, installed-metadata, fresh-process, artifact, and - applicable runtime evidence. -2. Verify only package metadata. -3. Verify only editable installs. -4. Treat unavailable runtime evidence as a documented passing limitation. - -## Recommendation - -Choose option 1. A migrated package verifies installed and built metadata, -fresh-process isolation, decorator location, full parity, lazy delegation, -optional selection, real public dispatch, and direct implementation behavior. -Every admitted host package additionally requires host-runtime evidence. - -## Consequences - -- Completion evidence is consistent across packages. -- Missing required host evidence means incomplete and unverified, not passing. -- Editable-install success alone is insufficient. -- Generated artifacts remain isolated in temporary directories. - -## Affected packages - -Every package admitted to the initiative. - -## Dependencies - -- [ADR 001](001-authoritative-discovery.md) -- [ADR 002](002-registration-boundary.md) -- [ADR 003](003-contract-and-direct-apis.md) -- [ADR 004](004-optional-runtimes.md) diff --git a/initiatives/plugin-implementations/decisions/006-rollout-scope.md b/initiatives/plugin-implementations/decisions/006-rollout-scope.md deleted file mode 100644 index 5defed2..0000000 --- a/initiatives/plugin-implementations/decisions/006-rollout-scope.md +++ /dev/null @@ -1,52 +0,0 @@ -# ADR 006: Rollout Scope and Package Admission - -## Status - -Accepted. - -## Context - -The inventory spans current reference packages, partially migrated COMPAS 3 -packages, optional backends, host integrations, and many ecosystem packages. -An open-ended approval would make completion ambiguous and could activate -incompatible legacy plugins without repository ownership or runtime evidence. - -## Options - -1. Limit initial implementation to Waves 0–1 and require explicit admission - for every later package. -2. Approve all inventoried waves as one initiative scope. -3. Implement only the reference packages and omit model and viewer. -4. Allow packages to enter implicitly when maintainers begin work. - -## Recommendation - -Choose option 1. Initial implementation and completion cover exactly: - -- `compas` -- `compas_cgal` -- `compas_libigl` -- `compas_occ` -- `compas_model` -- `compas_viewer` - -Optional backends, host integrations, and remaining ecosystem packages stay on -the roadmap. Adding any of them requires a documented scope amendment, package -ownership, compatibility evidence, and new user approval. - -## Consequences - -- Initial completion is finite and independently verifiable. -- Waves 2–4 do not block the initial initiative. -- Later packages cannot enter silently. -- An admitted host package must satisfy ADR 005 host evidence; unavailable - validation leaves it incomplete. - -## Affected packages - -Initial scope: the six packages listed above. Later packages are affected only -after explicit admission. - -## Dependencies - -- [ADR 005](005-verification-and-evidence.md) diff --git a/initiatives/plugin-implementations/decisions/README.md b/initiatives/plugin-implementations/decisions/README.md deleted file mode 100644 index 6c40ecf..0000000 --- a/initiatives/plugin-implementations/decisions/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# Plugin Implementations Architecture Decisions - -Decisions 001–006 are **Accepted**. Implementation is authorized for the exact -initial scope in ADR 006; later waves still require explicit admission. - -| Order | ADR | Status | Depends on | Main tradeoff | -|---:|---|---|---|---| -| 1 | [001 — Authoritative discovery](001-authoritative-discovery.md) | Accepted | None | Explicit entry points versus legacy scanning or a new registry. | -| 2 | [002 — Registration boundary](002-registration-boundary.md) | Accepted | 001 | Lightweight category modules versus importing implementations during discovery. | -| 3 | [003 — Contract and direct APIs](003-contract-and-direct-apis.md) | Accepted | 002, stable core contracts | Exact core wrappers plus useful direct APIs versus divergent adapters. | -| 4 | [004 — Optional runtimes](004-optional-runtimes.md) | Accepted | 001, 002 | Accurate requirements and normal failures versus eager imports or suppression. | -| 5 | [005 — Verification and evidence](005-verification-and-evidence.md) | Accepted | 001–004 | Source, installed, artifact, and runtime evidence versus partial verification. | -| 6 | [006 — Rollout scope and package admission](006-rollout-scope.md) | Accepted | 005 | Six-package initial scope and explicit later admission versus open-ended rollout. | - -## Dependency graph - -```text -001 - | -002 - |\ -003 004 - \ / - 005 - | - 006 -``` diff --git a/initiatives/plugin-implementations/inventory.md b/initiatives/plugin-implementations/inventory.md deleted file mode 100644 index b12442a..0000000 --- a/initiatives/plugin-implementations/inventory.md +++ /dev/null @@ -1,244 +0,0 @@ -# Plugin Implementations Inventory - -Inventory date: 2026-11-06. Updated after the approved Wave 0–1 implementation -audit and the subsequent typing/modernization checkpoints. - -## Audited checkpoints - -The current coordination record uses these pushed candidate or modernization -heads. Counts below were re-inspected from these source checkpoints; hosted -claims are limited to the package evidence recorded by the owning initiative. - -| Package | Branch | Audited checkpoint | -|---|---|---| -| `compas` | `initiative/typing-alignment` | `99b82a6673ff7d05c1c323c8921135c274993f11` | -| `compas_cgal` | `initiative/typing-alignment` | `bb3624e714719d543c61768320d91811ba96cc6c` | -| `compas_libigl` | `initiative/typing-alignment` | `710b2b6714839a203fc8a6c62c437c0f6735ba0e` | -| `compas_occ` | `initiative/typing-alignment` | `7fdf2ffb57d1de16308020e14ec626d79e65a034` | -| `compas_model` | `initiative/repository-modernisation` | `83df4167f7ba1539ae205a837e0238afecc0a36b` | -| `compas_viewer` | `initiative/repository-modernisation` | `cf5a5195bda840a511319d6b7201978af68c15e3` | - -## Core discovery contract - -`compas.plugins.PluginManager.load_plugins` loads explicitly configured -builtin modules and modules declared in the installed `compas.plugins` -entry-point group. The global manager configures only `compas.scene` as a -builtin. It does not scan installed packages and does not read -`__all_plugins__`. - -`PluginManager.register_module` inspects a loaded module for decorated -functions. Consequently, `entry_point.load()` imports every declared -registration module during discovery. Any native, GUI, host, scene-adapter, or -implementation import at module scope is therefore an eager discovery cost and -may prevent unrelated plugins from loading. - -String requirements are checked with `find_spec` without importing the target. -Selection rejects equal-priority conflicts instead of relying on discovery -order. Call validation verifies argument binding, but discovery alone does not -prove annotation, result, or semantic parity. - -Core documentation in `docs/background/plugins.md` already describes the -intended pattern: explicit entry points, lightweight registration modules, and -function-local optional imports. - -## Current entry-point packages - -| Package | Entry-point modules | Decorated functions | Current state | -|---|---:|---:|---| -| `compas_cgal` | 4 | 9 | Lightweight category modules, function-local implementation imports, and per-family compiled-module requirements. | -| `compas_libigl` | 3 | 8 | Lightweight `trimesh`, `intersections`, and `quadmesh` modules; discovery is native-import-free, but requirements do not yet name the compiled runtime. | -| `compas_occ` | 4 | 130 | Lightweight BRep, curve, surface, and intersection modules guarded by the OCC requirement. | -| `compas_model` | 1 | 1 | Built entry point is isolated, requires `compas_viewer`, and preserves implementation import failures. | -| `compas_viewer` | 1 | 4 | Lazy package exports make actual entry-point loading Qt/OpenGL-free; implementation imports remain inside wrappers. | - -### Measured Wave 0 evidence - -The initial clean external-process audit produced: - -| Provider | Installed entry-point modules | Registered plugins | Selected plugins | -|---|---:|---:|---:| -| `compas_cgal` | 5 | 11 | 11 | -| `compas_libigl` | 3 | 8 | 8 | -| `compas_occ` | 4 | 131 | 131 | - -Fresh-process discovery did not import backend implementation or native -modules for any of the three providers. The later CGAL cleanup intentionally -reduced its entry-point/decorator counts from 5/11 to 4/9, and the OCC contract -consolidation reduced its decorator count from 131 to 130. Therefore the table -above is historical evidence, not the expected count for the current heads. - -At the current heads, package tests verify the changed registration contracts. -Framework ADR 021's exact live manifest passes semantic/hash validation, -offline staging, exact-version checks, installed entry-point/plugin discovery, -and strict exact-wheel typing. The lightweight source modules are inspected -separately. CGAL run `42231235319` attempt 2 is green across all platform wheel -builds and Python 3.12/3.14 wheel-smoke jobs. - -The Linux x86-64 CGAL→core→libigl native runtime path remains unexecuted -locally on Darwin ARM64, but protected framework run `42299118381` supplies -the hosted positive: all four required runtime contracts pass without skips. - -### Reference implementation state - -CGAL and libigl are the clearest category-oriented references. Both declare -entry points, keep contract imports type-only, and import implementations -inside wrapper bodies. CGAL now requires the actual compiled module for each -family. `split_mesh_mesh`, `mesh_skeleton`, and -`mesh_skeleton_with_mapping` have no current core pluggable and are retained as -undecorated direct APIs. Active contributor guidance explicitly forbids legacy -`__all_plugins__` discovery. - -Libigl's eight adapters map structurally to current core extension points and -now use the approved private hook names and complete native stubs. None yet -declares a compiled-runtime requirement. Its discovery and wheel tests cover -installed metadata and selected lazy paths; unavailable-runtime selection and -the complete per-category public-dispatch matrix remain open. - -OCC follows the same lazy principle and correctly names `OCC` as the optional -runtime. Its accepted curve, surface, BRep, and intersection signature/type -corrections are present at the current head. Repository plugin tests still use -synthetic entry points, so package-owned installed and built-wheel discovery -proof remains open even though the framework exact-candidate validation -supplies cross-package installed discovery and runtime evidence. - -### Measured Wave 1 evidence - -Current built wheels contain the intended entry points: - -- `compas_model = compas_model.plugins`; -- `compas_viewer = compas_viewer.plugins`. - -Model's installed consumer verifies the exact wheel entry point, registers one -Viewer-context plugin, proves that `compas_viewer` is absent, and confirms the -requirement prevents selection. Viewer makes its package exports lazy, so -loading the real installed entry point registers four plugins without loading -PySide6, OpenGL, or scene implementation modules. Its build workflow checks -the wheel metadata and repeats graphics-free discovery in a clean wheel -environment. - -### Current Wave 1 packages - -`compas_model` removes the legacy list and dormant second decorated -registration. Its sole plugin declares `requires=["compas_viewer"]`, performs -implementation imports in the function body, and does not swallow -implementation failures. `ensure_scene_objects_registered` is documented as -an explicit helper for editable/source activation and does not create a second -installed discovery mechanism. - -`compas_viewer.plugins` keeps implementation imports inside wrapper bodies, -and the package initializer now exposes Viewer and related public objects -lazily. Source and installed-wheel tests prove that entry-point discovery is -graphics-free. Final initiative evidence still needs the coordinated -model/viewer collect-all registry and lifecycle test. - -Both packages' real scene/render consumers still use stored resolutions, -cached tessellations, strategy objects, or the old `polygonize`/`tessellate` -paths. Their final dispatch evidence depends on Accepted Geometry ADRs 022–023 -and Typing ADR 015. - -## Legacy-only packages - -Current worktrees with `__all_plugins__` but no inspected `compas.plugins` -entry points include: - -- host and visualization packages: `compas_notebook`, `compas_rhino`, - `compas_blender`, `compas_ghpython`; -- geometry and integration packages: `compas_ifc`, `compas_robots`, - `compas_triangle`, `compas_fd`, `compas_tna`; -- ecosystem packages: `compas_ui`, `compas_cloud`, `compas_dr`, - `compas_assembly`, `compas_bender`, `compas_dem`, `compas_rui`, - `compas-Masonry`, `compas-FoFin`, `compas-IGS`, and `compas-RV`. - -Archived or parallel checkouts also contain legacy lists, but are not release -targets merely because they exist. - -These packages are not all metadata-only migrations: - -- notebook scene registration eagerly imports its full adapter set and exposes - at least one hook absent from current core; -- Rhino and Blender Boolean modules import their host runtimes at module scope - and target obsolete Boolean hook names; -- host scene modules eagerly import adapter classes; -- `compas_triangle` targets obsolete triangulation hooks and mutates some - caller inputs; -- `compas_ifc` uses an unsupported decorator option and imports optional viewer - code too early. - -Adding entry points before contract inspection could make incompatible plugins -selectable. - -## Existing data contracts - -The initiative must preserve the contracts currently established in package -source while tracking approved replacements explicitly: - -- triangle algorithms currently use core `TriangleMeshInput` structural - buffers and general-face operations use `MeshType` where supported; Accepted - Typing ADRs 016–017 replace both with a coordinated public vocabulary, so - final parity work follows their accepted migration order; -- planar triangulation uses the core planar point/domain hooks and their - approved result contract; -- OCC implements existing BRep, curve, surface, intersection, tessellation, - and polygonal-surface contracts; -- viewer, model, notebook, and host plugins register adapters through current - scene/factory extension points. - -Native conversion and process-safety validation belong to implementation -modules, not registration wrappers. - -## Test coverage - -Strong reusable patterns exist for: - -- installed distribution entry-point inspection; -- fresh-process discovery isolation; -- exact registration count and extension-point selection; -- decorator location and signature/default parity; -- representative lazy delegation; -- direct backend and native-boundary behavior. - -Common gaps are: - -- built-wheel metadata rather than editable-install metadata; -- optional requirement selection and unavailable-backend behavior; -- complete parity across every wrapper; -- conflict checks across packages; -- end-to-end public dispatch per category; -- host-runtime discovery and invocation evidence. - -## Documentation state - -Core's plugin author guide is the canonical baseline. Viewer documents its -entry point and warns against import side effects. CGAL and OCC agent guidance -requires explicit entry points and forbids restoring `__all_plugins__`. -Package-level contributor guidance and final migration notes remain uneven; -model, notebook, Rhino, Blender, and GH Python lack equivalent current author -guidance, though only model is in the approved Waves 0–1 scope. - -## Risks - -1. Entry points can activate obsolete or incompatible hooks. -2. Host behavior cannot be inferred from ordinary CPython CI. -3. Multiple collect-all scene registrations can introduce unintended registry - contents even when they do not create a selection conflict. -4. A requirement must identify the actual optional runtime, not merely the - plugin package. -5. Moving decorators changes module-qualified diagnostic plugin IDs. -6. Stale documentation can reintroduce removed discovery patterns. - -## Recommended waves - -The approved initial scope contains only: - -1. Wave 0: freeze the standard with core, CGAL, libigl, and OCC. -2. Wave 1: clean up current COMPAS 3 packages model and viewer. - -The following remain roadmap candidates rather than current implementation or -completion scope: - -3. compatible optional backends after contract inspection; -4. Rhino, GH Python, Blender, and notebook after explicit admission and with - required host evidence; -5. remaining active ecosystem packages admitted individually. - -Each later wave requires an explicit scope amendment and new user approval. diff --git a/initiatives/plugin-implementations/objective.md b/initiatives/plugin-implementations/objective.md deleted file mode 100644 index 29a008c..0000000 --- a/initiatives/plugin-implementations/objective.md +++ /dev/null @@ -1,89 +0,0 @@ -# Plugin Implementations Initiative - -## Objective - -Establish one simple and verifiable pattern for plugin implementations across -the COMPAS framework. Installed packages should use the current core plugin -manager through explicit package entry points, lightweight registration -modules, lazy implementation imports, exact core contracts, and tests that -prove both discovery and invocation behavior. - -The initiative consolidates existing mechanisms. It does not introduce a new -registry, plugin-specific geometry representations, compatibility scanning, or -dependency-resolution layer. - -## Questions to resolve - -1. Which discovery metadata is authoritative for installed packages? -2. What may a registration module import during ordinary discovery? -3. How must wrappers conform to core extension-point signatures and results? -4. When may a backend keep a directly importable implementation API? -5. How should optional native, GUI, notebook, and host runtimes affect - registration, selection, and failure? -6. Which source, installed-metadata, wheel, and host-runtime tests are required - before a package is considered migrated? -7. How should current packages and legacy ecosystem packages be sequenced? - -## Design principles - -- Use the existing `compas.plugins` entry-point group as the one installed - discovery path. -- Keep registration modules lightweight and organized by core plugin category. -- Import implementations and optional runtimes only when a plugin is invoked. -- Preserve current core data and result contracts; do not invent plugin-only - representations or adapters. -- Prefer exact visible wrappers over generated metadata or compatibility - layers. -- Keep direct backend APIs only when useful and semantically consistent. -- Treat import-free discovery and usable invocation as separate contracts. -- Require host-specific evidence for host integrations. - -## Deliverables - -1. A cross-package inventory of discovery metadata, wrappers, implementation - imports, tests, documentation, and compatibility risks. -2. An approved architecture and independent ADRs. -3. Reference verification in core, CGAL, libigl, and OCC. -4. A dependency-ordered initial migration of the six proposed Wave 0–1 - packages: `compas`, `compas_cgal`, `compas_libigl`, `compas_occ`, - `compas_model`, and `compas_viewer`. -5. Canonical contributor guidance and package-specific migration notes. -6. An inventoried but unapproved roadmap for optional backends, host - integrations, and remaining active ecosystem packages. - -## Non-goals - -- Replacing `PluginManager` or the entry-point mechanism. -- Restoring installed-package scanning or `__all_plugins__` compatibility. -- Changing geometry, tessellation, triangulation, or scene data models. -- Resolving unrelated algorithm correctness or native ABI work. -- Enabling incompatible legacy hooks merely by adding metadata. -- Treating archived or duplicate checkouts as release targets. -- Treating optional, host, or remaining ecosystem packages as part of the - initial completion criteria without a scope amendment and new approval. - -## Dependencies - -Stable extension-point signatures from the typing-alignment and geometry work -are prerequisites for migrating corresponding implementations. Repository -modernization provides packaging, wheel, and CI infrastructure used by the -verification gates. Model, viewer, and documentation initiatives must -coordinate ownership where their files overlap. If a host package is admitted -later, host-runtime evidence is required; unavailable host validation means -that package remains incomplete. - -## Current status - -Reconnaissance and architecture are complete. The proposal and ADRs 001–006 -are Accepted. Source migration has advanced across all six approved Wave 0–1 -packages through the typing and modernization branches: CGAL now has four -category entry points and no orphan decorators, model declares its Viewer -runtime, and viewer discovery no longer imports Qt/OpenGL. Built-wheel evidence -exists for model and viewer, and the native framework gate exercises installed -CGAL, libigl, and OCC discovery. - -The initiative remains incomplete. The core requirement-selection matrix, -libigl compiled-runtime requirements, package-owned OCC artifact evidence, -coordinated model/viewer registration, and final installed cross-package -review still have to satisfy the implementation-plan gates. No later wave is -authorized. diff --git a/initiatives/plugin-implementations/proposal.md b/initiatives/plugin-implementations/proposal.md deleted file mode 100644 index 45a2056..0000000 --- a/initiatives/plugin-implementations/proposal.md +++ /dev/null @@ -1,214 +0,0 @@ -# Plugin Implementations Proposal - -## Summary - -Standardize packages on the current core plugin manager, explicit -`compas.plugins` entry points, lightweight category registration modules, -function-local implementation imports, and a common verification contract. -Do not add another registry, compatibility scanner, or wrapper-generation -system. - -## Recommended architecture - -### Authoritative discovery - -Installed packages declare plugin modules only through PEP 621 metadata: - -```toml -[project.entry-points."compas.plugins"] -package_trimesh = "package.plugins.trimesh" -``` - -Remove `__all_plugins__` after every legacy contract has been inspected, the -package requires a compatible COMPAS version, and replacement entry points and -tests are complete. Core must not restore legacy package scanning. - -### Lightweight category modules - -Use category-oriented registration modules, for example: - -```text -src/package/plugins/ -├── __init__.py -├── intersections.py -├── scene.py -└── trimesh.py -``` - -These modules import the decorator at runtime, import contract types only under -`TYPE_CHECKING`, define decorated wrappers, and import implementations inside -wrapper bodies. They perform no native, GUI, host, scene-adapter, -implementation, or registration-side-effect import during discovery. - -Categories, rather than build artifacts, define module boundaries. Very small -packages may use one lightweight module when that remains clearer than a -directory. - -### Wrapper contract - -Every wrapper matches its core extension point in domain, category, name, -parameters, kinds, defaults, accepted structural inputs, return contract, and -documented failure behavior. Wrappers delegate. Native conversion and -process-safety validation remain in implementation modules. - -The initiative does not change geometry representations, tessellation versus -triangulation, approximation controls, or scene registries. Those contracts -remain owned by their existing initiatives. - -### Direct implementation APIs - -Useful direct backend APIs may remain public, but they are undecorated, do not -register through import side effects, and do not maintain a divergent second -high-level contract. Clearly named low-level native APIs may retain genuinely -low-level results when documented as such. - -### Optional runtimes - -Registration succeeds without optional runtimes. `requires` identifies the -actual selectable runtime. Use a module-name requirement where `find_spec` is -sufficient and a callable only when presence does not prove availability. -Do not use the plugin package itself as a proxy for a different runtime. - -Selection and invocation keep current core behavior. When nothing is -selectable, the core default or `PluginNotInstalledError` remains authoritative. -Ordinary implementation failures propagate after selection. - -## Verification contract - -Every migrated package verifies: - -1. exact installed `compas.plugins` entry-point names and values; -2. fresh-process registration count and extension-point set; -3. absence of implementation, native, GUI, and host modules after discovery; -4. decorators only in registration modules; -5. full parameter, default, annotation, and result parity; -6. representative lazy delegation per registration module; -7. unavailable-runtime registration and non-selection behavior; -8. at least one real public dispatch per category; -9. direct implementation and native-boundary behavior separately; -10. built-wheel metadata and discovery isolation; -11. host-runtime evidence for every admitted host package. Missing host - evidence is an incomplete gate, not a passing limitation. - -Generated files use isolated temporary directories. - -## Initial implementation scope - -Approval of this proposal would authorize only Waves 0–1 and exactly these six -packages: - -- `compas` -- `compas_cgal` -- `compas_libigl` -- `compas_occ` -- `compas_model` -- `compas_viewer` - -Waves 2–4 are roadmap candidates. Adding any optional backend, host -integration, or other ecosystem package requires an explicit scope amendment -and new user approval. They are not part of the initial completion criteria. - -## Initial rollout - -### Wave 0 — Reference baseline - -Affected packages: `compas`, `compas_cgal`, `compas_libigl`, and `compas_occ`. - -- make the core author guide canonical; -- add missing core requirement-selection tests; -- freeze the reusable verification contract; -- remove stale CGAL guidance; -- strengthen OCC from synthetic to installed-metadata verification; -- avoid rewriting already correct references. - -Typing alignment must stabilize relevant core signatures first. - -### Wave 1 — Current COMPAS 3 packages - -Affected packages: `compas_model` and `compas_viewer`. - -- remove model's obsolete legacy list; -- resolve duplicate model scene registration; -- add installed metadata, isolation, parity, and conflict tests; -- add installed metadata and graphics-import isolation to viewer; -- preserve scene registry behavior. - -Coordinate these edits with the model-alignment and viewer initiatives. - -## Deferred roadmap — not authorized by initial approval - -### Wave 2 — Compatible optional backends - -Inspect contracts before adding metadata. Triangle requires triangulation -contract migration. IFC requires decorator and optional-viewer cleanup. Other -packages enter only after activity, ownership, and compatibility are confirmed. - -### Wave 3 — Host integrations - -Affected packages: Rhino, GH Python, Blender, and notebook. - -Separate lightweight registration from host implementations, align current -core hooks, and require host-specific verification. If the required host -evidence cannot run, the admitted package remains incomplete and unverified. - -### Wave 4 — Remaining ecosystem - -Migrate active packages individually. Do not silently include archived or -duplicate checkouts. Every package requires explicit admission. - -## Documentation - -Core owns the canonical author guide. Package documentation describes only -package-specific runtimes and implementations. Examples show entry-point -metadata, lightweight wrappers, function-local imports, actual requirements, -and direct versus dispatched usage. Remove active guidance recommending -`__all_plugins__` and note plugin-ID changes as diagnostic changes. - -## Alternatives - -### Keep `__all_plugins__` - -Rejected. Core does not read it, and restoring scanning creates competing -paths and import side effects. - -### Point metadata at implementations - -Rejected. Discovery eagerly imports optional and native runtimes. - -### One monolithic module everywhere - -Viable only for very small packages. Category modules are the default because -they provide clearer ownership and isolation without one file per function. - -### One entry point per native extension - -Rejected. Registration follows core categories, not build artifacts. - -### Generate wrappers or metadata - -Rejected. Generation adds machinery and obscures signatures and imports. - -### Centralize third-party implementations in core - -Rejected. It couples core to optional package releases and runtimes. - -### Decorate and re-export direct APIs - -Rejected. It still imports implementations during discovery and blurs the -registration boundary. - -## Compatibility implications - -- Migrated branches require COMPAS 3 before legacy discovery is removed. -- Moving decorators changes module-qualified plugin IDs; these are diagnostic, - not stable public APIs, but changelogs should note the change. -- Direct imports remain valid. -- Equal-priority duplicates must be resolved explicitly. -- Incompatible legacy hooks require contract migration before metadata. -- No compatibility shims or duplicate registration paths are proposed. - -## Approval record - -ADRs 001–006 are Accepted. Implementation is authorized only for the approved -six-package Waves 0–1 scope. Later waves still require a scope amendment and -new explicit approval; merge and publication remain separately gated. diff --git a/initiatives/repository-modernisation/baseline.md b/initiatives/repository-modernisation/baseline.md deleted file mode 100644 index 34af17b..0000000 --- a/initiatives/repository-modernisation/baseline.md +++ /dev/null @@ -1,386 +0,0 @@ -# Repository Modernisation Phase 0 Baseline - -## Status - -Complete on 2026-11-03. Rollback commits and exact Phase 1 debt manifests are -recorded. The dirty `compas_framework` and `compas_session` worktrees have -explicit preservation gates because commits cannot restore their dirty or -untracked user content. This report does not claim that unavailable checks -passed and it does not authorize publishing, deployment, repository-setting -changes, or merges. - -## Method - -The ten initial repositories were inspected in parallel without installing or -updating dependencies and without editing their worktrees. Checks used the -`compas3` environment and its Python interpreter where feasible: - -```text -/Users/vanmelet/miniforge3/envs/compas3/bin/python -``` - -The observed interpreter was Python 3.12.13. Commands were directed to -temporary output locations when supported. Builds or documentation commands -that necessarily wrote generated files into a repository were not run. Network -inventory and isolated-build failures caused by the restricted audit -environment are reported as environmental limitations, not package failures. - -For a clean repository, the recorded commit is the rollback point for -subsequent migration work. A commit is not a complete rollback point for a -dirty repository because it cannot restore modified, deleted, ignored, or -untracked user content. That state is user-owned and must be reconciled or -preserved through a recoverable, owner-approved mechanism before edits begin. - -The measured checks can be reproduced from each repository with the `compas3` -interpreter. Commands use the applicable subset of: - -```text -python -m pytest -p no:cacheprovider -q -python -m ruff check --no-cache . -python -m ruff format --check --no-cache . -python -m pyright --pythonpath /Users/vanmelet/miniforge3/envs/compas3/bin/python -python -m mkdocs build --strict --site-dir -``` - -OCC's source-only typing capture adds `--outputjson src/compas_occ`. Commands -must be invoked through the explicit `compas3` interpreter path recorded above; -the shortened `python` form is shown only for readability. - -## Repository and rollback inventory - -| Repository | Profile | Branch | Rollback commit | Worktree | -|---|---|---|---|---| -| `compas` | Pure Python | `remove-future` | `8d2becec9efe92a4d106d9802eeb1bb05812984f` | Clean | -| `compas_occ` | External-runtime hybrid | `c3-upgrade` | `e8ca13092f0768b7ed10d0befda26068b62f77e2` | Clean | -| `compas_cgal` | Native wheel | `c3-upgrade` | `ab7f96acc5011d6758a455c012523b0ab8b54da0` | Clean | -| `compas_framework` | Pure Python plus coordinated native integration | `initiative/geometry-tessellation` | `552929cb7e2b47be9076110334f89bb74e127f1e` (tracked base only; incomplete rollback point) | Dirty before audit; preservation gate required | -| `compas_gmsh` | External-runtime hybrid | `main` | `c16725f12930659e85849640d912717bd0fe9475` | Clean | -| `compas_libigl` | Native wheel | `c3-upgrade` | `70acf990bc0015fc2b27abeae28f9e50f68e4561` | Clean | -| `compas_model` | External-runtime hybrid | `c3-upgrade` | `fdb37df8ee343bbaea5f6420d987e8a4ea468ed3` | Clean | -| `compas_session` | Pure Python | `main` | `4668a20b3820277cd6ba9f7a523c84cf6177acaf` (tracked base only; incomplete rollback point) | Dirty before audit; preservation gate required for untracked `src/compas_session/workflow.py` | -| `compas_shapeop` | Native wheel | `main` | `9f575799747d79348b2661917628408fa84acd09` | Clean; ignored local native source exists | -| `compas_viewer` | Pure Python with Qt/OpenGL/headless extension | `c3-upgrade` | `ff1c81f37b7233c783a5e44f87adf4e8ca583f2a` | Clean | - -## Measured quality baseline - -Results below are exact observations from this audit. A dash means the check -was unavailable or not run, not that it passed. - -| Repository | Tests | Ruff check | Ruff format | Pyright | Strict docs | Build/artifact | Native import | -|---|---|---|---|---|---|---|---| -| `compas` | 2009 passed, 30 failed because installed OCC/CGAL plugins invalidate missing-plugin assumptions | Pass | `src`, tests, and tasks pass; full repository has 17 files to format | 0 errors | Blocked by remote inventory fetch | Not run read-only | N/A | -| `compas_occ` | 95 passed | Pass | focused scope passes; full repository has 37 files to format | 62 errors | Network blocked plus 11 real warnings | Not run read-only | Pass | -| `compas_cgal` | 129 passed, 6 failed | 1 unused import | 30 files to format | 258 errors; environment/import configuration is not authoritative | Blocked by remote inventories | Not run read-only | Pass for sampled ABI3 modules | -| `compas_framework` | 23 passed | Pass | Pass, 85 files checked | 0 errors | Pass | no-isolation sdist/wheel and Twine checks pass; isolated build blocked by DNS | Integration environment present | -| `compas_gmsh` | 1 dummy test passed with source paths; does not exercise Gmsh | Pass | 1 file to format | 10 errors | 4 real Griffe warnings plus 2 network inventory failures | No current artifacts | Gmsh unavailable | -| `compas_libigl` | 41 passed | Pass | Pass, 54 files checked | 215 errors; no authoritative configured scope | Sphinx write requirement blocked read-only audit | Not run read-only | Pass for sampled ABI3 modules | -| `compas_model` | 363 passed, 11 failed, 11 errors | 32 errors | Pass, 166 files checked | 114 errors; no authoritative configured scope | Fails on stale `interactiongraph` reference | Unverified; isolated build blocked by DNS and no-isolation build needed repository writes | Existing environment exercised optional backends, but isolation unverified | -| `compas_session` | 6 passed, 6 sandbox-write failures with `PYTHONPATH=src` | Pass | Pass, 18 files checked | 69 broad-scope errors; no authoritative configured scope | Sphinx write requirement blocked read-only audit | No artifact evidence | N/A | -| `compas_shapeop` | Collection blocked: native extension unavailable | 6 import-order errors | Pass, 22 files checked | 51 errors, 11 warnings; scope includes ignored native sources | Sphinx write requirement blocked read-only audit | No local artifacts | Fail: extension not built/installed | -| `compas_viewer` | 95 passed, 1 failed | Pass | 40 Markdown files to format | 19 errors | Pass | Existing wheel is stale and not evidence for current commit | Qt/OpenGL provisioning not isolated | - -## Repository migration surfaces and gates - -### `compas` - -The Phase 1 manifest is: - -- `pyproject.toml` -- new `uv.lock` -- `tasks.py` -- `mkdocs.yml` -- `docs/background/setup.md` -- `docs/background/workflow.md` -- `docs/background/documentation.md` -- `.github/workflows/build.yml` -- `.github/workflows/coverage.yml` -- `.github/workflows/docs.yml` -- `.github/workflows/pr-checks.yml` -- `.github/workflows/prepare-release.yml` -- `.github/workflows/release.yml` -- `.gitignore` only if the accepted lock/build-output policy requires it -- focused test/configuration files needed to isolate pure-core tests from - installed plugin discovery - -The exact Ruff-format debt is: - -- `docs/assets/examples/_plotter.py` -- `docs/assets/examples/basics.datastructures.cellnetworks.py` -- `docs/assets/examples/colors_saturation.py` -- `docs/background/code.md` -- `docs/background/dtypes.md` -- `docs/examples/color-maps.md` -- `docs/examples/point-in-box.md` -- `docs/examples/quadmesh-planarisation.md` -- `docs/getting-started/advanced.hashtree.md` -- `docs/getting-started/advanced.serialisation.md` -- `docs/getting-started/basics.colors.md` -- `docs/getting-started/basics.datastructures.cellnetwork.md` -- `docs/getting-started/basics.datastructures.meshes.md` -- `docs/getting-started/basics.datastructures.trees.md` -- `docs/getting-started/basics.datastructures.volmeshes.md` -- `docs/getting-started/basics.visualisation.md` -- `docs/getting-started/first-steps.md` - -All 30 contaminated failures are in -`tests/compas/geometry/test_incomplete_geometry_apis.py`. Relevant core dispatch -paths are `src/compas/plugins.py` and `src/compas/geometry/brep/brep.py`; the -installed providers that expose the isolation problem are the sibling paths -`compas_occ/src/compas_occ/plugins/brep.py`, -`compas_occ/src/compas_occ/brep/brep.py`, and -`compas_cgal/src/compas_cgal/plugins/triangulation.py`. The sibling files are -evidence, not `compas` ownership. The main gates are a committed lock, direct -commands, immutable action pins, strict documentation without suppressed -warnings, and a clean core test environment. - -### `compas_occ` - -The Phase 1 manifest is: - -- `pyproject.toml` -- new `uv.lock` -- `environment.yml` -- `tasks.py` -- `mkdocs.yml` -- `docs/installation.md` -- contributor/developer command documentation to be created or updated at the - repository's established documentation location -- `.github/workflows/build.yml` -- `.github/workflows/docs.yml` -- `.github/workflows/pr-checks.yml` -- `.github/workflows/release.yml` -- artifact-install and native-import smoke tests to be added under `tests/` - -The exact Pyright debt surface is: - -- `src/compas_occ/brep/brepedge.py` -- `src/compas_occ/brep/brepface.py` -- `src/compas_occ/brep/breploop.py` -- `src/compas_occ/brep/brepvertex.py` -- `src/compas_occ/conversions/meshes.py` -- `src/compas_occ/geometry/curves/curve.py` -- `src/compas_occ/geometry/curves/curve2d.py` -- `src/compas_occ/geometry/curves/nurbs.py` -- `src/compas_occ/geometry/surfaces/__temp/extrusion.py` -- `src/compas_occ/geometry/surfaces/__temp/revolution.py` -- `src/compas_occ/geometry/surfaces/nurbs.py` -- `src/compas_occ/geometry/surfaces/surface.py` - -Strict-doc warnings originate in `src/compas_occ/brep/brepface.py`, -`src/compas_occ/geometry/surfaces/nurbs.py`, and -`src/compas_occ/conversions/geometry.py`; they surface through -`docs/api/compas_occ.conversions.md`. Inventory configuration is in -`mkdocs.yml`. - -The exact formatting debt is `docs/tutorial.md`; the ten Markdown files under -`docs/examples/breps/` named `brep_explorer`, `brep_fillet`, -`brep_from_booleans`, `brep_from_mesh`, `brep_overlap`, `brep_slice`, -`brep_split`, `brep_trim`, `brep_with_hole`, and `brep_with_holes`; the thirteen -files under `docs/examples/curves/` named `curve_closest_parameters_curve`, -`curve_closest_point`, `curve_comparison1`, `curve_comparison2`, `curve_divide`, -`curve_from_circle`, `curve_from_ellipse`, `curve_from_interpolation`, -`curve_from_line`, `curve_from_parameters`, `curve_from_points`, -`curve_joining`, and `curve_segmentation`; and the thirteen files under -`docs/examples/surfaces/` named `__temp/surface_from_extrusion-1`, -`__temp/surface_from_extrusion-2`, `surface_aabb`, `surface_frames`, -`surface_from_fill`, `surface_from_meshgrid`, `surface_from_parameters`, -`surface_from_points`, `surface_intersections_with_line`, `surface_isocurves`, -`surface_jsondata`, `surface_random`, and `surface_spacepoints`, all with the -`.md` suffix. Python metadata, Ruff, Conda, and CI matrices must agree. The -minimal Conda layer must continue to provide PythonOCC explicitly. - -### `compas_cgal` - -The Phase 1 manifest is: - -- `pyproject.toml` -- `uv.lock` -- `pixi.lock` -- `environment.yml` -- `requirements.txt` -- `requirements-dev.txt` -- `requirements-docs.txt` -- `requirements-viz.txt` -- `tasks.py` -- `CMakeLists.txt` -- `mkdocs.yml` -- `.github/workflows/build.yml` -- `.github/workflows/docs.yml` -- `.github/workflows/pr-checks.yml` -- `.github/workflows/release.yml` -- contributor, build, and release documentation at their existing repository - locations - -The test debt is in `tests/test_straight_skeleton_2_extrude.py`, -`src/compas_cgal/straight_skeleton_2.py`, and `tests/test_subdivision.py`. The -Ruff error is in `docs/examples/example_meshing.py`. - -The exact Pyright surface comprises these stubs under `src/compas_cgal/`: -`_booleans.pyi`, `_geodesics.pyi`, `_intersections.pyi`, `_isolines.pyi`, -`_measure.pyi`, `_meshing.pyi`, `_polylines.pyi`, `_reconstruction.pyi`, -`_skeletonization.pyi`, `_slicer.pyi`, `_straight_skeleton_2.pyi`, -`_subdivision.pyi`, `_triangulation.pyi`, and `_types_std.pyi`; these wrappers: -`_tessellation.py`, `booleans.py`, `geodesics.py`, `intersections.py`, -`isolines.py`, `measure.py`, `meshing.py`, `polylines.py`, `projection.py`, -`reconstruction.py`, `skeletonization.py`, `slicer.py`, -`straight_skeleton_2.py`, `subdivision.py`, `triangulation.py`, and `types.py`; -and `plugins/booleans.py`, `plugins/intersections.py`, `plugins/mesh.py`, -`plugins/triangulation.py`, and `plugins/trimesh.py`. - -The exact formatting debt is `docs/devguide/contribute.md`, -`docs/devguide/types.md`, and the Markdown files under `docs/examples/` named -`example_boolean_difference_mesh_meshes`, `example_booleans`, -`example_booleans_with_edges`, `example_booleans_with_face_source`, -`example_geodesics`, `example_geodesics_exact`, `example_intersections`, -`example_isolines`, `example_measure`, `example_meshing`, -`example_meshing_dual`, `example_projection`, -`example_reconstruction_pointset_normal_estimation`, -`example_reconstruction_pointset_outlier_removal`, -`example_reconstruction_pointset_reduction`, -`example_reconstruction_pointset_smoothing`, -`example_reconstruction_poisson_surface_reconstruction`, -`example_simplify_polylines`, `example_skeletonization`, -`example_skeletonization_with_mapping`, `example_slicer`, -`example_straight_skeleton_2_extrude`, -`example_straight_skeleton_2_interior_straight_skeleton`, -`example_straight_skeleton_2_interior_straight_skeleton_offset_polygon`, -`example_straight_skeleton_2_interior_straight_skeleton_weighted_offset_polygon`, -`example_straight_skeleton_2_interior_straight_skeleton_with_holes`, -`example_subdivision`, and `example_triangulation`, all with the `.md` suffix. -Documentation inventories are configured in `mkdocs.yml` lines 83–108 and -`requirements-docs.txt`. Competing dependency paths must be reduced to one -authoritative Python path plus visible native provisioning. CGAL, Boost, and -Eigen downloads need integrity verification. Current test, lint, typing, -formatting, and artifact gates are not green. - -### `compas_framework` - -Migration files are `pyproject.toml`, a new `uv.lock`, `environment.yml`, -`tasks.py`, the build/docs/PR/release workflows, and contributor, testing, and -package documentation. Ordinary pure checks must be separated from an -explicitly provisioned exact-candidate-artifact integration job. Python -metadata and both CI matrices must be reconciled. Existing user-owned worktree -changes must be preserved. The exact pre-existing dirty paths are: - -- deleted `.agents/skills/update-docstrings/SKILL.md` -- deleted `.agents/skills/update-type-hints/SKILL.md` -- modified `AGENTS.md` -- untracked `.codex/` -- untracked `initiatives/repository-modernisation/` -- untracked `initiatives/typing-alignment/` - -Before any edits in this repository, the owner must choose and verify a -recoverable preservation/reconciliation method for all of these paths. The -tracked commit alone is not an adequate rollback point. This report records -path names and status only; it deliberately does not copy user content. - -### `compas_gmsh` - -Migration files are `pyproject.toml`, a new `uv.lock`, `tasks.py`, -`environment-linux.yml`, `mkdocs.yml` and omitted pages, all four workflows, -`tests/test_dummy.py`, new runtime tests, and typing corrections in the CSG, -model, and options modules. The primary gate is meaningful Gmsh runtime -coverage and an evidence-based Python/platform matrix; the dummy test cannot -support a migration claim. - -### `compas_libigl` - -Migration files are `pyproject.toml`, a new `uv.lock`, `environment.yml`, -`requirements-dev.txt`, `tasks.py`, `CMakeLists.txt`, the full Sphinx-to-MkDocs -documentation conversion, all four workflows, contributor/build/release -documentation, and typing-marker/stub and artifact-verification work. The -mutable libigl `main` dependency is a blocking reproducibility defect and must -be replaced by a reviewed immutable revision. - -### `compas_model` - -Migration files are `pyproject.toml`, a new `uv.lock`, `environment.yml`, -`tasks.py`, `mkdocs.yml`, the stale interactiongraph reference, contributor and -testing documentation, all four workflows, the PR template, duplicate/debt -tests, viewer fixtures, and production typing-contract files. Coal, OCC, and -Viewer jobs must remain explicit. Existing test, Ruff, Pyright, strict-doc, and -artifact-build debt must be resolved before the gates become blocking. - -### `compas_session` - -Migration files are `pyproject.toml`, both requirements files, a new `uv.lock`, -`tasks.py`, all four workflows, the Sphinx/RST documentation tree, a new -`mkdocs.yml`, README/contributor instructions, and possibly `.gitignore`. -The untracked `src/compas_session/workflow.py` must be reconciled with its owner -before edits. A recoverable, owner-approved preservation point for that file is -required because the tracked commit cannot restore it. Tests need a writable -temporary-path contract rather than writing under the repository. - -### `compas_shapeop` - -Migration files are `pyproject.toml`, both requirements files, -`environment.yml`, a new `uv.lock`, `CMakeLists.txt`, `tasks.py`, all four -workflows, the Sphinx-to-MkDocs documentation conversion, build/release docs, -native and ABI tests, and artifact verification. The declared Python 3.9+ -support conflicts with a `cp312` stable ABI and other Python baselines. That -contract must be resolved before workflow migration. Eigen needs integrity -verification, and the ignored local native tree is not a reproducible source. - -### `compas_viewer` - -Migration files are `pyproject.toml`, a new `uv.lock`, `tasks.py`, `mkdocs.yml`, -all six workflows, scene objects using obsolete COMPAS tessellation APIs, -associated tests, and contributor/build/headless-test documentation. The -mutable COMPAS Git branch installed by CI must be replaced by accepted bounds -or exact candidate artifacts. Qt/OpenGL packages and headless behavior must -remain visible rather than hidden in a generic profile. - -## Cross-cutting blockers - -1. No audited repository has a satisfactory committed development lock; CGAL's - existing lock contradicts its project metadata. -2. Invoke and `compas_invocations2` remain canonical in most repositories. -3. Workflows widely use moving action tags, obsolete actions, broad or implicit - permissions, and token-based publication. -4. Most release paths rebuild or do not prove promotion of the exact tested - artifacts. -5. Python metadata, Ruff targets, CI matrices, native ABI settings, and actual - dependency availability disagree in several repositories. ShapeOp is the - most severe case. -6. Strict documentation is not a demonstrated green gate for most packages. - Remote inventories also require a controlled network-aware verification - environment. -7. Pyright is green only for `compas` and `compas_framework`; several other - results are broad unconfigured scans and require authoritative scopes before - debt can be fixed and made blocking. -8. Native and optional-runtime provisioning is not reproducibly verified for - Gmsh, ShapeOp, Model, Viewer, or release artifacts. -9. `compas_framework` and `compas_session` contain pre-existing user-owned - worktree state that must not be overwritten. - -## Environmental limitations - -- Restricted network access blocked remote documentation inventories and - isolated build-dependency downloads. -- Read-only audit rules prevented Sphinx autosummary and build backends from - generating files inside repositories. -- Phase 0 did not install, update, publish, deploy, or change repository - settings. -- Missing Gmsh and ShapeOp native runtimes are recorded as unavailable, not as - passing skips. -- Existing installed sibling plugins contaminated the nominally pure `compas` - test run; Phase 1 must establish isolated and integration test modes. - -## Phase 1 readiness - -Phase 0 is complete: it has produced the required measured baseline, exact -Phase 1 debt manifests, and rollback commits. The dirty `compas_framework` and -`compas_session` worktrees have explicit preservation gates that must close -before their later migration phases. This does not block Phase 1, which may -begin with separate owners for `compas`, `compas_occ`, and `compas_cgal`. -Before editing: - -1. preserve the recorded rollback commits and confirm each worktree state; -2. assign non-overlapping repository ownership; -3. keep `compas_framework` and `compas_session` user changes out of Phase 1 and - do not edit either repository until its preservation gate is closed; -4. establish authoritative direct commands and writable temporary build output; -5. resolve failures within each reference repository before enabling new - blocking gates; and -6. do not change repository settings, publish, deploy, or merge without further - explicit approval. diff --git a/initiatives/repository-modernisation/compas-gmsh.md b/initiatives/repository-modernisation/compas-gmsh.md deleted file mode 100644 index 573d81c..0000000 --- a/initiatives/repository-modernisation/compas-gmsh.md +++ /dev/null @@ -1,242 +0,0 @@ -# `compas_gmsh` Modernisation Proposal - -**Status:** Approved and implemented on the reviewed initiative branch - -This package proposal refines the accepted repository-modernisation policy for -`compas_gmsh`. ADRs 014–016 are Accepted and implemented at -`c47af195bf04d0d2e874255bfe9c5f351beda672` on draft -[PR 7](https://github.com/compas-dev/compas_gmsh/pull/7). Its real Gmsh matrix, -macOS 15 migration, typed artifacts, strict documentation, and separate OCC -integration are hosted green. Repository settings, publishing, deployment, and -merging remain separately approval-gated. - -## Objective - -Make `compas_gmsh` a reproducible, typed Python 3.12+ wrapper around the -official Gmsh Python SDK, with real meshing tests, strict documentation, and a -release that promotes one verified artifact set. Keep Gmsh provisioning -visible and avoid a second Python dependency authority. - -## Current evidence - -At baseline commit `c16725f12930659e85849640d912717bd0fe9475`: - -- the only test imports `compas_gmsh` and prints its version; -- `gmsh`, `compas`, and directly imported NumPy are not bounded consistently; -- `requires-python`, classifiers, Ruff, and workflows disagree; -- Linux instructions split provisioning between pip and Conda, and - `environment-linux.yml` installs both `gmsh` and `python-gmsh`; -- Pyright reports ten errors and the distribution has no `py.typed` marker; -- `Model.from_brep` leaks the `mkstemp` file descriptor and leaves its generated - BRep file behind; -- project metadata names a nonexistent `LICENSE`, while `LICENSE.MIT` and a - GPL-3.0 text coexist without an explicit project/dependency boundary; -- build and release workflows use moving shared-action tags, a token publisher, - and matrices that do not match the package metadata; and -- MkDocs exists, but strict builds have real Griffe warnings and rely on - network inventory resolution. - -The official Gmsh project documents `pip install --upgrade gmsh` as the normal -Python SDK installation path. As of 2026-11-05, Gmsh 4.15.2 provides official -PyPI wheels for Windows x86-64, Linux x86-64, macOS x86-64, and macOS ARM64. -This evidence supports a uv/PyPI primary path; it does not prove arbitrary -platform support. - -## Accepted decisions - -| ADR | Decision | Status | Depends on | -|---|---|---|---| -| [014](decisions/014-gmsh-runtime-and-support.md) | Official PyPI SDK as the canonical runtime and an evidence-based support matrix | Accepted | 001, 002, 003, 009 | -| [015](decisions/015-gmsh-license-boundary.md) | MIT wrapper license separated from the GPL Gmsh dependency | Accepted | 002, 014 | -| [016](decisions/016-gmsh-verification-and-release.md) | Real-runtime gates, typed artifacts, temporary-file ownership, and exact artifact promotion | Accepted | 004–011, 014, 015 | - -## Recommended package contract - -Use one public installation contract: - -```toml -requires-python = ">=3.12" -dependencies = [ - "compas>=3,<4", - "gmsh>=4.13.1,<5", - "numpy>=1.26", -] -``` - -The lower Gmsh bound is an implementation hypothesis that must pass the -minimum-dependency runtime job before release. If 4.13.1 cannot satisfy the -approved smoke contract, implementation must return with evidence and a new -bound proposal; it must not silently change the bound or weaken the test. - -The committed `uv.lock` records the tested development environment. It is not -the published compatibility contract. `environment-linux.yml` is removed once -the uv/PyPI path passes on Linux; the repository must not install both the PyPI -SDK and Conda's Gmsh bindings into one environment. Conda can be documented as -an unsupported alternative provisioning route, but it is not a CI dependency -authority unless a demonstrated platform requirement produces a later ADR. - -## Runtime and platform matrix - -The blocking current-dependency matrix covers: - -- CPython 3.12 and 3.14 on Linux x86-64; -- CPython 3.12 and 3.14 on Windows x86-64; and -- CPython 3.12 and 3.14 on macOS ARM64. - -Run Python 3.12 minimum-dependency jobs with the declared lower bounds on all -three verified OS/architecture targets. This separates SDK availability from -the current-lock jobs instead of inferring cross-platform compatibility from a -Linux result. Python 3.13 is inside the supported range but does not need a -duplicate blocking job: per ADR 009, the matrix exercises the minimum and -latest supported interpreters. - -The public platform floor follows the official binary SDK contract: - -- Windows 10 or newer on x86-64; -- Linux x86-64 with glibc 2.28 or newer; and -- macOS 12 or newer on ARM64. - -Workflow evidence records the exact hosted runner labels, architectures, and -image releases; it does not use a generic `latest` label as the support -definition. - -Add macOS x86-64 as a blocking target only when a dependable runner is -available and the official SDK wheel passes the same runtime contract. Until -then, documentation may identify macOS 10.15+ x86-64 as an upstream Gmsh -target, but `compas_gmsh` must not report it as framework-verified. Other -architectures or source-built Gmsh installations are best-effort, not -supported targets. - -The matrix verifies `gmsh.initialize()` and `gmsh.finalize()` in addition to -import. Gmsh's GUI is not opened, and tests must remain headless. - -## Verification contract - -Replace the dummy test with a compact suite that exercises real public -behavior: - -1. initialize and finalize a named model repeatedly without leaking global - Gmsh state; -2. construct a simple planar model, generate a two-dimensional mesh, convert it - to a COMPAS mesh, and assert nonempty vertices/faces and valid indices; -3. construct one OCC solid and generate a three-dimensional mesh with nonempty - tetrahedral output; -4. exercise one boolean operation and assert resulting entity dimensions; -5. import a committed, read-only STEP fixture; -6. preserve `Model.from_brep(Brep)`, export through the core-supported - `Brep.to_step` path into a scoped intermediate, and prove that the file and - descriptor are released on success and failure; -7. cover option round-trips that are part of the public API; and -8. run a clean installed-wheel consumer from outside the source tree. - -Tests own every generated path through `tmp_path` or `tmp_path_factory`. -Runtime code that needs an intermediate BRep owns a scoped temporary directory -and removes it after `gmsh.open` returns or raises. Committed fixtures are -read-only inputs. Mocks may isolate exceptional paths but do not replace the -real Gmsh smoke gates. - -The ordinary Gmsh matrix does not acquire an implicit OCC dependency. A -separate Linux integration job installs `compas_occ` and verifies the real -`COMPAS Brep backed by compas_occ -> Brep.to_step -> Model.from_brep` path. -Focused unit tests may use a small duck-typed exporter to prove cleanup -failures. Requiring native BREP serialization instead of the core STEP -contract would be a new input-protocol decision and is outside this proposal. - -## Typing and public API scope - -Add `py.typed`, type every exported `compas_gmsh` function and method, and make -Pyright blocking for `src`, tests, and a strict installed-wheel consumer. Gmsh -does not need a repository-maintained full stub package. A narrow configuration -exception for the external generated `gmsh` module is acceptable; it must not -exclude `compas_gmsh` modules or turn public results into `Any`. - -Typing cleanup may modernize annotations and remove inaccurate ignores, but it -does not authorize behavioral API redesign. Genuine CSG or lifecycle defects -found while typing require focused regression tests; broader model API changes -return to proposal rather than entering as incidental modernization. - -## Documentation scope - -Keep MkDocs and make `mkdocs build --strict` reproducible and blocking. Correct -site URLs and navigation, remove superseded RST residue, resolve all Griffe -warnings, and ensure the build does not depend on a live documentation -inventory. Installation documentation must show the uv/PyPI path first, -identify the exact supported platform matrix, explain the separate Gmsh GPL -license, and distinguish upstream Gmsh support from framework-verified support. - -Examples should cover planar meshing, solid meshing, and deterministic cleanup. -They must write outputs to a user-selected or temporary directory. When package -docstrings or rendered signatures are touched, the implementation owner must -apply the repository-local `update-docstrings` skill and run its doctest, Ruff, -diff, and affected strict-MkDocs checks. - -## Work packages - -### G1 — Metadata and environment - -- align Python classifiers and Ruff with Python 3.12+; -- declare `compas`, `gmsh`, and NumPy bounds; -- add PEP 735 development, test, and docs groups plus `uv.lock`; -- remove duplicated requirements and `environment-linux.yml` only after parity; -- retain thin repository-owned Invoke aliases over documented `uv run` - commands, with no environment or Gmsh provisioning inside tasks. - -### G2 — Runtime tests and lifecycle corrections - -- replace the dummy test with the real-runtime contract above; -- make Gmsh global-state cleanup deterministic; -- repair BRep intermediate-file ownership and add success/failure regressions; -- keep all generated artifacts under pytest temporary directories. - -### G3 — Blocking typing and documentation - -- resolve the measured Pyright debt and add `py.typed`; -- add source and installed-artifact typing consumers; -- complete the strict MkDocs cleanup and installation/license guidance; -- verify public examples against the supported runtime. - -### G4 — Workflows and artifacts - -- keep OS/runtime provisioning and test commands visible in repository YAML; -- use immutable action pins, least-privilege permissions, concurrency, and - temporary runner directories; -- run Ruff, format check, Pyright, strict docs, minimum/current runtime tests, - and package checks as blocking jobs; -- build the pure-Python wheel and sdist once, inspect metadata and contents, - install the exact wheel with dependencies in a clean environment, and run - the installed runtime and typing consumers; -- pass the unchanged verified artifacts to trusted publishing and the GitHub - release, then deploy documentation from the same verified release revision, - only after repository settings are configured and publication is separately - approved. - -## Compatibility implications - -- Python 3.9–3.11 leave the supported contract, matching COMPAS 3. -- COMPAS 2 and future COMPAS 4 are outside the declared range. -- Gmsh 5 is excluded until its API is reviewed and tested. -- the project remains MIT; installing it also installs a separately licensed - GPL-2.0-or-later Gmsh runtime. -- users relying on Conda-only environment files move to the documented uv path - or manage an external Gmsh environment themselves. -- no public `compas_gmsh` model method is removed or renamed by this proposal. - -## Completion evidence - -The package is modernized only when all accepted ADRs are implemented and: - -- frozen uv sync, Ruff check/format, Pyright, pytest, and strict MkDocs pass; -- minimum and current Gmsh runtime jobs satisfy the same smoke contract; -- wheel and sdist metadata contain the approved Python, dependency, and license - contracts plus `py.typed`; -- the exact wheel passes clean installed runtime and strict typing consumers; -- tests and workflows leave no generated files in the checkout; -- workflow YAML is independently reviewed for pinning, permissions, artifact - identity, and publish isolation; and -- no merge, deployment, or publication has occurred without explicit approval. - -## Sources - -- [Gmsh stable manual: obtaining and installing Gmsh](https://gmsh.info/doc/texinfo/#Obtaining-Gmsh) -- [Official Gmsh PyPI distribution](https://pypi.org/project/gmsh/) -- [Gmsh downloads and platform requirements](https://gmsh.info/#Download) diff --git a/initiatives/repository-modernisation/decisions/001-repository-profiles.md b/initiatives/repository-modernisation/decisions/001-repository-profiles.md deleted file mode 100644 index 25d0a14..0000000 --- a/initiatives/repository-modernisation/decisions/001-repository-profiles.md +++ /dev/null @@ -1,42 +0,0 @@ -# ADR 001: Common Policy and Repository Profiles - -**Status:** Accepted - -## Context - -COMPAS repositories share Python tooling and release policy but differ in -runtime provisioning and artifact production. `compas` is pure Python, -`compas_occ` needs Conda-provided PythonOCC, and `compas_cgal` builds native -wheels with CMake and cibuildwheel. - -## Options - -1. **One identical template.** Minimal visible variation, but cannot express - native and Conda requirements honestly. -2. **Independent repository configurations.** Flexible, but perpetuates drift. -3. **One policy with explicit profiles.** Shares outcomes and conventions while - keeping provisioning/build behavior repository-owned. - -## Recommendation - -Use one common policy with pure-Python, external-runtime hybrid, and -native-wheel profiles. Optional runtime integration jobs and coordinated -framework integration are explicit additions to the closest profile, not new -universal configuration layers. Assign `compas_viewer` to the Python profile -with an explicit Qt/OpenGL/headless-test extension. Add -a profile only for a demonstrated requirement, not anticipation. - -## Consequences - -Shared checks, documentation, and release stages remain consistent. Workflow -files are not byte-identical. Tests must cover each profile. Documentation must -state which profile a repository follows and any justified deviations. - -## Affected repositories - -The ten initial core repositories named in the initiative proposal. Host -integrations are a later wave. - -## Dependencies - -None. diff --git a/initiatives/repository-modernisation/decisions/002-pyproject-source-of-truth.md b/initiatives/repository-modernisation/decisions/002-pyproject-source-of-truth.md deleted file mode 100644 index e006f34..0000000 --- a/initiatives/repository-modernisation/decisions/002-pyproject-source-of-truth.md +++ /dev/null @@ -1,37 +0,0 @@ -# ADR 002: Python Project Configuration Source of Truth - -**Status:** Accepted - -## Context - -The references already use `pyproject.toml`, but some duplicate Python -dependencies and tool configuration in requirements, environment, Pixi, and -legacy configuration files. - -## Options - -1. Keep tool-specific dependency files as equal authorities. -2. Generate multiple files from a new repository schema. -3. Make standards-based `pyproject.toml` authoritative and keep separate files - only for system/native tools that cannot be represented there. - -## Recommendation - -Use PEP 621 project metadata, build-system tables, and PEP 735 dependency groups -in `pyproject.toml`. Configure pytest, Ruff, Pyright, cibuildwheel, and -versioning there when supported. Keep MkDocs, workflows, CMake, and minimal -system provisioning explicit in their native formats. Do not add a generator. - -## Consequences - -Duplicated Python requirements can be removed after consumer parity is proven. -Native/system dependencies remain visible. Package metadata and documentation -need consistency tests. - -## Affected repositories - -All core COMPAS repositories. - -## Dependencies - -ADR 001. diff --git a/initiatives/repository-modernisation/decisions/003-uv-and-lockfiles.md b/initiatives/repository-modernisation/decisions/003-uv-and-lockfiles.md deleted file mode 100644 index e0d3f35..0000000 --- a/initiatives/repository-modernisation/decisions/003-uv-and-lockfiles.md +++ /dev/null @@ -1,39 +0,0 @@ -# ADR 003: uv and Development Lock Files - -**Status:** Accepted - -## Context - -`compas` uses uv in CI without a lock, `compas_occ` needs Conda, and -`compas_cgal` has a stale uv lock alongside a stronger Pixi environment. A -library's published dependency bounds and its reproducible development -environment are different contracts. - -## Options - -1. Use uv without committed locks. -2. Commit a uv development lock and keep project metadata as the installation - compatibility contract. -3. Use Conda or Pixi universally. - -## Recommendation - -Use uv as the canonical Python dependency runner and commit a current -`uv.lock` for each migrated repository. CI ordinarily uses frozen sync. Keep -Conda only where it supplies unavailable runtime dependencies and keep native -toolchain provisioning explicit. Validate declared lower/upper compatibility -separately from the locked development environment. - -## Consequences - -Local and CI environments are reproducible. Lock update policy and automated -update PRs are required. OCC retains a minimal Conda layer; CGAL retains system -build prerequisites. Stale locks become blocking configuration defects. - -## Affected repositories - -All core repositories; special handling for Conda/native profiles. - -## Dependencies - -ADR 001, ADR 002. diff --git a/initiatives/repository-modernisation/decisions/004-command-interface.md b/initiatives/repository-modernisation/decisions/004-command-interface.md deleted file mode 100644 index cbdb21c..0000000 --- a/initiatives/repository-modernisation/decisions/004-command-interface.md +++ /dev/null @@ -1,42 +0,0 @@ -# ADR 004: Canonical Local and CI Commands - -**Status:** Accepted - -## Context - -Current repositories mix direct tools, Invoke/`compas_invocations2`, Pixi -tasks, requirements installation, and workflow-specific commands. This creates -multiple definitions of the same operation. - -## Options - -1. Keep Invoke as a mandatory facade. -2. Create a new COMPAS command runner. -3. Document direct `uv run ` commands and explicit native build commands. - -## Recommendation - -Make direct uv/tool commands authoritative and document them for local and CI -use. Workflows and convenience tasks execute the same underlying commands. Keep -thin repository-owned Invoke tasks for now, normally run as -`uv run invoke `, when they provide useful command sequencing. Tasks must -not own environment creation, dependency resolution, system/native -provisioning, or hidden workflow policy. Do not create a wrapper framework. -Removing Invoke more broadly requires a separate coordinated team decision. - -## Consequences - -Commands remain transparent and reproducible even when contributors use a short -Invoke convenience. Native repositories document explicit provisioning and -build/rebuild steps outside the tasks. Contributor documentation lists both the -authoritative direct commands and retained conveniences without presenting -Invoke as a required environment or dependency-management layer. Shared actions -may call a thin task only when its bounded sequencing contract is explicit. - -## Affected repositories - -All core repositories and `compas-actions`. - -## Dependencies - -ADR 002, ADR 003, ADR 007. diff --git a/initiatives/repository-modernisation/decisions/005-ruff-standard.md b/initiatives/repository-modernisation/decisions/005-ruff-standard.md deleted file mode 100644 index 7ea18f2..0000000 --- a/initiatives/repository-modernisation/decisions/005-ruff-standard.md +++ /dev/null @@ -1,35 +0,0 @@ -# ADR 005: Ruff as the Python Style Tool - -**Status:** Accepted - -## Context - -The references already use Ruff, but `compas` retains Black configuration and -current shared lint tasks can mutate CI checkouts or omit repository Python -files. - -## Options - -1. Keep Black/isort/Flake8 beside Ruff. -2. Use Ruff only for linting and keep Black formatting. -3. Use Ruff for linting, import sorting, and formatting. - -## Recommendation - -Use Ruff alone. CI runs non-mutating `ruff check .` and -`ruff format --check .`. Local fix commands are separate. Adopt a conservative -common rule baseline and comment package-specific exclusions. - -## Consequences - -Overlapping dependencies/configuration are removed. Formatting may cause a -one-time mechanical diff. CI and local docs must distinguish checking from -fixing. Ruff and Pyright remain separate tools. - -## Affected repositories - -All core repositories. - -## Dependencies - -ADR 002, ADR 004. diff --git a/initiatives/repository-modernisation/decisions/006-mkdocs-standard.md b/initiatives/repository-modernisation/decisions/006-mkdocs-standard.md deleted file mode 100644 index 43b93f2..0000000 --- a/initiatives/repository-modernisation/decisions/006-mkdocs-standard.md +++ /dev/null @@ -1,37 +0,0 @@ -# ADR 006: MkDocs Documentation Standard - -**Status:** Accepted - -## Context - -The three references use MkDocs Material and mkdocstrings, but installation, -strictness, URLs, versioning, and deployment differ. Some obsolete RST remains. - -## Options - -1. Permit Sphinx or MkDocs per repository indefinitely. -2. Use one generated central documentation configuration. -3. Standardize outcomes and a small MkDocs baseline while keeping explicit - repository navigation/content. - -## Recommendation - -Use MkDocs Material, mkdocstrings, Markdown, explicit navigation, correct -site/repository URLs, and cross-package inventories. Every PR runs -`mkdocs build --strict`. Use Mike only for repositories with versioned deployed -docs. Keep `mkdocs.yml` repository-owned and remove superseded RST after link -verification. - -## Consequences - -Documentation failures become visible before merge. Existing warnings must be -resolved before strict mode blocks changes. Documentation dependencies live in -the pyproject docs group. Migration requires link, API, and example validation. - -## Affected repositories - -All core repositories with published documentation. - -## Dependencies - -ADR 002, ADR 003. diff --git a/initiatives/repository-modernisation/decisions/007-shared-action-boundary.md b/initiatives/repository-modernisation/decisions/007-shared-action-boundary.md deleted file mode 100644 index 3f21e55..0000000 --- a/initiatives/repository-modernisation/decisions/007-shared-action-boundary.md +++ /dev/null @@ -1,38 +0,0 @@ -# ADR 007: Shared Actions and Repository Workflow Boundary - -**Status:** Accepted - -## Context - -Modern `compas-actions@v1` works well for `compas`, while OCC and CGAL still use -legacy actions and bespoke jobs. A universal remote workflow could hide native -toolchains and matrices. - -## Options - -1. Duplicate all mechanics in each repository. -2. Put complete CI/release workflows behind a parameterized shared workflow. -3. Share bounded actions while keeping orchestration and package commands - visible in each repository. - -## Recommendation - -Use bounded shared actions for setup, release detection, PR checks, artifact -transfer/verification, GitHub releases, and docs deployment. Keep matrices, -commands, Conda provisioning, native builds, and artifact composition visible -in repository workflow YAML. Do not create a workflow generator. - -## Consequences - -Some YAML duplication remains intentionally. Shared actions need explicit -inputs/outputs, contract tests, versioning, and examples for all profiles. -Repository failures remain reproducible without reverse-engineering a remote -workflow. - -## Affected repositories - -All core repositories and `compas-actions`. - -## Dependencies - -ADR 001. diff --git a/initiatives/repository-modernisation/decisions/008-release-and-artifacts.md b/initiatives/repository-modernisation/decisions/008-release-and-artifacts.md deleted file mode 100644 index 5cd0546..0000000 --- a/initiatives/repository-modernisation/decisions/008-release-and-artifacts.md +++ /dev/null @@ -1,37 +0,0 @@ -# ADR 008: Release Governance and Artifact Promotion - -**Status:** Accepted - -## Context - -The references mix release pull requests and tag-driven releases. CGAL -duplicates build logic; OCC lacks a complete modern publish path. Rebuilding at -publish time can release files different from those tested. - -## Options - -1. Preserve repository-specific tag releases. -2. Rebuild artifacts in each release stage. -3. Use release pull requests and promote one tested artifact set unchanged. - -## Recommendation - -Use a release PR as the version/changelog authority. On merge, run validation, -build artifacts once, inspect/install/test the exact files, publish them through -trusted publishing, attach them to the GitHub release, and deploy versioned -docs. Never rebuild for publication. - -## Consequences - -Maintainer workflow and branch protection may change. Artifact retention and -job dependencies must be explicit. Every PyPI project needs trusted-publisher -configuration before token workflows are removed. Dry runs must verify the -sequence without publishing. - -## Affected repositories - -All publishable core repositories and `compas-actions`. - -## Dependencies - -ADR 007, ADR 009, ADR 010, ADR 011. diff --git a/initiatives/repository-modernisation/decisions/009-python-platform-support.md b/initiatives/repository-modernisation/decisions/009-python-platform-support.md deleted file mode 100644 index f71de9d..0000000 --- a/initiatives/repository-modernisation/decisions/009-python-platform-support.md +++ /dev/null @@ -1,38 +0,0 @@ -# ADR 009: Python and Platform Support Matrices - -**Status:** Accepted - -## Context - -Metadata, Ruff targets, and CI matrices currently disagree. OCC is constrained -by PythonOCC builds; CGAL distributes native artifacts across several systems. - -## Options - -1. Force one matrix across every repository. -2. Let workflow matrices drift independently from metadata. -3. Make project metadata authoritative and derive an explicit profile-specific - test/artifact matrix from supported dependencies and user commitments. - -## Recommendation - -Keep `requires-python` and classifiers consistent and authoritative. Test the -minimum and latest supported Python, plus justified intermediates. OCC support -cannot exceed available PythonOCC packages. Native artifact matrices explicitly -list required OS/architecture targets and stable-ABI assumptions. Resolve -ShapeOp's current Python/ABI inconsistency and establish meaningful Gmsh test -coverage before accepting their matrices. - -## Consequences - -Some repositories support different matrices. Matrix changes require evidence -and metadata/docs updates. Tests should mechanically detect metadata/workflow -drift where feasible. - -## Affected repositories - -All core repositories, especially `compas_occ` and native packages. - -## Dependencies - -ADR 001, ADR 002. diff --git a/initiatives/repository-modernisation/decisions/010-workflow-security.md b/initiatives/repository-modernisation/decisions/010-workflow-security.md deleted file mode 100644 index ae69f7b..0000000 --- a/initiatives/repository-modernisation/decisions/010-workflow-security.md +++ /dev/null @@ -1,35 +0,0 @@ -# ADR 010: Workflow Security and External Action Policy - -**Status:** Accepted - -## Context - -Current workflows include old actions, moving version tags, broad or implicit -permissions, token-based release paths, and inconsistent release environments. - -## Options - -1. Continue using moving major tags for convenience. -2. Pin only third-party actions deemed high risk. -3. Pin all external actions to reviewed commit SHAs and automate update PRs. - -## Recommendation - -Pin external actions immutably with readable version comments and automated -update PRs. Declare least-privilege permissions per workflow/job, use protected -environments and OIDC trusted publishing, add concurrency controls, and never -expose publish credentials to untrusted PR jobs. - -## Consequences - -Configuration is more verbose and needs an update bot. Pins and permissions -become reviewable/testable. Repository owners must configure environments and -trusted publishers; file changes alone cannot finish migration. - -## Affected repositories - -All core repositories and `compas-actions`. - -## Dependencies - -ADR 007. diff --git a/initiatives/repository-modernisation/decisions/011-quality-gate-adoption.md b/initiatives/repository-modernisation/decisions/011-quality-gate-adoption.md deleted file mode 100644 index db5adcf..0000000 --- a/initiatives/repository-modernisation/decisions/011-quality-gate-adoption.md +++ /dev/null @@ -1,53 +0,0 @@ -# ADR 011: Adoption of New Blocking Quality Gates - -**Status:** Accepted - -## Context - -Strict MkDocs and Pyright are desired, but some repositories have existing -warning or typing debt. Enabling a failing required check immediately can halt -unrelated work; permanently non-blocking checks provide no contract. - -## Options - -1. Make every new gate blocking immediately. -2. Keep debt-heavy gates advisory indefinitely. -3. Measure a baseline, fix or narrowly record existing debt, then make the - complete target gate blocking within the same migration phase. - -## Recommendation - -Use an explicit, time-bounded baseline phase. Do not add broad exclusions or -silent failure. A repository is not considered migrated until its applicable -Ruff, Pyright, tests, strict docs, and artifact gates are blocking and pass. - -Executable Python examples are part of the public contract and are included in -both Ruff and Pyright. Repositories configure their example directories -explicitly, repair outdated framework idioms, and prove that the configured -commands actually enumerate those files. Optional runtime examples may use a -focused execution environment, but they are not excluded from static checks. - -## Consequences - -Repositories with debt need preparatory work. Progress reports must distinguish -baseline, advisory transition, and completed blocking state. Regression tests -cover configuration as well as package behavior. Example cleanup prefers the -current high-level framework API over equivalent low-level attribute access; -for example, use `mesh.vertex_point(vertex)` instead of constructing -`Point(*mesh.vertex_attributes(vertex, "xyz"))`. - -## Affected repositories - -All core repositories. - -## Dependencies - -ADR 005, ADR 006, ADR 009. - -## Clarification - -On 2026-11-06, explicit user direction made executable-example Ruff and -Pyright coverage part of the blocking migration gate. Broader prose and -cross-framework example coordination may be organized as a separate -documentation initiative, but that does not defer checking executable examples -in repositories already being modernized. diff --git a/initiatives/repository-modernisation/decisions/012-external-build-sources.md b/initiatives/repository-modernisation/decisions/012-external-build-sources.md deleted file mode 100644 index 093baa8..0000000 --- a/initiatives/repository-modernisation/decisions/012-external-build-sources.md +++ /dev/null @@ -1,39 +0,0 @@ -# ADR 012: Reproducible External Native Build Sources - -**Status:** Accepted - -## Context - -Native repositories may download third-party source during CMake builds. -`compas_libigl` currently tracks an upstream main branch, while CGAL also -downloads substantial native dependencies. An unpinned branch can produce -different artifacts from unchanged repository source. - -## Options - -1. Track upstream branches for immediate updates. -2. Vendor all native dependencies. -3. Pin reviewed immutable versions/hashes and update them through explicit PRs. - -## Recommendation - -Pin every fetched native source to an immutable reviewed tag/commit and verify -integrity where the tool supports hashes. Record versions visibly in repository -build configuration and update them through tested dependency PRs. Vendor only -when licensing, availability, patching, or offline-build requirements justify -the maintenance cost. - -## Consequences - -Native builds become reproducible and auditable. Updates are deliberate and -may lag upstream. Clean build tests must verify downloads and licenses. Build -documentation lists network and cached/offline behavior. - -## Affected repositories - -Native-wheel core repositories, initially `compas_cgal`, `compas_libigl`, and -`compas_shapeop` where applicable. - -## Dependencies - -ADR 001, ADR 010. diff --git a/initiatives/repository-modernisation/decisions/013-framework-integration-and-release-order.md b/initiatives/repository-modernisation/decisions/013-framework-integration-and-release-order.md deleted file mode 100644 index be6d003..0000000 --- a/initiatives/repository-modernisation/decisions/013-framework-integration-and-release-order.md +++ /dev/null @@ -1,41 +0,0 @@ -# ADR 013: Framework Integration and Coordinated Release Order - -**Status:** Accepted - -## Context - -`compas_framework` depends on the core package set and verifies cross-package -behavior. Running every native dependency in its ordinary pure-Python job would -make that job slow and fragile, while independent package releases can publish -an incompatible combination. - -## Options - -1. Install all native packages in every framework check. -2. Test packages only within their own repositories. -3. Separate fast framework checks from a coordinated native integration job and - make release order explicit. - -## Recommendation - -Use the pure uv profile for ordinary framework checks. Add a separate, -explicitly provisioned integration job that installs the exact candidate core -artifacts, exercises cross-package contracts, and records unavailable backends -as skips rather than passes. Define and verify a dependency-ordered release -plan before publishing coordinated changes. - -## Consequences - -Fast checks remain reliable while integration coverage is authoritative. -Candidate artifacts and versions must be passed explicitly. Coordinated release -automation cannot publish downstream packages before required upstream -artifacts exist and pass integration. - -## Affected repositories - -`compas_framework` and every core package participating in coordinated -contracts or releases. - -## Dependencies - -ADR 008, ADR 009, ADR 011, ADR 012. diff --git a/initiatives/repository-modernisation/decisions/014-gmsh-runtime-and-support.md b/initiatives/repository-modernisation/decisions/014-gmsh-runtime-and-support.md deleted file mode 100644 index 9007ec5..0000000 --- a/initiatives/repository-modernisation/decisions/014-gmsh-runtime-and-support.md +++ /dev/null @@ -1,83 +0,0 @@ -# ADR 014: Gmsh Runtime Provisioning and Support Contract - -**Status:** Accepted - -## Context - -`compas_gmsh` imports Gmsh as a required runtime. Its metadata currently lists -an unbounded `gmsh` dependency, while Linux instructions and -`environment-linux.yml` also install Conda's `gmsh` and `python-gmsh` -packages. These paths can place different bindings and native libraries in one -environment. The existing test never initializes Gmsh, so none of the claimed -Python or platform combinations is verified. - -The Gmsh project documents its official PyPI package as the normal Python SDK -installation path and currently publishes binary SDK wheels for Windows -x86-64, Linux x86-64, macOS x86-64, and macOS ARM64. COMPAS 3 requires Python -3.12 or newer. - -## Options - -1. **Conda is authoritative.** It can provide system libraries, but adds a - second Python dependency authority and is unnecessary on platforms covered - by the official SDK wheels. -2. **Support interchangeable pip and Conda environments.** This is flexible, - but doubles resolution and test obligations and makes failure provenance - unclear. -3. **Use the official PyPI SDK as the canonical path.** Manage the Python - project and Gmsh SDK together through uv, while treating externally managed - runtimes as best-effort alternatives. - -## Recommendation - -Choose option 3. Use uv and the official PyPI `gmsh` distribution for local -development, CI, documentation examples, and installed-artifact tests. Remove -`environment-linux.yml` after parity is demonstrated. Never install the PyPI -and Conda Gmsh bindings into the same test environment. - -Publish this compatibility contract: - -- Python `>=3.12`, supporting 3.12 through 3.14 while blocking jobs exercise - the minimum and latest interpreters; -- `compas>=3,<4`; -- `numpy>=1.26`, because `compas_gmsh` imports NumPy directly; and -- `gmsh>=4.13.1,<5`, verified at the lower bound and at the lock's current - version. - -The blocking current-runtime matrix covers Linux x86-64, Windows x86-64, and -macOS ARM64 on Python 3.12 and 3.14. Python 3.12 minimum-dependency jobs verify -the declared lower bounds on all three OS/architecture targets. Python 3.13 is -inside the supported range but does not duplicate the ADR 009 minimum/latest -matrix. - -The public platform floors are Windows 10+ x86-64, Linux x86-64 with glibc -2.28+, and macOS 12+ ARM64. Workflow evidence records the exact hosted runner -labels, architectures, and image releases rather than treating a generic -`latest` label as a support definition. macOS 10.15+ x86-64 becomes a blocking -framework-verified target only when a dependable runner executes the same -contract. Until then it is documented as an upstream Gmsh platform, not a -verified `compas_gmsh` target. Other architectures and source-built SDKs are -best-effort. - -Every runtime job must initialize and finalize Gmsh and generate a real mesh; -import success alone is insufficient. If the proposed lower Gmsh bound fails, -on any supported platform, return with evidence and revise this ADR rather -than weakening the smoke test. - -## Consequences - -One lock and provisioning path governs ordinary development. The repository no -longer promises Python 3.9–3.11, COMPAS 2, Gmsh 5, or untested platforms. Gmsh -remains an external binary runtime even though uv installs its official SDK -wheel; repository workflows keep that provisioning visible. Conda users can -manage a compatible external environment, but that path is not the release -authority. - -## Affected files - -`pyproject.toml`, `uv.lock`, `environment-linux.yml`, `tasks.py`, installation -documentation, runtime tests, and build/release workflows. - -## Dependencies - -ADRs 001, 002, 003, and 009. diff --git a/initiatives/repository-modernisation/decisions/015-gmsh-license-boundary.md b/initiatives/repository-modernisation/decisions/015-gmsh-license-boundary.md deleted file mode 100644 index f57b36c..0000000 --- a/initiatives/repository-modernisation/decisions/015-gmsh-license-boundary.md +++ /dev/null @@ -1,58 +0,0 @@ -# ADR 015: `compas_gmsh` and Gmsh License Boundary - -**Status:** Accepted - -## Context - -The wrapper source is intended to use the MIT license, and documentation -includes `LICENSE.MIT`. Project metadata instead points to a nonexistent -`LICENSE`. The repository also contains a GPL-3.0 license text, while its README -describes the separately installed Gmsh runtime as GPL-2.0-or-later. This can be -read as an accidental dual-license declaration or as an incorrect statement of -Gmsh's license. - -`compas_gmsh` does not build or bundle Gmsh. Its dependency resolver installs -the separately distributed official Gmsh SDK. - -## Options - -1. **Declare the wrapper GPL.** This would remove ambiguity but changes the - intended license of COMPAS-owned source without a technical requirement. -2. **Declare dual MIT/GPL licensing.** This preserves both files but does not - explain which terms apply to which software. -3. **Declare the wrapper MIT and document Gmsh separately.** Package metadata - and artifacts identify only the wrapper's license; installation guidance - identifies the required Gmsh dependency and its GPL-2.0-or-later terms. - -## Recommendation - -Choose option 3. Use the SPDX expression `MIT` in project metadata and include -`LICENSE.MIT` as the wrapper's license file. Remove the ambiguous GPL-3.0 text -from the wrapper distribution. Add a concise third-party runtime notice in the -README, installation guide, and license page linking to Gmsh's authoritative -license information and stating that Gmsh is installed and distributed -separately. - -Do not copy Gmsh binaries or its license into the `compas_gmsh` wheel. If a -future release bundles Gmsh, vendors patched Gmsh, or publishes a combined -installer, this decision no longer covers that artifact and legal/license -review is required before distribution. - -## Consequences - -PyPI metadata, source archives, wheels, badges, and documentation have one -unambiguous project license. Users are still informed that using the package -requires separately licensed GPL software. The repository stops shipping an -unrelated GPL-3.0 text that can be mistaken for the wrapper's license. - -This is a packaging boundary, not legal advice. Maintainers remain responsible -for confirming license metadata before publication. - -## Affected files - -`pyproject.toml`, `LICENSE.MIT`, `LICENSE.GPL`, `README.md`, `docs/license.md`, -installation documentation, and artifact metadata tests. - -## Dependencies - -ADRs 002 and 014. diff --git a/initiatives/repository-modernisation/decisions/016-gmsh-verification-and-release.md b/initiatives/repository-modernisation/decisions/016-gmsh-verification-and-release.md deleted file mode 100644 index 9fed14f..0000000 --- a/initiatives/repository-modernisation/decisions/016-gmsh-verification-and-release.md +++ /dev/null @@ -1,83 +0,0 @@ -# ADR 016: Gmsh Verification, Typing, and Artifact Release - -**Status:** Accepted - -## Context - -The current `compas_gmsh` test only imports the wrapper and prints a version. -It does not prove that the native Gmsh SDK loads, initializes, meshes geometry, -or finalizes correctly. Pyright has measured source errors, installed typing is -not advertised, strict docs have real warnings, and `Model.from_brep` leaves a -generated file and descriptor behind. Legacy workflows rebuild across a -matrix, use moving actions, and publish with a token. - -## Options - -1. **Keep import tests and mock Gmsh.** Fast, but cannot verify the external - runtime, native loader, API compatibility, or artifact installation. -2. **Run broad examples as integration tests.** Exercises more behavior, but is - slow, fragile, and obscures the minimum supported contract. -3. **Define compact real-runtime gates plus focused unit tests.** Exercise a - small deterministic meshing contract on every supported target, while using - unit tests only for pure logic and exceptional cleanup paths. - -## Recommendation - -Choose option 3. A supported environment must: - -1. initialize and finalize named models repeatedly without leaking global - state; -2. generate and retrieve a nonempty two-dimensional mesh; -3. generate nonempty tetrahedral output for one simple OCC solid; -4. complete one boolean operation with the expected entity dimension; -5. open one committed read-only STEP fixture; -6. preserve `Model.from_brep(Brep)`, serialize through `Brep.to_step` into a - scoped temporary file, and release that file and descriptor on success and - failure; and -7. round-trip representative public mesh options. - -All generated test files use `tmp_path` or `tmp_path_factory`. Runtime -intermediates use scoped temporary directories and deterministic cleanup. -Mocks may cover failure paths but never replace native initialization and mesh -generation in the blocking matrix. - -Keep OCC out of the ordinary Gmsh matrix. A separate Linux integration job -installs `compas_occ` and verifies the real -`COMPAS Brep backed by compas_occ -> Brep.to_step -> Model.from_brep` path. -Unit tests may use a small duck-typed exporter for exceptional cleanup paths. -Native BREP serialization would require a separate input-protocol ADR; it is -not implied by the existing method name. - -Make Ruff check/format, Pyright, tests, and strict MkDocs blocking. Add -`py.typed`, type all exported wrapper APIs, and verify those types from the -installed wheel. A narrow Pyright exception for the external generated `gmsh` -module is allowed; broad source exclusions or a repository-owned full Gmsh -stub package are not. Apply the repository-local `update-docstrings` skill -whenever docstrings, rendered signatures, or examples change. - -Build one pure-Python wheel and one sdist in a runner temporary directory. -Inspect their Python, dependency, and license metadata and require `py.typed`. -Install the exact wheel with dependencies into a clean environment outside the -checkout, then run the runtime smoke and strict typing consumer. Promote those -unchanged files through OIDC trusted publishing and the GitHub release, then -deploy documentation from the same verified release revision, only after -protected environments/trusted publishers exist and publication is explicitly -approved. Never rebuild for publication. - -## Consequences - -CI becomes slower than an import-only job but provides evidence for the actual -package purpose. The real-runtime contract is deliberately small and -headless. Existing lifecycle, temp-file, typing, and documentation debt must be -resolved before modernization can be declared complete. Release artifacts are -traceable to the files tested on supported runtimes. - -## Affected files - -Source annotations and BRep temporary-file handling, tests and fixtures, -`py.typed`, `pyproject.toml`, `uv.lock`, MkDocs pages/configuration, `tasks.py`, -and all repository workflows. - -## Dependencies - -ADRs 004, 005, 006, 007, 008, 009, 010, 011, 014, and 015. diff --git a/initiatives/repository-modernisation/decisions/017-shapeop-python-stable-abi-matrix.md b/initiatives/repository-modernisation/decisions/017-shapeop-python-stable-abi-matrix.md deleted file mode 100644 index 01a6717..0000000 --- a/initiatives/repository-modernisation/decisions/017-shapeop-python-stable-abi-matrix.md +++ /dev/null @@ -1,73 +0,0 @@ -# ADR 017: ShapeOp Python and Stable-ABI Matrix - -**Status:** Accepted - -## Context - -`compas_shapeop` currently declares Python 3.9+, asks CMake for Python 3.8, -tests Python 3.10, and configures scikit-build-core and nanobind to produce a -CPython 3.12 stable-ABI wheel. Those promises cannot all be true. The COMPAS 3 -framework and the other native packages now use Python 3.12 as their minimum. - -The present wheel configuration also builds an implicit set of interpreter -tags while intending one `cp312-abi3` artifact per platform. Without installing -that wheel on later CPython versions, the stable-ABI claim is configuration, -not evidence. - -## Options - -1. **Keep Python 3.9+ and publish interpreter-specific wheels.** This restores - old-interpreter coverage but multiplies artifacts, abandons the current - stable-ABI direction, and conflicts with the COMPAS 3 support floor. -2. **Keep Python 3.9+ but provide wheels only for Python 3.12+.** This creates a - split support contract in which older users must build an undocumented - native toolchain from source. -3. **Require Python 3.12+ and retain a CPython 3.12 stable-ABI baseline.** Build - one `cp312-abi3` wheel per supported platform and test it on every advertised - CPython minor. -4. **Require Python 3.12+ but publish one wheel per CPython minor.** This is - simpler conceptually but needlessly duplicates native builds if the stable - ABI works. - -## Recommendation - -Choose option 3. - -- Set `requires-python` and CMake's Python discovery minimum to 3.12. -- Keep nanobind `STABLE_ABI` and scikit-build-core `wheel.py-api = "cp312"`. -- Configure cibuildwheel to build only the CPython 3.12 artifact for each - supported OS/architecture, and assert that its tag is `cp312-abi3`. -- Advertise Python 3.12, 3.13, and 3.14 only after the exact wheel has been - installed and tested on each version. Add future Python minors through the - same evidence gate rather than an artificial upper bound. -- Preserve the intended platform set: Linux x86_64, Windows AMD64, macOS arm64, - and macOS x86_64. Treat unavailable runners as explicit verification gaps, - not successful or silently dropped targets. -- Build and install the sdist in a clean Python 3.12+ environment as a separate - source-build contract. - -## Consequences - -The support promise becomes consistent with COMPAS 3 and the native artifact. -One wheel per platform serves the supported CPython minors, reducing build and -release duplication. The repository must maintain cross-version wheel smoke -tests because a successful CPython 3.12 build alone does not prove later -interpreter compatibility. - -Python 3.9–3.11 support is removed. This is an intentional compatibility break -and must be stated in the changelog and installation documentation. A platform -cannot be reported as supported until its wheel and installed tests pass. - -## Verification - -- Assert consistency between `requires-python`, classifiers, Ruff target, - CMake discovery, cibuildwheel, and documentation. -- Inspect every wheel filename and `WHEEL` metadata for the expected ABI tag. -- Install each exact wheel on CPython 3.12, 3.13, and 3.14 and run public solver - smoke tests from outside the source tree. -- Build the sdist, build a wheel from it in a clean environment, and run the - same smoke tests. - -## Dependencies - -ADRs 001, 002, 008, 009, 011, and 013. diff --git a/initiatives/repository-modernisation/decisions/018-shapeop-native-dependencies-and-portability.md b/initiatives/repository-modernisation/decisions/018-shapeop-native-dependencies-and-portability.md deleted file mode 100644 index dc0e452..0000000 --- a/initiatives/repository-modernisation/decisions/018-shapeop-native-dependencies-and-portability.md +++ /dev/null @@ -1,91 +0,0 @@ -# ADR 018: ShapeOp Native Dependencies and Build Portability - -**Status:** Accepted - -## Context - -`compas_shapeop` bundles MPL-2.0 ShapeOp source and downloads Eigen 3.4.0 into -an ignored directory under the checkout. The Eigen URL has no integrity hash. -The build also applies `-fPIC` unconditionally to a static target, uses global -compiler flags, and contains host-specific Homebrew discovery for optional -OpenMP. These choices make clean and cross-platform builds difficult to audit -and reproduce. - -The package itself is MIT-licensed, but its metadata currently advertises BSD -and does not describe the bundled MPL-2.0 source accurately. - -## Options - -### Eigen provisioning - -1. Use only a system Eigen package. -2. Vendor Eigen in the repository. -3. Fetch an immutable Eigen archive with integrity verification into the CMake - build tree. - -### Compiler and OpenMP behavior - -1. Preserve compiler-specific global flags and host package-manager probing. -2. Use CMake target properties and imported targets; keep OpenMP opt-in and - fail clearly when an explicitly requested toolchain feature is unavailable. - -## Recommendation - -Choose Eigen option 3 and compiler option 2. - -- Fetch Eigen 3.4.0 from an immutable archive and record its SHA-256 digest in - CMake. Place downloaded and extracted content below the build directory, not - the source checkout. Document the verified network download required by a - clean build. -- Do not vendor Eigen without a demonstrated offline, patching, licensing, or - availability requirement. -- Keep the current bundled ShapeOp sources and their notices in the source - distribution. Binary wheels contain the compiled extension, `LICENSE`, - `LICENSE.shapeop`, and a third-party notice identifying the exact bundled - ShapeOp source revision and its corresponding-source location; they do not - duplicate the C++ source tree. -- Use `POSITION_INDEPENDENT_CODE` instead of an unconditional `-fPIC`; use - target-scoped include directories, definitions, and compile options; link - imported CMake targets such as `Threads::Threads` and - `OpenMP::OpenMP_CXX`. -- Keep OpenMP disabled by default. If a caller enables it, use CMake's normal - `find_package(OpenMP)` contract and fail clearly when the requested feature - is unavailable. Do not execute Homebrew or choose a compiler from project - CMake. -- Preserve C++20 and verify the same CMake path on every wheel platform and - from the sdist. -- Correct packaging metadata and documentation to distinguish the MIT wrapper - from bundled MPL-2.0 ShapeOp source. Include both `LICENSE` and - `LICENSE.shapeop` in wheels and sdists and remove the incorrect BSD - classifier. - -## Consequences - -Clean builds remain network-dependent for Eigen but become deterministic and -integrity-checked. The build no longer writes ignored dependencies into the -checkout. Compiler behavior is expressed through portable CMake mechanisms, -so MSVC does not receive GCC flags and optional OpenMP does not depend on a -developer's package manager. - -The distribution exposes its mixed licensing accurately. Updating Eigen or -the bundled ShapeOp source requires an explicit dependency update, license -review, and clean platform builds. - -## Verification - -- Configure from a clean source tree and confirm no generated or downloaded - file appears in the checkout. -- Verify the recorded Eigen digest and exercise both a cold download and a - cache-backed build. -- Build with GCC/Clang, Apple Clang, and MSVC through the supported wheel jobs. -- Test the default OpenMP-off configuration everywhere; test OpenMP-on only in - an explicitly provisioned job and assert a clear failure when requested but - unavailable. -- Inspect wheels for both license files and the third-party source notice. - Inspect the sdist for those files and every bundled ShapeOp source needed - for an offline ShapeOp compile (apart from the separately fetched, - hash-verified Eigen archive). - -## Dependencies - -ADRs 001, 002, 008, 010, 011, 012, and 017. diff --git a/initiatives/repository-modernisation/decisions/019-shapeop-distribution-and-quality-contract.md b/initiatives/repository-modernisation/decisions/019-shapeop-distribution-and-quality-contract.md deleted file mode 100644 index cedfcad..0000000 --- a/initiatives/repository-modernisation/decisions/019-shapeop-distribution-and-quality-contract.md +++ /dev/null @@ -1,101 +0,0 @@ -# ADR 019: ShapeOp Distribution and Quality Contract - -**Status:** Accepted - -## Context - -The `compas_shapeop` Python wrapper imports NumPy and COMPAS, but project -metadata declares neither runtime dependency. Requirements files still target -COMPAS 2 and mix runtime, build, test, documentation, and release tools. The -repository has one checkout-based solver smoke test, no Pyright contract, no -PEP 561 marker, and Sphinx/RST documentation. - -For a native package, source-tree tests alone cannot prove that a wheel contains -the extension, dependency metadata, typing files, licenses, or the sources -needed to rebuild an sdist. The current release workflow also creates or -rebuilds artifacts through separate paths rather than promoting one tested -set. - -## Options - -1. **Preserve requirements files and checkout-based tests.** This minimizes - migration work but leaves package metadata and published artifacts - unverified. -2. **Declare dependencies but treat native artifact and typing checks as - advisory.** This improves installation while leaving the distribution - contract unenforced. -3. **Make `pyproject.toml` authoritative and require source plus installed- - artifact gates.** Verify public behavior, native import, metadata, typing, - documentation, wheels, and sdist before considering the migration complete. - -## Recommendation - -Choose option 3. - -- Declare direct runtime dependencies `compas>=3,<4` and `numpy>=1.26` in - project metadata. Keep CMake, Ninja, nanobind, scikit-build-core, - cibuildwheel, test, type, and documentation tools in explicit PEP 735 groups, - with a committed uv lock for development and CI. -- Remove superseded requirements files only after every consumer has moved to - the authoritative metadata and parity is proven. -- Keep `_shapeop` private. The supported import paths remain - `compas_shapeop.shapeop.Solver` and - `compas_shapeop.meshsolver.MeshSolver`; this modernization does not add - root-level re-exports, a plugin, or a second low-level public API. -- Add behavioral tests for accepted point-array shape, finite output, - constraint and force effects, `fix_vertex` target proximity within the - documented finite-weight tolerance, and numerical repeatability within - documented tolerances. Preserve and test only invalid-input failures that - the existing wrappers or native binding already expose; do not add broad - runtime validation or promise new exception semantics as part of this - modernization. Tests must use temporary paths for generated files and - artifacts. -- Test installed wheels and the sdist-built wheel from outside the checkout. - Assert that the imported package and native extension originate in the - isolated environment. -- Mark the distribution with `py.typed` and provide a private `_shapeop.pyi` - matching the nanobind surface used by the wrappers. Run strict Pyright over - source and tests and against representative calls in a clean installed-wheel - consumer. The private stub supports verification; it does not make - `_shapeop` public. -- Migrate to MkDocs/mkdocstrings Markdown under ADR 006. Apply the - repository-local `update-docstrings` skill to touched public docstrings and - keep documentation-only edits behavior-neutral. Document numerical - methodology, tolerance/iteration semantics, mutation and memory ownership, - native build prerequisites, known limitations, and primary ShapeOp sources. - Record those primary sources in top-level `REFERENCES.md`, keep claims scoped - to verified wrapper behavior, and include both package license texts from the - documentation license page. -- Use one release artifact set: build once, inspect and install the exact - files, then pass them unchanged to trusted publishing and the GitHub release. - Publishing and repository-setting changes remain separately approval-gated. - -## Consequences - -Normal installation receives every direct Python dependency. Contributor and -CI environments become reproducible. The native extension remains an -implementation detail while the typed Python wrapper is verifiable both from -source and from the actual wheel. - -The migration is larger than a metadata-only update: existing typing and -documentation debt must be resolved before Pyright and strict MkDocs become -blocking. This work must preserve solver behavior unless a separate public API -decision is approved. - -## Verification - -- Validate the frozen lock and clean dependency-group sync. -- Run Ruff check/format, strict Pyright, source tests, focused doctests, and - strict MkDocs. -- Inspect wheel and sdist metadata for Python/runtime requirements, licenses, - `py.typed`, `_shapeop.pyi`, and the native module. -- Install exact artifacts into clean environments outside the checkout and run - public solver and strict typing consumers. -- Verify workflow permissions, immutable action pins, temporary artifact - locations, and unchanged artifact promotion. -- Obtain independent code and documentation review before reporting the - package Ready. - -## Dependencies - -ADRs 002, 003, 004, 005, 006, 008, 010, 011, 013, 017, and 018. diff --git a/initiatives/repository-modernisation/decisions/020-framework-host-extras.md b/initiatives/repository-modernisation/decisions/020-framework-host-extras.md deleted file mode 100644 index 029717d..0000000 --- a/initiatives/repository-modernisation/decisions/020-framework-host-extras.md +++ /dev/null @@ -1,169 +0,0 @@ -# ADR 020: `compas_framework` Host Extras During the COMPAS 3 Transition - -**Status:** Accepted - -## Context - -`compas_framework` is a COMPAS 3 metapackage and requires `compas>=3.0.0`. -Its project metadata for that release line also defines three optional host -extras: - -```toml -rhino = ["compas_ghpython", "compas_rhino"] -blender = ["compas_blender"] -hosts = ["compas_blender", "compas_ghpython", "compas_rhino"] -``` - -The exact host-package revisions inspected by the modernization work remain on -the COMPAS 2 contract: - -- `compas_blender` at `2796eec4` requires `compas>=2.15,<3`; -- `compas_rhino` at `8f5e28d1` requires `compas>=2.15,<3`; and -- `compas_ghpython` at `8dabfefd` requires both `compas>=2.15,<3` and - `compas_rhino>=2.15,<3`. - -Consequently, no standards-compliant resolver can install the COMPAS 3 -metapackage together with any of those extras. uv also resolves project extras -when producing the root development lock, so the contradiction prevents a -truthful `uv.lock` even when ordinary CI later synchronizes tooling groups -without installing the project. - -The draft modernization patch temporarily uses -`override-dependencies = ["compas>=3.0.0"]` plus Git source pins. That makes the -lock resolvable by discarding the host packages' declared COMPAS constraint. -It does not establish runtime compatibility and permits an explicitly -unsupported `uv sync --extra ...` environment. - -Host integration packages are outside the approved initial core modernization -wave. Their runtime migration requires separate evidence in Rhino, -Grasshopper, and Blender. - -## Options - -### 1. Remove and defer the incompatible host extras - -Remove `rhino`, `blender`, and `hosts` from `compas_framework` metadata for the -COMPAS 3 line. Remove their Git sources and the COMPAS override from the root -uv configuration. Remove installation examples that claim the extras work and -state in the changelog and installation guide that host bundles will return -after their owning packages have compatible, verified releases. - -This is a visible compatibility break, but it makes published metadata, the -development lock, and documentation tell the same truth. - -### 2. Retain the extras with a documented tooling-only override - -Keep the current extras, Git sources, and `override-dependencies`, while -documenting that only `--only-group ... --no-install-project` commands are -supported and that the extras must not be synchronized. - -This preserves the extra names but publishes combinations that ordinary -installers cannot resolve. The override also suppresses dependency evidence -instead of demonstrating compatibility. A warning in contributor docs cannot -repair invalid distribution metadata. - -### 3. Put modernization tools in a nested uv project - -Move dependency groups and their lock into a separate tooling project whose -metadata never includes the metapackage extras. Keep the existing root project -metadata unchanged and leave its extras outside the tooling lock. - -This can make contributor tooling reproducible without an override, but adds a -second project configuration, lock, environment location, and command context. -It still leaves the published COMPAS 3 host extras unsatisfiable, so it avoids -rather than resolves the public contract defect. - -## Recommendation - -Choose option 1. Remove and explicitly defer all three host extras for the -COMPAS 3 metapackage until their dependencies and host-runtime evidence are -compatible with COMPAS 3. - -This is the smallest truthful contract: - -- `pyproject.toml` remains the sole dependency authority; -- the root `uv.lock` resolves without overrides that contradict dependency - metadata; -- every documented installation command denotes a resolvable environment; and -- host support is restored only by the repositories that own and can verify - it. - -Do not publish empty extras, aliases, placeholder packages, conditional -constraints, or a compatibility shim. Those would preserve names without -providing the advertised functionality. - -## Decision - -Approved on 2026-11-05. Remove and explicitly defer the incompatible COMPAS 2 -host extras from the COMPAS 3 metapackage. The rationale is to keep published -metadata, the root lock, and installation documentation truthful rather than -override dependency evidence or advertise combinations that cannot resolve. -Host support returns only through separately verified package decisions. - -## Compatibility implications - -- `pip install "compas_framework[rhino]"`, - `pip install "compas_framework[blender]"`, and - `pip install "compas_framework[hosts]"` stop being supported COMPAS 3 - installation paths. -- Existing COMPAS 2 releases and their host extras are unchanged. -- Users needing a current host package continue to install the COMPAS 2 stack - documented by that host package. Mixing it with the COMPAS 3 metapackage is - explicitly unsupported. -- Removing the extras must be recorded in the changelog and release notes as a - deliberate compatibility break, not hidden as lock-file maintenance. -- No host package source, runtime behavior, or release is changed by this ADR. - -## Implementation consequences - -After acceptance, the bounded `compas_framework` modernization patch must: - -1. remove the three entries from `[project.optional-dependencies]`; -2. remove the `compas-blender`, `compas-rhino`, and `compas-ghpython` uv source - entries and remove the COMPAS dependency override; -3. regenerate `uv.lock` from the unmodified remaining project metadata; -4. remove the three extra-install commands from the README and installation - documentation, replacing them with the explicit deferral notice; -5. add changelog and release-guide coverage for the compatibility break; and -6. keep the pure tooling synchronization and native integration jobs otherwise - unchanged. - -The repository must not claim that removing the extras completes host-package -modernization. It only removes an invalid metapackage promise. - -## Verification - -- `uv lock --check` succeeds without `override-dependencies`. -- A clean root `uv lock` resolves all remaining project metadata and dependency - groups without host-package Git sources. -- The pure development synchronization still installs no COMPAS framework or - native runtime distributions. -- Wheel and sdist metadata contain no `Provides-Extra` or conditional - `Requires-Dist` entries for `rhino`, `blender`, or `hosts`. -- Repository search finds no command that recommends installing one of the - removed extras for COMPAS 3. -- Ruff, Pyright, tests, strict MkDocs, artifact inspection, and isolated - no-dependency metapackage import remain green. - -## Restoration criteria - -A host extra may return only through a new explicit architecture decision -after every package in that extra: - -1. declares a compatible COMPAS 3 dependency range without an override; -2. has a released or immutable candidate artifact that resolves together with - the metapackage; -3. passes source and installed-artifact checks appropriate to its Python - runtime; -4. passes real Rhino, Grasshopper, or Blender runtime evidence for the public - integration contract, rather than ordinary CPython import tests alone; and -5. has installation, support-matrix, failure-mode, and ownership documentation - consistent with the restored metadata. - -The `hosts` aggregate returns only after all three individual package paths -meet these criteria. Individual extras may be restored independently when -their complete dependency set is ready. - -## Dependencies - -ADRs 001, 002, 003, 009, 011, and 013. diff --git a/initiatives/repository-modernisation/decisions/021-cross-repository-candidate-artifacts.md b/initiatives/repository-modernisation/decisions/021-cross-repository-candidate-artifacts.md deleted file mode 100644 index 1b3176b..0000000 --- a/initiatives/repository-modernisation/decisions/021-cross-repository-candidate-artifacts.md +++ /dev/null @@ -1,186 +0,0 @@ -# ADR 021: Cross-Repository Candidate Artifact Provenance - -**Status:** Accepted - -## Context - -Accepted ADR 013 requires the framework integration gate to install the exact -candidate artifacts of coordinated core packages before downstream release. -The initial workflow draft instead pins Git commits and runs `pip install` on -their source URLs. That can rebuild different artifacts, resolve undeclared -members of the candidate set from an index, and does not prove which hosted -workflow produced the installed wheel. Pytest can also exit successfully when -a required native-backend test is skipped. - -The framework repository's token is scoped to that repository and must not be -assumed to read Actions artifacts from `compas`, `compas_occ`, `compas_cgal`, -or `compas_libigl`. Cross-repository artifact access and its credential model -therefore need an explicit decision. This is distinct from configuring the -credential or publishing any package. - -## Options - -### 1. Install immutable Git source revisions - -Keep a constraints file of full commit SHAs and let pip build or install each -repository. - -This proves source identity but not artifact identity. Build isolation and -dependency resolution may select packages outside the declared candidate set, -and the result is not necessarily the wheel later promoted by the owning -repository. - -### 2. Test only already-published exact versions and hashes - -Release every upstream package first, then install exact PyPI files by version -and hash before publishing `compas_framework`. - -This needs no cross-repository Actions credential and proves the files used by -the final metapackage. It cannot prevent publication of an incompatible -upstream candidate because integration occurs only after those packages are -already public. - -### 3. Verify a manifest of hosted candidate artifacts - -Each owning repository builds and uploads its candidate wheel through its -normal protected workflow. A framework-owned manifest records, for each -coordinated package: - -- repository and successful workflow run; -- exact head commit; -- artifact name and archive digest; -- distribution version, selected wheel filename, and wheel SHA-256; and -- dependencies on other entries in the candidate set. - -The manifest also fixes the integration target—initially Python 3.12 on the -Linux x86-64 runner—and each selected wheel must have a compatible Python, -ABI, and platform tag. A single filename without this execution context is not -an adequate artifact contract. - -A read-only organization GitHub App grants the framework workflow Actions -artifact access only to the repositories in the manifest. The workflow checks -run provenance and every digest, installs only the selected wheels with -`--no-index --no-deps`, installs the framework candidate wheel, and then runs -the cross-package contracts. A JUnit post-check treats any failed, errored, -skipped, or zero-test native suite as a failed gate. - -## Recommendation - -Choose option 3. - -This is the only option that verifies the same immutable candidate artifacts -before dependent packages are published. Keep the mechanism narrow: - -- one JSON manifest is the sole candidate-set authority; -- source URLs, editable installs, and a second candidate constraints file are - forbidden; -- the GitHub App receives read-only Actions access to only the admitted core - repositories; -- the private key is stored as a repository or organization Actions secret and - is never exposed to pull requests from forks; -- credentialed retrieval and candidate execution run in separate jobs: the - retrieval job validates provenance, hashes, and wheel metadata, emits one - verified bundle, revokes its token, and ends; the execution job receives no - secrets or write permission before installing or importing candidate code; -- third-party native runtimes are pinned separately from COMPAS candidates; -- candidate wheels are installed without dependency or index resolution; and -- the framework publication job depends on successful candidate verification. - -Candidate verification happens before any coordinated candidate is published. -Promotion then follows this explicit dependency order: - -```text -candidate set passes integration - ↓ - compas - ↙ ↓ ↘ -compas_occ compas_cgal compas_libigl - ↘ ↓ ↙ - compas_framework -``` - -Every package is built once. Before publishing a dependent package, its -release job verifies that every declared upstream distribution is already -published and that the selected public filename, version, and SHA-256 match -the candidate manifest. `compas_framework` is published only after every -declared upstream artifact passes the same public-file match. Promotion never -rebuilds a wheel. - -The manifest records only packages participating in the coordinated change. -Adding another package is an explicit manifest and test change, not implicit -resolution from PyPI. - -## Compatibility and operational implications - -- `compas` and `compas_occ` must upload installable candidate distributions; - CGAL and libigl may reuse their verified platform wheel artifacts. -- Successful hosted run IDs, filenames, versions, and digests cannot be filled - speculatively. Placeholder, expired, failed, or mismatched artifacts are hard - failures. -- `run_attempt` selects the successful aggregate workflow attempt. GitHub - [retains successful job outputs when failed or dependent jobs are - rerun](https://docs.github.com/en/actions/how-tos/manage-workflow-runs/re-run-workflows-and-jobs), - so an admitted artifact may have been created by an earlier successful job - in the same run. Its exact artifact ID, name, workflow-run ID, head SHA, - repository ownership, API digest, archive digest, and wheel digest must still - match; its creation timestamp is not required to fall inside the selected - attempt's start-to-finish interval. An artifact created after the selected - successful attempt remains invalid. -- The initial integration manifest selects Python 3.12 and the Linux x86-64 - runner. Additional required platforms use explicit selected artifacts and - hosted gates; they are not inferred from one Linux result. -- Repository owners must install and configure the read-only GitHub App before - hosted positive verification can pass. This ADR does not authorize that - settings change. -- Only explicitly admitted commits and successful artifacts from protected - owning workflows enter the manifest. A fork-origin run is not trusted merely - because its archive digest is recorded. -- Framework publishing remains disabled or blocked until the candidate gate is - configured and passes. -- No package merge, release, publication, deployment, or settings mutation is - authorized by this decision. - -## Implementation consequences - -After acceptance: - -1. add candidate artifact jobs to `compas` and `compas_occ` and verify the - selected CGAL/libigl wheel artifacts; -2. replace the Git-source constraints draft with one validated JSON manifest; -3. add focused scripts for artifact retrieval/provenance, wheel metadata and - hash verification, exact installation, and JUnit skip enforcement; -4. split the workflow into a minimal credentialed retrieval job and a - secret-free candidate execution job, without persisted checkout or App - credentials; -5. make the native-integration workflow reusable from framework build and - release workflows; -6. add release-order checks that match each published upstream file back to - the approved candidate version, filename, and SHA-256 before dependents can - publish; -7. make framework publication depend on both the native gate and successful - public-file matches for every declared upstream artifact; and -8. document the candidate update, dependency order, credential ownership, and - failure modes. - -## Verification - -- Unit tests cover manifest schema, duplicate packages, unknown dependencies, - dependency cycles/order, placeholders, wrong run SHA/conclusion, expired or - missing artifacts, wrong archive/wheel hashes, wrong wheel metadata, and - missing wheels. -- JUnit tests cover pass, failure, error, skip, and zero-test results. -- Workflow security checks cover immutable actions, least permissions, fork - admission, retrieval/execution job isolation, absence of secrets during - candidate execution, and absence of credential persistence. -- A hosted positive run installs the exact four recorded package artifacts and - the framework wheel in a clean Python 3.12 native environment. -- Hosted negative checks prove that a changed digest and a skipped required - backend both fail the gate. -- Release-order fixtures prove that a missing upstream publication, different - version, rebuilt filename, or changed public-file hash blocks every - dependent promotion. -- The framework publish job remains blocked when candidate verification fails. - -## Dependencies - -ADRs 008, 010, 012, and 013. diff --git a/initiatives/repository-modernisation/decisions/README.md b/initiatives/repository-modernisation/decisions/README.md deleted file mode 100644 index 9f284de..0000000 --- a/initiatives/repository-modernisation/decisions/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# Repository Modernisation Decisions - -ADRs 001–021 are **Accepted**. All implementation remains subject to the -repository-setting, publishing, deployment, and merge approval boundaries. - -| ADR | Decision | Status | Depends on | -|---|---|---|---| -| [001](001-repository-profiles.md) | Common policy and repository profiles | Accepted | — | -| [002](002-pyproject-source-of-truth.md) | `pyproject.toml` source of truth | Accepted | 001 | -| [003](003-uv-and-lockfiles.md) | uv and committed development locks | Accepted | 001, 002 | -| [004](004-command-interface.md) | Direct local and CI commands | Accepted | 002, 003, 007 | -| [005](005-ruff-standard.md) | Ruff-only style tooling | Accepted | 002, 004 | -| [006](006-mkdocs-standard.md) | Strict MkDocs documentation | Accepted | 002, 003 | -| [007](007-shared-action-boundary.md) | Shared-action boundary | Accepted | 001 | -| [008](008-release-and-artifacts.md) | Release PRs and artifact promotion | Accepted | 007, 009, 010, 011 | -| [009](009-python-platform-support.md) | Python/platform support policy | Accepted | 001, 002 | -| [010](010-workflow-security.md) | Workflow security and action pins | Accepted | 007 | -| [011](011-quality-gate-adoption.md) | Blocking quality-gate adoption | Accepted | 005, 006, 009 | -| [012](012-external-build-sources.md) | Immutable native build sources | Accepted | 001, 010 | -| [013](013-framework-integration-and-release-order.md) | Framework integration and release order | Accepted | 008, 009, 011, 012 | -| [014](014-gmsh-runtime-and-support.md) | Gmsh runtime provisioning and support contract | Accepted | 001, 002, 003, 009 | -| [015](015-gmsh-license-boundary.md) | `compas_gmsh` and Gmsh license boundary | Accepted | 002, 014 | -| [016](016-gmsh-verification-and-release.md) | Gmsh verification, typing, and artifact release | Accepted | 004–011, 014, 015 | -| [017](017-shapeop-python-stable-abi-matrix.md) | ShapeOp Python and stable-ABI matrix | Accepted | 001, 002, 008, 009, 011, 013 | -| [018](018-shapeop-native-dependencies-and-portability.md) | ShapeOp native dependencies and build portability | Accepted | 001, 002, 008, 010, 011, 012, 017 | -| [019](019-shapeop-distribution-and-quality-contract.md) | ShapeOp distribution and quality contract | Accepted | 002–006, 008, 010, 011, 013, 017, 018 | -| [020](020-framework-host-extras.md) | `compas_framework` host extras during the COMPAS 3 transition | Accepted | 001, 002, 003, 009, 011, 013 | -| [021](021-cross-repository-candidate-artifacts.md) | Cross-repository candidate artifact provenance | Accepted | 008, 010, 012, 013 | - -## Recommended review order - -1. ADR 001: establish the policy/profile model. -2. ADR 002 and ADR 007: choose configuration and automation boundaries. -3. ADR 003, ADR 004, ADR 009, and ADR 010: settle environments, commands, - support, and security. -4. ADR 005 and ADR 006: settle style and documentation targets. -5. ADR 011: settle adoption after target gates are known. -6. ADR 008: approve release behavior once its dependencies are clear. -7. ADR 012: settle native-source reproducibility after security policy (this - can be reviewed in parallel with ADR 008). -8. ADR 013: approve coordinated integration/release order after release and - native-source decisions. -9. ADRs 014–016: implement the accepted Gmsh provisioning/support, licensing, - and verification/release contracts in dependency order. -10. ADRs 017–019: implement the accepted ShapeOp Python/ABI matrix, native - dependency portability, and distribution/quality contract in dependency - order. -11. Implement accepted ADR 020 to resolve the framework host-extra metadata - conflict before the ordinary framework modernization patch is committed. -12. ADR 021: implement the accepted candidate-artifact provenance and - credential boundary before enabling the native integration and - release-order gate. diff --git a/initiatives/repository-modernisation/inventory.md b/initiatives/repository-modernisation/inventory.md deleted file mode 100644 index 4567bd3..0000000 --- a/initiatives/repository-modernisation/inventory.md +++ /dev/null @@ -1,307 +0,0 @@ -# Repository Modernisation Inventory - -## Scope - -This inventory compares `compas`, `compas_occ`, and `compas_cgal` using their -checked-in configuration, documentation, tasks, and GitHub workflows. No -package or automation files were modified. - -## Executive summary - -All three reference repositories already use MkDocs, PEP 517/621-style -`pyproject.toml` configuration, and Ruff. The initiative is therefore primarily -about completing and aligning earlier migrations. - -- `compas` is the strongest general baseline: MkDocs Material, consolidated - metadata, Ruff, uv-backed CI, modular `compas-actions@v1`, release pull - requests, and trusted PyPI publishing. -- `compas_occ` has modern package/docs configuration but legacy CI and release - workflows. Its Conda-only `pythonocc-core` dependency prevents a uv-only - environment model. -- `compas_cgal` has strong native-build configuration but several competing - dependency/task systems. Its checked-in `uv.lock` is stale. cibuildwheel, - CMake, compilers, and platform SDKs remain essential. - -The evidence supports one common policy with three explicit profiles: - -1. pure Python with uv; -2. Conda-provisioned runtime plus uv-managed Python project; -3. native wheel and source-distribution builds. - -## Comparison - -| Concern | `compas` | `compas_occ` | `compas_cgal` | -|---|---|---|---| -| Docs | MkDocs Material + mkdocstrings | MkDocs Material + mkdocstrings + Mike | MkDocs Material + mkdocstrings + Mike | -| Packaging | setuptools, PEP 621 | setuptools, PEP 621 | scikit-build-core + nanobind, PEP 621 | -| Python baseline | `>=3.12`; CI 3.12–3.14 | `>=3.9`; CI 3.10–3.12 | `>=3.12`; stable ABI cp312 | -| Lint/format | Ruff; obsolete Black table remains | Ruff | Ruff | -| Typing | Pyright configured | no Pyright configuration/task | Pyright configured | -| Environment | uv in CI; local docs use Conda/pip | Conda required for PythonOCC; no uv | Pixi + stale uv lock + Conda + requirements files | -| Shared actions | modular `compas-actions@v1` | legacy monolithic build action | legacy action plus bespoke native jobs | -| Publishing | trusted publishing | incomplete current publish path | trusted publishing, old release orchestration | -| Release model | release PR on main | tag-driven GitHub release | tag-driven duplicated wheel/sdist build | - -## `compas`: baseline and corrections - -### Strengths - -- `pyproject.toml` contains PEP 621 metadata, setuptools, dependency extras, - pytest, Ruff, Pyright, and versioning settings. -- `mkdocs.yml` and `docs/` use Material, mkdocstrings, explicit navigation, - inventories, and MathJax. -- `.github/workflows/` separates build, coverage, documentation, PR checks, - release preparation, and release. -- Workflows use modular `compas-dev/compas-actions/*@v1` and uv-backed setup. -- PyPI publication uses trusted publishing; release preparation is PR-based. - -### Gaps not to copy - -- An obsolete `[tool.black]` table remains although Ruff is the formatter. -- The shared lint task applies `ruff check --fix`; CI checks should not mutate - the checkout. -- Ruff tasks scan only `src` and `tests`, omitting task files and executable - docs examples. -- MkDocs CI is not strict. -- Project classifiers and the CI Python matrix disagree. -- uv is used in CI while contributor docs still describe Conda/pip. -- There is no committed `uv.lock`; the library lock policy is unresolved. -- Ruff/mkdocstrings line-length and effective lint settings are inconsistent. -- Actions use moving tags rather than immutable commit SHAs. - -## `compas_occ`: hybrid environment - -### Strengths - -- `pyproject.toml` centralizes setuptools/PEP 621 metadata, plugin entry points, - pytest, Ruff, versioning, and docs/dev/visualization extras. -- `mkdocs.yml` uses Material, mkdocstrings, inventories, and Mike. -- Ruff already replaces Black. - -### Gaps - -- Build uses legacy `compas-actions.build@v4` and an older Python matrix. -- Docs installation/deployment are manual and PRs do not validate docs. -- PR/release workflows use obsolete checkout/changelog/create-release actions. -- Release does not implement current artifact validation, trusted publishing, - GitHub release, and versioned docs sequencing. -- Workflow permissions are not consistently explicit and minimal. -- Pyright has no repository configuration or task. -- Python requirements, classifiers, Ruff target, and CI coverage disagree. -- `environment.yml` has no Python pin and requests `compas>=2.4`, conflicting - with the current `compas>=3,<4` project requirement. -- `site_url` points to the repository rather than the published docs site. - -### Constraint - -`pythonocc-core` is supplied through Conda. uv can manage Python project -dependencies inside that environment, but cannot be the sole runtime -provisioner. The Python/platform matrix must follow available PythonOCC builds. - -## `compas_cgal`: native build - -### Strengths - -- `pyproject.toml` contains PEP 621, scikit-build-core/nanobind, pytest, Ruff, - Pyright, cibuildwheel, versioning, and Pixi configuration. -- CMake requires C++20 and builds multiple native modules. -- cibuildwheel covers Linux, Windows, and macOS x86_64/arm64. -- The CPython 3.12 stable ABI and macOS deployment target are explicit. -- PyPI publication already uses trusted publishing. -- MkDocs Material, mkdocstrings, inventories, and Mike are configured. - -### Gaps - -- Dependencies are fragmented across `pyproject.toml`, Pixi/`pixi.lock`, - `uv.lock`, `requirements*.txt`, and `environment.yml`. -- `uv.lock` is stale: it records Python `>=3.9` and COMPAS 2.x, while the - project requires Python `>=3.12` and COMPAS 3.x. -- Pixi currently handles editable native rebuilds and build isolation more - completely than uv. -- Build mixes Conda, a legacy action, and bespoke wheel/sdist jobs; build logic - is duplicated in release. -- Docs install several redundant requirement sources and deploy manually. -- PR/release workflows use obsolete actions. -- Parallel obsolete RST documentation remains beside canonical Markdown. -- Development docs offer Conda, uv, and Pixi without one source of truth. - -### Constraints - -- uv does not provision compilers, CMake, SDKs, or every platform tool. -- Editable native development requires an explicit rebuild path. -- Build isolation and preinstalled build-backend behavior matter. -- Clean CMake builds download CGAL, Boost, and Eigen. -- Wheel migration must preserve platform coverage, stable ABI, artifact tests, - and sdist validation. - -## Shared workflow architecture - -The current `compas` workflows provide a useful common sequence: - -1. detect release PRs and avoid redundant CI; -2. provision the selected environment profile; -3. run non-mutating lint, format, typing, tests, docs, and build checks; -4. prepare a release PR from version/changelog policy; -5. build artifacts once and validate them; -6. publish through trusted publishing; -7. create the GitHub release; -8. deploy versioned documentation. - -Before OCC and CGAL adopt it, `compas-actions@v1` must support their profiles or -allow explicit package jobs to participate without duplicating release policy. - -## Additional core migration targets - -### `compas_framework` - -Profile: pure-Python metapackage with a separate cross-package/native -integration responsibility. - -- PEP 621, MkDocs, Ruff, and Pyright are already configured. -- Obsolete Black configuration, Conda/pip contributor instructions, and legacy - v4/v3 build/docs/publish actions remain. -- CI/release Python matrices conflict with the declared Python `>=3.12` range; - the release matrix cannot currently install the project. -- The ordinary project can use uv, but framework integration must separately - install and identify sibling/native backends and respect package release - ordering. - -### `compas_gmsh` - -Profile: Python package with an externally supplied Gmsh runtime. - -The current clean baseline is `c16725f12930659e85849640d912717bd0fe9475`. -The package-specific architecture is recorded in -[`compas-gmsh.md`](compas-gmsh.md). Accepted ADRs 014–016 are implemented at -`c47af195bf04d0d2e874255bfe9c5f351beda672` on hosted-green draft PR 7. The -baseline findings below record the pre-migration state rather than remaining -implementation debt. - -- PEP 621, MkDocs, and Ruff exist; uv and Pyright do not. -- Python metadata, classifiers, Ruff target, and CI matrix disagree. -- Gmsh/COMPAS dependencies are unconstrained and Linux installation is split - across pip, Conda, and an incomplete environment file. -- Tests currently verify only that a version exists; meaningful initialization - and meshing smoke coverage is required before CI modernization is verifiable. -- Docs metadata/deployment, task code, PR checks, and token-based release - workflows are legacy; obsolete RST examples coexist with Markdown. - -### `compas_libigl` - -Profile: native nanobind/cibuildwheel package. - -- PEP 621/735, scikit-build-core, Ruff, and cibuildwheel are present. -- This repository still requires a real Sphinx/RST to MkDocs migration. -- Black remains in configuration and requirements; no Pyright configuration or - uv lock exists. -- Python declarations range from 3.8/3.9/3.10 through the cp312 stable ABI. -- Native dependency sources overlap across pyproject groups, requirements, - Conda, and tasks. -- libigl is fetched from the moving `main` branch, making clean builds - non-reproducible. -- Build and release independently rebuild native artifacts; the release - workflow uses obsolete orchestration despite trusted PyPI publishing. - -### `compas_model` - -Profile: pure-Python base with optional Coal/OCC integration. - -- PEP 621, Python 3.12+, MkDocs, and Ruff are already present. -- uv is absent; a Conda environment currently makes optional native - integrations part of the default setup. -- Pyright is installed but not configured as a repository gate. -- Docs contain stale metadata and an installation extra that does not exist. -- Base CI should use uv; optional native integrations should have an explicit - separate job. -- Workflows are legacy and token-published. The repository is hosted outside - `compas-dev`, so trusted-publisher and environment governance must be set up - in its actual organization. - -### `compas_session` - -Profile: pure Python. - -- Packaging is only partially consolidated: runtime/dev dependencies are - dynamically read from requirements files. -- Documentation remains Sphinx/RST. -- Black and Ruff coexist; uv and Pyright are absent. -- Tasks contain nonexistent GHUser component paths, apparently template - residue. -- All CI/docs/PR/release workflows use legacy actions and token publishing. -- An unrelated untracked source file exists locally and must be preserved - during any mechanical migration. - -### `compas_shapeop` - -Profile: native scikit-build-core/nanobind/cibuildwheel package. - -The current clean baseline is `9f57579`. An explicit import outside the -checkout with the required `compas3` interpreter fails because the package is -not installed there, so no local native baseline is claimed. The -package-specific architecture is recorded in -[`shapeop-modernisation-proposal.md`](shapeop-modernisation-proposal.md); -implementation is authorized by Accepted ADRs 017–019 but has not started. - -- Runtime dependency metadata is missing from built-project configuration even - though a requirements file declares COMPAS 2.x. -- Documentation remains Sphinx/RST; Black and Ruff coexist; uv/Pyright are - absent. -- Python `>=3.9`, a cp312 stable ABI, cibuildwheel selection, CMake Python 3.8, - and a single Python 3.10 CI job are mutually inconsistent. This blocks a - correct wheel matrix. -- Native build/release jobs duplicate wheels and sdists, and GitHub releases - can be created before artifacts succeed. -- Trusted publishing exists, but surrounding PR/docs/release actions are old. -- CMake/compiler/OpenMP provisioning and editable rebuild behavior must remain - explicit. - -### `compas_viewer` - -Profile: pure Python with Qt/OpenGL system-library and headless-test needs. - -- PEP 621, MkDocs, Ruff, Pyright, uv-backed modular v1 actions, release PRs, - and trusted publishing already closely match the modern reference. -- Obsolete Black configuration remains and the shared lint task mutates CI via - `ruff check --fix` while omitting format and type-check gates. -- CI hardcodes a development branch of COMPAS and project metadata still - permits COMPAS 2.x. -- MkDocs builds are non-strict, release does not deploy docs, and local uv/lock - policy is undocumented. -- Qt/OpenGL Linux libraries and headless execution must be represented as an - explicit test profile rather than hidden in generic setup. - -### Host integrations - -The local `compas_rhino`, `compas_ghpython`, and `compas_blender` directories -are source directories rather than standalone Git repositories with their own -project/workflow/docs configuration. Their canonical repository ownership and -release units must be identified before the later host-specific wave can be -planned or migrated. - -## Significant architecture questions - -1. Whether uv is canonical and whether library development locks are committed. -2. How uv composes with Conda for OCC and native toolchains for CGAL. -3. Whether Invoke remains the local command facade or tools run directly. -4. The Ruff baseline, scanned paths, and separation of check/fix commands. -5. Strict MkDocs, versioning, inventories, and deployment conventions. -6. What belongs in `pyproject.toml` versus separate native/docs files. -7. The boundary between shared actions and visible repository workflows. -8. Release-PR semantics, version/changelog authority, and artifact reuse. -9. Action pinning, automated updates, permissions, and trusted publishing. -10. Python support and package-specific platform matrices. -11. How new gates handle existing typing or documentation-warning debt. - -## Risks and conclusion - -- Copying `compas` verbatim would obscure OCC and CGAL provisioning. -- Treating CGAL's stale lock as authoritative installs the wrong COMPAS major. -- Removing environment files before transferring their responsibilities makes - native development incomplete. -- Release-PR migration changes maintainer practice and branch protection. -- Trusted publishing must be configured per PyPI project before token removal. -- Strict docs or Pyright need measured migrations where debt already exists. -- Artifacts should be built once, tested, and then published unchanged. - -Use `compas` as the policy and pure-Python reference after correcting its known -inconsistencies. Keep OCC and CGAL provisioning explicit and package-owned. diff --git a/initiatives/repository-modernisation/objective.md b/initiatives/repository-modernisation/objective.md deleted file mode 100644 index 2982679..0000000 --- a/initiatives/repository-modernisation/objective.md +++ /dev/null @@ -1,209 +0,0 @@ -# Repository Modernisation Initiative - -## Objective - -Define and apply one simple, explicit, and maintainable repository standard to -the core COMPAS packages. Use `compas`, `compas_occ`, and `compas_cgal` as -reference implementations, while also correcting the inconsistencies found in -those repositories rather than copying them into the wider package set. - -The standard should align documentation, packaging, dependency management, -code-quality tools, shared GitHub actions, and continuous-integration workflows -without imposing unnecessary abstraction on packages with different build -requirements. - -## Scope - -The initial migration targets include the reference repositories: - -- `compas` -- `compas_occ` -- `compas_cgal` - -and the other packages declared by `compas_framework` as part of the -coordinated core installation: - -- `compas_framework` -- `compas_gmsh` -- `compas_libigl` -- `compas_model` -- `compas_session` -- `compas_shapeop` -- `compas_viewer` - -Host integrations (`compas_rhino`, `compas_ghpython`, and `compas_blender`) -should be assessed separately and scheduled as a later host-specific wave. The -host application runtimes and Python versions must not be forced into the -ordinary core-package matrix. - -The initiative will assess and propose a consistent approach for: - -- MkDocs documentation structure, configuration, API generation, examples, - local preview, and deployment; -- PEP 517/518 packaging and project/tool configuration in `pyproject.toml`; -- `uv` for reproducible dependency installation, lock files, environments, - development commands, and CI where appropriate; -- Ruff for linting and formatting, replacing Black and overlapping lint tools; -- current `compas-actions` releases and clearly defined shared-action - responsibilities; -- modern GitHub Actions workflows for tests, typing, documentation, native - builds, releases, and supported Python/platform matrices; -- the distinction between shared framework conventions and package-specific - requirements, especially for native packages. - -## Questions to resolve - -1. Which repository conventions should be identical across COMPAS packages, - and which should remain package-specific? -2. What is the canonical MkDocs configuration and documentation layout? -3. Which metadata and tool settings belong in `pyproject.toml`, and which - configuration files should remain separate? -4. What role should `uv.lock`, dependency groups, and project environments - have for pure-Python and native-extension repositories? -5. Which Ruff lint rules and formatting settings form the common baseline? -6. Which Black, Flake8, isort, or other overlapping configurations and - workflows should be removed? -7. Which responsibilities belong in `compas-actions`, reusable workflows, or - individual repository workflows? -8. What test, typing, documentation, build, release, and platform matrices are - required for pure-Python, PythonOCC, and CGAL packages? -9. How should releases, trusted publishing, changelogs, and documentation - deployment be secured and kept transparent? -10. In what order can repositories be migrated while keeping every step - verifiable and reversible? - -## Design principles - -- Prefer a small, understandable standard over a configurable framework. -- Use current upstream conventions and supported tool features. -- Keep all important behavior visible in repository configuration. -- Share configuration only where it removes real duplication without hiding - package-specific behavior. -- Do not add compatibility layers for obsolete tooling unless a current - package requires them. -- Keep local development and CI commands aligned. -- Pin or constrain automation dependencies deliberately and document update - policy. -- Treat native build, platform, and system-dependency requirements explicitly. -- Preserve release safety and artifact verification throughout migration. - -## Initial deliverables - -1. `inventory.md` deriving reference patterns from `compas`, `compas_occ`, and - `compas_cgal` and comparing every initial migration target against them. -2. `proposal.md` defining the recommended repository standard, alternatives, - migration effects, and verification strategy. -3. One Proposed ADR for every significant independent architectural choice. -4. An implementation plan with dependencies, repository ownership, rollout - stages, and opportunities for parallel work. - -## Verification target - -Each migrated repository should have documented local commands equivalent to -CI and should pass its applicable: - -- package and integration tests; -- Ruff lint and format checks; -- Pyright checks; -- MkDocs strict build and link/reference validation; -- source and wheel builds; -- native-extension imports and platform-specific tests; -- artifact metadata and installation smoke tests; -- release workflow validation without publishing. - -## Non-goals for the initial architecture phase - -- Modifying package source code or repository automation before approval. -- Requiring identical build workflows for pure-Python and native packages. -- Creating a general-purpose workflow generator. -- Making the three reference repositories identical where their runtime or - native-build requirements differ. -- Migrating every COMPAS ecosystem or host-integration repository in the first - implementation wave. -- Publishing packages, deploying documentation, or changing repository - settings without explicit approval. - -## Current status - -Implementation and integration verification are complete for the approved -scope. ADRs 001–021 are Accepted, and Phases 0–6 pass on reviewed initiative -branches with hosted draft-PR evidence. No initiative branch has been merged -into a target/default branch, and no package or documentation site has been -published. - -The bounded `compas-actions` v2 prerequisite is independently reviewed Ready. -Commit `5c64e6e2b576a1232d28fed47d9478ca8eb63b2d` is pushed on -`initiative/repository-modernisation` and is the immutable consumer pin. Direct -local commands remain canonical; shared actions retain bounded repeated CI -mechanics without hiding repository-owned orchestration. - -The current package checkpoints are carried by draft PRs and remain outside -`main`: - -- core [PR 1539](https://github.com/compas-dev/compas/pull/1539) at - `99b82a6673ff7d05c1c323c8921135c274993f11`; -- OCC [PR 32](https://github.com/compas-dev/compas_occ/pull/32) at - `7fdf2ffb57d1de16308020e14ec626d79e65a034`; -- CGAL [PR 81](https://github.com/compas-dev/compas_cgal/pull/81) at - `bb3624e714719d543c61768320d91811ba96cc6c`; -- libigl [PR 47](https://github.com/compas-dev/compas_libigl/pull/47) at - `710b2b6714839a203fc8a6c62c437c0f6735ba0e`; -- model [PR 68](https://github.com/BlockResearchGroup/compas_model/pull/68) at - `83df4167f7ba1539ae205a837e0238afecc0a36b`; -- viewer [PR 232](https://github.com/compas-dev/compas_viewer/pull/232) at - `cf5a5195bda840a511319d6b7201978af68c15e3`; -- Gmsh [PR 7](https://github.com/compas-dev/compas_gmsh/pull/7) at - `c47af195bf04d0d2e874255bfe9c5f351beda672`; -- ShapeOp [PR 7](https://github.com/compas-dev/compas_shapeop/pull/7) at - `930619a9aecd3e37515be9ce342ac20746ccf6d3`; and -- session [PR 1](https://github.com/BlockResearchGroup/compas_session/pull/1) at - `e0bdd02aa8490248c6f2f36042651d8ebfc4442b`. - -All cited package PR heads have complete green hosted evidence. CGAL build run -`42231235319` attempt 2 succeeded at the cited head: quality, minimum/current -NumPy, sdist, all four platform wheel builds, and every Python 3.12/3.14 wheel -smoke passed. Candidate artifact `13522578476` is the selected Linux wheel -artifact for provenance admission. - -Accepted ADR 021 is implemented on framework draft -[PR 2](https://github.com/compas-dev/compas_framework/pull/2) at -`d0c9d4ef939ebbd4da4e14446e2e11f83a8a97b0`. The independently reviewed live -manifest passes schema and semantic validation with exact hashes for all four -wheels. Local evidence covers offline bundle revalidation, `--no-index ---no-deps` staging, exact distribution versions, installed entry-point/plugin -discovery, OCC BRep/tessellation behavior, strict exact-wheel typing, 44 -candidate-contract tests at the manifest checkpoint and 54 focused contract -tests at the final workflow checkpoint, plus Ruff, Pyright, actionlint, and -strict MkDocs. - -Protected native-integration run -[`42299118381`](https://github.com/compas-dev/compas_framework/actions/runs/42299118381) -passes at that exact head. Credentialed retrieval verifies the admitted -artifacts, the framework wheel is built once, and the separate secret-free -Linux x86-64 execution reports four required runtime tests passed with no -skips and an external installed-wheel typing result of zero errors and zero -warnings. This includes the CGAL→core→libigl path and OCC BRep construction. - -The current framework implementation head has no unresolved hosted workflow -failure. Push/PR build runs (`42299118404`, `42299126001`), docs runs -(`42299118452`, `42299125994`), and candidate-contract/actionlint runs -(`42299118380`, `42299126013`) all succeed at `d0c9d4e`; PR checklist run -`42299126033` and release metadata also pass. - -The protected non-main integration ref and `candidate-artifact-retrieval` -environment were used only for the credentialed retrieval boundary. The -successful run completes the modernization verification scope; revoking its -one-time App credential is operational cleanup rather than an additional -evidence gate. `main` remains untouched. - -ShapeOp ADRs 022–023 are Proposed in the separate follow-up draft PR and are -not prerequisites for completing the accepted packaging modernization. They -cover the misleading correspondence flags and post-initialization point-buffer -lifecycle respectively; neither contract is implemented by the green ShapeOp -modernization checkpoint. - -A larger future refactor may narrow `compas_gmsh` to COMPAS meshing -infrastructure rather than modeling features. `compas_fea2` is explicitly -outside that future initiative: it is only a known deferred external consumer -while its independent refactor proceeds. No `compas_fea2` migration, -compatibility layer, or coordinated source change is authorized here. diff --git a/initiatives/repository-modernisation/proposal.md b/initiatives/repository-modernisation/proposal.md deleted file mode 100644 index 0658e22..0000000 --- a/initiatives/repository-modernisation/proposal.md +++ /dev/null @@ -1,274 +0,0 @@ -# Repository Modernisation Proposal - -Status: approved - -This proposal defines a repository standard for the initial core scope: -`compas`, `compas_occ`, `compas_cgal`, `compas_framework`, `compas_gmsh`, -`compas_libigl`, `compas_model`, `compas_session`, `compas_shapeop`, and -`compas_viewer`. The first three provide the initial evidence and profile -examples, and also receive focused corrective work. Host repositories -`compas_rhino`, `compas_ghpython`, and `compas_blender` form a later wave. -This proposal changes no package, workflow, or repository setting. Accepted -ADRs are the implementation authority; repository settings, publishing, -deployment, and merging remain separately approval-gated. - -Accepted ADR 021 records the separately discovered cross-repository candidate -artifact and credential boundary. Accepted ADR 013 requires an exact candidate -gate, while ADR 021 selects authenticated hosted candidate artifacts and their -provenance contract. - -## Recommendation - -Adopt one visible repository policy with three execution profiles, rather than -one configurable template: - -- **Python profile (`compas`)**: uv provisions the project and all Python - development dependencies. -- **Conda-runtime profile (`compas_occ`)**: Conda provisions PythonOCC and the - compatible Python runtime; uv manages and runs the Python project inside that - environment. -- **Native-wheel profile (`compas_cgal`)**: uv manages Python dependencies and - local commands; repository-owned CMake/cibuildwheel jobs provision and build - native artifacts on each platform. - -Initial classification extends these patterns as follows: - -- pure uv: `compas`, `compas_session`, and `compas_framework`, with a separate - framework integration job for coordinated native packages; -- external-runtime hybrid: `compas_occ`, `compas_gmsh`, and `compas_model` - where optional Coal/OCC features are tested; -- native wheels: `compas_cgal`, `compas_libigl`, and `compas_shapeop`; -- Python/GUI runtime: `compas_viewer`, using the uv profile with explicit - Qt/OpenGL provisioning and headless-test settings. - -The profiles share project metadata conventions, dependency groups, Ruff, -Pyright, MkDocs, workflow stages, release governance, permissions, and artifact -verification. Native provisioning and build commands stay explicit in each -repository. - -## Canonical repository contract - -### Project configuration - -`pyproject.toml` is the source of truth for: - -- PEP 621 project metadata and Python compatibility; -- build-system requirements and backend configuration; -- runtime dependencies and PEP 735 dependency groups; -- pytest, Ruff, Pyright, cibuildwheel, and versioning configuration where those - tools support `pyproject.toml`. - -Keep `mkdocs.yml`, workflow YAML, CMake files, and minimal system-provisioning -files separate because they describe different tools or platform resources. -Remove duplicated Python dependency lists only after their consumers use the -new groups. - -### Environments and commands - -Commit a current `uv.lock` for each migration target and use `uv sync --frozen` -in ordinary CI. The lock represents the tested development environment, not -the package's installation compatibility contract; `[project.dependencies]` -and `requires-python` remain that contract. - -Canonical commands are direct and documented: - -```text -uv sync --frozen --group dev --group docs -uv run ruff check . -uv run ruff format --check . -uv run pyright -uv run pytest -uv run mkdocs build --strict -uv build -``` - -OCC runs them after activating its minimal Conda environment. CGAL adds an -explicit editable/native build step and uses cibuildwheel for distributable -artifacts. Do not require Invoke or a generated command wrapper. Thin -repository-owned Invoke conveniences may remain and normally run as -`uv run invoke `, but direct tool commands remain authoritative and -documented. Tasks may sequence commands; they must not own environment, -dependency, system, or native provisioning. Broader Invoke removal requires a -coordinated team decision. - -### Ruff - -Ruff is the only Python linter, import sorter, and formatter. Remove Black, -isort, Flake8, and obsolete configuration once Ruff covers their active role. -CI uses non-mutating `ruff check .` and `ruff format --check .`; local fix -commands are separately documented. Start from one conservative shared rule -baseline and add package-specific exclusions only with comments. - -### Documentation - -Use MkDocs Material and mkdocstrings, Markdown content, explicit navigation, -correct site/repository URLs, and inventories for cross-package references. -Every PR runs `mkdocs build --strict`. Release deployment uses the shared docs -action and Mike where versioned documentation is required. Remove superseded -Sphinx/RST residue after confirming it is not linked. - -### Workflows and shared actions - -Keep workflow orchestration visible in each repository. Shared actions should -perform bounded mechanics such as uv setup, release detection, PR validation, -artifact download/verification, GitHub release creation, and MkDocs deployment. -They should not hide package test commands, native toolchains, matrices, or -artifact build logic. - -Use the same semantic workflow set where applicable: - -- `build.yml`: lint, format, type, docs, tests, package build; -- `pr-checks.yml`: changelog/release-policy checks; -- `prepare-release.yml`: release pull request; -- `release.yml`: validate, build once, test artifacts, publish, release, docs; -- optional focused workflows such as coverage. - -### Releases and security - -Use release pull requests and one version/changelog authority. Build artifacts -once in the release run, test the exact files, then pass those files unchanged -to trusted publishing and the GitHub release. Never rebuild for publication. -Use explicit least-privilege job permissions, protected GitHub environments, -PyPI trusted publishing, concurrency controls, and immutable action commit -pins with automated update PRs. - -### Support matrices - -Project metadata is authoritative. Test the minimum and latest supported Python -versions plus any intermediate versions justified by user support. OCC's -matrix is bounded by available PythonOCC builds. CGAL's artifact matrix is -bounded by supported cibuildwheel platforms and its stable-ABI policy. Matrix -differences are explicit repository data, not options hidden in a generic -workflow. - -### Quality-gate adoption - -New checks must ultimately be blocking, but a migration may use an explicit, -time-bounded baseline phase. Measure existing failures, fix them in scope, and -then enable the gate. Do not suppress broad paths, silently ignore failures, or -claim completion while a target gate is non-blocking. - -## Alternatives considered - -### Copy `compas` into every repository - -Simple initially, but incorrect for Conda-only PythonOCC and CGAL native wheel -builds. It would hide or discard real provisioning and artifact requirements. - -### One highly parameterized reusable workflow - -Reduces YAML lines but moves important package behavior into remote inputs and -conditionals. Native failures become harder to reproduce locally. Prefer -shared bounded actions and visible repository orchestration. - -### Keep Pixi or Conda as the universal manager - -Both can provision more system software than uv, but they add a second Python -dependency authority to repositories that do not need it. Retain Conda only -where it provides PythonOCC; retain explicit native tooling for CGAL. - -### Do not commit library lock files - -This maximizes resolver freshness but prevents exact local/CI reproduction. -The proposed lock is explicitly a tested development snapshot; package -compatibility continues to be validated through declared bounds and dedicated -resolution jobs. - -### Keep Invoke as the authoritative command API - -It offers short names, but duplicates tool commands and couples workflows to a -Python task layer. Direct uv/tool commands are clearer and portable, so Invoke -is not the authority. This does not reject thin repository-owned convenience -tasks that only sequence the documented direct commands. - -## Package-specific migration effects - -### `compas` - -- Remove obsolete Black configuration. -- Make lint/format checks non-mutating and cover agreed repository paths. -- Add and document the uv development lock/workflow. -- Align classifiers and CI matrix; make docs strict. -- Pin actions immutably without changing release semantics. - -### `compas_occ` - -- Reduce `environment.yml` to accurate Conda runtime provisioning and align - its Python/COMPAS constraints. -- Add uv dependency groups/lock and Pyright configuration. -- Migrate legacy build/docs/PR/release workflows to current release governance - while retaining Conda provisioning. -- Enable strict docs and trusted publishing only after repository/environment - prerequisites are verified. - -### `compas_cgal` - -- Replace stale lock and competing Python dependency authorities with - pyproject groups plus a current uv lock. -- Preserve explicit CMake, compiler, editable rebuild, cibuildwheel, stable-ABI, - sdist, and multi-platform behavior. -- Build release artifacts once and reuse them for testing/publication. -- Remove obsolete requirement/Pixi/Conda/RST paths only after parity checks. - -### Other initial core repositories - -- `compas_libigl`, `compas_session`, and `compas_shapeop` require actual - Sphinx-to-MkDocs content/configuration migration, not only standardization. -- `compas_libigl` must replace unpinned FetchContent tracking of an upstream - main branch with a reviewed immutable version before claiming reproducible - native artifacts. -- `compas_shapeop` must resolve its Python-support and native-ABI inconsistency - before its metadata and wheel matrix can be aligned. The approved package - proposal and Accepted ADRs 017–019 are in - [`shapeop-modernisation-proposal.md`](shapeop-modernisation-proposal.md). -- `compas_gmsh` needs a meaningful test baseline and evidence-based support - matrix before workflow modernization can make tests authoritative. The - approved package proposal and Accepted ADRs 014–016 are in - [`compas-gmsh.md`](compas-gmsh.md), and implementation may proceed within - their boundaries. -- `compas_model` must keep optional Coal/OCC runtime provisioning explicit; - those integrations do not belong in its ordinary pure-Python job. -- `compas_framework` keeps ordinary pure-Python checks separate from a - coordinated native-package integration/release-order job. Its incompatible - COMPAS 2 host extras and root-lock conflict are resolved by Accepted - [ADR 020](decisions/020-framework-host-extras.md) before the ordinary - modernization patch is committed. -- `compas_viewer` keeps its current modular actions and uv profile, while - removing Black residue, temporary COMPAS branch installation, mutating lint, - and non-strict docs; Qt/OpenGL provisioning stays explicit. - -### Host integrations - -`compas_rhino`, `compas_ghpython`, and `compas_blender` are excluded from the -initial implementation wave. Their host runtimes require separate evidence and -architecture after the core standard is proven. - -## Verification - -For each repository: - -1. create a clean environment from the documented frozen inputs; -2. run Ruff check/format, Pyright, tests, and strict MkDocs locally and in CI; -3. build sdist and wheels; -4. inspect artifact metadata and install artifacts into clean environments; -5. run package/native import smoke tests from outside the source tree; -6. for CGAL, test each produced wheel platform and the sdist build path; -7. validate release jobs without publishing; -8. confirm workflow permissions and pins mechanically; -9. verify local commands and CI invoke the same underlying operations. - -## Documentation deliverables - -- one concise contributor setup and command reference per profile; -- a release-maintainer guide covering release PRs and recovery; -- native prerequisites and editable rebuild instructions for CGAL; -- Conda/uv boundary explanation for OCC; -- shared-action input/output and security documentation. - -## Approval boundary - -Implementation may proceed only under Accepted ADRs. Gmsh ADRs 014–016 and -ShapeOp ADRs 017–019 authorize their scoped source work. -Repository settings, trusted-publisher configuration, deployment, publishing, -merging, and removal of active environment paths require explicit execution -approval in their implementation phase. diff --git a/initiatives/repository-modernisation/shapeop-modernisation-proposal.md b/initiatives/repository-modernisation/shapeop-modernisation-proposal.md deleted file mode 100644 index c4e1a78..0000000 --- a/initiatives/repository-modernisation/shapeop-modernisation-proposal.md +++ /dev/null @@ -1,207 +0,0 @@ -# `compas_shapeop` Modernisation Proposal - -**Status:** Approved; source implementation is authorized by ADRs 017–019 - -## Purpose - -Apply the approved native-wheel repository profile to `compas_shapeop` without -changing its solver API. The migration must first resolve the repository's -Python/stable-ABI contradiction, make the native build reproducible and -portable, and establish installed-artifact evidence strong enough to make its -quality gates authoritative. - -This package proposal refines the accepted framework-wide decisions. It does -not reopen the common uv, Ruff, MkDocs, workflow-security, or release-artifact -policies. - -## Current evidence - -The inspected `main` branch is clean at `9f57579` and currently has these -material inconsistencies: - -- project metadata declares Python 3.9 and classifiers through 3.12, while - scikit-build-core emits `cp312` stable-ABI wheels and nanobind's stable ABI - requires Python 3.12 or newer; -- CMake asks for Python 3.8, the ordinary workflow tests only Python 3.10, and - cibuildwheel excludes CPython 3.13; -- the extension is built with nanobind `STABLE_ABI`, but cibuildwheel does not - explicitly build only the single CPython 3.12 wheel that is meant to cover - later supported CPython versions; -- the Python package imports NumPy and COMPAS, but built-project metadata has - no runtime dependencies; -- `requirements.txt` still declares COMPAS 2.x, while the current framework - initiative targets COMPAS 3; -- Eigen 3.4.0 is downloaded without an integrity hash into an ignored - source-tree directory; -- the static ShapeOp target receives the GCC/Clang-only `-fPIC` flag even on - MSVC, and optional OpenMP probing contains host-specific Homebrew logic; -- tests contain one source-tree solver smoke test and do not test installed - wheels, the sdist build path, stable-ABI compatibility, failure behavior, or - typing metadata; -- an explicit import from outside the checkout with the required `compas3` - interpreter fails because `compas_shapeop` is not installed there, so no - local native baseline may be claimed from that environment; -- the wrapper license is MIT and bundled ShapeOp sources are MPL-2.0, but - project metadata advertises BSD and does not declare both license files; -- documentation remains Sphinx/RST, Black and Ruff overlap, Pyright and a uv - lock are absent, and build/release workflows rebuild equivalent artifacts - independently. - -The existing solver smoke test passes only when the extension and dependencies -are already available. It proves a basic numerical update but not the -distribution or platform contracts above. - -## Recommended package contract - -### Python and artifacts - -- Require Python 3.12 or newer and advertise only versions with passing - evidence. -- Retain nanobind's stable ABI with `cp312` as the baseline. -- Build one `cp312-abi3` wheel per supported OS/architecture, then install and - test that exact wheel on every advertised CPython minor. -- Cover Linux x86_64, Windows AMD64, macOS arm64, and macOS x86_64. A target - without a functioning runner remains explicitly unverified; it is not - silently removed or reported as passing. -- Build and install an sdist in a clean environment to prove that all C++ - sources, license files, and build inputs are present. - -ADR 017 records this decision. - -### Native dependency and portability boundary - -- Keep the bundled ShapeOp sources in the sdist and preserve their MPL-2.0 - notices. Wheels contain the compiled extension, both license files, and a - third-party notice identifying the exact ShapeOp source revision and its - corresponding-source location; wheels do not duplicate the C++ source tree. -- Fetch Eigen 3.4.0 from an immutable archive with a recorded SHA-256 hash into - the CMake build tree, never into the checkout. Document that a clean sdist - build needs network access for this verified download. -- Prefer target properties and imported CMake targets over compiler-specific - global flags: use `POSITION_INDEPENDENT_CODE`, target-scoped include paths, - and `Threads::Threads`/`OpenMP::OpenMP_CXX` where applicable. -- Keep OpenMP disabled by default. If explicitly enabled, require a toolchain - where CMake can provide `OpenMP::OpenMP_CXX`; do not discover Homebrew or - mutate compiler selection inside the project. -- Preserve C++20 and verify clean builds on every wheel platform. -- Correct distribution licensing to identify the MIT wrapper and bundled - MPL-2.0 ShapeOp source, and include both `LICENSE` and `LICENSE.shapeop` in - wheels and sdists. - -ADR 018 records this decision. - -### Python dependencies, verification, typing, and documentation - -- Declare direct runtime requirements in `pyproject.toml`: - `compas>=3,<4` and `numpy>=1.26`. Do not rely on transitive installation. -- Separate build, test, docs, and developer tools into PEP 735 groups and - commit a frozen uv lock. CMake, Ninja, nanobind, scikit-build-core, and - cibuildwheel are build/development tools, not runtime dependencies. -- Keep the compiled `_shapeop` module private. Preserve the existing public - import paths `compas_shapeop.shapeop.Solver` and - `compas_shapeop.meshsolver.MeshSolver`; do not introduce package-root - re-exports. Test behavior through those Python wrappers, while also proving - that the installed extension resolves from the wheel rather than the - checkout. -- Add numerical contract tests for accepted input shape, finite output, - constraint effects, `fix_vertex` target proximity within its documented - finite-weight tolerance, and repeatable results within documented - tolerances. Preserve and test only invalid-input failures already exposed by - the wrappers or binding; do not add broad runtime validation or new - exception promises. Generated files and build products must use pytest - temporary paths or runner temporary directories. -- Add `py.typed` and a private `_shapeop.pyi` binding contract so strict - Pyright can validate the Python wrapper without making `_shapeop` public. - Verify the marker, stub, and representative public calls from an installed - wheel in a clean consumer environment. -- Convert Sphinx/RST to strict MkDocs/mkdocstrings Markdown. Apply the - repository-local `update-docstrings` skill to every touched public docstring; - documentation work must not change solver behavior. -- Record the primary ShapeOp methodology and backend sources in a top-level - `REFERENCES.md`. Scope numerical and performance claims to behavior actually - verified by the wrapper, and include both license texts from the docs license - page. -- Build artifacts once in the release workflow, test those exact files, and - promote them unchanged under the accepted trusted-publishing policy. The - migration may validate this sequence but may not publish without separate - approval. - -ADR 019 records this decision. - -## Alternatives and tradeoffs - -### Build one wheel for every CPython minor - -This avoids relying on the stable ABI but multiplies build and release -artifacts. It also discards a stable-ABI design already shared by the native -COMPAS packages. Prefer retaining `cp312-abi3`, with installation tests that -make the compatibility claim observable. - -### Keep Python 3.9–3.11 through source builds - -This would split the support promise: old interpreters could build only from -source while published wheels start at 3.12. It also conflicts with the COMPAS -3 framework floor. Prefer one honest Python 3.12+ contract. - -### Use a system Eigen package - -System Eigen can avoid downloads but creates platform- and distribution- -specific provisioning and makes PyPI sdist builds harder to reproduce. A -verified immutable archive is the smallest consistent cross-platform path. - -### Vendor Eigen in the repository - -Vendoring supports offline builds but adds a large third-party source tree and -an update burden. No current offline requirement justifies it. Vendoring can be -reconsidered only if availability, patching, or licensing evidence requires it. - -### Test only the Python wrapper from the checkout - -This is fast but cannot prove wheel tags, packaged native binaries, licenses, -typing metadata, or source-distribution completeness. Source tests remain -useful, but installed-artifact tests are required for completion. - -## Implementation sequence - -1. Create the ShapeOp modernization branch from the recorded clean baseline. -2. Align Python metadata, stable-ABI settings, CMake Python discovery, and the - cibuildwheel matrix. -3. Replace the unverified Eigen download and non-portable CMake flags; verify - clean native builds before changing workflows. -4. Consolidate dependencies/groups, create `uv.lock`, and add Ruff, Pyright, - source tests, and installed-artifact tests. -5. Migrate docs with the `update-docs` and `update-docstrings` instructions. -6. Modernize visible workflows with immutable action pins, least privilege, - temporary artifact directories, and one tested release artifact set. -7. Run an independent review and the full platform matrix. Record unavailable - targets as unverified. -8. Push an initiative branch and open a draft PR only when authorized. Do not - merge or publish. - -## Completion evidence - -The repository is not modernized until all applicable checks pass: - -- frozen uv sync and lock validation; -- Ruff check and format check; -- strict Pyright over source, tests, and the private binding stub; -- source tests on the minimum and latest supported Python; -- strict MkDocs build and focused doctests; -- one `cp312-abi3` wheel for every supported OS/architecture; -- clean installation and public solver smoke tests on Python 3.12, 3.13, and - 3.14 for each produced platform artifact; -- clean sdist build and installed smoke tests; -- artifact inspection for runtime metadata, wheel tags, native module, - `py.typed`, `_shapeop.pyi`, `LICENSE`, and `LICENSE.shapeop`; wheels also - contain the third-party source notice, while the sdist contains the complete - bundled ShapeOp source tree required for its build; -- workflow policy checks for immutable pins, permissions, artifact reuse, and - temporary output locations; -- independent code and documentation review. - -## Approval record - -ADRs 017–019 are accepted and authorize the bounded ShapeOp implementation -described above. This approval does not authorize merging, publishing, -repository-setting changes, or removal of a currently advertised platform -without evidence and explicit follow-up approval. diff --git a/initiatives/scene-viewer-visualisation/README.md b/initiatives/scene-viewer-visualisation/README.md deleted file mode 100644 index ce1b708..0000000 --- a/initiatives/scene-viewer-visualisation/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Scene, Viewer, and Visualisation - -This initiative aligns backend-neutral scene infrastructure with Viewer -rendering, interaction, state, and UI composition. The COMPAS Hub tracks -the active implementation plan and handoff. - -- [Objective](objective.md) -- [Inventory](inventory.md) -- [Proposal](proposal.md) -- [Architecture decisions](decisions/README.md) -- [UI design](ui.md) diff --git a/initiatives/scene-viewer-visualisation/decisions/001-ownership-boundaries.md b/initiatives/scene-viewer-visualisation/decisions/001-ownership-boundaries.md deleted file mode 100644 index 5c81733..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/001-ownership-boundaries.md +++ /dev/null @@ -1,86 +0,0 @@ -# ADR 001: Ownership and State Boundaries - -## Status - -Accepted. - -## Context - -Core scene objects currently combine durable content with context-adapter -state, while Viewer selection, GPU identity, configuration, tool state, and UI -refresh paths are distributed across objects, renderer, commands, and widgets. -Moving everything into core would make Qt/rendering concerns framework -dependencies; leaving ownership implicit perpetuates coupling. - -## Options - -1. Keep core responsible for durable scene content and place renderer and - interaction state in Viewer. -2. Add rendering, selection, and reactive application state to core Scene. -3. Keep all current ownership and coordinate behavior through conventions. -4. Move durable scene content into Viewer and reduce core Scene to adapters. - -## Recommendation - -Choose option 1. - -- Core owns scene items, hierarchy, scene-object GUIDs, local transformations, - visibility, durable appearance, and serialization. -- Viewer configuration owns persistent application preferences. -- Viewer session state owns selection, hover, tools, gestures, and transient - results. -- Viewer rendering owns indexed buffers, pick IDs, GPU resources, and refresh. -- Domain packages own authoritative domain hierarchies and caches and project - them into core scenes through public Viewer operations. - -GUIDs connect durable scene objects to Viewer state. Pick IDs and transient -state are never serialized. Do not add Qt signals or GPU contracts to core. - -## Consequences - -- Core remains usable by notebook and host adapters without Viewer. -- Selection and tools stop leaking into serialized scene-object settings. -- Viewer must provide explicit public state and synchronization operations. -- Domain packages retain their own data authority rather than duplicating it - in a generic application store. -- Existing Viewer code that reaches its singleton, renderer, or widgets must - migrate gradually after the public boundary exists. - -## Compatibility - -ADR 008 proposes replacing the current incomplete scene serialization without -a compatibility loader. Removing transient Viewer fields and introducing the -new scene-node schema therefore form a deliberate C3 serialization break. - -## Verification - -- Round-trip core scenes without Viewer installed. -- Prove Viewer selection, hover, tools, and pick IDs are absent from scene - serialization. -- Verify domain objects resolve through stable scene-object GUIDs after UI - rebuilds. - -## Affected packages - -Initial implementation: `compas`, `compas_viewer`, and `compas_framework`. - -Later redesign/regression consumer: `compas_model`. - -## Dependencies - -- Geometry-tessellation ADRs 022 and 024 -- Plugin-implementations ADR 002 - -## Pending amendments - -Verified round-trip failures showed that this decision did not distinguish the -durable scene node/state from the context-specific runtime `SceneObject` -adapter precisely enough. Accepted [ADR 008](008-scene-nodes-and-runtime-adapters.md) -and [ADR 009](009-scene-state-fields.md) amend that boundary. Accepted -[ADR 010](010-scene-description-and-item-bundling.md) defines item ownership -and the later Session aggregation boundary. - -The generic principle that domain packages retain their own data authority -does not preserve the current draft `ModelViewer` controller, projections, -selection behavior, or cache shape. Explicit user correction moves that draft -to a later redesign phase. diff --git a/initiatives/scene-viewer-visualisation/decisions/002-indexed-buffer-geometry.md b/initiatives/scene-viewer-visualisation/decisions/002-indexed-buffer-geometry.md deleted file mode 100644 index cf552f3..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/002-indexed-buffer-geometry.md +++ /dev/null @@ -1,75 +0,0 @@ -# ADR 002: Indexed Viewer Buffer Geometry - -## Status - -Accepted. - -## Context - -Viewer can batch geometry efficiently but its general `BufferGeometry` -requires expanded line and triangle vertices. This duplicates arrays and makes -callers manually expand vertices plus edges or triangles. Core numerical APIs -already accept structural Python and NumPy buffers, and Viewer-specific GPU -layout should not become a compulsory core geometry representation. - -## Options - -1. Add one Viewer-owned shared-vertex indexed `BufferGeometry` contract and - convenience constructors. -2. Put a GPU-oriented buffer type in core. -3. Require `Tessellation`, `PolygonalSurface`, or `Mesh` for every input. -4. Preserve expanded arrays and add only helper functions that duplicate them. - -## Recommendation - -Choose option 1. Use shared `vertices` plus optional point, edge, and triangle -index channels. Provide: - -```python -BufferGeometry.from_points(vertices) -BufferGeometry.from_vertices_and_edges(vertices, edges) -BufferGeometry.from_vertices_and_triangles(vertices, triangles) -``` - -Accept structural Python sequences and NumPy arrays. Normalize once to Viewer -dtypes and check rank, column count, and index bounds. Preserve indices through -the buffer manager and do not create one scene object per primitive. - -Keep styling on scene objects. Do not add a universal render geometry to core -or make this contract an input to geometry algorithms. - -## Consequences - -- Large edge and triangle datasets avoid Python-object and vertex-expansion - overhead. -- Viewer adapters gain one common path for indexed geometry. -- Geometry with independent point/line/triangle vertex pools must combine - them into one vertex table with offset indices at the Viewer boundary. -- Per-channel or per-primitive color arrays beyond current behavior require - evidence and a separate refinement rather than speculative fields. - -## Compatibility - -The existing expanded `points`, `lines`, and `faces` constructor is replaced -in a coordinated Viewer change. Examples and adapters migrate together; no -parallel deprecated constructor is proposed. - -## Verification - -- Test list and NumPy inputs, exact shapes/dtypes, bounds, empty channels, and - input non-mutation. -- Assert indices remain indexed in CPU/GPU assembly. -- Exercise large input without per-edge or per-triangle scene objects. -- Compare rendering semantics with current points, lines, and faces. - -## Affected packages - -Initial implementation: `compas_viewer` and `compas_framework`. - -Later redesign consumer: `compas_model`; its current render-cache shape is not -preserved by this decision. - -## Dependencies - -- [ADR 001](001-ownership-boundaries.md) -- Accepted structural numerical-input decisions from typing alignment diff --git a/initiatives/scene-viewer-visualisation/decisions/003-viewer-state-and-selection.md b/initiatives/scene-viewer-visualisation/decisions/003-viewer-state-and-selection.md deleted file mode 100644 index de0febb..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/003-viewer-state-and-selection.md +++ /dev/null @@ -1,76 +0,0 @@ -# ADR 003: Viewer State and Object Selection - -## Status - -Accepted. - -## Context - -Selection currently lives in mutable `ViewerSceneObject.is_selected` flags. -Viewport commands, tree widgets, shaders, and programmatic consumers mutate or -poll those flags and then trigger imperative refreshes. `ViewerState` observes -persistent configuration but not selection or tool state. - -## Options - -1. Add one Viewer-owned observable object-selection model and separate - persistent configuration from transient state. -2. Keep scene-object flags and add selection-change signals around them. -3. Put selection into core Scene and serialize it. -4. Adopt a generic third-party reactive state store for all Viewer data. - -## Recommendation - -Choose option 1. - -`Viewer.state.selection` stores ordered scene-object GUIDs and provides -replace, add, remove, toggle, clear, membership, and ordered-resolution -operations. It emits one batched change notification per operation. Viewport, -rectangle selection, scene tree, commands, shaders, and programmatic consumers use -this model exclusively. - -Keep `Viewer.config` for persistent preferences. Keep hover, active tool, -gesture, and temporary tool values in small explicit Viewer state fields. Use a -Qt-neutral Python model with a Qt bridge. Remove `is_selected` rather than -retaining a second writable authority. - -Initial selection is scene-object-level only. Do not invent a generic vertex, -edge, face, or domain-component token until an approved editing workflow -requires it. - -## Consequences - -- Tree, viewport, code, and renderer observe one mutation - path. -- Selection no longer participates in scene serialization. -- Batch changes avoid repeated renderer/UI updates. -- Existing selection APIs and tests require a coordinated breaking migration. -- Sub-object selection remains explicitly unsupported in the initial wave. - -## Compatibility - -Remove Viewer `is_selected` constructor/settings behavior. Later integrations -may consume the selection model but do not define its contract. - -## Verification - -- Exercise replace/add/remove/toggle/clear from viewport, rectangle, tree, and - programmatic paths. -- Assert one notification and one render/UI synchronization per batch. -- Verify stable ordering, removed-object cleanup, and serialization exclusion. - -## Affected packages - -`compas_viewer` and `compas_framework`. `compas_model` is a later redesign -consumer. - -## Dependencies - -- [ADR 001](001-ownership-boundaries.md) - -## Refinement after acceptance - -The current `compas_model.ModelViewer` is a draft and does not promise a -model-order selection contract that this ADR must preserve. The accepted -decision remains one Viewer-owned selection model; model-specific preservation -language has been removed by explicit user correction. diff --git a/initiatives/scene-viewer-visualisation/decisions/004-transform-refresh-undo.md b/initiatives/scene-viewer-visualisation/decisions/004-transform-refresh-undo.md deleted file mode 100644 index fa49950..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/004-transform-refresh-undo.md +++ /dev/null @@ -1,76 +0,0 @@ -# ADR 004: Transformations, Refresh, and Undo - -## Status - -Accepted. - -## Context - -Core already owns local/world transformations and Viewer can update transform -buffers efficiently, but there is no public multi-object transformation -operation, gizmo contract, or undo behavior. Geometry, selection, sidebar, and -renderer refreshes are invoked through concrete internals. A universal core -event bus would make every mutable property observable before its semantics are -known. - -## Options - -1. Add explicit Viewer transform transactions, undo/redo, and categorized - refresh operations while retaining core transformations. -2. Add a generic observable mutation/event system to core Scene. -3. Mutate scene objects directly and require callers to refresh internals. -4. Move transformations and history entirely into Viewer state. - -## Recommendation - -Choose option 1. - -Expose `viewer.transform_objects(objects, transformation, space="world")`. -Apply one world-space delta to each pre-operation world transformation and -derive each new local transformation through its parent. Reject requests that -contain both an ancestor and its descendant in the initial version. Validate -the entire request before mutation and leave all objects unchanged on failure. - -Record before/after local transformations as one reversible Viewer -transaction. Add a small undo/redo stack for explicit reversible Viewer -transactions; do not absorb general session or domain history. - -Expose explicit geometry, appearance, transform, and hierarchy refresh -operations. Do not add a core scene event bus in this wave. Direct external -mutation requires the matching Viewer refresh call. - -## Consequences - -- Code, commands, and a future gizmo use identical transformation semantics. -- Atomic transactions provide predictable undo and efficient transform-buffer - updates. -- Ancestor/descendant simultaneous transforms remain unsupported until their - intended group semantics are decided. -- Arbitrary item mutation is not magically detected; synchronization remains - explicit and testable. - -## Compatibility - -Existing direct transformation mutation remains a core operation, but Viewer -consumers migrate to the public transaction when they require refresh or undo. -Existing callback commands remain valid and simply do not enter history unless -they produce a reversible transaction. - -## Verification - -- Test world/local conversion under transformed parents. -- Test multiple independent objects, atomic validation failure, ancestor/ - descendant rejection, undo, redo, and redo invalidation after new work. -- Assert transform-only refresh does not rebuild geometry buffers. -- Verify failed commands do not create history entries. - -## Affected packages - -Initial implementation: `compas`, `compas_viewer`, and `compas_framework`. - -Later redesign consumer: `compas_model`. - -## Dependencies - -- [ADR 001](001-ownership-boundaries.md) -- [ADR 003](003-viewer-state-and-selection.md) diff --git a/initiatives/scene-viewer-visualisation/decisions/005-annotations-and-overlays.md b/initiatives/scene-viewer-visualisation/decisions/005-annotations-and-overlays.md deleted file mode 100644 index 24f87b5..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/005-annotations-and-overlays.md +++ /dev/null @@ -1,92 +0,0 @@ -# ADR 005: Annotations, Measurements, and Overlays - -## Status - -Accepted, amended by ADRs 024 and 028. - -## Context - -Viewer has concrete `Tag` and `ArrowOverlay` rendering paths but no general -measurement, dimension, scale, or legend behavior. Treating every visual aid -as a scene item would serialize view-dependent UI; treating every annotation -as an overlay would lose world anchoring and durable intent. - -## Options - -1. Separate durable world annotations from transient screen overlays. -2. Make every annotation and overlay a core scene item. -3. Keep every visual aid as a renderer-special-cased Viewer class. -4. Add a framework-wide overlay plugin registry before adding features. - -## Recommendation - -Choose option 1. - -- World text annotations and distance dimensions are serializable scene items - with Viewer adapters. Distance dimensions store two anchors, unit, - precision, and optional label override; distance is derived. -- Scale indicators and legends are transient screen-space Viewer overlays and - are not serialized or picked initially. -- Measurement preview state belongs to the active Viewer tool. Completing a - transient inspection does not mutate Scene. Completing an explicitly - persistent dimension-annotation mode creates a durable distance dimension; - cancelling either mode creates nothing. -- Fixed and associative persistent dimension modes both use snapping. Fixed - acquisition stores a point; associative acquisition stores a supported - component reference and never silently falls back to a point. - -Align current Tag/Arrow behavior with these paths. Use one Viewer overlay layer -for the approved screen types and ordinary scene adapter registration for -world annotations. Do not add a general overlay registry. - -## Consequences - -- Persistence follows user intent rather than rendering technique. -- World annotations participate in hierarchy and transformations. -- View-dependent overlays remain independent of scene files. -- Current concrete renderer checks can be consolidated behind the two paths. -- Dimension editing, angular dimensions, and arbitrary overlay plugins remain - later requirements. Initial snap targets and acquisition behavior are - governed by ADR 026. - -## Compatibility - -Accepted ADR 023 records the completed migration audit and chooses a clean -break. `Tag`, `ArrowOverlay`, their aliases, and their serialized dtype paths -are removed when the canonical types land. Old payloads are unsupported and no -compatibility decoder silently reinterprets them. - -## Verification - -- Test distance derivation, units, precision, label override, transformed - parents, serialization, and reload. -- Test transient inspection and persistent dimension preview/cancel/complete - state transitions, including their different scene-mutation behavior. -- Test fixed and associative snapping, mixed anchors, and explicit unresolved - component references without silent fallback. -- Assert scale and legend overlays are absent from scene serialization. -- Verify renderer ordering, resize behavior, and no concrete type checks in - the main render loop for approved types. - -## Affected packages - -`compas`, `compas_viewer`, and `compas_framework`. - -## Dependencies - -- [ADR 001](001-ownership-boundaries.md) -- [ADR 002](002-indexed-buffer-geometry.md) -- [ADR 003](003-viewer-state-and-selection.md) - -## Amendment - -Accepted ADR 024 refines measurement outcomes after the user identified two -distinct intents. Live inspection is transient and never creates scene -content. Persistent dimension-annotation mode may share acquisition and -preview infrastructure, but only its completion creates a durable -`DistanceDimension`. - -Accepted ADR 028 adds explicit fixed and associative persistent dimension -anchors. Both modes use snapping, but only Associative mode stores a component -reference. Missing components become unresolved rather than silently falling -back or displaying stale coordinates. diff --git a/initiatives/scene-viewer-visualisation/decisions/006-viewer-integration-facade.md b/initiatives/scene-viewer-visualisation/decisions/006-viewer-integration-facade.md deleted file mode 100644 index 597fd63..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/006-viewer-integration-facade.md +++ /dev/null @@ -1,88 +0,0 @@ -# ADR 006: Public Viewer Integration Facade - -## Status - -Accepted. - -## Context - -Viewer-owned commands and components reach into concrete renderer and widget -objects. Viewer has command and menu composition but no equally clear public -dock or synchronization boundary. Optional consoles or assistants should not -force shell, network, or credential behavior into the Viewer core. - -## Options - -1. Expose a small public Viewer facade for scene, state, refresh, history, - commands, docks, annotations, and overlays. -2. Let integrations continue using renderer and widget internals. -3. Define a large abstract Viewer/controller framework for every domain. -4. Design the facade around the current draft `ModelViewer` controller. - -## Recommendation - -Choose option 1. Provide public operations for: - -- scene access and GUID resolution; -- selection and transient state; -- categorized refresh; -- transform transactions and undo/redo; -- command registration and menu placement; -- dock addition/removal; and -- annotation and overlay addition/removal. - -The facade is defined only by approved Viewer-owned tools, commands, state, -annotations, overlays, refresh, and UI composition. Do not create a generic -controller base class or add operations solely to match a current external -consumer. - -A future console, terminal, or assistant may use a dock and registered command -API. Arbitrary Python/shell execution, subprocesses, credentials, network -transport, and assistant policy require a separate security ADR and are not -implemented in this wave. - -## Consequences - -- Viewer-owned components gain a stable, testable integration surface that - later consumers may reuse. -- Viewer internals can change without coordinated domain rewrites. -- Public API growth is limited to demonstrated Viewer feature needs. -- Dock content remains Viewer/Qt-specific; core stays UI-independent. -- Console/chat presentation becomes possible without prematurely authorizing - execution or remote services. - -## Compatibility - -The current draft `ModelViewer` has no compatibility requirements under this -ADR. Its later redesign may consume the proven facade but may not enlarge it -without a demonstrated requirement and approval. - -## Verification - -- Test facade behavior with a lightweight fake UI/renderer boundary. -- Forbid private renderer/widget access in Viewer-owned command, tool, and - component tests. -- Verify dock and command registration/removal and duplicate-ID failures. -- Verify plugin discovery imports no Qt/OpenGL or optional-consumer - implementation modules. - -## Affected packages - -`compas_viewer` and `compas_framework`. `compas_model` is a later redesign -consumer. - -## Dependencies - -- [ADR 001](001-ownership-boundaries.md) -- [ADR 003](003-viewer-state-and-selection.md) -- [ADR 004](004-transform-refresh-undo.md) -- [ADR 005](005-annotations-and-overlays.md) - -## Refinement after acceptance - -The original context and compatibility clauses relied too heavily on the -current `compas_model.ModelViewer`. Explicit user correction establishes that -controller as a draft that may be redesigned freely. The accepted decision is -therefore narrowed to a small Viewer-owned public boundary justified by -Viewer's own approved capabilities; no ModelViewer behavior or controller -shape is preserved. diff --git a/initiatives/scene-viewer-visualisation/decisions/007-scope-and-verification.md b/initiatives/scene-viewer-visualisation/decisions/007-scope-and-verification.md deleted file mode 100644 index 97ea306..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/007-scope-and-verification.md +++ /dev/null @@ -1,89 +0,0 @@ -# ADR 007: Initial Scope and Verification - -## Status - -Accepted. - -## Context - -Core Scene is consumed by Viewer, model, notebook, session, and CAD-host -packages. Expanding the first implementation across every backend would mix -runtime-specific migrations and make completion evidence unavailable. Package -tests alone do not prove installed cross-package behavior. - -## Options - -1. Implement an initial core/Viewer/framework wave and compatibility- - review adjacent consumers. -2. Migrate every visualisation and host package in one wave. -3. Change Viewer only and defer core scene alignment. -4. Accept package-local source tests as completion evidence. - -## Recommendation - -Choose option 1. - -Initial implementation packages are `compas`, `compas_viewer`, and -`compas_framework`. Review `compas_model`, `compas_session`, -`compas_notebook`, Rhino, Grasshopper, and Blender for compatibility with core -changes, but do not modify them without a scope amendment and approval. - -Require: - -- focused and full applicable local tests, Ruff, Pyright, and strict docs; -- clean package CI and built-wheel checks at exact heads; -- framework CI installing exact candidates and exercising plugin discovery, - scene and Viewer construction, indexed buffers, selection, transformations, - annotations, serialization, and graphics-free discovery; and -- candidate-artifact CI for claims about independently built distributable - compatibility. - -Coordinate the plugin initiative's installed model/viewer registry gate rather -than creating a second competing test. - -## Consequences - -- The first wave remains verifiable on ordinary CI with offscreen Viewer - support. -- Host-specific behavior remains unverified and unmodified, not implicitly - passed. -- Core compatibility risks are still inspected before implementation. -- Later session, notebook, host, sub-object selection, advanced transform, - and console/assistant waves require explicit decisions. - -## Compatibility - -Any approved core change must preserve current public scene contracts for -compatibility-only consumers or identify a concrete blocker and return for -scope/compatibility approval before implementation proceeds. - -## Verification - -- Record local, package, framework-integration, and candidate-artifact - evidence separately in the handoff. -- Pin exact commit and artifact identities. -- Treat unavailable required runtime evidence as unverified, not passing. -- Keep generated files in isolated temporary directories. - -## Affected packages - -Initial: `compas`, `compas_viewer`, and `compas_framework`. - -Later redesign consumer and regression evidence: `compas_model`. - -Compatibility review only: `compas_session`, `compas_notebook`, Rhino, -Grasshopper, and Blender scene adapters. - -## Dependencies - -- [ADRs 001–006](README.md) -- Plugin-implementations ADR 005 - -## Refinement after acceptance - -The initial package list previously included `compas_model` as though the -current `ModelViewer` behavior constrained this initiative. Explicit user -correction moves it to a later redesign phase. Its current serialization -failure remains valid evidence for core scene reconstruction, but its -hierarchy projections, selection behavior, cache, controller shape, and facade -usage are not initial-wave completion criteria. diff --git a/initiatives/scene-viewer-visualisation/decisions/008-scene-nodes-and-runtime-adapters.md b/initiatives/scene-viewer-visualisation/decisions/008-scene-nodes-and-runtime-adapters.md deleted file mode 100644 index ea845f3..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/008-scene-nodes-and-runtime-adapters.md +++ /dev/null @@ -1,180 +0,0 @@ -# ADR 008: Serializable Scene Nodes and Runtime Adapters - -## Status - -Superseded by ADRs 013–014. - -## Context - -ADR 001 correctly separates durable scene content from Viewer interaction and -renderer state, but it still treats `SceneObject` as both durable node and -context-specific runtime adapter. Current serialization stores an item's GUID -plus `sceneobject.settings`, then calls `Scene.add(..., **settings)` during -load. Factory dispatch chooses a runtime subclass and executes its constructor -before that object is attached to the reconstructed hierarchy. - -Two verified regressions expose the consequences: - -1. A Viewer Box/ShapeObject with local translation `[2, 0, 0]` reloads with - `transformation is None` because `ViewerSceneObject.settings` replaces - rather than extends core settings. In a headless ShapeObject case, `u=7`, - `v=9`, and a face color reload as the defaults `16`, `16`, and the default - face color. -2. A `ModelViewer` scene cannot reload. The controller originally creates - `ModelObject(add_elements=False)` and `ElementObject(add_children=False)`, - but those construction controls are absent from serialized settings. - Reload dispatches `ModelObject` with `add_elements=True`; its constructor - calls `self.add(...)` before attachment and raises `RuntimeError: A detached - scene object cannot own child objects.` Render caches are transient and - should not be serialized, but hierarchy reconstruction must not depend on - them or on constructor side effects. - -The shared item store already preserves identity when multiple nodes reference -one item GUID. Scene-object/node GUIDs are not preserved across round trips. -Context also determines which runtime subclass is constructed, even though a -serialized scene should remain loadable without that backend. - -## Options - -1. Separate a serializable scene-owned node/state value from context-specific - runtime adapters and reconstruct them in two phases. -2. Keep `SceneObject` as both node and adapter and expand every subclass's - `settings` property until current tests pass. -3. Serialize complete runtime adapter objects, including their concrete class - and context. -4. Serialize only items and hierarchy and discard all per-node appearance and - transformations. - -## Recommendation - -Choose option 1. - -`Scene` owns a serializable node/state record for every hierarchy entry. The -closed base record contains: - -- a durable node GUID; -- node kind (`item` or `group`); -- optional item GUID; -- name; -- local transformation; -- visibility, opacity, and base appearance; and -- explicitly declared extension state governed by ADR 009. - -Items remain separate and keyed by item GUID, preserving shared item identity. -Accepted ADR 010 requires a serialized scene description to reference those -items without embedding them. Node GUIDs are serialized -and restored so selection references, domain indexes, and external scene -references have durable identity. Runtime adapter instances are not durable -identities. - -Deserialize in two phases: - -1. validate and create nodes, state, GUIDs, and the complete hierarchy without - requiring item bindings, context dispatch, or adapter constructors; -2. bind adapters for an explicitly requested or detected runtime context only - after the scene is structurally complete, either eagerly for drawing or - lazily on first use. - -`SceneObject` becomes the runtime adapter bound to a scene, node, and optional -item. Its constructor must not populate hierarchy or own serialized state. -Application/domain projection creates nodes explicitly through an owning -controller; adapter binding never recreates children. The current draft -`ModelViewer` is evidence of why constructor-driven hierarchy creation fails, -not a controller contract to preserve. - -Scene context is runtime binding configuration, not authoritative serialized -content. A scene may record a non-binding context hint for user experience, -but loading must not require that context or silently select a different one. -Drawing without a usable context raises a precise runtime error after the -backend-neutral scene has loaded. - -Known extension fields are activated only by a compatible adapter. Unknown -extension namespaces and fields are preserved losslessly as inactive node -state and written back unchanged. Unknown required base schema versions fail -validation; unknown adapter state is not passed blindly to constructors. - -## Refinement of ADR 001 - -This ADR preserves ADR 001's package boundaries but refines these clauses: - -- "Core owns scene items, hierarchy, scene-object GUIDs..." becomes: core - owns durable node/state GUIDs and stable item references; runtime adapter - identity is not serialized. Accepted ADR 010 defines the non-owning runtime - binding boundary for items. -- "GUIDs connect durable scene objects to Viewer state" becomes: durable node - GUIDs connect scene content to Viewer state and domain indexes. -- Core still owns transformations, visibility, durable appearance, and - serialization, but those values live on node state rather than being - discovered from a runtime adapter's constructor/settings implementation. - -ADR 001's durable identity and serialization boundary is amended by this -Accepted decision and ADR 009. Accepted ADR 010 defines item ownership and -packaging. - -## Consequences - -- Scenes load without Viewer, model adapters, or another visualization backend. -- Runtime constructors no longer execute hierarchy-building side effects during - deserialization. -- Switching or omitting runtime contexts does not destroy durable node state. -- Shared item identity and durable node identity have separate, explicit GUIDs. -- Core Scene/SceneObject APIs require a coordinated redesign and compatibility - review; this is larger than patching two `settings` properties. -- Adapter binding and lifecycle need focused tests, but no universal renderer - abstraction or event bus is introduced. - -## Compatibility - -The new node schema replaces the existing serialized scene shape. The initial -implementation does not include a compatibility loader because current files -omit required state and cannot be migrated reliably without guessing. If -concrete legacy files later require recovery, migration tooling needs separate -evidence, scope, and approval. - -Existing public code may continue to receive a `SceneObject` adapter from -`Scene.add`, but code that treats adapter identity or constructor side effects -as durable must migrate. Exact compatibility is part of the Phase 1 audit. - -## Verification - -- Reproduce the Viewer regression as a focused test and retain the draft - ModelViewer failure as evidence. -- Round-trip local transformations, `u=7`, `v=9`, face color, shared items, - node GUIDs, groups, and hierarchy without a visualization backend installed. -- Use a minimal test adapter with constructor-side-effect behavior to prove - hierarchy deserialization never invokes runtime construction; redesign and - test the actual ModelViewer later. -- Load and re-save unknown extension state without loss or constructor use. -- Verify missing/unknown context permits load but produces a precise binding or - draw error. -- Verify duplicate item or node GUIDs and unsupported base schema versions fail - atomically. - -## Affected packages - -Initial implementation: `compas`, `compas_viewer`, and `compas_framework`. - -Later redesign/regression consumer: `compas_model`. - -Compatibility review only: `compas_session`, `compas_notebook`, and CAD-host -scene adapters. - -## Dependencies - -- [ADR 001](001-ownership-boundaries.md), refined by this decision - -ADR 009 supplies the serialization field policy required to implement this -decision. ADR 010 separately decides that referenced items remain external to -Scene and defines the boundary for later Session aggregation. - -## Decision - -Accepted on 2026-11-07. The user additionally required a separate decision -ensuring that independently serializable `Data` objects are not forced to live -inside a scene. Accepted ADR 010 records that packaging refinement without -changing this decision's accepted node/adapter separation. - -Superseded on 2026-11-07 after implementation exposed duplicate detached/bound -state and backend-dependent object types. Accepted ADRs 013–014 retain -backend-independent loading and reference-only data binding while assigning -durable state to stable scene objects and backend behavior to operations. diff --git a/initiatives/scene-viewer-visualisation/decisions/009-scene-state-fields.md b/initiatives/scene-viewer-visualisation/decisions/009-scene-state-fields.md deleted file mode 100644 index 93752df..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/009-scene-state-fields.md +++ /dev/null @@ -1,113 +0,0 @@ -# ADR 009: Explicit Scene-State Serialization Fields - -## Status - -Superseded in part by ADR 013. - -## Context - -Current scene serialization depends on each runtime adapter's `settings` -property and reconstructs state by replaying that mapping as constructor -arguments. Subclasses can accidentally replace base settings, as demonstrated -by the lost transformation regression. Required subclass state can be omitted, -as demonstrated by lost ShapeObject resolution and face color. Conversely, -serializing `__dict__`, every property, annotations, or constructor parameters -would capture caches, renderer handles, item/scene backreferences, derived -values, and construction commands such as `add_elements`. - -The durable node proposed by ADR 008 needs an explicit field policy that -supports inheritance without treating Python introspection as persistence. - -## Options - -1. Use a closed base node-state schema plus explicit MRO-composed extension - field declarations. -2. Serialize every entry in `__dict__` except a growing denylist. -3. Serialize every public property, type annotation, or constructor parameter - discovered through introspection. -4. Require every subclass to replace and manually merge a free-form - `settings` dictionary. -5. Allow only the closed base schema and prohibit all adapter/domain extension - state. - -## Recommendation - -Choose option 1. - -Base node state is a closed value-object schema owned by core. A class that -owns additional durable scene state declares only its local fields through an -explicit class-level declaration. The serializer composes declarations across -the MRO from base to subclass, rejects duplicate or incompatible declarations, -and stores extension values under a stable owning namespace. - -Declarations specify the serialized name, expected value contract, default or -required status, and whether omission is allowed. They do not execute arbitrary -getters during schema discovery. The implementation may use annotations, -constructor signatures, descriptors, and properties only to validate a -declaration or generate editor/documentation metadata; introspection never -decides that a field is persistent. - -Unrestricted `__dict__`, public-property, constructor-parameter, or annotation -serialization is forbidden. Derived values, scene/item backreferences, -renderer/GPU handles, pick IDs, caches, selection, hover, tools, and command -history are not durable fields. `ModelObject.add_elements` and -`ElementObject.add_children` are construction commands, not state. Model render -caches are transient. Shape resolution and durable colors are serialized only -through explicit declarations. - -Deserialization validates the closed base state and known declarations without -passing a free-form mapping to adapter constructors. Unknown namespaced -extension values remain inactive and round-trip unchanged under ADR 008. - -## Consequences - -- Base transformations and subclass fields cannot disappear because a - subclass forgot `super().settings`. -- Persistence changes are visible in code review and independently testable. -- Runtime caches and constructor side effects are excluded by default. -- Subclasses must deliberately declare every durable field and migration. -- Editor tooling can reuse schema metadata without becoming the source of - truth for persistence. -- A small schema/version and migration mechanism is required for renamed or - removed fields; it remains data-focused rather than adapter-constructor - compatibility code. - -## Compatibility - -Legacy `settings` mappings are not accepted by the new serializer. They are -incomplete, unversioned, and cannot be mapped into declared base/extension -fields reliably. The new implementation reads and writes only the explicit -schema. Any later recovery tool remains separate from runtime serialization. - -## Verification - -- Assert MRO composition preserves base transformation plus declared subclass - `u`, `v`, and face color. -- Assert duplicate field declarations, invalid values, missing required fields, - and unknown base fields fail with precise paths. -- Prove caches, Viewer handles, pick IDs, selection, and construction commands - are absent from serialized state. -- Prove unknown namespaced extension state round-trips byte-for-value without - importing or constructing its adapter. -- Use introspection-based validation tests to detect a declaration that names a - missing/incompatible attribute, without auto-serializing undeclared members. - -## Affected packages - -Initial implementation: `compas`, `compas_viewer`, and `compas_framework`. - -Later redesign/regression consumer: `compas_model`. - -## Dependencies - -- [ADR 008](008-scene-nodes-and-runtime-adapters.md) - -## Decision - -Accepted on 2026-11-07. Persistent fields use the closed base schema and -explicit MRO-composed declarations described above. Item ownership and -serialization packaging are decided separately by Accepted ADR 010. - -Superseded in part on 2026-11-07. Accepted ADR 013 retains the closed-schema, -explicit-field principle but moves durable state from node extensions onto -ordinary stable scene-object attributes and rejects attribute interception. diff --git a/initiatives/scene-viewer-visualisation/decisions/010-scene-description-and-item-bundling.md b/initiatives/scene-viewer-visualisation/decisions/010-scene-description-and-item-bundling.md deleted file mode 100644 index 0b7fe72..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/010-scene-description-and-item-bundling.md +++ /dev/null @@ -1,144 +0,0 @@ -# ADR 010: Scene Description, Item Bindings, and Aggregation Boundary - -## Status - -Accepted. - -## Context - -ADRs 008–009 separate durable scene node state from runtime adapters and define -its serialization fields. They do not yet decide whether referenced domain -items must be embedded in a serialized scene. - -A geometry or other `Data` object may need to be serialized independently for -later algorithmic processing while also being referenced by one or more scene -nodes. It must not be forced to live inside the scene or require extraction -from a scene file before ordinary data processing. Conversely, users sometimes -need an aggregate containing data, one or more scenes, settings, and history. - -The current item table preserves shared identity inside one scene file, but -conflates a scene description, runtime bindings, and packaging. - -## Options - -1. Keep Scene reference-only and treat a redesigned Session as the likely - optional aggregate under a separate decision and scope. -2. Always embed every referenced item in the scene serialization. -3. Add a dedicated `SceneBundle` containing one scene plus its items. -4. Introduce a general asset catalog with URIs, search paths, network loading, - and resolver plugins. - -## Recommendation - -Choose option 1. - -Define one Scene role, its runtime bindings, and one later aggregation boundary: - -- `Scene` is the durable, backend-neutral visual description from ADRs 008–009. - Its serialized node hierarchy contains stable item GUID references only. - At runtime it may hold a nonserialized binding table from those GUIDs to - already loaded `Data` objects. A binding is a reference, not ownership; the - same object remains independently usable and serializable. -- A redesigned `compas_session.Session` is the likely optional aggregate for - independently serialized data, one or more scene descriptions, settings, - history, and their shared identity. Its exact schema, ownership, and loading - behavior require a separate dependent decision and explicit scope approval. - Do not add Session implementation to the current wave. - -A later Viewer/Session integration may provide convenient new, open, and save -operations. Viewer remains a client of Session persistence: it does not own the -aggregate format, and session support remains optional and lazily loaded. The -exact convenience API follows the separately approved Session redesign. - -The intended runtime operations are conceptually: - -```python -scene = Scene.from_json(...) -scene.bind(item) -scene.bind_many(items) -``` - -Exact method naming may follow established core conventions during -implementation. Scene serialization remains reference-only; it is not -controlled by an `include_items` boolean. - -Loading a Scene succeeds when item references are unresolved. Hierarchy, -node state, and reference inspection remain available. Binding an item uses -its existing GUID. Binding the same instance again is idempotent; binding a -different object with the same GUID is rejected. All nodes referencing one -GUID resolve to the same bound object instance. - -Drawing, adapter binding, or another operation that requires an -unresolved item raises a precise error containing the node GUID and item GUID. -The caller may bind the item later and retry. Serialization and inspection of -the reference-bearing description do not require bindings. - -Do not add URIs, filesystem lookup, network loading, an asset registry, or a -resolver plugin. Callers load `Data` objects through existing serialization and -bind them explicitly. A concrete external-resource requirement would need a -separate decision. - -## Refinement of ADR 008 - -ADR 008's separate item store is refined into a runtime binding table. Core -owns the Scene description and stable references, but it does not claim -exclusive ownership of bound `Data` objects. Aggregation belongs outside Scene; -a future Session design may package objects without making that aggregate their -only valid serialization path. - -## Consequences - -- Domain data remains independently serializable and directly available for - algorithms. -- Scenes can be stored, compared, or transmitted without - duplicating large items. -- A future self-contained aggregate can support multiple scenes, settings, and - history without introducing a redundant one-scene bundle type now. -- Shared identity is deterministic within a runtime Scene and must remain so - in any future approved Session aggregate. -- Unresolved references become a normal, inspectable state with precise - failure at item-dependent operations. -- Cross-file discovery remains the caller's responsibility; no speculative - asset system is introduced. - -## Compatibility - -The new Scene format is reference-only. Existing `Data` serialization remains -unchanged. A future Session aggregate and any legacy recovery tooling remain -outside Scene runtime serialization and require separate approval. - -## Verification - -- Serialize and load one `Data` object independently, bind it to a separately - loaded Scene, and run an algorithm on the original/bound object - without extraction or copying. -- Round-trip a reference-only Scene while items remain unresolved. -- Bind later and prove every node sharing one item GUID resolves to the same - object instance. -- Reject a different object with a duplicate GUID atomically. -- Raise precise node/item errors for draw and adapter operations that - require unresolved items. -- Prove description serialization needs no bound items and no URI/network - resolver is invoked. -- In a separate future Session decision, verify data and multiple scenes share - identity without requiring extraction from Scene. - -## Affected packages - -Initial implementation: `compas` and `compas_framework`. - -Consumer: `compas_viewer`. - -Separate later design/scope: `compas_session`, followed by `compas_model`, -notebook, and CAD-host integrations as applicable. - -## Dependencies - -- [ADR 008](008-scene-nodes-and-runtime-adapters.md) -- [ADR 009](009-scene-state-fields.md) - -## Amendment - -Accepted ADR 013 amended this decision on 2026-11-07: item GUID references live -on stable scene objects rather than hierarchy nodes. Items remain independently -serializable, explicitly bound, and outside the serialized scene description. diff --git a/initiatives/scene-viewer-visualisation/decisions/011-node-first-scene-adapters.md b/initiatives/scene-viewer-visualisation/decisions/011-node-first-scene-adapters.md deleted file mode 100644 index 8980f81..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/011-node-first-scene-adapters.md +++ /dev/null @@ -1,102 +0,0 @@ -# ADR 011: Node-First Scene Construction and Adapter Lifetime - -## Status - -Superseded by ADRs 013–014 before acceptance. - -## Context - -ADR 008 correctly separates durable scene nodes from runtime adapters, but its -first implementation still constructs a detached `SceneObject` before creating -the node. The adapter temporarily owns the item reference, GUID, name, -transformation, appearance, and extension values. Binding then changes those -properties to read from the node. - -This creates two object modes, duplicate storage, and identity whose meaning -changes after binding. Verified probes show that removal can expose stale -provisional values and a different GUID. Context rebinding replaces adapters -and leaves external references detached with the same stale fallback state. -The implementation therefore contradicts ADR 008's requirement that an -adapter constructor must not own serialized state. - -## Options - -1. Create the node first and construct a permanently node-bound runtime - adapter from `(scene, node)`. -2. Retain detached and bound adapter modes while hiding the transition behind - additional helpers. -3. Put runtime drawing behavior directly on `SceneNode`. -4. Preserve detached adapters through a compatibility wrapper. - -## Recommendation - -Choose option 1. - -`SceneNode` remains the sole durable authority for identity, hierarchy, item -GUID, name, local transformation, appearance, visibility, and extension state. -`SceneObject` becomes a plain runtime adapter rather than a `Data` object. It -is constructed only from an existing scene and node and owns only context -handles, derived caches, drawing behavior, and invalidation. - -Keep the convenient public call: - -```python -sceneobject = scene.add(mesh, color=Color.red(), show=True) -``` - -Internally, `Scene.add` resolves the adapter type, validates node and extension -arguments, creates and attaches the node, records the item binding, and only -then creates `adapter_type(scene, node)`. Failure rolls back the node and item -binding atomically. - -Deserialization remains node-only. `Scene.bind_context` constructs a complete -replacement adapter table after hierarchy and required items exist, then swaps -it in atomically. Adapter construction never creates hierarchy or durable -state. - -Remove detached adapter construction, `Scene.add(sceneobject)`, adapter -serialization, adapter-owned temporary GUIDs and presentation fallbacks, and -constructor-driven child creation. Registry dispatch moves from -`SceneObject.__new__` to `Scene`. - -Removed or context-replaced adapters become invalid runtime references. They -do not transition to a detached reusable mode. Re-adding content means adding -the `Data` item or retaining and explicitly rebinding an existing node. - -## Compatibility - -This intentionally breaks direct `SceneObject(item, ...)`, -`Scene.add(sceneobject)`, reusable removed adapters, and one-shot -`SceneObject(item).draw()`. Core and Viewer tests migrate to `Scene.add`. -GhPython one-shot conversion requires a small explicit context helper or local -scene. CAD-host adapters require audit before their later migration. - -`Scene.add(data, ...)`, registry/context dispatch, durable node GUIDs, -reference-only serialization, unresolved loading, explicit item binding, and -shared item identity remain public behavior. - -Direct `Group(...)` construction and arbitrary group constructor keywords as -future child defaults are removed. `scene.add_group(...)` creates the node -first; callers pass child presentation explicitly. - -## Verification - -- Prove the node exists before adapter construction. -- Prove adapter constructors receive only scene and node. -- Prove construction and context-binding failures roll back atomically. -- Prove GUID meaning and durable property storage never switch. -- Prove removed and replaced adapters fail precisely. -- Prove deserialization and unknown extension round trips need no adapters. -- Preserve Viewer round trips and `compas_model` compatibility through the - public `Scene.add(data, ...)` path. - -## Dependencies - -- Supersedes the construction, adapter identity, and compatibility clauses of - Accepted [ADR 008](008-scene-nodes-and-runtime-adapters.md). -- Preserves Accepted [ADR 010](010-scene-description-and-item-bundling.md). -- Works with Proposed [ADR 012](012-explicit-node-backed-adapter-state.md). - -## Decision - -Not accepted. Superseded on 2026-11-07 by Accepted ADRs 013–014. diff --git a/initiatives/scene-viewer-visualisation/decisions/012-explicit-node-backed-adapter-state.md b/initiatives/scene-viewer-visualisation/decisions/012-explicit-node-backed-adapter-state.md deleted file mode 100644 index 3f41682..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/012-explicit-node-backed-adapter-state.md +++ /dev/null @@ -1,79 +0,0 @@ -# ADR 012: Explicit Node-Backed Adapter State - -## Status - -Superseded by ADR 013 before acceptance. - -## Context - -ADR 009 correctly requires a closed base schema and explicit namespaced -extension declarations. Its implementation, however, uses -`SceneObject.__getattribute__` and `__setattr__` to scan declarations and -redirect attributes dynamically. Other durable fields use individual -node-or-local properties, and color uses a special descriptor. The result is -three different state-routing mechanisms whose behavior changes when an -adapter binds to a node. - -The declarations should define persistence and validation, not invisibly -change normal Python attribute access. - -## Options - -1. Keep declarations as schema metadata and implement ordinary explicit - node-backed adapter properties. -2. Replace interception with a general descriptor or state-proxy framework. -3. Store durable adapter state in a third state object. -4. Keep the current interception and add documentation. - -## Recommendation - -Choose option 1. - -Keep `SceneStateField`-style declarations only for stable names, namespaces, -types, defaults, required fields, validation, and preservation of unknown -extension state. `Scene.add` validates declared keyword arguments and writes -them directly to `SceneNode.extensions`. Deserialization validates known state -without constructing adapters. - -Adapters expose ordinary properties whose implementation visibly reads and -writes the node. A small typed `SceneNode.extension(namespace, field)` and -`set_extension(...)` helper may remove repetitive mapping access. Do not add a -general descriptor, proxy, reflection layer, or global attribute interception. -Property setters perform required invalidation explicitly. - -Remove extension capture/apply operations, declaration-driven -`__getattribute__`/`__setattr__`, detached attribute validation, and all local -durable fallbacks. Base properties such as name, transformation, color, -opacity, and visibility are likewise direct node-backed properties on an -always-bound adapter. - -## Consequences - -- Durable state has one storage location and one visible access path. -- Persistence remains explicit and reviewable. -- Adapter classes contain some repetitive properties, which is preferable to - hidden control flow. -- Unknown namespaced state remains serializable without importing its adapter. -- Constructor signatures no longer double as persistence or editor schemas. - -## Verification - -- Prove each declared property reads and writes its node extension. -- Prove setters trigger their documented cache invalidation. -- Reject unknown, missing, duplicate, and invalid declared fields precisely. -- Preserve unknown namespaces without adapter imports. -- Prove caches, selection, context handles, and construction commands are not - durable. -- Assert no runtime adapter class uses persistence interception or capture. - -## Dependencies - -- Supersedes the runtime interception and capture mechanism introduced under - Accepted [ADR 009](009-scene-state-fields.md), while retaining its closed - schema and explicit declarations. -- Depends on Proposed [ADR 011](011-node-first-scene-adapters.md). -- Preserves Accepted [ADR 010](010-scene-description-and-item-bundling.md). - -## Decision - -Not accepted. Superseded on 2026-11-07 by Accepted ADR 013. diff --git a/initiatives/scene-viewer-visualisation/decisions/013-hierarchy-nodes-and-stable-sceneobjects.md b/initiatives/scene-viewer-visualisation/decisions/013-hierarchy-nodes-and-stable-sceneobjects.md deleted file mode 100644 index c57b732..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/013-hierarchy-nodes-and-stable-sceneobjects.md +++ /dev/null @@ -1,125 +0,0 @@ -# ADR 013: Hierarchy-Only Nodes and Stable Scene Objects - -## Status - -Accepted. - -## Context - -Accepted ADR 008 separated durable scene nodes from runtime adapters, but the -implementation duplicated state across detached and bound adapter modes. -Proposed ADR 011 removes that dual lifecycle, but still makes `SceneNode` own -both hierarchy and all durable visual state while `SceneObject` is only a -runtime projection. This leaves two public concepts that appear to describe -the same scene entry and makes backend-specific replacement classes central to -ordinary object access. - -A simpler separation is possible: nodes describe only hierarchy; stable scene -objects describe everything durable about a visualized item; backends provide -operations rather than replacement object classes. - -## Options - -1. Use hierarchy-only nodes and durable, stable scene objects. -2. Keep durable state on nodes and make scene objects always-bound adapters as - proposed by ADRs 011–012. -3. Merge hierarchy and durable state back into one tree-node class. -4. Keep the implemented detached/bound adapter model. - -## Recommendation - -Choose option 1. - -`SceneObject` is a backend-neutral `Data` object with a stable Python type and -GUID. It owns: - -- the referenced item GUID, if any; -- name and local transformation; -- visibility, opacity, and durable backend-neutral appearance; and -- stable semantic type-specific state. - -Stable subclasses such as `GroupObject`, `GeometryObject`, `ShapeObject`, -`MeshObject`, `GraphObject`, and `VolMeshObject` express durable semantics. -Installing Viewer, Rhino, Blender, or another backend never changes an -object's class. - -`SceneNode` owns only ordered parent/child relationships and a reference to one -scene-object GUID. Enforce exactly one node per scene object in one scene. -Instancing is not included. Multiple appearances of one data item use multiple -scene objects referencing the same item GUID. - -Do not serialize a second durable node GUID. The scene-object GUID is the -hierarchy key. The root is an ordinary `GroupObject` with a corresponding root -node rather than a special identity model. - -`Scene` owns separate object and hierarchy stores. `scene.add(item, **state)` -creates the stable semantic scene object, attaches its hierarchy node, and -returns the object. `scene.add_object(sceneobject, parent=...)` explicitly -attaches an existing durable scene object; `Scene.add` is not overloaded with -runtime adapters. - -Scene serialization contains a version, name, stable scene-object records, -and a hierarchy of scene-object GUID references. Referenced `Data` items remain -external under ADR 010. Loading requires no visualization backend and leaves -item references unresolved until explicitly bound. - -Durable type-specific state follows ADR 009's useful rule: a closed base schema -plus explicit fields. State lives as ordinary `SceneObject` attributes, not in -node extensions and not behind attribute interception. Unknown namespaced -state may be retained solely for lossless forward round trips. Backend plugins -may not add durable fields. - -Selection, picking, UI state, renderer configuration, generated buffers, -handles, and caches remain runtime/application state outside `SceneObject`. - -## Consequences - -- Nodes, scene objects, represented data, and backend operations have distinct - and explainable roles. -- Scene-object type and GUID remain stable through attachment, removal, - serialization, and context changes. -- A durable scene object may exist detached without acquiring a second storage - mode; attachment adds only a nonserialized scene backreference. -- Removing and explicitly reattaching an object never reveals stale fallback - values or changes identity. -- The scene schema changes from nested stateful nodes to object records plus a - hierarchy of references. -- Backend-specific replacement classes are removed under ADR 014. - -## Compatibility - -Preserve `scene.add(data, ...)`, shared item identity, unresolved scene loading, -explicit item binding, stable object GUIDs, and hierarchy operations through -returned scene objects. - -Remove backend adapter serialization, constructor-driven child creation, and -implicit group child defaults. `GroupObject` is durable and backend-neutral. -`compas_model`'s maintained controller path already uses `scene.add`; its custom -scene-object redesign remains a later phase. - -## Verification - -- Prove nodes serialize only hierarchy references. -- Prove one node per scene object and reject accidental instancing. -- Preserve scene-object GUIDs through add, move, remove, reattach, reload, and - visualization-context changes. -- Prove durable state has one storage location. -- Load, inspect, edit, and serialize a scene without backend plugins. -- Bind independently loaded items with shared identity. -- Round-trip multiple scene objects referencing one item. -- Exclude selection, handles, buffers, caches, and context from serialization. - -## Dependencies - -- Intended to supersede Accepted ADR 008 and ADR 009's placement of extension - state if approved. -- Retains ADR 009's closed-schema principle. -- Preserves Accepted ADR 010, with item references moving from nodes to scene - objects. -- Works with Proposed [ADR 014](014-context-keyed-scene-operations.md). - -## Decision - -Accepted on 2026-11-07. The user approved hierarchy-only nodes, stable durable -scene objects, one-to-one node/object cardinality without instancing, and the -scene-object GUID as the sole durable hierarchy key. diff --git a/initiatives/scene-viewer-visualisation/decisions/014-context-keyed-scene-operations.md b/initiatives/scene-viewer-visualisation/decisions/014-context-keyed-scene-operations.md deleted file mode 100644 index 6e50e8a..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/014-context-keyed-scene-operations.md +++ /dev/null @@ -1,128 +0,0 @@ -# ADR 014: Context-Keyed Scene Operation Plugins - -## Status - -Accepted. - -## Context - -Current visualization plugins register replacement `SceneObject` subclasses by -represented item type and context. `SceneObject.__new__` may therefore return a -Viewer, Rhino, Blender, Grasshopper, or Notebook subclass. This changes object -type based on installed plugins and mixes durable scene semantics with backend -runtime behavior. - -The general COMPAS pluggable dispatcher identifies extension points globally -by domain, category, and function name. It does not select an implementation -from a call's explicit context or represented object type. Directly registering -multiple `draw` plugins would therefore conflict when several backends are -installed. - -## Options - -1. Register operation functions in a small scene-specific registry keyed by - context, stable scene-object type, and operation. -2. Extend the general plugin manager with argument-aware dispatch. -3. Use one global backend plugin that switches internally on context and type. -4. Retain backend-specific replacement classes. - -## Recommendation - -Choose option 1. - -Backend packages expose lightweight registration plugins that register -functions rather than classes: - -```python -register_scene_operation( - context="Viewer", - sceneobject_type=MeshObject, - operation="draw", - implementation=draw_meshobject, -) -``` - -Lookup is deterministic by `(context, scene-object type MRO, operation)`. -Duplicate registrations for one exact key fail clearly. Heavy Qt, OpenGL, -Rhino, Blender, or other host imports remain inside operation bodies. - -The initial public operation surface is only: - -- `draw`; -- `clear`. - -Backend-private buffer extraction, host-object creation, component drawing, -refresh strategies, and cache structures do not become speculative public -operations. Additional operations require demonstrated cross-backend need and -approval. - -Conceptually: - -```python -scene.draw(context="Viewer", runtime=viewer) -meshobject.draw(context="Viewer", runtime=viewer) -``` - -The selected implementation receives the owning scene, stable scene object, -and optional transient backend runtime. It may return opaque handles. Runtime -resources live in a nonserialized context store keyed by context and -scene-object GUID, never on the durable object. - -There is no adapter-binding phase. Changing context selects different -operations and resources without replacing scene objects. Automatic context -selection is permitted only when exactly one compatible context is available. -Missing operations report context, scene-object type, and operation. - -Keep the general COMPAS plugin manager unchanged. Its existing lightweight -`register_scene_objects` pattern may be renamed or replaced by -`register_scene_operations`, but discovery must remain graphics-free. - -## Consequences - -- Several visualization backends can coexist without class or plugin - conflicts. -- Backend implementations become ordinary functions with explicit inputs. -- Stable scene-object classes remain backend-neutral. -- Runtime ownership is explicit and serialization-safe. -- Viewer requires a coordinated migration because its renderer currently - consumes concrete `ViewerSceneObject` buffer APIs rather than only `draw`. -- CAD, notebook, robots, and domain backends require later coordinated - migrations before they are admitted as compatible C3 candidates. - -## Compatibility - -Remove context-specific scene-object class registration, -`SceneObject(item, context=...)` factory substitution, `sceneobject_type=`, -`Scene.bind_context`, and direct one-shot `SceneObject(item).draw()`. - -Preserve explicit context selection, automatic selection when unambiguous, -graphics-free plugin discovery, `scene.add(data, ...)`, and deterministic -resource clearing. - -The initial coordinated implementation remains core, Viewer, and framework. -Other backends are recorded as incompatible until migrated; no compatibility -factory should retain type substitution. - -## Verification - -- Install Viewer and a fake second backend simultaneously and select each - explicitly. -- Verify deterministic MRO fallback and duplicate-registration errors. -- Verify missing-operation diagnostics. -- Prove discovery imports no graphics modules. -- Prove context changes never replace or mutate durable scene objects. -- Prove draw/clear resource handling does not enter serialized state. -- Preserve indexed Viewer buffers, picking by stable scene-object GUID, and - exact-candidate framework integration. - -## Dependencies - -- Depends on Proposed [ADR 013](013-hierarchy-nodes-and-stable-sceneobjects.md). -- Replaces context-specific class registration if approved. -- Leaves the general plugin dispatcher unchanged. - -## Decision - -Accepted on 2026-11-07. The user approved context-keyed operation functions, -the initial `draw`/`clear` surface, backend-neutral durable state, and -coordinated later migration of visualization hosts. diff --git a/initiatives/scene-viewer-visualisation/decisions/015-contextual-scene-form-contributions.md b/initiatives/scene-viewer-visualisation/decisions/015-contextual-scene-form-contributions.md deleted file mode 100644 index 8b75f75..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/015-contextual-scene-form-contributions.md +++ /dev/null @@ -1,119 +0,0 @@ -# ADR 015: Editable Scene-Object Attributes - -## Status - -Accepted, amended on 2026-11-08. - -## Context - -Viewer's object-settings form currently infers editable controls from private -render-helper attributes. The first accepted correction introduced a separate -class-level editable-attribute declaration for every editable property. That -would duplicate durable semantic attribute names already declared by -`SceneStateField`, allowing persistence and editability declarations to drift. - -Core needs one normalized answer to “which stable scene-object attributes are -editable?” without acquiring labels, editor choices, form layout, rendering -refresh policy, or other Viewer concerns. - -## Options - -1. Mark durable semantic fields editable on their existing `SceneStateField` - and reserve a separate name-only declaration for editable attributes that - are not scene state fields. -2. Duplicate every editable attribute in a separate class-level declaration. -3. Infer editable fields from annotations, constructors, or `hasattr` checks. -4. Put form descriptors or widget metadata on scene-object classes. - -## Decision - -Choose option 1. - -`SceneStateField` gains only: - -- `editable: bool = False`; and -- an optional synchronous atomic data-only `update(owner, value) -> None` - callback. - -A state field with `update` and `editable=False` is invalid. Without `update`, -an editable field uses `setattr(owner, name, value)`. The callback exists only -for a data-side update that cannot be expressed by direct assignment. It must -leave the owner unchanged if it raises. It is not a Viewer, form, rendering, -refresh, context, or asynchronous hook. - -Durable semantic editable state uses its existing `SceneStateField` as the -single source of both persistence and editability. Subclasses do not repeat -those attribute names in a separate editable declaration. - -`SceneObject.__editable_attributes__` remains a class-level mapping only for -genuinely editable attributes that are not `SceneStateField` entries. Its -initial core entries are `name` and `opacity`, matching the existing inspector. -Each mapping value is only an optional synchronous atomic data-only update -callback; `None` means ordinary `setattr`. - -`SceneObject.editable_attributes()` composes both sources across the class MRO -and returns one normalized ordered mapping: - -```text -attribute name -> optional update callback -``` - -MRO composition must not duplicate subclass names. A name resolves once in the -normalized result, with the most specific applicable definition governing its -callback while retaining deterministic order. - -Core contains no label, editor, arbitrary metadata/data, form identifier, -refresh category, or context metadata. Viewer infers presentation from the -resolved object and owns every form and post-mutation refresh decision. - -The initial scope contains only attributes owned by stable `SceneObject` -instances. Represented-item parameters remain on the existing `ParameterForm` -path. - -## Consequences - -- Durable semantic fields have one declaration rather than parallel state and - editable inventories. -- Non-state editable attributes remain explicit and narrowly scoped. -- All consumers receive the same normalized name-to-callback mapping. -- Core remains free of form presentation and rendering refresh policy. -- Arbitrary widgets, item parameters, dotted paths, asynchronous callbacks, - and refresh callbacks remain outside this contract. - -## Compatibility - -The uncommitted separate `EditableAttribute`/declaration design is superseded -before it becomes public. The current public `FormField` implementation and -parallel hardcoded Viewer field inventory must also be replaced. Existing -represented-item `ParameterForm` behavior remains separate and unchanged. - -## Verification - -- Compose editable `SceneStateField` entries and non-state - `__editable_attributes__` entries across the MRO into one ordered mapping. -- Verify durable subclass fields are not duplicated in - `__editable_attributes__` or the normalized result. -- Reject a `SceneStateField` with `update` and `editable=False`. -- Verify default mutation uses `setattr` and callbacks receive exactly - `(owner, value)` synchronously and atomically. -- Verify the initial non-state entries are `name` and `opacity`. -- Prove core declarations and resolution contain no UI, form, context, or - refresh metadata and import no graphics modules. -- Prove editability declarations and resolved mappings are absent from scene - serialization. -- Verify represented-item parameters continue through `ParameterForm`. - -## Dependencies - -- Depends on Accepted ADR 013 for stable scene-object types and durable scene - state. -- Respects ADR 014's restricted `draw`/`clear` operation surface. -- Context-specific normalized mapping changes are governed by Accepted ADR - 016. - -## Amendment - -Approved on 2026-11-08. This amendment supersedes both the earlier accepted -public `FormField`/item-target/refresh design and the first uncommitted -class-level design that separately redeclared durable editable attributes. -`SceneStateField` is now the single source for durable semantic editable state. diff --git a/initiatives/scene-viewer-visualisation/decisions/016-scene-form-field-bindings.md b/initiatives/scene-viewer-visualisation/decisions/016-scene-form-field-bindings.md deleted file mode 100644 index 4d67a8a..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/016-scene-form-field-bindings.md +++ /dev/null @@ -1,121 +0,0 @@ -# ADR 016: Contextual Editable-Attribute Overrides and Mutation - -## Status - -Accepted, amended on 2026-11-08. - -## Context - -ADR 015 makes `SceneStateField` and narrowly scoped -`__editable_attributes__` declarations the sources of one normalized editable -attribute mapping. A visualization context may still need to expose an -additional scene-object attribute, replace its data-side update callback, or -hide an otherwise editable attribute. This must operate on that normalized -mapping without reintroducing a second public field type or putting -presentation and rendering refresh instructions in core. - -## Options - -1. Let context plugins extend, replace, or remove entries in the resolved - class declaration mapping. -2. Let context plugins return public form-field or widget objects. -3. Add refresh callbacks or context protocols to core declarations. -4. Keep context-specific hardcoded field inventories in Viewer components. - -## Decision - -Choose option 1. - -Context plugins register graphics-free contributions under the exact key -`(context, stable SceneObject type, contribution ID)`. A contribution modifies -the normalized `attribute name -> optional update callback` mapping: - -- a new attribute with an optional callback appends; -- an existing attribute's callback is replaced while retaining its position; - and -- an explicit removal marker removes the attribute. - -The removal marker is distinct from `None`, because `None` means the attribute -uses ordinary `setattr`. - -Resolution starts with the base-to-derived class declarations from ADR 015 and -then applies applicable context contributions by stable scene-object MRO from -general to specific. At each MRO specificity, contributions are applied in -lexical contribution-ID order while preserving each contribution mapping's -insertion order. This makes the append order deterministic. Duplicate exact -registration keys are errors. Two contributions at the same specificity that -both edit or remove the same attribute are also errors; registration order -never silently resolves a conflict. - -Class declarations and plugin discovery remain graphics-free. Contributions -and their resolved mappings are runtime-only and are never serialized. - -Viewer introspects the final mapping and owns form construction. It determines -presentation from the current value, checks writability, and applies the -default assignment or synchronous data-side callback defined by ADR 015. -There is no public `FormField` object and the mapping contains no labels, -editors, arbitrary data, form metadata, or refresh instructions. - -Mutation is atomic from the form's perspective. If assignment or the callback -raises, the owner remains unchanged under ADR 015's callback contract, the -control is restored to the previous value, the original failure is reported, -and no view refresh occurs. After a successful mutation, Viewer exclusively -decides which render-data rebuild, redraw, and UI refresh operations are -required. Context plugins only filter, extend, or replace normalized attribute -names and callbacks. Core declarations contain no refresh callback, refresh -category, or context protocol. - -The initial scope is only stable `SceneObject` attributes in object settings. -Represented-item parameters continue to use the existing `ParameterForm` and -are not extended or overridden through this registry. - -## Consequences - -- Contexts customize the same authoritative attribute mapping instead of - maintaining parallel form schemas. -- Conflict handling is deterministic and independent of plugin load order. -- Core remains unaware of rendering and UI refresh policy. -- Viewer may refresh conservatively first and optimize only with measured - evidence. -- Arbitrary widgets, item parameters, dotted paths, asynchronous callbacks, - and plugin-provided refresh hooks remain outside the mechanism. - -## Compatibility - -The former `FormField`-based context registry, represented-item targets, and -field-level `draw`/`geometry` refresh modes were removed. Built-in object -settings migrated to class declarations; only genuinely contextual differences -remain plugin contributions. Existing `ParameterForm` behavior is preserved. - -## Verification - -- Compose class declarations and general-to-specific context contributions in - lexical contribution-ID and mapping-insertion order, preserving positions - for replacements and deterministically appending new attributes. -- Verify the explicit removal marker removes class-owned or inherited context - attributes while `None` selects ordinary `setattr`. -- Reject duplicate exact registrations and same-specificity attribute - conflicts with diagnostics naming context, scene-object type, and attribute. -- Verify two contexts may resolve different mappings for the same stable - scene-object type. -- Verify failed assignment/callback leaves the owner unchanged, restores the - control, and performs no render, redraw, or UI refresh. -- Verify successful mutation causes Viewer—not core metadata or context - plugins—to select conservative render rebuild, redraw, and UI refresh. -- Prove plugin discovery imports no graphics or UI modules. -- Prove contributions and resolved mappings are absent from serialization. -- Verify represented-item parameters remain on the existing `ParameterForm` - path. - -## Dependencies - -- Depends on Accepted ADR 015 for class-owned declarations and mutation. -- Reuses ADR 014's context/type registration principles without extending its - public `draw`/`clear` operation surface. - -## Amendment - -Approved on 2026-11-08. This amendment supersedes the earlier accepted flat -`FormField` binding contract, including item targets and field-level refresh -semantics. The implementation of that earlier design was replaced by the -implemented and verified amendment. diff --git a/initiatives/scene-viewer-visualisation/decisions/017-lazy-datastructure-attribute-tables.md b/initiatives/scene-viewer-visualisation/decisions/017-lazy-datastructure-attribute-tables.md deleted file mode 100644 index e0f2a3e..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/017-lazy-datastructure-attribute-tables.md +++ /dev/null @@ -1,106 +0,0 @@ -# ADR 017: Lazy Datastructure Element-Attribute Tables - -## Status - -Accepted. - -## Context - -Viewer can inspect a selected scene object's presentation attributes, but it -does not provide a scalable view of attributes stored on Mesh or Graph -elements. Building one widget per value would be slow for large structures, -while copying all sparse element dictionaries would increase startup cost and -could invent columns that have no declared domain meaning. - -COMPAS datastructures already expose domain defaults such as -`default_vertex_attributes` and singular domain APIs for retrieving element -attributes. The initial table design can use those public contracts without a -new core abstraction. - -## Options - -1. Add Viewer-owned lazy table models for declared Mesh and Graph element - domains. -2. Materialize every element attribute into ordinary table widgets. -3. Add a generic tabular-inspection API to core. -4. Scan sparse per-element dictionaries to infer every observed column. - -## Recommendation - -Choose option 1. - -Viewer owns a lazy `QAbstractTableModel` for datastructure element attributes. -The initial supported types are Mesh and Graph. Domains are discovered from -their existing `default_*_attributes` mappings and corresponding singular -element APIs: Mesh vertex, edge, and face domains; Graph node and edge domains. -The default mapping's insertion order defines the initial column order. - -The model stores element identifiers and reads effective cell values lazily -through the singular getter. It does not build one component per cell or copy -the complete attribute table. Sparse undeclared attributes found only in local -element dictionaries are omitted; the table does not scan the datastructure to -invent columns. - -Viewer adds a tab only for a supported domain whose default-attribute mapping -declares at least one column. A declared domain with no elements may therefore -show a zero-row table with its declared columns. A domain with no declared -attribute columns is omitted. - -## Accepted amendment: opt-in sidebar placement - -Accepted on 2026-11-09 after direct use of the default sidebar. The -`DatastructureAttributes` component remains available to explicitly configured -custom sidebars, but it is not part of the built-in sidebar composition. The -table model and editing contracts remain unchanged. - -This is a Viewer feature. It requires no changes to Mesh, Graph, or core -datastructure APIs and does not make Qt a core dependency. - -## Consequences - -- Large Mesh and Graph attribute sets can be inspected without eagerly - constructing all cell widgets or values. -- The visible schema is stable and follows datastructure-declared defaults. -- Undeclared sparse attributes remain available through datastructure APIs but - are not exposed by this initial table. -- Additional datastructure types or domains require evidence and a later - amendment. - -## Compatibility - -The table is an opt-in Viewer sidebar surface. It does not change datastructure -serialization, element attribute semantics, object settings, or the existing -represented-item `ParameterForm`. - -## Verification - -- Discover the supported Mesh and Graph domains from default mappings and - singular APIs. -- Preserve default mapping insertion order in columns. -- Verify data is read lazily and no per-cell component collection is created. -- Omit sparse undeclared attributes without scanning all local dictionaries. -- Create tabs only for domains with declared attribute columns, including a - zero-row table when such a domain has no elements. -- Verify empty datastructures, large datastructures, and effective default - values. -- Verify the built-in sidebar omits the component and an explicitly configured - custom sidebar can still instantiate it. -- Prove importing Viewer plugins remains graphics-free. - -## Dependencies - -- Uses the Viewer-owned sidebar boundary from ADR 006. -- Independent of ADRs 015–016; object settings and element tables edit - different owners. -- Implementation must coordinate sidebar file ownership with ADRs 019–020 and - other Viewer UI work. - -## Decision - -Approved on 2026-11-08. Viewer owns lazy Mesh and Graph element-attribute table -models whose domains and columns come from declared defaults and existing -singular datastructure APIs. The rationale is to keep large tables scalable and -their schema explicit without copying all values, scanning sparse dictionaries, -adding per-cell components, or introducing a new core abstraction. Amended on -2026-11-09 to keep the component opt-in rather than adding it to the default -sidebar. diff --git a/initiatives/scene-viewer-visualisation/decisions/018-datastructure-attribute-editing.md b/initiatives/scene-viewer-visualisation/decisions/018-datastructure-attribute-editing.md deleted file mode 100644 index a5f201b..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/018-datastructure-attribute-editing.md +++ /dev/null @@ -1,93 +0,0 @@ -# ADR 018: Datastructure Element-Attribute Editing - -## Status - -Accepted. - -## Context - -ADR 017 defines lazy Viewer tables for declared Mesh and Graph element -attributes. Editing needs a narrow value-type, mutation, selection, and refresh -contract. Without one, delegates could silently change types, bypass -datastructure semantics, or couple table selection to viewport object -selection. - -## Options - -1. Edit supported declared values through singular datastructure APIs and keep - table interaction local. -2. Write directly into internal element dictionaries. -3. Add batch editing, default-schema editing, undo, and viewport selection in - the first version. -4. Treat all values as editable text. - -## Recommendation - -Choose option 1. - -Editor choice follows the declared default value's exact supported type: - -- `bool`; -- `int`; -- `float`; and -- `str`. - -Other default types are displayed read-only. The table shows effective values -through the singular getter, including inherited defaults. A successful edit -uses the matching singular setter. Reset uses the singular unset operation so -the effective value falls back to its declared default rather than copying the -default into local storage. - -Table row/cell selection is local to the table. It does not mutate Viewer -object selection, viewport picking, or a future component-selection model. - -After a successful mutation, Viewer conservatively refreshes the affected -scene object's render data, redraw, and relevant UI. Failed validation or -mutation leaves the datastructure and displayed value unchanged and triggers -no refresh. - -The initial version does not edit default attribute definitions, scan or add -sparse undeclared attributes, batch-edit cells, add undo/redo transactions, or -link table selection to viewport selection. - -## Consequences - -- Editing preserves datastructure validation and default/local semantics. -- Unsupported values remain visible without unsafe coercion. -- Conservative refresh favors correctness before optimization. -- Bulk operations, history, and component selection remain separately - decidable features. - -## Compatibility - -No core API or serialized data format changes. Existing singular getters, -setters, and unset operations remain authoritative. - -## Verification - -- Select Boolean, integer, float, and text editors from default value types, - distinguishing `bool` from `int`. -- Display unsupported types read-only. -- Mutate through each singular setter and reset through each singular unset - operation. -- Display effective inherited defaults without inserting local values. -- Keep table selection independent of Viewer and viewport selection. -- Verify failed edits are atomic and successful edits invoke one conservative - Viewer refresh path. -- Verify no default editing, sparse scan, batch edit, undo, or viewport - component-selection behavior appears in the initial implementation. - -## Dependencies - -- Depends on Accepted ADR 017 for the lazy table model and declared columns. -- Uses Viewer refresh ownership established by ADRs 006 and 016 without - extending the scene-object editable-attribute mechanism. - -## Decision - -Approved on 2026-11-08. The initial editor supports only declared Boolean, -integer, float, and text values; mutations and resets use the existing singular -datastructure APIs, table selection remains local, and successful changes use -one conservative Viewer refresh path. The rationale is to preserve declared -types and default/local semantics without unsafe coercion, direct dictionary -writes, batch operations, undo, or viewport component-selection coupling. diff --git a/initiatives/scene-viewer-visualisation/decisions/019-configured-viewer-identity.md b/initiatives/scene-viewer-visualisation/decisions/019-configured-viewer-identity.md deleted file mode 100644 index c343baa..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/019-configured-viewer-identity.md +++ /dev/null @@ -1,74 +0,0 @@ -# ADR 019: Configured Viewer Identity - -## Status - -Accepted. - -## Context - -Viewer configuration has a `WindowConfig.title`, but application identity and -startup window behavior are not consistently applied before Qt application -construction. Icon selection also needs a clear packaged-default and -custom-file contract. - -## Options - -1. Use startup-only `WindowConfig` fields as the single configured Viewer - identity. -2. Add separate application-name, display-name, and window-title fields. -3. Keep identity hardcoded and let callers mutate Qt objects after startup. - -## Recommendation - -Choose option 1. - -The existing `WindowConfig.title` supplies all three startup identity values: - -- Qt application name; -- Qt application display name; and -- main window title. - -`WindowConfig.icon` is either: - -- `None`, which selects the packaged Viewer icon; or -- an absolute filesystem path to a custom icon. - -Relative paths are invalid. Identity, icon, dimensions, and fullscreen are -startup-only configuration. Viewer validates and applies the configuration -before constructing `QApplication` and the main window. The existing -`fullscreen` field is honored during startup rather than remaining inert. - -This decision does not add a runtime identity mutation API. - -## Consequences - -- One title cannot diverge across application and window identity surfaces. -- Packaged applications get a default icon without configuring a path. -- Custom identity is deterministic but cannot be changed live. - -## Compatibility - -Existing title, width, height, and fullscreen values keep their startup -meaning. The optional icon is additive startup configuration. - -## Verification - -- Apply title to application name, display name, and window title before the - window is shown. -- Use the packaged icon for `None` and an existing absolute path for a custom - icon. -- Reject relative or invalid icon paths with a precise configuration path. -- Honor configured width, height, and fullscreen at startup. -- Verify no runtime identity mutation API is added. - -## Dependencies - -- Independent of scene, object-settings, and configuration-cleanup ADRs. - -## Decision - -Approved on 2026-11-08. `WindowConfig.title` is the single startup identity for -the Qt application and main window, while `WindowConfig.icon` selects either -the packaged icon or an existing absolute custom path. The rationale is to -make identity and startup window behavior deterministic without duplicate -names, post-construction mutation, or a separate runtime identity API. diff --git a/initiatives/scene-viewer-visualisation/decisions/020-viewer-config-lifecycle-and-audit.md b/initiatives/scene-viewer-visualisation/decisions/020-viewer-config-lifecycle-and-audit.md deleted file mode 100644 index 5cceefb..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/020-viewer-config-lifecycle-and-audit.md +++ /dev/null @@ -1,116 +0,0 @@ -# ADR 020: Viewer Configuration Lifecycle and Field Audit - -## Status - -Accepted. - -## Context - -Viewer uses nested dataclasses for configuration, but deserialization currently -performs limited structural migration rather than explicit validation. Several -fields are inert, duplicate transient runtime state, or retain residues of -earlier sidebar and display designs. The cleanup needs a complete disposition -without replacing the simple dataclass model with another framework. - -## Options - -1. Retain typed dataclasses, add explicit path-aware validation, and remove or - connect fields according to demonstrated ownership. -2. Replace configuration with Pydantic models. -3. Store arbitrary plugin dictionaries and validate them inside consumers. -4. Turn all configuration into a live reactive state store. - -## Recommendation - -Choose option 1. - -Retain the nested configuration dataclasses and add explicit `validate()` -behavior that reports the complete field path for every invalid value. Validate -after construction/deserialization and before Viewer creates `QApplication`. - -Separate startup configuration from transient state: - -- startup configuration includes window identity and geometry, appearance, - UI component visibility, renderer/camera defaults, and `vectorsize`; -- transient selection, hover, active tools, live view interaction, and other - session values remain outside serialized configuration. - -Apply this field audit for schema version 2: - -- connect `window.fullscreen` to startup behavior; -- connect `ui.statusbar.show` to status-bar visibility; -- remove `window.about`; -- remove obsolete sidebar residues `show_widgets` and `sceneform`; -- remove `renderer.opacity` because effective renderer opacity is derived from - render mode; -- remove the root `display` group and its duplicated scene-object defaults; -- remove root `unit` until a unit-aware workflow has an approved owner and - lifecycle; -- add `ortho` to the accepted renderer view values; and -- keep root `vectorsize` as an active render default. - -Unknown or invalid schema fields fail with their full path; migration must not -silently preserve removed fields as runtime attributes. Schema version 2 also -implements ADR 019's identity and icon contract. - -Typed Viewer subclasses may extend configuration with typed dataclass fields -and validation. Do not add untyped plugin dictionaries, automatic plugin -configuration merging, Pydantic, or a promise that configuration is reactive. - -Direct dataclass mutation is supported only while assembling configuration -before Viewer construction. Post-construction mutation has no reactive -guarantee, and replacing `viewer.config` is unsupported. Existing dotted-path -`ViewerState` access is transitional internal wiring, not a configuration or -extension target. - -## Consequences - -- Configuration remains simple Python data with explicit validation. -- Removed fields stop suggesting unsupported behavior. -- Startup and transient ownership become testable. -- Typed subclass extensions remain possible without a generic plugin schema. -- Schema version 2 is an intentional compatibility boundary. - -## Compatibility - -Serialized schema version 2 removes `about`, sidebar residues, renderer -`opacity`, the `display` group, and root `unit`. Loading schema 1 drops known -retired fields and preserves every retained value. Unknown schema-1 fields are -rejected. Schema 2 rejects retired fields when they are supplied explicitly, -rather than silently accepting or storing them. - -## Verification - -- Validate nested types, literals, ranges, icon paths, and unknown fields with - complete configuration paths. -- Apply configuration before `QApplication` and window construction. -- Verify fullscreen and status-bar fields affect startup UI. -- Verify every removed field is absent from schema-2 serialization and rejected - when explicitly supplied in schema 2. -- Verify schema-1 migration drops known retired fields, preserves retained - values, and rejects unknown fields. -- Verify renderer view accepts `ortho` and rejects other unknown modes. -- Verify `vectorsize` remains active. -- Verify transient state changes do not mutate serialized startup - configuration. -- Verify setup-time direct mutation is honored, post-construction mutation has - no reactive contract, replacing `viewer.config` is unsupported, and - dotted-path `ViewerState` access is not presented as an extension API. -- Verify a typed subclass can add and validate typed dataclass fields without - untyped plugin dictionaries. - -## Dependencies - -- Depends on Accepted ADR 019 for the identity fields that schema 2 validates - and applies at startup. -- Independent of ADRs 015–018, but sidebar implementation must coordinate file - ownership with ADRs 017–018. - -## Decision - -Approved on 2026-11-08. Viewer retains typed nested dataclasses, adds explicit -path-aware validation, separates startup configuration from transient state, -and applies the complete schema-version-2 field audit and migration contract. -The rationale is to keep configuration simple and truthful without Pydantic, -untyped plugin dictionaries, reactive-state promises, or silent preservation -of removed and unknown fields. diff --git a/initiatives/scene-viewer-visualisation/decisions/021-durable-annotation-ownership.md b/initiatives/scene-viewer-visualisation/decisions/021-durable-annotation-ownership.md deleted file mode 100644 index 4506809..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/021-durable-annotation-ownership.md +++ /dev/null @@ -1,94 +0,0 @@ -# ADR 021: Durable Annotation Ownership and Schema - -## Status - -Accepted. - -## Context - -Accepted ADR 005 separates durable world annotations from transient Viewer -overlays, but it does not assign the durable data types to a package. The -current `Tag` and `ArrowOverlay` types live in `compas_viewer`, so a scene that -references them cannot load without the visualization backend installed. -Core has no neutral text, arrow, or distance-annotation data types. - -The durable schema must express annotation intent without storing Viewer -resources, editor state, or rendering implementation details. - -## Options - -1. Define neutral annotation data in `compas.scene`; Viewer provides only the - rendering operations. -2. Keep serializable annotation data in `compas_viewer`. -3. Define annotation data in `compas.geometry`. - -## Recommendation - -Choose option 1. - -Add three backend-neutral data types to `compas.scene`: - -- `TextAnnotation` stores text, a local anchor, height, height mode, and - horizontal and vertical alignment; -- `ArrowAnnotation` stores local start and end anchors; and -- `DistanceDimension` stores two anchors governed by Accepted ADR 028, plus - unit, precision, and an optional label override. - -Keep the first schemas narrow. Color, opacity, visibility, hierarchy, and -transformation remain scene-object state. Font files, background rendering, -padding, screen offsets, arrowhead styles, snapping metadata, editor state, and -Viewer configuration do not enter the neutral data schema. - -Fixed annotation anchors use the annotation item's local coordinates. A -root-level fixed dimension initially stores `PointAnchor` values equal to -acquired world points. A fixed pair can derive its local-coordinate distance -directly; associative and mixed pairs require their `ComponentAnchor` -references to resolve and otherwise report unresolved state. Viewer derives -the displayed distance from resolved anchors after applying the owning scene -object's world transformation where applicable. - -Viewer registers ordinary rendering operations for these stable core types. -Core loading, inspection, transformation, and serialization never import Qt, -OpenGL, font libraries, or `compas_viewer`. - -## Consequences - -- Durable scene intent loads without a visualization backend. -- One canonical data model serves Viewer and future visualization contexts. -- The initial annotation schema deliberately omits existing Viewer-specific - typography and arrow styling. -- Adding later semantic fields requires evidence and a separate approved - change rather than copying renderer options into core. - -## Compatibility - -ADR 023 governs removal of the current Viewer-owned `Tag` and `ArrowOverlay` -paths. This ADR defines their proposed canonical replacements but does not add -a compatibility loader. - -## Verification - -- Serialize and load every annotation type without `compas_viewer` installed. -- Verify local anchors, transformations, hierarchy, and independently bound - item identity. -- Verify local distance derivation and transformed-world display distance. -- Verify core plugin discovery imports no Viewer, Qt, OpenGL, or font modules. -- Verify Viewer rendering uses registered scene operations rather than core - renderer dependencies. - -## Dependencies - -- Refines Accepted ADR 005. -- Implements Accepted ADR 028's fixed and associative anchor model. -- Respects Accepted ADRs 010, 013, and 014 for item references, stable scene - objects, and context-keyed rendering operations. - -## Decision - -Approved on 2026-11-08. Durable `TextAnnotation`, `ArrowAnnotation`, and -`DistanceDimension` data belong to `compas.scene`; Viewer provides rendering -operations only. The schemas remain narrow and backend-neutral, with -presentation, hierarchy, and transformation owned by scene objects. The -rationale is that durable scene intent must load and serialize without a -visualization backend or renderer-specific resources. - diff --git a/initiatives/scene-viewer-visualisation/decisions/022-distance-dimension-units.md b/initiatives/scene-viewer-visualisation/decisions/022-distance-dimension-units.md deleted file mode 100644 index 9f57270..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/022-distance-dimension-units.md +++ /dev/null @@ -1,105 +0,0 @@ -# ADR 022: Distance-Dimension Unit Semantics - -## Status - -Accepted; amended by ADR 044 on 2026-11-10. - -## Context - -Accepted ADR 005 requires a distance dimension to store a unit and precision. -The user also requires Viewer-level unit, precision, and tolerance settings -with UI exposure. The framework currently has no approved scene-unit owner or -conversion service, and Accepted ADR 020 deliberately removed the old Viewer -root `unit` field until a coordinated unit-aware workflow has an approved owner -and lifecycle. - -Treating a unit label as an implicit conversion request would therefore hide -an unknown source unit and produce unverifiable values. - -## Options - -1. Snapshot the active Viewer measurement unit and precision when a persistent - dimension is created; the unit declares the coordinates' unit and performs - no conversion. -2. Require unit and precision explicitly for every persistent dimension, - independent of Viewer settings. -3. Add separate source and display units with conversion infrastructure in - this phase. - -## Recommendation - -Choose option 1, dependent on approval of ADR 027. - -Persistent dimensions snapshot unit and precision at creation so their durable -labels do not change when Viewer preferences change later. Explicit -construction arguments may override the current settings. Transient -inspections use the current Viewer unit and precision without creating a -durable snapshot. - -`DistanceDimension.unit` is `str | None`. For example, `unit="mm"` declares -that the stored coordinate distance is already expressed in millimetres. It -appends `mm` to the formatted value but never rescales coordinates. - -`precision` is an integer from 0 through 15 inclusive. The derived label uses -fixed-point formatting and separates a non-empty unit from the value with one -space. A non-`None` explicit label is displayed verbatim instead of the -derived value but does not relax precision validation. - -Tolerance remains Viewer measurement behavior governed by ADR 027; it is not -stored on every dimension. Do not add a supported-unit registry, spelling -normalization, localization, source-unit inference, or conversion factor in -this phase. Actual conversion depends on a separate framework-wide unit -decision. - -## Consequences - -- Formatting is deterministic and honest about the available information. -- Callers and Viewer remain responsible for supplying coordinates in the - declared unit. -- The unit string is descriptive rather than computational. -- Durable dimensions remain stable when Viewer measurement preferences change. -- Later conversion infrastructure may extend construction explicitly, but it - must not silently change existing serialized meaning. - -## Compatibility - -There is no existing distance-dimension payload. This decision establishes the -initial serialized semantics without reviving the removed Viewer root unit. - -## Verification - -- Derive and format distances with no unit and with an explicit unit. -- Verify the 0 and 15 precision boundaries. -- Reject -1, 16, and invalid unit values precisely without clamping or - truncation. -- Verify an explicit label bypasses derived numeric and unit formatting. -- Verify serialization preserves unit, precision, and label without adding a - conversion factor or source-unit field. -- Verify persistent creation snapshots Viewer settings while transient - inspection reads their current values. -- Verify later Viewer-setting changes do not rewrite existing dimensions. - -## Dependencies - -- Depends on proposed ADR 021 for `DistanceDimension` ownership and schema. -- Depends on proposed ADR 027 for Viewer measurement-setting ownership. -- Refines Accepted ADR 005. -- Respects Accepted ADR 020's removal of the unowned Viewer root unit. - -## Decision - -Approved on 2026-11-08. Persistent dimensions snapshot the active Viewer unit -and precision at creation, while transient inspections use their current -values. The unit declares the coordinates' existing unit and formats a suffix; -it never performs implicit conversion. Durable dimensions retain their -snapshot when Viewer preferences change, and tolerance is not duplicated on -each dimension. The rationale is deterministic, honest formatting without an -unowned source unit or hidden conversion. - -Amended on 2026-11-10 through ADR 044. Core data, Viewer configuration, and -Viewer editors share the 0–15 inclusive precision domain. Outside values raise -`ValueError` rather than being clamped or truncated. Existing data or -configuration above 15 is rejected without migration or schema changes, and -an explicit label does not bypass validation. - - diff --git a/initiatives/scene-viewer-visualisation/decisions/023-annotation-clean-break.md b/initiatives/scene-viewer-visualisation/decisions/023-annotation-clean-break.md deleted file mode 100644 index 93a9fdc..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/023-annotation-clean-break.md +++ /dev/null @@ -1,78 +0,0 @@ -# ADR 023: Clean Break for Legacy Viewer Annotations - -## Status - -Accepted. - -## Context - -The current Viewer-owned `Tag` is a durable camera-facing text item. -`TextAnnotation` is only an alias, so serialized data still records the `Tag` -dtype. `ArrowOverlay` is also durable, world-anchored, transformable, and -serialized despite its transient-sounding name. No committed legacy JSON -fixtures exist, but current tests, documentation, and examples use both names. - -Keeping aliases or legacy decoders would leave multiple public paths and retain -the misleading use of “overlay” for durable scene content. - -## Options - -1. Remove both legacy public types and their decoding paths when the canonical - annotation types land. -2. Keep the old types only as aliases and serialized-data decoders. -3. Retain the old names indefinitely and add new types alongside them. - -## Recommendation - -Choose option 1. - -Remove `Tag`, `ArrowOverlay`, and their old serialized dtype paths. Update all -package tests, examples, and documentation to the canonical types approved by -ADR 021. Do not add aliases, deprecation shims, dtype remapping, or a legacy -scene loader. - -Old payloads containing `compas_viewer.scene/Tag` or -`compas_viewer.scene/ArrowOverlay` are unsupported after the change and fail -through the normal unknown-type loading boundary. Release notes and migration -documentation state the replacement construction paths explicitly. - -Reserve “annotation” for durable world-anchored content and “overlay” for the -transient, non-serialized Viewer layer. - -## Consequences - -- The public vocabulary has one clear path per concept. -- Core and Viewer carry no permanent compatibility layer for experimental - annotation types. -- Existing source imports and serialized payloads using the old types break - intentionally. -- Implementation can remove obsolete concrete renderer branches instead of - preserving parallel behavior. - -## Compatibility - -This is an intentional breaking change. The current initiative branches and -draft pull requests are the migration boundary. No release or main branch is -modified without the initiative's later explicit merge approval. - -## Verification - -- Verify old names are absent from public exports, examples, and documentation. -- Verify no legacy alias, dtype remapping, or decoder remains. -- Verify canonical annotations cover the approved visible behavior. -- Verify old serialized dtype strings fail clearly rather than being silently - reinterpreted. - -## Dependencies - -- Depends on proposed ADR 021 for the canonical replacement ownership and - names before implementation can begin. -- Refines the migration requirement of Accepted ADR 005. - -## Decision - -Approved on 2026-11-08. The annotation migration is a clean break: obsolete -public names and serialized-data paths are removed rather than preserved as -aliases or compatibility decoders. The rationale is to keep the system clean, -simple, efficient, and transparent, with one canonical path per concept. - diff --git a/initiatives/scene-viewer-visualisation/decisions/024-measurement-outcomes-and-persistence.md b/initiatives/scene-viewer-visualisation/decisions/024-measurement-outcomes-and-persistence.md deleted file mode 100644 index 0933d1d..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/024-measurement-outcomes-and-persistence.md +++ /dev/null @@ -1,80 +0,0 @@ -# ADR 024: Measurement Outcomes and Persistence - -## Status - -Accepted. - -## Context - -A measurement interaction may serve two different intentions. A user may want -to inspect a value temporarily while working, or may want to create a durable -dimension annotation that remains part of the scene. Treating every completed -measurement as persistent would mutate the scene during ordinary inspection; -treating every result as transient would prevent intentional documentation. - -The two workflows may share point acquisition and preview rendering, but their -results need different ownership and persistence. - -## Options - -1. Provide distinct transient inspection and persistent dimension-annotation - modes that may share acquisition and preview infrastructure. -2. Make every completed measurement create a durable scene item. -3. Keep every measurement transient and require manual dimension construction. - -## Recommendation - -Choose option 1. - -Transient inspection derives and displays the live measurement in Viewer tool -state. It does not add, remove, select, or serialize scene content. Completion -may retain the result only for the lifetime defined by the active inspection -tool; cancellation clears it. - -Persistent dimension-annotation mode may use the same anchor acquisition and -preview path. Completing it creates exactly one durable `DistanceDimension` in -the scene using the explicit fixed or associative anchors governed by Accepted -ADR 028. Cancellation creates nothing. The exact acquisition, snapping, -repetition, activation, and post-completion lifecycles remain governed by -proposed ADR 026. - -The mode is explicit before completion. Viewer never infers persistence from -the number of acquired points or silently promotes a transient result into a -scene item. - -## Consequences - -- Ordinary measurement does not pollute or mutate the scene. -- Users can intentionally preserve dimensions when they need documentation. -- Shared acquisition and preview code does not imply shared result ownership. -- Session history for transient inspections remains outside Scene and outside - the Viewer transform-transaction stack. - -## Compatibility - -There is no existing measurement workflow. This decision establishes two -clear public outcomes without preserving an earlier behavior. - -## Verification - -- Verify transient inspection never mutates scene objects, hierarchy, - selection, serialization, or transform history. -- Verify persistent completion creates exactly one durable dimension. -- Verify cancellation in either mode creates no durable content. -- Verify switching modes clears incompatible transient result state rather - than reinterpreting it. - -## Dependencies - -- Refines Accepted ADR 005. -- Persistent results depend on proposed ADRs 021 and 022. -- Persistent anchor semantics are governed by Accepted ADR 028. -- Interaction details depend on proposed ADR 026. - -## Decision - -Approved on 2026-11-08. Viewer provides separate transient inspection and -persistent dimension-annotation outcomes. They may share acquisition and -preview infrastructure, but transient measurements never mutate or serialize -Scene, while persistent completion creates a durable `DistanceDimension`. - diff --git a/initiatives/scene-viewer-visualisation/decisions/025-scale-and-legend-overlays.md b/initiatives/scene-viewer-visualisation/decisions/025-scale-and-legend-overlays.md deleted file mode 100644 index cf0a4ff..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/025-scale-and-legend-overlays.md +++ /dev/null @@ -1,102 +0,0 @@ -# ADR 025: Scale and Legend Overlay Contracts - -## Status - -Accepted. - -## Context - -Accepted ADR 005 assigns scale indicators and legends to a transient, -non-serialized Viewer overlay layer, but it does not define the meaning of the -scale or the initial legend content model. The first contract should be useful -without introducing a colormap framework or a general overlay registry. - -## Options - -1. Add a camera-target scale bar and an ordered categorical legend. -2. Limit scale display to orthographic view and add continuous numeric legends. -3. Add one generalized overlay and legend schema for every future use. - -## Recommendation - -Choose option 1. - -Viewer owns one ordered overlay collection exposed through -`viewer.add_overlay()` and `viewer.remove_overlay()`. It accepts only the -approved concrete overlay types; it is not a plugin registry. - -`ScaleBarOverlay` represents world distance at the camera-target plane. It is -globally exact in orthographic projection and explicitly local to that depth in -perspective projection. It selects a readable `1–2–5 × 10ⁿ` bar length near a -target pixel width. - -`LegendOverlay` stores an optional title and ordered categorical -`(label, color)` entries. Continuous ranges, normalization, interpolation, -colormaps, and out-of-range behavior are deferred. - -Both overlay types are Viewer-owned, screen-space, unpicked, and absent from -scene serialization. - -## Implementation note: one widget overlay canvas - -Recorded on 2026-11-09 after direct use of the measurement preview exposed -missing transient graphics and an intermittent `QPainter` failure on macOS. - -Viewer renders scale, legend, and measurement feedback on one transparent, -mouse-transparent `QWidget` canvas stacked above the OpenGL renderer. The -renderer remains a pure OpenGL surface. `QPainter` is created, used, and ended -only during the overlay widget's ordinary `paintEvent`. A completed renderer -frame and a direct change to overlay or measurement state both schedule a -canvas repaint. - -The canvas remains Viewer-owned, screen-space, unpicked, and absent from scene -serialization. This mechanism implements the already approved overlay -ownership and lifecycle; it does not introduce a general widget, snapping, or -plugin framework. - -## Consequences - -- The scale bar has precise, testable meaning in both projection modes. -- Perspective display states its depth-dependent limitation rather than - implying a global scale. -- Categorical legends cover a concrete initial need without speculative scalar - normalization behavior. -- One narrow ordered layer replaces concrete main-loop checks without becoming - a framework-wide extension registry. -- One ordinary widget paint lifecycle keeps transient UI painting separate - from the OpenGL renderer and its context lifecycle. - -## Compatibility - -These are new transient Viewer APIs. They do not preserve the obsolete durable -`ArrowOverlay` behavior removed by ADR 023. - -## Verification - -- Verify overlay insertion order, removal, resize behavior, and serialization - exclusion. -- Verify orthographic scale and perspective target-depth scale, including the - `1–2–5 × 10ⁿ` choice. -- Verify categorical legend order, title, and colors. -- Verify overlays do not participate in scene selection or instance picking. -- Verify the canvas is transparent to pointer input, is stacked above the - renderer, and repaints after frame swaps and direct transient-state changes. -- Verify `QPainter` ownership begins and ends inside the canvas `paintEvent`. - -## Dependencies - -- Refines Accepted ADR 005. -- Uses Accepted ADR 006 for the public Viewer facade. -- Respects Accepted ADR 023's annotation/overlay vocabulary boundary. - -## Decision - -Approved on 2026-11-08. Viewer owns one ordered, concrete overlay layer with -public add/remove operations. The initial `ScaleBarOverlay` reports world scale -at the camera-target plane using readable `1–2–5 × 10ⁿ` lengths, with its -perspective depth limitation explicit. The initial `LegendOverlay` contains an -optional title and ordered categorical label/color entries. Both remain -screen-space, unpicked, and absent from Scene serialization. The rationale is a -small useful contract without a general overlay registry, continuous-colormap -semantics, or misleading global perspective scale. - diff --git a/initiatives/scene-viewer-visualisation/decisions/026-measurement-interaction-and-acquisition.md b/initiatives/scene-viewer-visualisation/decisions/026-measurement-interaction-and-acquisition.md deleted file mode 100644 index aedce74..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/026-measurement-interaction-and-acquisition.md +++ /dev/null @@ -1,204 +0,0 @@ -# ADR 026: Measurement Interaction and Acquisition - -## Status - -Accepted. - -## Context - -Accepted ADRs 005, 024, and 028 establish transient inspection, persistent -dimension outcomes, and fixed/associative anchor modes. Viewer has no -active-tool lifecycle or approved snapping path that turns pointer input into -an accurate world point and, when requested, a supported component reference. - -## Options - -1. Add one narrow snapping query used by inspection, Fixed dimension, and - Associative dimension acquisition, with an explicit one-shot tool lifecycle. -2. Read rendered depth only and never expose associative dimensions. -3. Add a generalized snapping and sub-object editing framework before the - first measurement tool. -4. Support only programmatic world-point input in the initial version. - -## Recommendation - -Choose option 1. - -### Snap result - -One narrow snapping query returns a `SnapResult` containing: - -- the resolved world point; -- the stable scene-object GUID; -- the snap kind; -- an optional stable component reference; and -- an explicit association error when a visible discrete component cannot be - represented by a stable reference. - -Interactive acquisition initially produces only discrete point kinds: - -1. a Point object; -2. a Mesh vertex; or -3. a Graph node. - -Snapping uses an 18-logical-pixel screen-space radius so its acquisition -footprint remains usable across zoom levels. The nearest eligible discrete -point wins. - -Fixed mode copies the resolved world point into a `PointAnchor`. - -Associative mode accepts the same displayed point, vertex, and node targets and -stores their stable component references. The two modes differ only in -persistence. Lines, edges, faces, and surfaces do not produce interactive -candidates until their eligible geometry has an explicit highlight overlay. - -### Tool lifecycle - -An explicit measurement mode activates one tool and cancels any previously -active tool. Left-button input reaches the active tool before ordinary -selection handling. The first valid click queries the approved snap targets. -Pointer movement over a valid snap updates a transient preview. The second -valid click completes the selected outcome: - -- inspection mode displays a transient result without scene mutation; or -- Fixed dimension mode creates `PointAnchor` values from the snapped points; or -- Associative dimension mode creates `ComponentAnchor` values and accepts only - snap results with supported component references. - -Completing either dimension mode creates one root-level durable -`DistanceDimension`, selects it, clears preview state, and deactivates. The -data model permits mixed anchors; the UI makes each acquired anchor's mode -explicit when constructing a mixed pair. - -Escape or explicit cancellation clears preview and result state and creates -nothing. A background or unsupported snap provides no anchor. Associative mode -never falls back to a fixed point. There is no construction-plane fallback, -general sub-object editing, repeating mode, or dimension editing in this phase. -Camera navigation remains available where its input does not conflict with the -active tool. Transient inspection and persistent dimension tools are both -one-shot in the first version: the second valid anchor completes the operation -and deactivates the tool. - -## Accepted amendment: visible discrete point acquisition - -Accepted on 2026-11-09 after direct use showed that a distance label alone did -not communicate which object components were available, which result a click -would accept, or whether the first anchor had been retained. - -While a measurement tool is active, hovering one object displays every -projected discrete point snap provided by that object: - -- the point of a Point object; -- the vertices of a Mesh; and -- the nodes of a Graph. - -The palette follows the hovered object and disappears when the pointer leaves -it. Guidance points are larger, bright hollow squares; the winner and retained -anchors are distinct filled squares. Palette points are guidance and are not -independently occlusion-tested. Only the distinct highlighted winner within -the existing screen-radius and depth acceptance rules is click-eligible. - -No invisible candidate is eligible. Standalone Lines, Mesh and Graph edges, -faces, and surfaces do not produce candidates. Later support must first define -and implement a visible candidate overlay for the corresponding segment, -region, or surface. - -Winner visibility searches a small instance-depth footprint around the -projected point. Only pixels belonging to the hovered object and matching the -candidate depth within the existing precision epsilon qualify. This avoids a -steeply tilted Mesh edge overwriting the single center sample while neither -loosening the global epsilon nor admitting background, another object, or a -fully occluded component. - -After the first winner is accepted, that anchor remains visible while the -palette follows the next hovered object. A missed point or background click -creates no anchor. Fixed mode has no implicit construction-plane or camera-plane -fallback because a background screen position does not define a unique world -point. - -Transient measurement graphics use the single Viewer overlay canvas recorded -in ADR 025's implementation note. Persistent dimension visibility follows ADR -030. These corrections do not add a general snapping or widget framework. - -## Consequences - -- Measurement accuracy and association follow the explicitly supported snap - targets; unsupported targets fail visibly. -- Fixed and associative acquisition share one result contract without - conflating a snapped coordinate with a durable association. -- Input priority and background behavior are deterministic. -- Both outcomes share acquisition and preview without sharing persistence. -- A narrow one-shot lifecycle avoids a general tool framework promise. -- Hover guidance makes the available discrete anchors, accepted winner, and - retained first anchor visible without changing snap eligibility. - -## Compatibility - -This is a new Viewer interaction. It does not change ordinary selection or -camera input when no measurement tool is active. - -## Verification - -- Verify activation, previous-tool cancellation, input priority, first anchor, - preview, second anchor, and cleanup. -- Verify background clicks and pointer motion over background do not create or - update anchors. -- Verify the 18-logical-pixel screen-space radius, nearest-candidate choice, and - every accepted `SnapResult` field. -- Verify hovering a Point, Mesh, or Graph shows all projected discrete point - snaps for that one object and leaving it clears the palette. -- Verify palette points are guidance only, the distinct depth-qualified winner - is the only click-eligible result, and the first anchor remains visible while - the palette follows the next object. -- Verify guidance points are bright hollow squares and the winner and retained - anchors are distinct filled squares. -- Verify point-footprint visibility accepts a visible receding vertex while - rejecting background pixels, another object's pixels, depth-mismatched - same-object pixels, and fully occluded vertices. -- Verify Lines, Mesh and Graph edges, faces, and surfaces do not produce - interactive candidates. -- Verify Fixed mode stores an exact displayed point, vertex, or node coordinate - in a `PointAnchor`. -- Verify Associative mode accepts the same target set and stores stable - component references without fallback. -- Verify opposite vertices of the 4 × 3 example resolve to a distance of 5. -- Verify transient completion follows ADR 024 without scene mutation. -- Verify fixed, associative, and any exposed mixed acquisition follow ADR 028, - including no silent fallback. -- Verify persistent completion creates and selects exactly one root-level - dimension and uses ADR 030's always-visible pass. -- Verify Escape and explicit cancellation create nothing in both modes. - -## Dependencies - -- Refines Accepted ADRs 005 and 024. -- Must implement Accepted ADR 028 anchor modes and unresolved behavior. -- Persistent results implement Accepted ADRs 021 and 022. -- Measurement labels and tolerance context implement Accepted ADR 027. -- Uses Accepted ADRs 003, 004, and 006 for selection, refresh/history - boundaries, and the public Viewer facade. - -## Decision - -Approved on 2026-11-08. One screen-space snapping query returns a world point, -scene-object GUID, snap kind, optional stable component reference, and explicit -association error for an unstable discrete component reference. Interactive -acquisition is restricted to Point objects, Mesh vertices, and Graph nodes with -visible guides. Fixed mode stores their resolved coordinates; Associative mode -stores their stable component references without fallback. -Active tools receive left-click input before selection, ignore background, -preview on pointer movement, cancel on Escape, retain non-conflicting camera -navigation, and complete as one-shot transient or persistent operations. The -rationale is precise, efficient initial snapping without a general snapping or -sub-object editing framework. Amended on 2026-11-09 to expose projected -Point/Mesh-vertex/Graph-node guidance for the hovered object, keep only the -distinct depth-qualified winner click-eligible, retain the first anchor while -the palette follows the next object, and keep transient graphics visible over -scene geometry. Refined through direct use on 2026-11-09 with larger bright -square markers, an 18-logical-pixel radius, same-object point-footprint -visibility, removal of every invisible line, edge, face, and surface candidate, -and ADR 030's always-visible final pass for persistent dimensions. The rationale -is direct, reliable, unambiguous feedback without loosening occlusion rules. -Continuous and regional targets can return only after their highlight overlays -are defined. - diff --git a/initiatives/scene-viewer-visualisation/decisions/027-viewer-measurement-settings.md b/initiatives/scene-viewer-visualisation/decisions/027-viewer-measurement-settings.md deleted file mode 100644 index 3c08323..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/027-viewer-measurement-settings.md +++ /dev/null @@ -1,110 +0,0 @@ -# ADR 027: Viewer Measurement Settings and UI - -## Status - -Accepted. - -## Context - -Unit, precision, and tolerance are important Viewer measurement information -and presentation settings and must be visible through the UI. Accepted ADR 020 -removed the old unowned root `unit` field and treats direct configuration -mutation as setup-only, so reintroducing editable values requires explicit -ownership, lifecycle, and mutation semantics. - -COMPAS global tolerance is process-wide numerical infrastructure. A Viewer -control must not silently mutate it or imply that display preferences change -geometry algorithm tolerances. - -## Options - -1. Add Viewer-owned unit and precision presentation defaults and show the - active COMPAS tolerance context read-only in one dedicated UI panel. -2. Add an explicit, clearly labeled operation for changing process-wide COMPAS - tolerance from Viewer. -3. Copy global tolerance into an independent editable Viewer field. -4. Keep all three values transient and omit them from Viewer configuration. - -## Recommendation - -Choose option 1. - -Add one typed `measurement` group to Viewer configuration: - -- `unit: str | None` declares the coordinate unit used for measurement labels; -- `precision: int` controls displayed decimal places; and -- tolerance information reports the active numerical tolerance context used by - COMPAS computations; it is not a private Viewer substitute. - -Expose the values through one **Units and Measurement** sidebar tab. Unit and -precision are presentation settings used by transient labels and snapshot into -persistent dimensions according to ADR 022. The first version shows tolerance -read-only and identifies its owner. Whether the same panel may -edit process-wide tolerance is outside this decision; it must never happen as a -side effect of editing Viewer presentation. - -An optional Settings-menu action may focus the same **Units and Measurement** -tab. It does not create a second settings surface or duplicate state. - -Unit, precision, and displayed tolerance are informational or presentational; -they are not sources of geometric correctness. Snap resolution and component -association follow ADRs 026 and 028. The UI does not reinterpret precision as -a geometric tolerance or silently mutate `compas.tolerance.TOL`. - -Persistent dimensions snapshot unit and precision according to ADR 022. -Transient inspection reads the current settings. Tolerance remains referenced -numerical context rather than being copied into every durable dimension or -duplicated as independent Viewer state. - -## Consequences - -- Measurement presentation and numerical tolerance context are discoverable. -- Runtime changes are explicit and validated instead of depending on arbitrary - dataclass mutation. -- Viewer presentation remains distinct from computational geometry tolerance. -- A later framework-wide unit-conversion design may extend these settings but - cannot silently reinterpret the initial declaration-only unit. - -## Compatibility - -This is a new schema field with an explicit owner. It does not restore the old -root `unit` field or weaken schema-2 rejection of that retired path. Its schema -version and migration must be coordinated with the next approved Viewer -configuration version. - -## Verification - -- Validate unit and precision with complete configuration paths and show the - active tolerance source accurately. -- Verify setup serialization, schema migration, explicit runtime updates, and - UI synchronization. -- Verify transient inspection responds to current settings. -- Verify persistent dimensions retain snapshot unit and precision after later - setting changes. -- Verify ordinary Viewer setting changes never mutate COMPAS global tolerance. -- If tolerance editing is later approved, verify it is explicit, process-wide, - and cannot be confused with Viewer-only state. -- Verify the measurement panel does not configure snapping or promise unit - conversion. - -## Dependencies - -- Refines Accepted ADRs 005 and 022. -- Amends the scoped configuration lifecycle of Accepted ADR 020 without making - general Viewer configuration reactive. -- Coordinates with proposed ADR 026 measurement interaction. -- Respects Accepted ADR 028: presentation settings do not determine whether an - anchor is fixed, associative, resolved, or geometrically correct. - -## Decision - -Approved on 2026-11-08. Viewer adds a nested measurement configuration group -for editable coordinate-unit declaration and display precision, exposed through -one **Units and Measurement** sidebar tab. The same tab shows the active global -COMPAS tolerance read-only with its process-wide ownership clear; Viewer never -silently mutates it. Measurement correctness comes from the approved snapping -path rather than unit, precision, or displayed tolerance. An optional Settings -menu action may focus the tab but does not duplicate it. The rationale is one -discoverable presentation surface without restoring the obsolete root unit or -creating a misleading Viewer-local geometry tolerance. - diff --git a/initiatives/scene-viewer-visualisation/decisions/028-dimension-anchor-modes.md b/initiatives/scene-viewer-visualisation/decisions/028-dimension-anchor-modes.md deleted file mode 100644 index 20d87e6..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/028-dimension-anchor-modes.md +++ /dev/null @@ -1,101 +0,0 @@ -# ADR 028: Fixed and Associative Dimension Anchors - -## Status - -Accepted. - -## Context - -Persistent dimensions may document either a position captured at creation or a -relationship to a component that should move as the referenced data changes. -Using only stored points makes every dimension stale after component edits. -Using only component references prevents intentionally fixed dimensions and -cannot represent every acquired location. - -Separate dimension classes would duplicate formatting, rendering, -serialization, and editing behavior even though only anchor resolution differs. - -## Options - -1. Use one `DistanceDimension` whose two anchors are independently either a - fixed `PointAnchor` or an associative `ComponentAnchor`. -2. Create separate fixed and associative dimension classes. -3. Store only points and update them opportunistically after component edits. -4. Store only component references and reject unassociated points. - -## Recommendation - -Choose option 1. - -`DistanceDimension` stores two values of one anchor union: - -- `PointAnchor` stores a fixed point captured at creation; and -- `ComponentAnchor` stores an explicit reference to a supported component and - resolves its current point when the dimension is evaluated. - -The data model permits two fixed anchors, two associative anchors, or one of -each. It does not infer an anchor kind from serialized fields. - -Viewer exposes explicit **Fixed** and **Associative** dimension modes. Both use -the approved snapping path: - -- Fixed mode snaps for accurate acquisition and stores the resulting point in - a `PointAnchor`. -- Associative mode snaps to a supported component and stores a - `ComponentAnchor`. - -Viewer never silently falls back from associative to fixed. If a snap result -cannot produce a supported component reference, associative acquisition does -not accept that anchor and reports the reason through tool state. - -Removing or invalidating a referenced component makes its -`ComponentAnchor` explicitly unresolved. The dimension retains the reference -and reports unresolved state; it never displays a cached point as if the -association were still valid. Rebinding or repairing the reference requires an -explicit later operation. - -The exact supported component selectors and snap targets remain part of -proposed ADR 026. This ADR fixes anchor semantics and failure behavior without -inventing a general component-resolution registry. - -## Consequences - -- One dimension type covers fixed, associative, and mixed use cases. -- Persistence intent is explicit at acquisition and in serialized data. -- Fixed measurements remain stable after later model edits. -- Associative measurements follow supported components and fail visibly when - their references cannot resolve. -- Snapping is required for both UI modes, but snapping does not imply - association unless Associative mode is active. - -## Compatibility - -There is no existing `DistanceDimension` payload. This establishes the initial -anchor schema without a legacy representation. - -## Verification - -- Serialize and evaluate fixed, associative, and mixed anchor pairs. -- Verify Fixed mode stores the snapped point and does not retain a component - reference. -- Verify Associative mode stores the component reference and follows supported - component changes. -- Verify associative acquisition never falls back silently to `PointAnchor`. -- Verify removed or invalid components produce explicit unresolved state and - never reuse a stale cached coordinate. -- Verify unresolved state survives serialization and reload. - -## Dependencies - -- Refines Accepted ADRs 005 and 024. -- Depends on proposed ADR 021 for canonical `DistanceDimension` ownership. -- Constrains proposed ADR 026 acquisition and snapping behavior. - -## Decision - -Approved on 2026-11-08. One `DistanceDimension` supports fixed -`PointAnchor` and associative `ComponentAnchor` values independently at both -ends. Viewer exposes explicit Fixed and Associative modes, uses snapping in -both, never silently falls back, and reports removed component references as -unresolved rather than displaying stale coordinates. - diff --git a/initiatives/scene-viewer-visualisation/decisions/029-persistent-annotation-collection-and-ui.md b/initiatives/scene-viewer-visualisation/decisions/029-persistent-annotation-collection-and-ui.md deleted file mode 100644 index 620c16d..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/029-persistent-annotation-collection-and-ui.md +++ /dev/null @@ -1,152 +0,0 @@ -# ADR 029: Persistent Annotation Collection and UI - -## Status - -Accepted; amended 2026-11-10 and 2026-11-11. The independent -extension-line-width amendment is implemented and locally verified. - -## Context - -Persistent annotations are currently represented as ordinary root-level scene -objects. This makes them appear in the spatial scene tree and gives them the -same parent/child and transformation semantics as geometry, even though a -dimension instead references fixed world points or components of spatial scene -objects. - -Persistence, spatial hierarchy, rendering, and user-interface placement are -independent concerns. An annotation can remain durable scene/session data -without becoming a transformable child in the ordinary object hierarchy. - -## Options - -1. Add one ordered, scene-scoped annotation collection outside the spatial - hierarchy and expose it through a separate flat Annotations UI. -2. Add a reserved Annotations group inside the ordinary hierarchy and hide its - special behavior behind UI filtering. -3. Move annotations to Session rather than Scene. -4. Keep annotations as ordinary root-level scene objects. - -## Recommendation - -Choose option 1. - -Core Scene owns an ordered persistent annotation collection separate from its -spatial object tree. Annotation data remains independently serializable and is -referenced by stable identity; Scene records placement, ordering, and -presentation state without embedding independently owned data. - -Semantic annotation data and presentation remain separate. A -`DistanceDimension` continues to own anchors, unit, precision, and label. Its -collection entry owns durable visibility and a narrow dimension style. The -initial style contains only color, line width, text size, arrow size, and label -offset. It is not a generalized styling or theme framework. - -Collection entries have no parent, child, or inherited transformation. Fixed -dimension anchors are world-coordinate points. Associative anchors resolve -against the referenced scene objects and their world transformations. Ordinary -object transform, reparent, and hierarchy operations do not apply to -annotations. - -Viewer presents the collection in a separate flat **Annotations** UI rather -than mixing it into the Scene tree. Initial operations are visibility, -selection, naming, removal, and editing the narrow supported style. Annotation -selection must not imply that the annotation can be transformed like a spatial -object. - -Session does not own the collection. A future Session may aggregate the Scene, -its independently serialized data, settings, and history, but dimensions that -reference scene-object GUIDs remain scene-scoped. - -## Consequences - -- Spatial hierarchy again represents only transformable spatial composition. -- Persistent dimensions remain scene-scoped and serializable without living - inside the ordinary tree. -- Viewer gains a clear location for annotation-specific controls without - inventing hierarchy behavior. -- Dimension presentation can be changed without mutating its semantic - measurement data. -- Scene serialization and the current annotation wrapper/storage model require - an explicit schema migration. -- Existing annotation entries require a clean migration decision before - implementation; no compatibility mechanism is implied by this proposal. - -## Compatibility - -This changes Scene's durable schema and the public location of persistent -annotations. Implementation must define the exact schema transition and update -Core, Viewer, framework gates, examples, and documentation together. - -## Verification - -- Round-trip spatial hierarchy and ordered annotations independently. -- Bind independently loaded annotation data by stable identity. -- Verify annotations have no node, parent, children, or inherited transform. -- Verify associative anchors resolve against spatial scene objects. -- Verify ordinary reparent and transform operations reject annotations. -- Verify the Scene tree excludes annotations and the flat Annotations UI shows - them in collection order. -- Verify visibility, selection, naming, and removal do not mutate spatial - hierarchy. -- Verify supported dimension-style values round-trip and refresh only the - annotation render layer. -- Verify semantic anchors, unit, precision, and label are unchanged by style - edits. -- Verify a future Session can aggregate the Scene without becoming annotation - owner. - -## Dependencies - -- Amends Accepted ADRs 005, 013, and 021. -- Preserves ADR 010's independent-data binding boundary. -- Rendering is independent and governed by Accepted ADR 030. - -## Decision - -Approved on 2026-11-09. Core Scene owns one ordered annotation collection -outside the spatial hierarchy. Viewer presents it through a separate flat -Annotations UI. Semantic annotation data remains independent from durable -visibility and the narrow dimension style consisting of color, line width, -text size, arrow size, and label offset. Annotations have no hierarchy or -inherited-transform semantics, and Session remains only a possible future -aggregate rather than the annotation owner. - -Amended on 2026-11-10: a newly constructed default `DimensionStyle` uses -`Color.magenta()` rather than `Color.white()` for its line and label. Explicit -colors remain authoritative, and deserialization preserves the stored color. -This changes no serialized field or schema version and does not rewrite -existing data. Magenta is a visible starting point, not a universal contrast -guarantee for every viewport background. No adaptive contrast, theme coupling, -outline, or automatic recoloring is added. - -## Accepted extension-line-width amendment - -Extend the durable narrow style with one independent positive finite width: - -```python -DimensionStyle( - line_width=3.0, - extension_line_width=1.0, - ..., -) -``` - -`line_width` continues to control the main dimension line and its arrowheads. -`extension_line_width` controls only the two lines from the measured anchors -to the displaced endpoints. Both are logical-pixel values. The Viewer form -labels them **Dimension Line Width** and **Extension Line Width**. Extension -lines retain the dimension color and selection behavior; no separate color, -dash pattern, opacity, or arrow style is added. A zero-offset dimension draws -no extension lines. - -New styles keep the existing `line_width=3.0` default and use -`extension_line_width=1.0`. Preserve legacy appearance through a closed -schema transition: advance Scene schema 5 to 6, annotation-entry schema 2 to -3, and add `DimensionStyle.STYLE_SCHEMA_VERSION = 2`. Current versioned style -payloads require `extension_line_width`. A genuine unversioned schema-5 style -migrates with `extension_line_width=line_width`; a schema-6 scene rejects a -legacy or malformed style. Explicit current values round-trip unchanged. - -Approved on 2026-11-11. The schema migration and Viewer behavior are implemented -and locally verified; native user retesting and hosted verification remain -pending. diff --git a/initiatives/scene-viewer-visualisation/decisions/030-always-visible-dimension-rendering.md b/initiatives/scene-viewer-visualisation/decisions/030-always-visible-dimension-rendering.md deleted file mode 100644 index d4424c0..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/030-always-visible-dimension-rendering.md +++ /dev/null @@ -1,73 +0,0 @@ -# ADR 030: Always-Visible Persistent Dimension Rendering - -## Status - -Accepted. - -## Context - -Transient measurement feedback renders above scene geometry and remains -legible. Persistent distance dimensions were rendered in the ordinary -depth-tested world-annotation pass and could disappear behind geometry. Their -durable storage location does not determine their render-layer semantics. - -## Options - -1. Render persistent distance dimensions in a separate final pass without - depth testing or depth writes. -2. Keep depth testing and increase depth bias or epsilon. -3. Reimplement persistent dimensions on the transient QWidget canvas. -4. Keep the current equal-depth world-annotation pass. - -## Recommendation - -Choose option 1. - -Viewer renders ordinary world text and arrows with their existing depth -behavior. It then renders `DistanceDimension` objects in a separate final pass, -preserving their scene insertion order. Depth testing and depth writes are -disabled for this pass, so scene geometry cannot hide a dimension. - -The pass restores the previous depth function, depth-test enablement, and -depth-write mask in all success and failure paths. It reuses the existing -dimension render geometry and does not duplicate persistent dimension drawing -on the transient QWidget canvas. - -This decision is independent of annotation persistence and UI ownership. -ADR 029 may later move annotations out of the spatial hierarchy without -changing this rendering contract. - -## Consequences - -- Persistent and transient distance feedback remain legible over scene - geometry. -- Dimensions no longer communicate occlusion through the depth buffer; their - purpose is annotation rather than solid-scene geometry. -- Text and arrow annotations keep their existing behavior. -- No general render-layer or annotation-plugin framework is introduced. - -## Compatibility - -This changes only Viewer rendering behavior. Annotation data, serialization, -anchor resolution, and public construction APIs remain unchanged. - -## Verification - -- Verify ordinary world annotations render before persistent dimensions. -- Verify insertion order is preserved within each pass. -- Verify dimensions draw with depth testing and depth writes disabled. -- Verify the previous depth function, test enablement, and write mask are - restored after success and after a draw failure. -- Verify scene geometry cannot hide a completed distance dimension. - -## Dependencies - -- Refines Accepted ADRs 005, 021, 024, and 026. -- Independent of Proposed ADR 029. - -## Decision - -Approved on 2026-11-09. Persistent distance dimensions render in a separate -final Viewer pass without depth testing or depth writes. The rationale is that -durable annotation visibility should match transient measurement legibility -without coupling render policy to spatial hierarchy or storage ownership. diff --git a/initiatives/scene-viewer-visualisation/decisions/031-spatial-object-deletion.md b/initiatives/scene-viewer-visualisation/decisions/031-spatial-object-deletion.md deleted file mode 100644 index d0183f8..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/031-spatial-object-deletion.md +++ /dev/null @@ -1,94 +0,0 @@ -# ADR 031: Spatial Object Deletion - -## Status - -Accepted. - -## Context - -Core `Scene.remove` already removes one scene object or one complete group -subtree without deleting the independently owned geometry or data item. Viewer -already wraps that operation with render-resource, picking, selection, buffer, -and UI cleanup, and registers `viewer.delete_selected` with the Delete key. - -Deletion is not discoverable in the default menus, however, and the viewport -key binding may not be available while the scene tree owns keyboard focus. -Deletion also has to remain consistent with transform-only history, associative -dimensions, and the proposed separation of spatial objects and annotations. - -## Options - -1. Expose the existing **Delete Selected** command in the default Edit menu and - preserve the current removal semantics. -2. Add deletion to the transform undo/redo stack. -3. Cascade deletion to dimensions that reference removed objects. -4. Add a separate Scene-tree-specific deletion implementation. - -## Recommendation - -Choose option 1. - -The default Edit menu exposes one **Delete Selected** action backed by the -existing `viewer.delete_selected` command and Delete shortcut. The operation -removes every selected spatial object and every descendant of a selected group -as one Viewer mutation. - -Deletion does not delete independently owned geometry or data. It removes -scene placement, render resources, picking registrations, and every removed -object from selection. It rebuilds the affected Viewer buffers and refreshes -the scene tree and viewport. - -Deletion is not undoable in this phase. It clears the existing transform-only -undo and redo history instead of implying a broader history contract. -Associative dimensions that reference a removed object remain durable and -become explicitly unresolved; deletion never converts them to fixed dimensions -or removes them as a cascade. - -ADR 029's flat Annotations UI owns annotation removal. Spatial deletion remains -a Scene-tree operation and does not remove annotation entries merely because -their referenced objects were deleted. - -## Consequences - -- Deletion is visible and usable regardless of whether the viewport or scene - tree currently has focus. -- Core and Viewer retain one removal path rather than duplicating Scene-tree - logic. -- Subtree, independent-data, selection, rendering, and unresolved-association - behavior remain explicit. -- Deletion remains outside undo/redo until a broader history decision is - proposed and approved. - -## Compatibility - -This exposes existing behavior through the default Edit menu. It does not -change Core scene serialization, object ownership, removal semantics, or the -transform-only history contract. - -## Verification - -- Verify **Delete Selected** appears once in the default Edit menu with the - existing command and shortcut. -- Verify it works when the viewport and scene tree respectively own focus. -- Verify one object and one selected group subtree remove all associated render - objects, picking colors, and selection entries. -- Verify independently owned data remains available after scene removal. -- Verify deletion clears transform undo and redo history. -- Verify an associative dimension remains present and resolves as unresolved - after deletion of its referenced object. -- Verify a fixed dimension is unchanged by deletion of unrelated objects. -- Verify spatial deletion and annotation removal remain separate operations. - -## Dependencies - -- Preserves Accepted ADRs 003, 004, 010, 013, and 028. -- Annotation removal is governed separately by Accepted ADR 029. - -## Decision - -Approved on 2026-11-09. Viewer exposes the existing -`viewer.delete_selected` command once through the default Edit menu. Spatial -deletion preserves independently owned data, removes selected subtrees and -their Viewer resources, clears transform-only history, and leaves dependent -associative dimensions present but unresolved. Annotation removal remains a -separate ADR 029 operation. diff --git a/initiatives/scene-viewer-visualisation/decisions/032-three-domain-viewer-sidebar.md b/initiatives/scene-viewer-visualisation/decisions/032-three-domain-viewer-sidebar.md deleted file mode 100644 index e1500a2..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/032-three-domain-viewer-sidebar.md +++ /dev/null @@ -1,167 +0,0 @@ -# ADR 032: Three-Domain Viewer Sidebar - -## Status - -Accepted. - -## Context - -The current right sidebar places the Scene tree, the flat Annotations panel, -and a shared Object/Camera/Display/Units tab form in one vertical splitter. -Selecting an annotation changes the annotation panel's size hint and updates -the complete sidebar, which redistributes the other panels. Spatial-object -details remain visible at the same time as annotation details even though the -two selections are intentionally independent. This makes the retained object -selection look stale or incorrectly connected to the annotation selection. - -Annotation details are embedded below the annotation list, annotation naming -depends on an undiscoverable inline tree edit, and neither an empty viewport -click nor the effective window-level Escape shortcut clears annotation -selection. The resulting UI does not give Scene, annotation, and system -settings clear ownership or a stable master/detail layout. - -## Options - -1. Replace the stacked sidebar with three top-level domains: **Scene**, - **Annotations**, and **System**. -2. Keep the current splitter and repair its sizing, update routing, and - selection behavior. -3. Introduce one union selection shared by spatial objects and annotations. -4. Make spatial and annotation selection mutually exclusive. - -## Recommendation - -Choose option 1. - -`SideBarRight` becomes one full-height tab widget with exactly three built-in -tabs: - -- **Scene** contains the spatial hierarchy and the selected spatial object's - details and controls. -- **Annotations** contains the ordered annotation list and the selected - annotation's details and controls. -- **System** contains Camera, Display, and Units and Measurement sections. - -Scene and Annotations use ordinary vertical layouts with a stable -master/detail allocation. The sidebar must not use a splitter whose sizes are -recomputed when a selection changes or a detail form is rebuilt. System uses -one scrollable page of clearly labeled sections rather than adding more -top-level tabs. The active tab is transient UI state, defaults to Scene, and -does not require a Viewer configuration schema change. - -Keep `ViewerState.selection` and `ViewerState.annotation_selection` as -independent typed selections. They may both contain values and are preserved -when tabs change. Spatial picking and the Scene tree change only spatial -selection. The annotation list changes only annotation selection. The design -does not add a union or active-selection abstraction. - -An unmodified click on empty viewport background clears both selections. -Ctrl-click on empty background remains a no-op. Escape first cancels an active -measurement and stops; otherwise it clears both selections. An editor that -owns Escape retains its normal local behavior. Annotation-list Delete removes -annotations only, while spatial Delete retains ADR 031's behavior. - -The annotation Name column is display-only. For exactly one selected -annotation, the details area exposes an explicit Name field, read-only Type, -and the supported distance-dimension style controls. Name commits update the -annotation collection and list without rebuilding render resources. Style -edits refresh only the affected annotation layer. No selection shows a clear -empty state; multiple selection shows a summary and the supported removal -operation rather than an ambiguous single-item form. - -Commands address the sidebar through a narrow tab/section navigation boundary -instead of reaching into generic form internals: - -```python -SidebarTab = Literal["Scene", "Annotations", "System"] -SystemSection = Literal["Camera", "Display", "Units and Measurement"] - -class SideBarRight: - def set_current_tab(self, tab: SidebarTab) -> None: ... - def focus_system_section(self, section: SystemSection) -> None: ... -``` - -The strings above name the complete accepted identifier sets, not arbitrary -extension values. Either method raises `ValueError` for an unsupported value. -`focus_system_section` activates System before focusing the requested section. -In particular, Camera Settings uses it to activate System and focus Camera. - -Existing sidebar-item component types remain the extension input for this -migration and are routed by domain: - -- `SceneTree`, `ObjectSetting`, and optional `DatastructureAttributes` belong - to Scene; -- `AnnotationPanel` belongs to Annotations; and -- `CameraSetting`, `DisplaySetting`, and `MeasurementSetting` belong to - System. - -The datastructure inspector remains omitted from the default composition. When -it is explicitly added through `viewer.sidebar_items`, it appears in Scene. - -## Consequences - -- Scene, annotation, and system controls have explicit and stable ownership. -- Spatial and annotation context can coexist without being presented as one - selection. -- Annotation naming and detail editing become discoverable. -- Background click and Escape provide predictable global deselection. -- The sidebar no longer resizes unrelated panels when annotation details - change. -- Viewer sidebar composition and interaction tests require a coordinated - update; Core Scene and its serialization require no change. - -## Compatibility - -This is a clean Viewer UI-composition change. It preserves the existing -spatial and annotation state models, durable annotation collection, Viewer -configuration schema, and optional sidebar component types. Code that reaches -through the sidebar into the old shared tab form is internal and must migrate -to the explicit sidebar navigation boundary. No compatibility layer for the -old visual arrangement is required. - -## Verification - -- Verify exactly three built-in top-level tabs and their component ownership. -- Verify no root or page splitter redistributes panes after selection or form - updates. -- Verify explicit annotation Name editing and the single, multiple, and empty - annotation-detail states. -- Verify object picking affects only spatial selection and annotation-list - interaction affects only annotation selection. -- Verify tab switching preserves both selections. -- Verify an unmodified empty viewport click clears both selections and - Ctrl-click does not. -- Verify real-window Escape cancels an active measurement first and otherwise - clears both selections, including when the viewport or a tree has focus. -- Verify editor-local Escape, annotation Delete, and spatial Delete retain - their distinct ownership. -- Verify Camera Settings activates System and focuses Camera. -- Verify optional datastructure attributes are absent by default and route to - Scene when explicitly configured through `viewer.sidebar_items`. -- Update Viewer user and developer documentation for the three domains and - selection behavior. - -## Dependencies - -- Refines Accepted ADRs 003, 027, 029, and 031. -- Preserves ADR 029's separate annotation collection and selection. -- Preserves ADR 031's separate spatial deletion operation. -- Requires no Core change. - -## Decision - -Approved on 2026-11-09. Viewer replaces the mixed stacked sidebar with stable -Scene, Annotations, and System domains. Spatial and annotation selections -remain independent and survive tab changes; empty-background click and Escape -clear both after measurement-cancel precedence. Annotation naming moves to an -explicit detail form, and commands use the closed sidebar tab/section -navigation boundary recorded above. - -Implementation evidence on 2026-11-09 exposed two regressions. Annotation -graphics refresh synchronously rebuilt the annotation tree, deleting the -checkbox item while its Qt signal was still active. Annotation graphics refresh -now updates render resources and redraws without rebuilding sidebar domains. -Numeric object editors also inferred integer-only behavior from the current -value even when the authoritative `SceneStateField` accepted both integers and -floats. Editors now use the declared field type, with current-value inference -only for contextual non-state attributes. diff --git a/initiatives/scene-viewer-visualisation/decisions/033-scene-inspector-details.md b/initiatives/scene-viewer-visualisation/decisions/033-scene-inspector-details.md deleted file mode 100644 index 9424743..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/033-scene-inspector-details.md +++ /dev/null @@ -1,120 +0,0 @@ -# ADR 033: Resizable Scene Inspector and Details Dialog - -## Status - -Accepted on 2026-11-11; implemented and locally verified, including the scroll -correction. Native user retesting and hosted verification remain pending. - -## Context - -The Scene tab currently gives the hierarchy and selected-object controls a -fixed layout allocation. `ObjectSetting` also places a read-only description -textbox above the editable controls. The description consumes scarce sidebar -space, while users cannot resize the hierarchy and selected-object areas. - -ADR 032 prohibited the previous root splitter because it mixed unrelated -Scene, Annotation, and System domains and redistributed them during updates. -That does not require the complete absence of a stable splitter inside one -domain. - -## Options - -1. Use one Scene-local two-pane splitter and move descriptive information to a - Details dialog. -2. Keep the fixed layout and only remove the description. -3. Restore a root-level splitter. -4. Add a permanently live modeless inspector window. - -## Recommendation - -Choose option 1. - -Keep the root three-domain tab widget. When both hierarchy and selected-object -details exist, the Scene page contains one vertical splitter with exactly two -stable children for its complete lifetime. The hierarchy is above the existing -Object or Object/Attributes detail surface. Initial stretch is 3:2, neither -child is collapsible, and selection or form updates never reset the user's -dragged allocation. Splitter position is transient UI state. - -Apply the same domain-local rule to Annotations: its annotation list and -selected-annotation/dimension details use one independent vertical splitter. -Resizing Scene never resizes Annotations and vice versa. Annotation selection, -visibility, and form refreshes do not reset the dragged allocation. No -splitter is added to System or around the root domains. - -Remove the inline read-only object-description textbox. Keep editable controls -in the selected-object panel and add a fixed **Details** button at its bottom: - -- no selection: show `No object selected` and disable Details; -- one selection: show editable controls and enable Details; -- multiple selection: show only a short count, no shared editing controls, and - enable Details. - -Details opens a read-only modal dialog owned by the main window. It snapshots -the current selection. For one object it shows name, represented type, -visibility, and complete inspected parameters. For multiple objects it shows -count, types, and names. It does not track later selection changes. - -## Consequences - -- Sidebar space is used for editable controls rather than duplicated prose. -- Users control Scene and Annotations allocations independently without - destabilizing another domain or System. -- No configuration, serialization, selection, or Core change is required. -- A live modeless inspector and persisted splitter position remain outside - scope. - -## Verification - -- Verify the root remains the three-domain tab widget. -- Verify exactly one Scene-local splitter and one independent - Annotations-local splitter when their panes exist, and none in System or at - the root. -- Verify resizing or rebuilding one domain never changes the other domain's - allocation. -- Verify user-set sizes survive zero, one, and multiple selection updates. -- Verify the inline description textbox is absent. -- Verify Details enablement and one/multiple-selection dialog content. -- Verify existing editable controls and optional Attributes routing remain - unchanged. - -## Dependencies - -- Narrowly amends Accepted ADR 032's no-page-splitter rule. -- Preserves Accepted ADRs 015–018 and 032's domain ownership. - -## Decision - -Approved on 2026-11-11. The approval covers the Details dialog, the Scene-local -hierarchy/details splitter, and the independent Annotations-local -list/dimension-details splitter described above. Splitter positions remain -transient and domain-local. Implementation and local verification pass as -recorded in the initiative handoff; native direct use and hosted verification -remain pending. - -## Approved scroll correction - -Direct use showed that the Annotations details surface is compressed when its -splitter allocation is smaller than the form's natural height. This is an -implementation defect in the accepted domain-local splitter, not a new -ownership decision. - -The Annotations splitter's second child is a vertical `QScrollArea`. It owns -the complete existing details surface, uses `widgetResizable=True`, disables -horizontal scrolling, and enforces the details layout's natural minimum size. -Shrinking the splitter therefore reduces only the scroll viewport: groups, -fields, buttons, and spacing retain their natural geometry and remain keyboard -reachable through vertical scrolling. Expanding the pane removes scrolling -when the complete content fits. Annotation refreshes preserve the user-set -splitter allocation, and the Scene and Annotations allocations remain -independent. - -The user approved this correction on 2026-11-11. It is implemented and locally -verified; native user retesting remains pending. - -## Approval history - -The Details dialog was initially separated from the Scene-local splitter as an -independent proposal. The user subsequently approved the Details dialog and -both domain-local splitters on 2026-11-11. No root or System splitter is -authorized. diff --git a/initiatives/scene-viewer-visualisation/decisions/034-hidden-vertex-snapping.md b/initiatives/scene-viewer-visualisation/decisions/034-hidden-vertex-snapping.md deleted file mode 100644 index f06b700..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/034-hidden-vertex-snapping.md +++ /dev/null @@ -1,97 +0,0 @@ -# ADR 034: Mesh-Vertex Snapping Independent of Vertex Glyphs - -## Status - -Accepted; implemented, locally verified, and independently reviewed. - -## Context - -Semantic snapping already enumerates every Mesh vertex while a measurement -tool is active. In practice, vertices become unreliable when normal vertex -glyphs are hidden because the instance/depth pass loses their dedicated point -footprint. Nearby faces or edges may happen to provide qualifying pixels, so -the current result is geometry-dependent. - -Normal rendering preferences and measurement eligibility are separate -concerns. A measurement guide can make a candidate visible without requiring -the ordinary vertex display to remain enabled. - -## Options - -1. Add a measurement-only acquisition footprint for Mesh vertices. -2. Require normal vertex glyphs to be visible. -3. Accept every projected vertex without depth qualification. -4. Add edge and face snapping at the same time. - -## Recommendation - -Choose option 1. - -`show_vertices` controls ordinary Mesh vertex glyphs only. During an active -measurement, every vertex of an effectively visible Mesh is a semantic -candidate and may appear as a hollow-square guide even when normal vertex -glyphs are off. - -Viewer renders a measurement-only point footprint into the offscreen -instance/depth acquisition pass. It never appears in ordinary rendering. The -nearest vertex within the existing 18-logical-pixel radius wins only when its -measurement footprint passes the existing same-object depth qualification. - -`show=False`, including effective ancestor hiding, remains a hard exclusion. A -Mesh with no visible face, edge, or vertex representation is not discoverable -solely because measurement mode is active. Faces and edges may establish -visibility and occlusion but remain non-candidates and create no attraction. -Partial ordinary vertex-display lists do not restrict measurement candidates. - -## Consequences - -- Users can snap to vertices of the normal face-only Mesh display. -- Measurement feedback, not ordinary glyph configuration, communicates snap - availability. -- Occluded vertices and other objects' pixels remain ineligible. -- No new public API, general snapping framework, or edge/face snapping is - introduced. - -## Verification - -- Verify hidden ordinary Mesh vertices remain semantic candidates. -- Verify face-only and edge-only visible Meshes produce guides and a qualified - winner. -- Verify front/silhouette vertices pass while back, depth-mismatched, and - externally occluded vertices do not. -- Verify hidden whole objects and Meshes with no visible representation produce - no candidates. -- Verify no edge or face result is introduced and the 3–4–5 regression remains - exact. - -## Dependencies - -- Amends Accepted ADR 026's visible-discrete-point acquisition wording. -- Preserves Accepted ADR 028's anchor semantics. - -## Decision - -Approved on 2026-11-10. Viewer adds a measurement-only acquisition footprint -for every semantic vertex of an otherwise visibly represented Mesh. Ordinary -vertex-glyph visibility remains independent. The existing radius, same-object -depth qualification, hidden-object exclusion, and prohibition on edge/face -snapping remain unchanged. Additional object types require a separate -follow-up after this implementation is stable. - -## Implementation note - -Implemented on 2026-11-10. Viewer builds a private Mesh-vertex index buffer -for measurement acquisition and draws it only in the active measurement -instance/depth pass. A Mesh contributes these footprints when its effective -visibility and ordinary face, edge, or vertex representation make it visible; -the footprints never enter normal rendering. Graph nodes and Point objects -retain their existing acquisition paths, and no broader object type, edge, or -face candidate was added. - -The full offscreen Viewer suite passes 550 tests with one structured skip for -the unavailable native OpenGL harness. The same native regression passes in a -separate real macOS run on OpenGL 4.1 Metal. Viewer Ruff, formatting, Pyright, -and `git diff --check` pass, and independent review reports no remaining -findings. The framework direct-source gate passes 15 tests with one expected -exact-revision skip. Refreshed hosted CI, candidate-artifact verification, and -user direct-use confirmation remain pending. diff --git a/initiatives/scene-viewer-visualisation/decisions/035-distance-dimension-spatial-layout.md b/initiatives/scene-viewer-visualisation/decisions/035-distance-dimension-spatial-layout.md deleted file mode 100644 index a192994..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/035-distance-dimension-spatial-layout.md +++ /dev/null @@ -1,244 +0,0 @@ -# ADR 035: Distance-Dimension Spatial Layout - -## Status - -Accepted on 2026-11-11; implemented, locally verified, and independently reviewed. Native direct use and hosted verification are pending. -The extension-line-width amendment coordinated with ADR 029 is implemented and -locally verified. - -## Context - -Persistent distance dimensions currently draw their dimension line between the -two measured anchors. This keeps the measured value correct, but it does not -allow the line and label to be moved away from the geometry for legibility. - -The measured anchors and value are semantic dimension data. The location of -the displayed dimension line is scene-specific presentation. A Viewer -construction plane can help an author choose an offset direction, but the -resulting dimension must not depend on mutable Viewer state or on the current -camera. - -## Options - -1. Store a signed world-space offset and captured plane normal as durable - dimension layout on the scene annotation. -2. Store a complete construction plane on the semantic distance dimension. -3. Choose the offset direction from the current camera whenever the annotation - is rendered. -4. Add the spatial offset to the existing screen-space dimension style. - -## Recommendation - -Choose option 1. - -Add a narrow durable `layout` field to the scene annotation that presents a -distance dimension: - -```python -DistanceDimensionLayout( - offset: float = 0.0, - plane_normal: Vector | None = None, -) -``` - -`SceneAnnotation.layout` has type `DistanceDimensionLayout | None`. A resolved -distance-dimension entry normalizes `None` to `DistanceDimensionLayout()`. -Supplying a layout for a resolved text or arrow annotation raises `ValueError`. -An unresolved entry may carry the layout until binding, when the same -annotation-type validation is applied. - -`offset` is a signed distance in world coordinate units. The informational -unit stored by the distance dimension does not convert it. `plane_normal` is -captured in world coordinates. For resolved anchors `start` and `end`, the -positive offset direction is - -```text -unit(plane_normal × (end - start)) -``` - -The displaced endpoints define the dimension line. Extension lines connect -the measured anchors to those endpoints. The measured value continues to come -only from the original anchors. The existing logical-pixel label offset applies -relative to the displaced dimension line. - -An offset of zero preserves current rendering and does not require a normal. A -nonzero offset is explicitly layout-unresolved when the normal is missing or -zero, the anchors coincide, or the normal is parallel to the measured segment. -Viewer does not substitute a camera-dependent direction. - -A complete durable construction plane is not part of this decision. Its origin -does not affect the resolved layout. A future Viewer construction-plane tool -may copy its normal into the durable layout, but the dimension does not retain -a live reference to that authoring context. - -### Proposed initial editing surface - -For exactly one selected, bound distance dimension, the Annotations details -panel adds a **Spatial Layout** group with: - -- **Offset**, a required finite signed world-space number; -- **Plane Normal X**, **Plane Normal Y**, and **Plane Normal Z**; -- **Status**, a read-only derived result; and -- **Reset Layout**, which restores `offset=0.0` and `plane_normal=None`. - -All three normal fields blank represents `None`. All three populated fields -represent one finite world-space vector. A partially blank normal, a -non-numeric value, or any non-finite component is invalid. The stored vector -is not normalized: its magnitude is immaterial to rendering, and its exact -components round-trip. - -Editing Offset or a normal component updates only a local draft. Tabbing among -the four fields preserves partial drafts, including an incomplete normal. -**Apply Layout** is the explicit commit boundary: it parses the complete form -and creates one replacement `DistanceDimensionLayout`. Assignment is atomic; -components are never mutated individually. Invalid Apply restores every editor -from the durable layout, performs no mutation, and triggers no refresh. Escape -has the same rollback behavior and preserves annotation selection. **Reset -Layout** immediately assigns `offset=0.0` and `plane_normal=None`. A successful -changed Apply or Reset calls exactly one annotation-only refresh for the -selected entry, rebuilding its dimension geometry and bounds without touching -spatial geometry buffers. - -Status uses this exact precedence: - -1. When `offset == 0`, report `Resolved — no displacement` regardless of the - normal or anchor layout inputs. -2. For a nonzero offset, report `Unresolved — dimension anchor is unresolved` - when either anchor cannot resolve. -3. Otherwise report `Unresolved — anchors coincide` when the anchors coincide. -4. Otherwise report `Unresolved — plane normal is missing` when no normal is - stored. -5. Otherwise report `Unresolved — plane normal is zero` for a zero vector. -6. Otherwise report `Unresolved — plane normal is parallel to dimension` when - the cross product has zero length. -7. Otherwise report `Resolved`. - -Status is derived Viewer presentation and is not serialized. When both anchors -resolve but the nonzero layout direction is missing, zero, or parallel, Viewer -draws the current zero-offset line while reporting the reason and does not -substitute a camera-dependent direction. If either anchor is unresolved, -ADR 028 remains authoritative: Viewer draws no cached, stale, or synthesized -dimension line. - -The group is hidden for multiple selection, text and arrow annotations, and -unresolved data bindings. A bound dimension whose associative geometry is -currently unresolved still exposes the group, consistent with format editing. -Acquisition does not capture camera or construction-plane state. - -`DistanceDimensionLayout` is a validated immutable-value-style data object: -`offset` and every supplied normal component must be finite. Scene -serialization advances from schema 4 to schema 5, and -`SceneAnnotation.ENTRY_SCHEMA_VERSION` advances to 2. COMPAS `DataDecoder` -decodes each nested `SceneAnnotation` before `Scene.__from_data__` can inspect -the parent Scene version. The entry payload must therefore carry its own -version rather than relying on the parent to select entry migration. - -Every current/versioned entry (`version=2`) requires the `layout` field and -rejects missing fields or unsupported entry versions. Only a legacy -unversioned entry may omit `layout`; this is the narrow bottom-up JSON migration -path for a schema-4 Scene. Such an unresolved entry retains `layout=None` -because its item type is not yet known. When binding later determines that it -is a distance annotation, `None` normalizes to `DistanceDimensionLayout()`; -text and arrow annotations retain `None` and reject any non-`None` layout. -Schema 5 round-trips signed offsets and optional normals through versioned -entries. - -## Consequences - -- Dimensions can be placed away from measured geometry without changing their - value or anchors. -- Fixed and associative dimensions use the same deterministic world-space - layout. -- The same independently serialized dimension data can have different layouts - in different scenes. -- The scene-annotation schema and Viewer dimension rendering require a - coordinated clean update. -- A general construction-plane feature remains a separate future decision. - -## Verification - -- Round-trip zero and signed nonzero layout values with scene annotations. -- Verify default normalization and rejection on text and arrow annotations, - including validation when an unresolved entry becomes bound. -- Verify the measured value is unchanged by layout offset. -- Verify positive and negative offsets and extension-line geometry. -- Verify associative-anchor updates recompute the displaced endpoints from the - stored normal and current resolved anchors. -- Verify missing, zero, coincident, and parallel inputs produce an explicit - layout-unresolved state with no camera fallback. -- Verify the existing logical-pixel label offset is relative to the displaced - line and persistent dimensions remain in the final no-depth render pass. -- Verify annotation bounds include both anchors and displaced endpoints. -- Verify real schema-4 JSON migration through an unversioned nested entry and - later distance/text/arrow binding behavior. -- Verify versioned entry schema 2 requires `layout`, rejects unsupported - versions, and schema-5 round-trips signed offsets and exact optional normal - components. -- Verify tabbing preserves partial drafts, Apply is the only draft commit, - invalid Apply and Escape restore durable values without refresh, and changed - Apply or immediate Reset produces exactly one annotation-only refresh. -- Verify the exact status precedence, including zero offset overriding every - normal/anchor layout condition, then anchor, coincidence, missing-normal, - zero-normal, and parallel-normal order for nonzero offsets. -- Verify zero-offset rendering fallback only for missing, zero, or parallel - layout direction when both anchors resolve. -- Verify an unresolved anchor preserves ADR 028 behavior with no cached, - stale, synthesized, or fallback dimension line. -- Verify the Spatial Layout group visibility for supported and unsupported - selection and binding states. - -## Excluded from the initial version - -- Viewport drag handles or clicking to place the dimension line. -- Automatic camera-facing offset directions. -- Reusable or live construction planes. -- Multi-dimension layout editing. -- Automatic label or dimension collision avoidance. - -## Dependencies - -- Extends Accepted ADRs 021, 028, 029, and 030. -- Preserves ADR 022's informational unit semantics. -- Does not approve a reusable Viewer construction-plane feature. - -## Accepted UI amendment - -The initial editing surface described above was identified as the preferred -first UI path on 2026-11-11 and was approved with the complete amended ADR. - -## Decision - -Approved on 2026-11-11. Core gains the validated durable layout and Scene -schema 5 migration described above. Viewer gains deterministic displaced -dimension rendering, extension lines, derived resolution status, displaced -bounds, and the atomic single-selection Spatial Layout form. The excluded -interactive and automatic-layout features remain outside this decision. - -## Implementation verification - -The completed Core tree passes 2,306 tests. The completed Viewer tree passes -652 tests with two expected offscreen native-OpenGL skips. Core and Viewer Ruff and -formatting, Viewer Pyright, focused Core source Pyright, strict Core and Viewer -MkDocs, framework direct-source integration with 15 passes and one expected -exact-VCS-metadata skip, independent review, and diff checks pass. - -Full Core Pyright remains blocked by two unrelated existing documentation -example errors (`Tag` import and a VolMesh call). The Markdown doctest remains -blocked by a pre-existing `scene.add(box)` output mismatch. Native direct use, -hosted CI, and candidate-artifact verification remain pending. - -## Accepted extension-line rendering amendment - -The displaced main dimension line continues to use -`DimensionStyle.line_width`, whose default is already `3.0`. Both extension -lines use the proposed `DimensionStyle.extension_line_width`, default `1.0` -for newly constructed styles. Style-only edits refresh the selected annotation -once and do not mutate spatial buffers. Layout resolution, measured value, -bounds, label positioning, final no-depth rendering, and unresolved-anchor -behavior remain unchanged. - -Legacy schema-5 scenes migrate the new width from their stored `line_width`, -preserving the exact appearance that previously used one width for all three -lines. The coordinated schema and UI contract is specified by ADR 029's -accepted amendment. It was approved on 2026-11-11, implemented, and locally -verified. Native user retesting and hosted verification remain pending. diff --git a/initiatives/scene-viewer-visualisation/decisions/036-viewport-text-ownership-and-persistence.md b/initiatives/scene-viewer-visualisation/decisions/036-viewport-text-ownership-and-persistence.md deleted file mode 100644 index cd36fee..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/036-viewport-text-ownership-and-persistence.md +++ /dev/null @@ -1,102 +0,0 @@ -# ADR 036: Viewport Text Ownership and Persistence - -## Status - -Accepted. - -## Context - -Text placed at a location in the view can mean either a world annotation whose -position is chosen through the viewport or text that remains fixed to the -screen while the camera changes. These have different ownership and -serialization contracts. Treating both as the existing world-space -`TextAnnotation` would hide that distinction. - -Persistent screen text also belongs to a particular view rather than to the -spatial Scene. The current initiative has not yet approved Session or view-state -persistence for such content. - -## Options - -1. Add a screen-pinned Viewer overlay in normalized viewport coordinates and - keep it out of Scene serialization for now. -2. Place an existing world-space text annotation by intersecting the viewport - ray with geometry or a construction plane. -3. Store screen coordinates directly in Scene annotations. -4. Make screen-pinned text persistent immediately by first designing Session - and view-state serialization. - -## Recommendation - -Choose option 1 for the requested view-screen text. - -Add one concrete Viewer-owned `ScreenTextOverlay` rather than a generalized -overlay registry. It contains text, a normalized viewport position, -horizontal and vertical alignment, and color. If ADR 037 is separately -accepted, it also exposes the equivalent narrow optional background fields. - -`(0, 0)` is the top-left and `(1, 1)` is the bottom-right of the viewport. -Resizing preserves the relative position. Camera changes do not move the text. -Drawing is clipped to the viewport. The overlay is not pickable, does not enter -the spatial Scene or annotation collection, and is absent from Scene -serialization. - -This recommendation intentionally does not make the overlay survive save/load. -If immediate persistence is required, implementation is blocked until a -separate Session/view-state decision defines ownership, stable identity, and -serialization. Viewer configuration is not an alternative owner because it -describes application defaults rather than document content. - -The narrow initial scope exposes construction through `viewer.add_overlay` -and removal through `viewer.remove_overlay`; it does not add a partial -interactive authoring UI. A user-facing click-to-place command also needs a -place to list, select, edit, and delete the resulting screen overlays. If that -workflow is required now, implementation is blocked until the same approval -defines that Viewer-side management surface, or Session/view-state ownership -if the result must persist. - -World-space text selected through the viewport remains a different operation -using the existing `TextAnnotation`; it requires an explicit world-point -acquisition contract and is outside this decision. - -## Consequences - -- The meaning of screen text remains stable under camera movement and viewport - resize. -- Scene stays limited to spatial content and durable scene annotations. -- The implementation remains one concrete overlay instead of a speculative - text or overlay framework. -- Screen-text persistence is deferred unless the user explicitly requires it, - in which case Session/view-state architecture must be approved first. -- World-space text placement remains available as a separately designed - feature rather than an overloaded mode. - -## Verification - -- Verify normalized positions at viewport corners and interior locations. -- Verify viewport resize preserves relative placement and camera changes have - no effect. -- Verify drawing clips to the viewport and respects insertion order. -- Verify screen text is unpickable and excluded from Scene and annotation - serialization. -- Verify color, alignment, and optional background presentation update only - the overlay layer. -- Verify no Session or configuration persistence is implied by the initial - implementation. - -## Dependencies - -- Extends Accepted ADRs 005 and 025 with one concrete overlay type. -- Uses ADR 037's narrow background presentation if both are accepted. -- Persistent screen text is blocked on a future Session/view-state ADR. -- World-space text placement would require a separate acquisition decision. - -## Decision - -Approved on 2026-11-09. Initial viewport text is a screen-pinned Viewer overlay -using normalized viewport coordinates. It is created and removed through the -existing `viewer.add_overlay` and `viewer.remove_overlay` boundary. The initial -scope is programmatic only and does not add interactive placement, listing, -selection, editing, deletion, or persistence. Those capabilities require -separate approval, with durable screen-text ownership blocked on a future -Session/view-state decision. diff --git a/initiatives/scene-viewer-visualisation/decisions/037-annotation-label-backgrounds.md b/initiatives/scene-viewer-visualisation/decisions/037-annotation-label-backgrounds.md deleted file mode 100644 index 410cff0..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/037-annotation-label-backgrounds.md +++ /dev/null @@ -1,141 +0,0 @@ -# ADR 037: Optional Annotation Label Backgrounds - -## Status - -Accepted; implemented, locally verified, independently re-reviewed, and -confirmed through user direct use. The default-background amendment was -accepted on 2026-11-11; implemented and locally verified. - -## Context - -Text and distance labels can overlap geometry or a dimension line. Without a -background, their glyphs may become unreadable. This is durable presentation, -not semantic annotation data, and it does not justify a general typography, -theme, or label-style system. - -## Options - -1. Add two direct optional background fields to scene-annotation - presentation. -2. Add a new public label-background class. -3. Duplicate background fields in dimension style and a new text style. -4. Make backgrounds a Viewer-global display preference. - -## Recommendation - -Choose option 1. - -Add only these fields to the durable scene-annotation presentation: - -```python -label_background: Color | None = None -label_background_padding: float = 2.0 -``` - -`None` keeps the current transparent result. The color alpha controls -background opacity. Padding is a nonnegative distance in logical pixels around -the rendered glyph bounds. The fields apply only when the presented annotation -has a text label, initially `TextAnnotation` and `DistanceDimension`. They do -not add label semantics to arrows. A resolved arrow entry accepts only the -defaults (`None` and `2.0`); assigning a background color or non-default -padding raises `ValueError`. An unresolved entry is validated the same way -when it becomes bound. - -Viewer draws the background immediately behind the label in the label's -existing render pass. For a distance dimension, the line is drawn first and -the label background covers the portion beneath the label. No border, corner -radius, shadow, font, theme, or generalized style object is introduced. - -A Viewer-only screen-text overlay may expose equivalent direct fields, but it -does not use scene-annotation storage. - -## Consequences - -- Labels remain legible over geometry and dimension lines. -- The schema stays transparent and avoids a new public helper type for two - values. -- Background presentation round-trips independently from semantic annotation - data. -- Core scene-annotation serialization and Viewer label rendering require a - coordinated clean update. -- More elaborate typography remains outside scope. - -## Verification - -- Round-trip `None`, opaque, translucent, and transparent colors. -- Accept zero and positive logical-pixel padding and reject negative padding. -- Verify default rendering is visually unchanged. -- Verify the background encloses padded glyph bounds and is drawn behind text - but in front of an overlapping dimension line. -- Verify background edits refresh only the affected annotation render layer. -- Verify semantic text, anchors, units, values, and precision remain unchanged. -- Verify annotations without labels do not gain background rendering. -- Verify non-default background presentation is rejected for resolved and - newly bound arrow annotations. - -## Dependencies - -- Extends Accepted ADRs 021 and 029's scene-presentation boundary. -- Preserves ADR 029's narrow `DimensionStyle` rather than mixing screen-pixel - label background fields into line and arrow presentation. -- ADR 036 may expose equivalent Viewer-owned fields for screen text. - -## Decision - -Approved on 2026-11-10. Durable annotation labels gain only the optional -`label_background` color and nonnegative logical-pixel -`label_background_padding` described above. Viewer renders the background -immediately behind label text, including over a dimension line. No border, -corner radius, shadow, font, theme, generalized style object, or arrow-label -semantics are authorized. - -## Annotations-details amendment - -Direct use confirms that the stored and rendered background has no editing -surface in the Annotations details panel. Add controls only for a selected -text-bearing annotation: - -- **Enable Background**, mapping disabled to `label_background=None`; -- a background color control, used only while enabled; and -- nonnegative logical-pixel padding. - -The existing transparent construction default remains unchanged. These -controls edit the existing fields atomically and refresh only the affected -annotation layer. Arrow annotations and unsupported selection states do not -show the controls. This amendment adds no field, schema version, generalized -style object, or theme dependency. - -Verification must cover enable/disable, opaque/translucent color, zero and -positive padding, rejection of negative padding without partial mutation, -serialization, selection changes, Escape/cancel behavior, and immediate -render refresh. - -This amendment was approved on 2026-11-10. It authorizes the controls and -verification described above without changing the accepted storage contract. - -## Amendment implementation verification - -The selected-annotation controls are implemented and covered by the focused -corrected-contract tests and full Viewer suite recorded in the initiative -handoff. The user confirms the corrected Viewer works well through direct use. -The accepted default-background amendment is implemented and locally verified. - -## Accepted default-background amendment - -New distance dimensions completed through Viewer's interactive measurement -tools should start with their label background enabled. Resolve the background -from the effective Viewer scheme at creation time: - -- light: `#FAFAFAE6`; -- dark: `#10161BE6`; -- padding: `2.0` logical pixels. - -This changes only Viewer-created persistent distance dimensions. Existing and -deserialized dimensions, explicit `None` or color values, text annotations, -and Core programmatic construction retain their current behavior. A later -appearance change does not recolor an already created dimension. - -This amendment was approved on 2026-11-11 with the exact scheme colors and -creation-time semantics above. Implementation and local verification pass as -recorded in the initiative handoff; native direct use and hosted verification -remain pending. diff --git a/initiatives/scene-viewer-visualisation/decisions/038-contextual-delete-selected.md b/initiatives/scene-viewer-visualisation/decisions/038-contextual-delete-selected.md deleted file mode 100644 index 443d4c1..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/038-contextual-delete-selected.md +++ /dev/null @@ -1,88 +0,0 @@ -# ADR 038: Contextual Delete Selected - -## Status - -Accepted; implemented, locally verified, and independently reviewed. - -## Context - -The default **Edit > Delete Selected** command and Delete shortcut currently -remove only spatial scene objects. Annotation removal exists in the -Annotations panel, but selecting a dimension does not make the user-facing -command remove it. Spatial and annotation selections may intentionally coexist, -so deleting their union would cross ownership boundaries and could remove more -than the current context indicates. - -## Options - -1. Dispatch the user-facing command to the selection owned by the current - interaction context. -2. Delete both spatial and annotation selections together. -3. Keep the menu command spatial-only and require the annotation Remove - control. -4. Replace the two selections with one union selection. - -## Recommendation - -Choose option 1. - -**Delete Selected** removes the selection owned by the current interaction -context and never crosses collection boundaries or deletes both coexisting -selections. The two existing removal operations remain separate. - -Dispatch follows this precedence: - -1. A focused text or numeric editor retains its normal local Delete behavior. -2. Focus in the annotation list or annotation details removes annotation - selection. -3. Focus in the Scene tree or viewport removes spatial selection, even if a - different sidebar tab remains visible. -4. Menu activation obscures the previous focused widget, so **Edit > Delete - Selected** follows the active sidebar tab: Scene removes spatial selection, - Annotations removes annotation selection, and System disables the menu - action. The underlying command safely performs no operation if invoked - directly while System is active. - -When both selections contain values, exactly one domain is affected and the -other selection remains unchanged. The explicit Annotations-panel Remove -control remains annotation-only. - -## Consequences - -- Selected dimensions can be removed through the same discoverable command as - selected spatial objects without conflating the two collections. -- Delete behavior follows visible interaction context and preserves - editor-local key behavior. -- Existing spatial subtree removal and annotation removal primitives remain - independently testable. -- Viewer needs a narrow way to query the active sidebar domain and route menu - and shortcut invocation. -- No union-selection abstraction or Core schema change is introduced. - -## Verification - -- Verify local Delete remains available in focused text and numeric editors. -- Verify annotation-list and annotation-detail focus delete annotations only. -- Verify Scene-tree and viewport focus delete spatial objects only. -- Verify menu invocation follows Scene, Annotations, and System tab ownership. -- Verify System disables the menu action and direct command invocation is a - no-op. -- Verify simultaneous selections remove exactly one domain and preserve the - other selection. -- Verify the explicit annotation Remove control remains annotation-only. -- Re-run spatial subtree, annotation resource cleanup, unresolved associative - anchor, and transformation-history invalidation regressions. - -## Dependencies - -- Amends Accepted ADR 032's input-ownership and Delete behavior. -- ADR 031 continues to govern the spatial removal primitive. -- ADR 029 continues to govern annotation removal and selection. - -## Decision - -Approved on 2026-11-10. **Delete Selected** dispatches only to the selection -owned by the active interaction context, using the precedence defined above. -It never removes both coexisting selections, preserves editor-local Delete -behavior, and remains a no-op in the System context. The spatial and -annotation removal primitives remain separate. diff --git a/initiatives/scene-viewer-visualisation/decisions/039-scene-add-menu.md b/initiatives/scene-viewer-visualisation/decisions/039-scene-add-menu.md deleted file mode 100644 index 93e8eac..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/039-scene-add-menu.md +++ /dev/null @@ -1,90 +0,0 @@ -# ADR 039: Scene-Owned Add Menu - -## Status - -Accepted; implemented, locally verified, and independently reviewed. - -## Context - -Viewer currently exposes geometry presets in a separate top-level **Add** menu. -Every geometry item created by these commands enters the current spatial Scene, -alongside the Scene menu's clear, load, and save operations. Keeping Add at the -top level obscures that ownership. - -Other creation workflows have different meanings. Measurement commands are -interactive acquisition tools even when they produce a durable dimension. -Transient overlays and system configuration do not enter the Scene. - -## Options - -1. Move the existing geometry hierarchy to **Scene > Add**. -2. Keep **Add** as a top-level menu. -3. Move every command that can eventually create durable data under Scene. -4. Expand Add with speculative datastructure, group, annotation, and text - commands during the move. - -## Recommendation - -Choose option 1. - -Move only the existing geometry hierarchy beneath **Scene > Add**: - -- Primitives; -- Curves; -- Surfaces; and -- Shapes. - -Preserve the existing command identifiers, callbacks, preset parameters, and -resulting Scene insertion behavior. This is a menu-ownership change, not a new -creation API. - -Keep measurement acquisition under **Measure**, including fixed and -associative dimension commands. Keep Scene load as a separate Scene operation. -Do not add datastructure, group, general annotation, or text creation commands -as part of this change. Transient overlays and System settings remain outside -Scene > Add. - -The old top-level Add path is removed without a compatibility alias. Extension -code should not receive a new arbitrary nested-menu registration API merely to -preserve the former path; any future menu-extension contract requires its own -evidence and decision. - -## Consequences - -- Menu placement communicates that added geometry belongs to the current - Scene. -- Existing creation behavior and command identities remain stable. -- Measurement remains organized by authoring workflow rather than by the - persistence of its result. -- The top-level menu becomes less crowded without introducing new commands or - extension abstractions. -- Code or tests that locate the former top-level Add menu must use the new - nested location. - -## Verification - -- Verify the top-level Add menu is absent and **Scene > Add** contains the four - existing geometry categories in their current order. -- Verify every existing geometry command retains its identifier, callback, - preset parameters, and resulting Scene object. -- Verify Measure still owns transient inspection and fixed and associative - dimension acquisition. -- Verify Scene load, save, and clear remain separate operations. -- Verify no datastructure, group, general annotation, text, overlay, or System - creation command is added. -- Update user and developer documentation that names the old Add menu path. - -## Dependencies - -- Consistent with Accepted ADRs 001 and 013's Scene ownership. -- Preserves Accepted ADRs 024 and 026's measurement-tool lifecycle. -- Requires no Core, Scene schema, or serialization change. - -## Decision - -Approved on 2026-11-10. Move only the existing Primitives, Curves, Surfaces, -and Shapes hierarchy from the top-level **Add** menu to **Scene > Add**. -Preserve command identities, callbacks, preset parameters, and Scene insertion -behavior. Measurement acquisition remains under **Measure**, and no new -creation commands, compatibility alias, or arbitrary menu-extension mechanism -is authorized. diff --git a/initiatives/scene-viewer-visualisation/decisions/040-default-toolbar-view-shortcuts.md b/initiatives/scene-viewer-visualisation/decisions/040-default-toolbar-view-shortcuts.md deleted file mode 100644 index 23a206f..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/040-default-toolbar-view-shortcuts.md +++ /dev/null @@ -1,262 +0,0 @@ -# ADR 040: Default Toolbar View Shortcuts - -## Status - -Accepted baseline; amended on 2026-11-10 and locally verified. Direct use -confirms the standard-view buttons but rejects Render Mode popup focus. A -second amendment was approved on 2026-11-10, implemented, locally verified, -independently re-reviewed, and confirmed through user direct use. The grouped -viewport/measurement-menu amendment was accepted on 2026-11-11, implemented, -and locally verified. - -## Context - -Viewer already exposes render-mode and current-view selection through the -View menu and System sidebar. Both surfaces use stable commands and shared -Viewer state, but the default toolbar is empty and hidden. Frequently changing -these presentation settings therefore requires opening a menu or sidebar. - -Nine independent toolbar buttons would consume substantial space and require -new icons and active-button styling. The original decision therefore used two -labeled selectors while preserving one command and state path for every -operation. - -Direct use on native macOS later showed that view changes through the combo -popup could still leave viewport interaction without focus despite observing -the popup Hide lifecycle and requesting restoration. Standard views are -frequent, fixed actions and do not need a popup. Render mode remains a compact -multi-value choice and keeps its selector. - -## Options - -1. Add one state-bound Render Mode selector plus five exclusive, state-bound - icon-only view buttons and show the default toolbar. -2. Keep two state-bound toolbar selectors. -3. Add nine independent icon or text buttons. -4. Keep render-mode and view selection in the menu and sidebar only. - -## Recommendation - -Choose option 1. - -Keep the narrow `select` item for **Render Mode** and extend the existing -`button` item only with optional `state` and required `value` fields for -state-bound use. Populate the default toolbar through -`default_toolbar_items()`. The default controls, in order, are: - -1. **Render Mode** - - Shaded - - Ghosted - - Lighted - - Wireframe -2. **Perspective** button with the existing palette-aware P icon -3. **Top** button with the existing palette-aware T icon -4. **Front** button with the existing palette-aware F icon -5. **Right** button with the existing palette-aware R icon -6. **Ortho** button with the matching palette-aware O icon - -The Render Mode selector reuses `viewer.change_rendermode` and binds to -`renderer.rendermode`. Each view button reuses `viewer.change_view`, binds to -`renderer.view`, and declares the corresponding `value`. Buttons sharing that -state path form one exclusive group. A click invokes the existing command; -toolbar, View menu, System form, and public API updates then synchronize -through the existing Viewer-state signal. State-driven updates select the -matching control without invoking a command again. - -An existing custom `type="button"` item without `state` keeps its unbound -callback behavior. The `state`/`value` fields define only this narrow -command-backed checked-state contract; they do not create a general toolbar -widget registry. `icon_only=True` hides button text while retaining `title` as -the tooltip and accessible name. Custom text-only and text-plus-icon buttons -remain unchanged. - -Focus restoration is one event-driven pending operation shared by selector and -button activation. A `focusWindowChanged` signal and one queued readiness check -re-evaluate the request. Renderer focus is applied only after the main window -is both the focused window and active, and after any selector popup cycle has -finished. Do not use an arbitrary delay, polling retry, or fixed retry count. - -Change the default `ui.toolbar.show` value to `True` so the shortcuts are -discoverable. An explicit configured value of `False` remains authoritative. -Existing custom `viewer.toolbar_items` remains the composition boundary. - -Do not add renderer commands, a general toolbar-widget registry, an icon -system, or another state path. - -## Consequences - -- Render mode remains a compact dropdown, while the five standard views are - one-click, popup-free, icon-only controls. -- Menu, sidebar, toolbar, and public API controls cannot drift because they - observe the same state. -- Exactly one view button is checked for the current `renderer.view` value. -- Existing configurations that explicitly hide the toolbar remain unchanged. -- Applications that relied on the previous implicit hidden default gain one - toolbar unless they set `ui.toolbar.show` to `False`. -- The supported toolbar schema keeps `select` and narrowly extends `button` - with `state`, `value`, and optional `icon_only`; existing text-only, - text-plus-icon, and unbound custom buttons remain valid. -- Semantic view titles remain available as tooltips and accessible names even - though the default buttons display only P, T, F, R, and O icons. -- Focus restoration waits on observable Qt window and popup state without an - arbitrary delay or retry loop. -- No arbitrary custom-widget mechanism is introduced. - -## Verification - -- Verify the Render Mode selector and five view-button icons, semantic titles, - accessible names, tooltips, values, and ordering. -- Verify configured renderer state determines the initial selector value and - exactly one checked view button. -- Verify each selector or button activation invokes the existing command - exactly once and view-button activation restores viewport focus without a - popup. -- Verify pending focus restoration does nothing while the main window is not - focused and active or a popup cycle remains active, then completes exactly - once after `focusWindowChanged` or the queued readiness check observes the - ready state. -- Verify menu, System form, and public API changes update the toolbar without - invoking a command again. -- Verify toolbar changes update the menu and System form through shared state. -- Verify state-bound buttons require a non-empty title, state path, command, - and value; verify unsupported state values leave every button unchecked. -- Verify existing custom unbound buttons retain their callback behavior. -- Verify custom text-only and text-plus-icon buttons retain their presentation. -- Verify explicit `ui.toolbar.show=False` remains effective and the unspecified - default is visible. -- Verify invalid selector definitions and unsupported values fail clearly. -- Run focused offscreen Qt tests, the full Viewer suite, Ruff, Pyright, strict - MkDocs, package CI, and framework integration. - -## Dependencies - -- Extends Accepted ADR 006's public Viewer UI facade. -- Amends Accepted ADR 020's default toolbar visibility without changing - configuration ownership or schema. -- Coordinates with ADR 041 through the existing render-mode and view state - paths but is independently implementable. - -## Decision - -Approved on 2026-11-09. The default toolbar gains visible, labeled Render Mode -and View selectors in that order. They reuse the existing commands and shared -renderer state, synchronize without recursive command invocation, and make the -toolbar visible by default while preserving an explicit -`ui.toolbar.show=False`. No button grid, new renderer command, general widget -registry, or icon system is authorized. - -Amended on 2026-11-10 after native direct use showed that combo-popup teardown -could still disrupt viewport focus. The Render Mode dropdown remains. The View -selector is replaced by exclusive icon-only **Perspective**, **Top**, -**Front**, **Right**, and **Ortho** buttons bound to `renderer.view`. They use -the existing palette-aware P, T, F, and R assets plus a matching O asset; each -semantic title remains the tooltip and accessible name. The narrow toolbar -schema extends `type="button"` with `state`, `value`, and optional `icon_only`; -each button invokes the existing command and shared state keeps the checked -button, menu, System form, and public API synchronized without recursive -invocation. Custom text-only, text-plus-icon, and unbound buttons remain -supported. No general widget registry is authorized. - -The earlier direct focus request is replaced by one pending event-driven -restoration. `focusWindowChanged` and a queued readiness check restore renderer -focus only after the main window is focused and active and the selector popup -cycle is complete. There is no arbitrary delay or retry loop. Actual-widget -tests and a native macOS probe cover the final revision. Earlier direct use -confirmed that button interaction had no focus problem before the icon-only -presentation was added. A subsequent direct-use retest confirmed the -standard-view buttons but found that Render Mode dropdown focus still fails. - -## Implementation verification - -The final toolbar/theme revision passes 47 focused tests, 61 initialization -smoke tests, five native macOS toolbar/Camera probes, and the full offscreen -Viewer suite with 587 passes plus one expected structured OpenGL skip. Ruff, -formatting, Pyright, strict MkDocs, diff checks, and independent review pass. -The framework direct-source gate passes 15 tests with one expected -exact-revision skip. Hosted package CI and candidate-artifact verification have -not been run for this tree. - -## Second amendment after native retest - -Native direct use confirms the five standard-view buttons, but the Render Mode -combo still fails to return viewport interaction focus reliably. The current -tests mask this path by forcing `hidePopup()` when synthetic interaction does -not close the popup. Native macOS can close it without delivering the watched -`Hide` event, leaving focus restoration pending indefinitely. - -Remove the Render Mode combo from the default toolbar instead of adding more -popup-lifecycle machinery. Replace it with four exclusive state-bound buttons -using original semantic monochrome SVGs: - -1. Shaded: filled cube. -2. Lighted: face-shaded cube. -3. Ghosted: translucent or dashed cube. -4. Wireframe: outline cube. - -Move Perspective, Top, Front, Right, and Ortho from the default toolbar into a -private fixed list over the viewport. The approved interpretation of “view -selection” is this fixed standard-view set. -The control reuses `viewer.change_view` and `renderer.view`, remains synchronized -with the View menu, System form, and public API, and is private Viewer chrome. -It does not extend the mouse-transparent public overlay layer or create a -general viewport-widget registry. - -Add three existing command-backed actions to the default toolbar: - -- Zoom Selected, with a selection/magnifier icon; -- Zoom Extents, with a framing-corners icon; and -- Capture View, with a camera icon. - -Reuse the palette-aware packaged-SVG path. Record asset origin and licensing; -retain semantic tooltips and accessible names; and verify high-DPI, light/dark, -checked, hover, focus, and disabled presentation. Preserve custom toolbar -composition and the narrow state-bound button contract. - -Verification must exercise native activation followed immediately by viewport -orbit, pan, and zoom; command-once behavior; cancelled capture; and state -synchronization across toolbar, viewport control, menu, System form, and -public API. The proposal removes the failing popup from the default path rather -than claiming the current focus restoration is fixed. - -This second amendment was approved on 2026-11-10. It authorizes the default -composition, private viewport control, assets, and verification described -above. - -The corrected implementation passes the focused corrected-contract tests and -the full Viewer and direct-source framework gates recorded in the initiative -handoff, and the user confirms it works well through direct use. Hosted CI and -candidate artifacts remain pending. The accepted grouped-menu amendment is -implemented and locally verified. - -## Accepted grouped viewport-menu amendment - -Replace both the private fixed standard-view list and the four default toolbar -render-mode buttons with one private viewport menu button. Its menu has two -titled, exclusive groups: - -1. **View** — Perspective, Top, Front, Right, Ortho. -2. **View Mode** — Shaded, Lighted, Ghosted, Wireframe. - -Checked state and activation reuse the existing `renderer.view`, -`renderer.rendermode`, `viewer.change_view`, and -`viewer.change_rendermode` paths. Use a `QToolButton`/`QMenu`, not the native -combo box whose popup lifecycle failed direct use. Restore renderer focus from -the menu's deterministic triggered/hide lifecycle. Keep this private Viewer -chrome rather than adding a public interactive-overlay framework. - -Remove the render-mode buttons from the default toolbar. Keep Zoom Selected, -Zoom Extents, and Capture View, and add one measurement menu button containing -only existing commands: - -- Inspect Distance; -- Add Fixed Distance Dimension; -- Add Associative Distance Dimension; and -- Cancel Measurement. - -This is a narrow default composition and menu-button presentation contract, -not a general toolbar-widget registry or new measurement behavior. The -amendment was approved on 2026-11-11. Implementation and local verification, -including popup and Escape lifecycle review, pass as recorded in the -initiative handoff. Native direct use confirms the grouped menu, focus, -alignment, non-overlap, and pressed-state behavior; hosted verification remains -pending. diff --git a/initiatives/scene-viewer-visualisation/decisions/041-grid-and-units-system-section.md b/initiatives/scene-viewer-visualisation/decisions/041-grid-and-units-system-section.md deleted file mode 100644 index 5a17d66..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/041-grid-and-units-system-section.md +++ /dev/null @@ -1,127 +0,0 @@ -# ADR 041: Grid and Units System Section - -## Status - -Accepted. - -## Context - -The System sidebar currently separates grid controls into Display while unit, -precision, and nine read-only global-tolerance values occupy Units and -Measurement. Grid and coordinate units describe the same spatial presentation -context, whereas global COMPAS tolerance is not currently a Viewer setting and -cannot be changed there. - -Camera and Display also rely on implicit row sizing with different editor -width limits. This produces inconsistent alignment and gives some controls less -usable width than others. - -## Options - -1. Add a Grid and Units section, remove tolerance from Viewer UI, and apply one - System-form layout rule. -2. Keep separate Display and Units and Measurement sections but align them. -3. Make global tolerance editable from Viewer. -4. Change the generic container layout for every Viewer form. - -## Recommendation - -Choose option 1. - -The closed System section set becomes, in order: - -1. Camera -2. Display -3. Grid and Units - -Display retains: - -- Render Mode; -- Current View; -- Background Color; and -- Selection Color. - -Grid and Units contains: - -- Show Grid; -- Show Z Axis; -- Grid Mode; -- Grid Color; -- Grid X Extent and Divisions; -- Grid Y Extent and Divisions; -- Coordinate Unit; and -- Display Precision. - -Replace the public `MeasurementSetting` component and sidebar item type with -`GridUnitSetting`. Replace the closed section identifier `Units and -Measurement` with `Grid and Units`. Remove the old names without aliases. - -Remove every tolerance row and the component's dependency on -`compas.tolerance.TOL`. Do not modify, copy, or provide Viewer controls for the -process-wide tolerance object. Computational code may continue using COMPAS -tolerance internally. - -Preserve the existing `renderer.*`, `measurement.*`, and -`ViewerState.set_measurement_*` paths. Unit remains an informational -declaration: it does not convert coordinates, grid spacing, snapping, geometry, -or measurements. Precision remains paired with the unit and controls -measurement formatting. Because configuration ownership and paths do not move, -no configuration-schema migration is introduced. - -Camera, Display, and Grid and Units use one private two-column layout rule: - -- labels occupy one left-aligned label column; -- editors occupy one aligned right-hand field column; -- editor rows share a common right edge; -- fields use the available column width rather than unrelated fixed maxima; -- checkboxes align within the same field column; and -- compact margins and row heights are retained. - -Implement the rule privately in the three System components. Do not change the -generic `Container` or introduce a public form-layout abstraction. - -## Consequences - -- Spatial grid presentation, declared coordinate unit, and precision are - available in one coherent section. -- Display becomes limited to general renderer presentation. -- Irrelevant global-tolerance information no longer consumes sidebar space, - while COMPAS tolerance behavior remains unchanged. -- System controls use consistent alignment and gain usable editor width. -- Custom sidebar definitions using `MeasurementSetting` or the old section - identifier require a clean update. -- Existing configuration files and runtime state paths remain valid. - -## Verification - -- Verify the exact Camera, Display, and Grid and Units section order and closed - identifiers. -- Verify Display no longer owns grid controls and `GridUnitSetting` owns grid, - unit, and precision controls. -- Verify no tolerance widgets or Viewer component dependency on `TOL` remains. -- Verify grid changes still rebuild only grid resources. -- Verify unit and precision changes affect measurement presentation without - changing geometry, grid scale, snapping, or global tolerance. -- Verify fixed-width Qt layout tests give each System section a common field - column, shared right edge, aligned checkboxes, and usable editor width. -- Verify the retired component type and section identifier fail clearly. -- Preserve configuration round-trip and Viewer-state tests, then run the full - Viewer suite, Ruff, Pyright, strict MkDocs, package CI, and framework - integration. - -## Dependencies - -- Amends Accepted ADR 027 by removing tolerance display while preserving unit - and precision semantics. -- Amends Accepted ADR 032's closed System section and component-type sets. -- Preserves Accepted ADR 020's configuration ownership and schema. -- Coordinates with ADR 040 through shared render-mode and view state. - -## Decision - -Approved on 2026-11-09. System contains Camera, Display, and Grid and Units. -Grid and Units replaces `MeasurementSetting` with `GridUnitSetting`, owns grid, -coordinate-unit, and display-precision controls, and removes tolerance from the -Viewer UI without changing global COMPAS tolerance or existing configuration -and state paths. All three System sections use the approved private aligned -two-column layout. The retired component and section names receive no aliases. diff --git a/initiatives/scene-viewer-visualisation/decisions/042-selected-area-and-volume-inspection.md b/initiatives/scene-viewer-visualisation/decisions/042-selected-area-and-volume-inspection.md deleted file mode 100644 index a5fbfe0..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/042-selected-area-and-volume-inspection.md +++ /dev/null @@ -1,142 +0,0 @@ -# ADR 042: Selected Area and Volume Inspection - -## Status - -Accepted. - -## Context - -Viewer's Measure menu currently supports point-acquired distance inspection and -persistent distance dimensions. Area and volume are whole-object properties; -they do not require point snapping and should not be forced into the distance -tool state. - -Core types expose area and volume through existing public APIs, but those APIs -are not syntactically uniform: some are methods and others are properties. A -selected scene object may also have inherited world transformations. Measuring -only its local item would disagree with displayed scale, while measuring its -render tessellation would silently replace exact public geometry behavior with -an approximation. - -## Options - -1. Add transient, selection-driven area and volume inspection using the - represented item's public scalar and exact supported transformation rules. -2. Add click-to-acquire whole-object measurement tools. -3. Measure rendered tessellations for every object. -4. Add persistent area and volume annotations immediately. -5. Aggregate areas or volumes across the current selection. - -## Recommendation - -Choose option 1. - -Add these commands to Measure: - -1. Inspect Distance -2. Inspect Selected Area -3. Inspect Selected Volume -4. separator -5. Add Fixed Distance Dimension -6. Add Associative Distance Dimension -7. separator -8. Cancel Measurement - -Use the public command and Viewer method identifiers -`viewer.inspect_selected_area` and `viewer.inspect_selected_volume`. - -Each inspection requires exactly one selected spatial scene object. It first -cancels active and retained distance-inspection state, resolves the represented -item, and reads its public `area` or `volume` member structurally: call the -member when callable, otherwise use the property value. Missing members, -`NotImplementedError`, and `None` mean that the measurement is unsupported. An -open Mesh whose `volume()` returns `None` explicitly reports that it does not -enclose a measurable volume. Other implementation exceptions are reported as -operation failures rather than silently reclassified as unsupported. - -Convert the result to a finite, nonnegative scalar. Reject booleans, -non-numeric values, non-finite values, and negative results. The public Viewer -method returns the world-space scalar or raises a clear error. Only the command -callback owns the read-only result or error dialog. - -Use the complete inherited `SceneObject.worldtransformation`: - -- For area, accept similarity transformations: rotation or reflection with a - uniform scale. Multiply local area by the square of that scale. Reject - non-uniform scale, shear, and projective transformations because a local - scalar does not contain the orientation information needed for an exact - transformed area. -- For volume, accept affine transformations and multiply local volume by the - absolute determinant of the linear part. Reject projective transformations. - -Similarity and affine classification may use COMPAS numerical tolerance -internally. Removing tolerance from Viewer UI in ADR 041 does not remove its -computational role. Never use rendered triangles as an implicit fallback. - -Area meaning follows the represented item's public contract: for example, -planar enclosed area for planar regions and surface area for Mesh, Shape, -Polyhedron, and Brep values. Volume likewise follows the item's declared -contract. - -Format the dialog using current Viewer precision. Append the declaration-only -unit with a squared or cubed exponent when present, such as `m²` or `m³`, and -perform no unit conversion. Retain no new measurement state. Do not mutate the -Scene, spatial or annotation selection, annotations, serialization, or -transformation history. - -Do not aggregate multiple selections or add persistent area/volume -annotations, region acquisition, face snapping, a measurement registry, new -Core protocols, or an approximation mode. - -## Consequences - -- Users can inspect exact supported area and volume values from the existing - selection model. -- The public Viewer methods remain UI-independent and reusable, while commands - own dialogs. -- Displayed transforms affect results when a scalar can be transformed exactly. -- Unsupported APIs, open volumes, and transformations that cannot be resolved - exactly fail explicitly instead of producing plausible but incorrect values. -- Persistent area and volume annotations and click-based region tools remain - outside scope. - -## Verification - -- Verify zero, one, and multiple spatial selections. -- Verify method-valued and property-valued measurements. -- Verify Mesh area, closed Mesh volume, open Mesh volume rejection, analytic - Shape, Polygon, Polyhedron, and available backend Brep behavior. -- Verify unsupported Group, Graph, BufferGeometry, and unresolved references. -- Verify parent and local rigid, reflected, and uniform-scale transformations. -- Verify area rejects non-uniform scale, shear, and projective transforms. -- Verify volume uses exact absolute affine-determinant scaling and rejects - projective transforms. -- Verify boolean, non-numeric, negative, and non-finite results fail clearly. -- Verify precision and squared or cubed unit suffixes without conversion. -- Verify active and retained distance state is cancelled. -- Verify Scene content, both selections, annotations, serialization, and - transformation history remain unchanged. -- Run focused Viewer tests, the full Viewer suite, Ruff, Pyright, strict - MkDocs, package CI, and framework exact-source integration. - -## Dependencies - -- Uses Accepted ADR 003's ordered spatial selection. -- Uses Accepted ADR 004's world-transformation contract. -- Extends Accepted ADR 006's public Viewer facade. -- Defines a transient measurement outcome under Accepted ADR 024. -- Uses ADR 027's unit and precision semantics, as amended by ADR 041 if that - proposal is accepted. -- Interacts with ADR 026 only by cancelling active distance state; it does not - use point snapping. - -## Decision - -Approved on 2026-11-09. Measure gains transient Inspect Selected Area and -Inspect Selected Volume operations for exactly one spatial selection. They use -the represented item's public scalar, apply only the approved exact -world-transformation rules, format declaration-only squared or cubed units, -and present a read-only result without retaining state or mutating the Scene. -Unsupported data and transformations fail explicitly; tessellation fallback, -multi-selection aggregation, persistent annotations, and generic measurement -infrastructure are not authorized. diff --git a/initiatives/scene-viewer-visualisation/decisions/043-built-in-compas-viewer-theme.md b/initiatives/scene-viewer-visualisation/decisions/043-built-in-compas-viewer-theme.md deleted file mode 100644 index 95e6878..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/043-built-in-compas-viewer-theme.md +++ /dev/null @@ -1,211 +0,0 @@ -# ADR 043: Built-in COMPAS Viewer Theme - -## Status - -Accepted. - -## Context - -Viewer currently exposes `system`, `light`, and `dark` appearances. They apply -a complete palette to the application-wide Qt instance. The implementation -also changes the renderer background whenever appearance changes, even though -background, selection, grid, object, annotation, measurement, and overlay -colors otherwise have separate configuration or data ownership. - -The current palettes are generic. Component-local stylesheets provide a small -amount of additional presentation, and the pending System-section refinement -adds another local heading rule. There is no central theme module, public theme -contract, or authoritative COMPAS palette in the repositories inspected for -this decision. - -The request is for a coherent COMPAS-styled Viewer, not for an arbitrary theme -framework. Exact colors must therefore be approved without presenting inferred -values as an organization-wide COMPAS brand standard. - -## Options - -1. Treat COMPAS as Viewer's one built-in theme and keep `system`, `light`, and - `dark` as its color-scheme choices. -2. Add `compas` as a fourth appearance value. -3. Add independent public theme and color-scheme settings. -4. Allow custom stylesheets or theme plugins. -5. Coordinate Qt chrome and all viewport/content colors under one theme. - -## Recommendation - -Choose option 1. - -COMPAS Viewer has one built-in theme with light and dark variants. Preserve the -existing public configuration and menu values: - -```python -config.ui.appearance = "system" # or "light" or "dark" -``` - -`system` follows the operating-system color scheme. `light` and `dark` force -the corresponding variant. Do not add a public theme field, another appearance -value, a theme registry, arbitrary stylesheet loading, or plugin hooks while -only one theme is required. Configuration remains schema 3. - -Implement the theme privately in Viewer with semantic light and dark tokens, -complete `QPalette` construction, and at most one narrowly scoped application -stylesheet for states that palette roles cannot express. Cover application -surfaces, controls, inputs, alternate surfaces, primary and muted text, -disabled states, borders, accent states, selected text, links, errors, -keyboard focus, and tooltips. Do not introduce a public token, typography, -spacing, icon-theme, or component-theme abstraction. - -The theme owns Qt application chrome only. It must not mutate renderer -background, selection, or grid colors; scene-object appearance; annotation or -dimension styles; measurement markers; legends; or overlays. Remove the -current appearance-driven renderer-background mutation. Explicit renderer and -content settings therefore remain unchanged when appearance switches. A dark -application surrounding a light viewport is valid. - -Preserve the platform Qt UI font. Retain the packaged COMPAS application icon, -the configured `window.icon` override, and the existing monochrome UI icons. -Any new font or icon family requires a separate asset, licensing, fallback, -and accessibility decision. Reconcile the System-section heading refinement -with the private theme while keeping System layout behavior owned by -`SystemPanel`. - -Exact tokens are an approval gate. Before implementation, approve either an -authoritative COMPAS brand source and an accessible token table derived from -it, or an explicitly Viewer-specific palette described as COMPAS Viewer -styling rather than an organization-wide standard. The approved table must -include contrast evidence for normal and selected text, links, disabled but -readable controls, and keyboard focus. - -## Proposed Viewer-specific token table - -The following table uses the blue hue visible in existing COMPAS-facing local -materials as visual direction only. It is proposed as the COMPAS Viewer -palette, not as an authoritative organization-wide brand standard. - -| Token | Light | Dark | Purpose | -|---|---:|---:|---| -| `window` | `#F4F7F9` | `#18242C` | Application background | -| `surface` | `#FFFFFF` | `#10191F` | Panels and input base | -| `surface_raised` | `#E8EEF2` | `#24343E` | Buttons and raised controls | -| `surface_alternate` | `#ECF2F5` | `#1E2D36` | Alternate rows and secondary areas | -| `text` | `#17242D` | `#F2F6F8` | Primary text | -| `text_muted` | `#526674` | `#B8C5CC` | Secondary text | -| `text_disabled` | `#71818C` | `#87969E` | Disabled and placeholder text | -| `border` | `#AAB8C2` | `#52636D` | Borders and separators | -| `accent` | `#0077B6` | `#38BDF2` | Accent and focus | -| `accent_hover` | `#00689D` | `#159ED0` | Hovered accent control | -| `accent_pressed` | `#005985` | `#0777AD` | Pressed accent control | -| `selection` | `#0077B6` | `#0777AD` | Selection background | -| `selection_text` | `#FFFFFF` | `#FFFFFF` | Text over selection | -| `link` | `#00689D` | `#5CC8F2` | Underlined links | -| `error` | `#B42318` | `#FF8A80` | Error and destructive emphasis | -| `focus` | `#0077B6` | `#38BDF2` | Keyboard-focus outline | -| `tooltip_surface` | `#17242D` | `#24343E` | Tooltip background | -| `tooltip_text` | `#FFFFFF` | `#F2F6F8` | Tooltip text | - -Map Qt `Window`, `Base`, `AlternateBase`, `Button`, text, tooltip, link, -highlight, placeholder, and bright-text roles directly to the corresponding -semantic tokens. Use `text_disabled` for disabled text roles. Use fixed private -surface and border tokens for Qt light, midlight, mid, dark, and shadow roles; -do not derive colors dynamically. Active and inactive groups initially share -the same mapping, while disabled uses its explicit text mapping. - -Limit the application stylesheet to a two-logical-pixel keyboard-focus -outline, accent hover and pressed states that Qt palette roles cannot express -reliably, underlined links, and the approved System-section heading hierarchy. - -Calculated WCAG relative-luminance contrast is: - -| Pair | Light | Dark | Target | -|---|---:|---:|---:| -| Primary text / window | `14.71:1` | `14.55:1` | `4.5:1` | -| Muted text / window | `5.56:1` | `8.96:1` | `4.5:1` | -| Disabled text / window | `3.74:1` | `5.19:1` | project target `3:1` | -| Selected text / selection | `4.87:1` | `4.94:1` | `4.5:1` | -| Link / primary background | `6.06:1` | at least `8.29:1` | `4.5:1` | -| Error / primary background | `6.57:1` | at least `6.93:1` | `4.5:1` | -| Focus / adjacent primary surface | `4.87:1` | at least `7.33:1` | `3:1` | - -Links remain underlined so recognition does not depend on color. Focus uses a -persistent outline and does not depend on fill color. Native Qt captures may -justify small token corrections without reopening the structural decision only -when rendering or measured contrast fails. A hue-family, ownership, font, icon, -or public-configuration change requires an amendment. - -## Consequences - -- Viewer gains coherent branded chrome without expanding its public - configuration or extension surface. -- Operating-system following and forced light/dark behavior remain intact. -- Appearance changes stop overwriting explicit viewport presentation. -- Existing configurations remain schema-compatible, but users who relied on - appearance to change the viewport background must set that renderer value - explicitly. -- The approved palette is Viewer-specific styling and is not presented as an - organization-wide COMPAS brand standard. -- Core, Scene serialization, content appearance, and overlay contracts remain - unchanged. - -## Verification - -- Verify the approved semantic tokens map to complete Qt palette roles for - both variants. -- Verify `system` resolution, operating-system scheme changes, and runtime - switching between all three existing appearance values. -- Verify appearance does not mutate renderer, grid, selection, object, - annotation, measurement, legend, or overlay colors. -- Verify configuration round-trip remains schema 3 and configured window icons - remain authoritative. -- Verify menus, toolbar, all three sidebar domains, trees, forms, dialogs, - tooltips, disabled states, selection, and keyboard focus. -- Verify existing icons remain legible in both variants and at high DPI. -- Record contrast checks against the approved token table. -- Run focused offscreen Qt tests, the full Viewer suite, Ruff, formatting, - Pyright, strict MkDocs, package CI, and framework exact-source integration. -- Capture native light and dark results on macOS, Windows, and Linux before - claiming cross-platform visual completion. - -## Dependencies - -- Preserves ADR 019 configured identity and icon override. -- Preserves ADR 020 configuration lifecycle and schema ownership. -- Covers ADR 032's three sidebar domains without changing their structure. -- Covers ADR 040's toolbar controls without changing their command/state path. -- Preserves ADR 041's private System layout ownership. - -## Decision - -The structural contract was approved on 2026-11-10. COMPAS Viewer has one -built-in theme with system-following light and dark variants, the existing -appearance configuration remains unchanged, and theme ownership is limited to -Qt chrome. No public theme framework or renderer/content color coupling is -authorized. - -The Viewer-specific token table in this ADR was approved on 2026-11-10. It is -the initial implementation contract and is not an organization-wide COMPAS -brand standard. Small token corrections remain limited to demonstrated native -rendering or measured-contrast failures as specified above. - -## Accepted content-palette amendment - -Direct use now requests coordinated light and dark viewport/content defaults. -This would amend the accepted chrome-only boundary only for omitted Viewer -presentation values, as specified by Accepted ADR 046. Explicit and serialized -colors remain authoritative. Core defaults do not change. - -The accepted first version resolves defaults from the effective scheme when a -Viewer object or dimension is created. Switching appearance later changes -chrome and the automatic viewport background, but does not guess which already -materialized geometry colors were defaults. Live recoloring of existing -objects remains deferred until a separate design can preserve automatic versus -explicit color provenance. - -Viewer configuration advances to schema 4. Only -`RendererConfig.backgroundcolor=None` means automatic; schema-3 concrete -backgrounds migrate as explicit. ADR 046 owns the exact migration and geometry -channel-precedence rules. - -This amendment was approved on 2026-11-11 together with ADR 046's exact tokens, -schema, precedence, and creation-time semantics. Implementation and local -verification pass as recorded in the initiative handoff; native direct use and -hosted verification remain pending. diff --git a/initiatives/scene-viewer-visualisation/decisions/044-editing-persistent-dimension-format.md b/initiatives/scene-viewer-visualisation/decisions/044-editing-persistent-dimension-format.md deleted file mode 100644 index 4a74b3e..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/044-editing-persistent-dimension-format.md +++ /dev/null @@ -1,158 +0,0 @@ -# ADR 044: Editing Persistent Distance-Dimension Format - -## Status - -Accepted; implemented, locally verified, and independently reviewed. - -## Context - -`DistanceDimension` durably owns its coordinate-unit declaration and display -precision. **Grid and Units** supplies defaults for transient measurements and -new dimensions, and accepted ADRs intentionally prevent later default changes -from rewriting existing dimensions. - -The Annotations details panel currently exposes annotation name, type, and -dimension style only. Users therefore cannot correct the unit or precision -snapshot of an existing dimension. Core also validates these values only at -construction, so invalid later assignment can corrupt formatting state. - -An unbounded precision also permits impractically large fixed-point output and -would leave Core data, Viewer configuration, and Viewer editors with different -effective domains. One bounded contract must apply at every boundary. - -## Options - -1. Add validated mutable Core properties and edit them in selected annotation - details. -2. Validate only in Viewer and keep unsafe direct Core assignment. -3. Replace the selected dimension with a newly constructed object. -4. Make Grid and Units retroactively update existing dimensions. -5. Treat format as entry-owned style or add bulk format editing. - -## Recommendation - -Choose option 1. - -Keep `DistanceDimension.unit` and `DistanceDimension.precision` publicly -assignable through validated properties. Construction uses the same setters. - -- `unit` accepts `None` or a `str` that is non-empty after stripping - whitespace. Core retains the supplied valid string without conversion or - canonicalization. -- `precision` accepts a non-boolean integer from 0 through 15 inclusive. -- Rejected assignment raises before changing the stored value. -- Precision outside 0–15 raises `ValueError`; it is never clamped or - truncated. -- Changing either field never rescales coordinates, anchors, or measured - distance. -- Serialization fields and Scene schema remain unchanged. - -For exactly one selected annotation entry whose semantic item resolves to a -`DistanceDimension`, the Annotations details area exposes a separate -**Measurement Format** group: - -- **Coordinate Unit** -- **Display Precision** - -This group is separate from **Dimension Style** because the values belong to -semantic dimension data rather than entry presentation. Hide the group for no -selection, multiple selection, text or arrow annotations, and unresolved data -bindings. A dimension with currently unresolved associative anchors remains -editable because its data item is still available. - -Viewer trims unit input and maps blank input to `None`. Precision is assigned -through the Core property. Synchronization blocks editor signals. Commit only -when the stored value changes and refresh only the affected annotation through -`viewer.refresh_annotations((entry,))`. Unit Escape restores the durable value, -clears editor focus, and does not trigger global deselection. - -Mutation preserves dimension and entry identity, anchors, optional explicit -label, style, ordering, visibility, both selections, Viewer measurement -defaults, spatial hierarchy, and spatial buffers. An explicit label remains a -verbatim override, so stored format edits may intentionally produce no visible -label change until that override is removed. The override does not relax unit -or precision validation. - -**Grid and Units** continues to control transient formatting and the snapshot -copied into dimensions created afterward. It never becomes a bulk or -retroactive editor. - -## Consequences - -- Existing dimensions can be corrected without losing identity or - associations. -- Core enforces its format invariants after construction and deserialization. -- Viewer defaults and durable per-dimension format remain distinct. -- No unit conversion, schema migration, configuration migration, generic - property editor, or bulk editing is introduced. -- Invalid post-construction assignments that previously succeeded now fail - immediately under the already documented invariant. - -## Compatibility - -Existing scenes whose dimensions use precision within 0–15 require no -migration. Valid direct assignment remains source-compatible. Invalid -assignment raises `TypeError` for non-string units, boolean or non-integer -precision; `ValueError` for blank units and precision outside 0–15. Blank -Viewer input maps to `None` before Core assignment. Existing serialized -dimensions or Viewer configurations containing precision above 15 are rejected -and must be corrected before loading; they are not migrated, clamped, or -truncated. Scene and Viewer configuration schema versions remain unchanged. - -## Verification - -- Verify valid reassignment at 0 and 15, invalid atomic rejection at -1 and 16, - formatting, explicit labels, unchanged distance and anchors, and - serialization round-trip. -- Verify the group appears only for one resolved distance-dimension item, - including geometrically unresolved associative anchors. -- Verify unit trimming, blank-to-`None`, precision editing, signal-blocked - synchronization, and editor-local Escape. -- Verify identity, anchors, style, selection, Viewer defaults, hierarchy, and - spatial buffers remain unchanged. -- Verify exactly one annotation refresh and no sidebar rebuild. -- Verify default changes do not rewrite existing dimensions and subsequently - created dimensions receive current defaults. -- Update Core property docstrings, Viewer guides, examples, and changelogs; - run focused/full package checks and framework integration. - -## Dependencies - -- Amends ADR 022: snapshots resist automatic default changes but are explicitly - editable afterward. -- Clarifies ADR 027 and ADR 041: Grid and Units remains a default-setting - surface, not an existing-dimension editor. -- Amends ADR 029 and ADR 032: selected annotation details gain semantic - Measurement Format controls separate from entry-owned style. - -## Decision - -Approved on 2026-11-10. Existing dimensions gain validated mutable unit and -precision properties and selected-annotation Measurement Format controls under -the contract above. Grid and Units remains a default-setting surface for -transient and newly created measurements and never rewrites existing -dimensions automatically. - -Amended on 2026-11-10 to set one shared Core and Viewer precision domain of -0–15 inclusive. Values outside that range raise `ValueError`; no assignment, -configuration load, or deserialization path clamps or truncates them. Explicit -labels do not bypass validation. Existing data or configuration above 15 is -rejected without migration or a schema-version change. - -## Implementation and verification - -Core and Viewer implementation is present in the working trees. Core routes -construction and later assignment through the same validated `unit` and -`precision` properties. Viewer exposes Measurement Format only for one bound -distance dimension, trims unit text, maps blank input to `None`, and refreshes -only the affected annotation. The approved 0–15 domain applies consistently to -Core assignment, Viewer configuration, and both Viewer editors. - -The full Core suite passes 2,264 tests. The Viewer tree before the final toolbar -follow-up passes 575 tests plus one expected structured OpenGL skip. The final -combined Viewer tree passes 587 plus the same expected skip. Independent focused -review passes 92 Core and 83 Viewer tests with no remaining findings. -Strict Core and Viewer documentation checks pass, and the framework -direct-source gate passes 15 tests with one expected exact-revision skip. -Hosted package CI and candidate-artifact verification have not been run for -these working trees. diff --git a/initiatives/scene-viewer-visualisation/decisions/045-default-viewport-content-contrast.md b/initiatives/scene-viewer-visualisation/decisions/045-default-viewport-content-contrast.md deleted file mode 100644 index 1f5c81e..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/045-default-viewport-content-contrast.md +++ /dev/null @@ -1,103 +0,0 @@ -# ADR 045: Default Viewport and Content Contrast - -## Status - -Accepted; implemented, locally verified, and confirmed through user direct -use. Accepted ADR 046 supersedes it for new Viewer behavior once implemented. - -## Context - -Direct use in the light Viewer scheme shows insufficient distinction between a -new default white surface and the default white viewport. Core currently -materializes white as the default scene-object color, while Viewer separately -defaults its renderer background to white. - -Accepted ADR 043 owns Qt chrome only. It intentionally prevents `system`, -`light`, and `dark` appearance changes from mutating renderer or content -colors. The contrast correction must therefore be fixed presentation, not an -adaptive theme coupling. - -## Options - -1. Change Viewer's fixed default viewport background to an approved neutral. -2. Change Core's default scene-object/surface color to an approved neutral. -3. Adapt viewport or content colors to the effective light/dark scheme. -4. Add a Viewer default-surface-color configuration layer. - -## Recommendation - -Choose option 1. - -Changing the Viewer background is the narrowest correction: it creates -contrast with existing white content, preserves explicit object colors, and -does not alter Core defaults for other visualization backends. The new value -must remain one fixed renderer default across `system`, `light`, and `dark`. -Explicit configured renderer backgrounds remain authoritative. - -Option 2 more literally changes newly constructed surfaces, but it is a Core -scene-presentation change affecting every backend and potentially serialized -new content. Choose it only with explicit cross-backend compatibility approval. -Reject option 3 because it contradicts ADR 043 and makes content appearance -mode-dependent. Defer option 4 because Core currently materializes white, so -Viewer cannot distinguish inherited white from explicitly requested white -without a broader state-contract change. - -The approved fixed neutral is `#D8DDE2`. It is not inferred from the Qt theme -token table because ADR 043 does not own the viewport. - -## Consequences - -- Default white surfaces remain visible against the default viewport. -- Explicit renderer and scene-object colors keep their existing ownership. -- Appearance switching does not recolor the viewport or content. -- Existing configurations that omit a renderer background receive the new - Viewer default; configurations with an explicit value do not change. -- A Core default-color change remains a separate broader alternative, not a - hidden consequence of this decision. - -## Verification - -- Verify `#D8DDE2` against white default surfaces and dimension/selection - presentation. -- Verify default construction and configuration round-trip. -- Verify explicit renderer backgrounds remain unchanged. -- Verify `system`, `light`, and `dark` switching does not mutate renderer or - content colors. -- Inspect native light and dark Viewer chrome around the fixed viewport on - macOS, Windows, and Linux. -- Run focused configuration and Viewer tests, full Viewer tests, Ruff, - formatting, Pyright, strict MkDocs, package CI, framework integration, and - candidate-artifact verification as applicable. - -## Dependencies - -- Preserves ADR 043's Qt-chrome-only ownership. -- Coordinates with ADR 029's explicit dimension presentation and ADR 040's - proposed toolbar/viewport controls without changing them. - -## Decision - -Approved on 2026-11-10. Viewer changes its fixed default renderer background to -`#D8DDE2`. Core's white scene-object and surface defaults remain unchanged. -The value does not adapt to `system`, `light`, or `dark`, and explicit renderer -background configuration remains authoritative. - -## Implementation verification - -Configuration tests, the full Viewer suite, quality checks, strict -documentation build, and direct-source framework gate pass as recorded in the -initiative handoff, and the user confirms the corrected Viewer works well -through direct use. Hosted verification remains pending. The accepted -superseding amendment is implemented and locally verified. - -## Accepted superseding amendment - -ADR 046 replaces the fixed `#D8DDE2` default with scheme-aware Viewer viewport -and omitted-presentation defaults. ADR 045 remains the -record of the earlier fixed-background decision but is superseded for new -Viewer behavior. Core defaults and explicit colors remain unchanged. During -schema-3 to schema-4 migration, `#D8DDE2` remains an explicit background; it is -never guessed to be the new automatic value. - -Approved on 2026-11-11. ADR 046's replacement is implemented, locally verified, -and confirmed through native direct use; hosted verification remains pending. diff --git a/initiatives/scene-viewer-visualisation/decisions/046-viewer-content-palette.md b/initiatives/scene-viewer-visualisation/decisions/046-viewer-content-palette.md deleted file mode 100644 index 74717a0..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/046-viewer-content-palette.md +++ /dev/null @@ -1,117 +0,0 @@ -# ADR 046: Viewer Scheme-Aware Content Palette - -## Status - -Accepted on 2026-11-11; implemented and locally verified. - -## Context - -Direct use requests an almost-white viewport with darker geometry in the light -scheme and the opposite hierarchy in the dark scheme. Core currently -materializes concrete colors and does not preserve whether a value was omitted -or explicitly selected. Heuristically recoloring matching values would -therefore overwrite legitimate user choices. - -## Options - -1. Resolve Viewer-owned defaults from the effective scheme at object creation. -2. Add durable automatic-versus-explicit color provenance to Core. -3. Recolor values heuristically whenever the scheme changes. -4. Keep one fixed viewport/content palette. - -## Recommendation - -Choose option 1 with these exact tokens: - -| Role | Light | Dark | -|---|---:|---:| -| Viewport | `#FAFAFA` | `#10161B` | -| Surface and face | `#D8DEE4` | `#3A4650` | -| Line and edge | `#4B5563` | `#B8C2CC` | -| Point and vertex | `#111827` | `#F2F6F8` | - -Advance Viewer configuration to schema 4 and change -`RendererConfig.backgroundcolor` to `Color | None`. `None` is the sole -automatic-viewport marker. A missing schema-4 value defaults to `None`; an -explicit color round-trips as a color. When loading schema 3, every concrete -background is preserved as explicit, including `#D8DDE2`; migration never -guesses that a color was automatic. - -Viewer applies content tokens only through presentation arguments omitted at -the existing Viewer add boundary. Explicit and deserialized values remain -authoritative. Precedence is: - -| Base color | Specialized channel | Result | -|---|---|---| -| Explicit | Explicit | Preserve the explicit specialized value. | -| Explicit | Omitted | Preserve current Core derivation of the specialized channel from the explicit base. | -| Omitted | Explicit | Preserve the explicit specialized value. | -| Omitted | Omitted | Apply the scheme token for that specialized role. | - -Apply this matrix to the existing uniform presentation channels of Geometry, -Mesh, Graph, and VolMesh. Collections and buffer-backed objects preserve their -existing explicit/per-element semantics; they receive a token only where their -existing Viewer add API already exposes an omitted uniform channel. Do not add -unsupported roles, per-element inference, or new public presentation fields. -Core's global defaults and other visualization backends do not change. - -An automatic (`None`) viewport follows the effective scheme. An explicit -background never does. Geometry defaults resolve when the Viewer object is -created and remain concrete thereafter. A live scheme switch therefore updates -chrome and the automatic viewport, but does not recolor existing geometry or -dimensions. - -Option 2 is the correct basis for full live inversion, but it is a broad Core -API, schema, serialization, and cross-backend change with no present approval. -Reject option 3 because it cannot distinguish an explicit color from the same -materialized default. Option 4 no longer satisfies the requested dark-scheme -behavior. - -## Consequences - -- New Viewer content has a consistent hierarchy in both schemes. -- Viewer configuration advances from schema 3 to schema 4; schema-3 concrete - backgrounds migrate as explicit values. -- Explicit and serialized presentation is never overwritten. -- Newly created objects can differ depending on the active scheme, and retain - those resolved colors after a later switch. -- Core and non-Viewer backends keep their existing defaults. -- ADR 043 gains a narrow Viewer-content exception and ADR 045's fixed viewport - default is superseded. - -## Verification - -- Verify every exact token in light and dark schemes. -- Verify schema-4 validation and round-trip for `None` and explicit colors; - verify missing schema-4 background becomes `None`. -- Verify every schema-3 concrete background, including `#D8DDE2`, migrates as - explicit and is never guessed to be automatic. -- Verify omitted and explicit base, point/vertex, line/edge, and surface/face - presentation independently across Geometry, Mesh, Graph, and VolMesh using - the precedence matrix. -- Verify collections and buffer-backed objects preserve existing explicit and - per-element behavior and gain no unsupported role. -- Verify explicit and serialized colors survive construction and scheme - changes unchanged. -- Verify the automatic viewport follows the scheme and an explicit background - does not. -- Verify existing objects are not recolored on a scheme change. -- Verify Core construction and other backends retain their current defaults. -- Capture native light and dark results and run Viewer/Core tests, Ruff, - Pyright, strict MkDocs, framework integration, and artifact checks as - applicable. - -## Dependencies - -- Narrowly amends ADR 043's chrome-only ownership. -- Supersedes ADR 045's fixed Viewer viewport default if accepted. -- Coordinates with ADR 037's accepted Viewer-created dimension background. - -## Decision - -Approved on 2026-11-11 with the exact token table, Viewer configuration schema -4, `None` automatic-background marker, lossless schema-3 migration, channel -precedence, and creation-time resolution described above. Implementation and -local verification pass as recorded in the initiative handoff. Native direct -use confirms the scheme-aware viewport, geometry, and new-dimension defaults; -hosted verification remains pending. diff --git a/initiatives/scene-viewer-visualisation/decisions/047-editable-parametric-shape-resolution.md b/initiatives/scene-viewer-visualisation/decisions/047-editable-parametric-shape-resolution.md deleted file mode 100644 index 01fb2a9..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/047-editable-parametric-shape-resolution.md +++ /dev/null @@ -1,138 +0,0 @@ -# ADR 047: Editable Parametric Shape Resolution - -## Status - -Accepted on 2026-11-11; the resolution controls are implemented, locally -verified, and independently reviewed. The settings-only refresh and wireframe -wording amendment is implemented, locally verified, and independently -reviewed. Native user retesting passed on 2026-11-11; hosted verification -remains pending. - -## Context - -Core already stores durable `u` and `v` resolution values on `ShapeObject` -and `SurfaceObject`. Both default to `16`, round-trip with the scene, and are -consumed by Viewer when it builds polygonal representations. They are not -currently editable, so Object Settings cannot change representation density -after construction. - -One scalar `resolution` cannot represent existing objects whose `u` and `v` -differ. Exposing both axes indiscriminately would show controls that do nothing -for fixed-topology or single-axis producers. - -## Options - -1. Expose the existing durable `u` and `v` fields only where the represented - producer consumes them. -2. Add one scalar `resolution` alias. -3. Add `u_resolution` and `v_resolution` aliases. -4. Expose `u` and `v` for every shape regardless of effect. -5. Add automatic screen-space level of detail. - -## Recommendation - -Choose option 1. - -Keep the existing durable fields, defaults, and serialization. Mark applicable -fields editable and present them as **U Resolution** and **V Resolution**. -Viewer filters ineffective axes according to the represented object: - -| Represented object | Controls | Validation | -|---|---|---| -| `Box` | None | Fixed topology does not consume resolution. | -| `Cone`, `Cylinder` | U | Integer at least `3`. | -| `Sphere`, `Torus` | U and V | Each integer at least `3`. | -| `Capsule` | U and V | U at least `3`; V at least `4` and even. | -| Parametric `Surface` | U and V | Each integer at least `1`. | -| Unknown `Shape` producer | None initially | Current conversion consumes neither axis. | - -Values must be whole integers and booleans are rejected. Validation and -assignment are atomic. Invalid input restores durable values and triggers no -refresh. - -A successful changed value rebuilds only the selected object's polygonal -representation, render buffers, and bounds; updates the renderer; and refreshes -Scene details once. It does not mutate the represented analytic shape, affect -other objects, or change selection. Edited values retain existing scene -round-trip behavior. - -Do not add another serialized field, compatibility alias, schema version, or -resolution abstraction. Existing `u` and `v` remain the one public path. - -### Settings-only refresh and wireframe wording amendment - -High-resolution direct use showed that ordinary appearance edits follow the -same tessellation and global buffer rebuild path as topology edits. The -accepted correction distinguishes the two classes of edit: - -- `show`, `show_points`, `show_lines`, `show_surfaces`, opacity, point size, - and line width update the selected render object's settings texture once and - request one redraw; -- these settings-only edits do not tessellate geometry, rebuild global render - buffers, or rebuild the Scene tree unless displayed tree content changed; -- `u` and `v` remain topology edits and retain the one-object tessellation, - buffer, bounds, renderer, and Scene-details refresh defined above; and -- color edits retain the current appearance-data path. Optimizing that path is - deferred pending measured need and a separately approved contract. - -ShapeObject and SurfaceObject forms present the existing line controls as -**Show wireframe**, **Wireframe color**, and **Wireframe width**. MeshObject and -GraphObject retain edge terminology. This is UI wording only: durable field -names, serialization, and public APIs do not change. - -## Consequences - -- Users can trade representation density against rendering cost after adding - a supported shape. -- Independent U/V resolution remains available where supported. -- Controls are absent when changing them would have no effect. -- Existing scenes and defaults remain unchanged. -- Analytic geometry remains authoritative; only its Viewer representation and - derived bounds are rebuilt. - -## Verification - -- Verify the exact controls for every listed producer. -- Verify labels, initial value `16`, whole-integer editing, and keyboard use. -- Reject booleans, fractions, below-minimum values, and odd Capsule V without - mutation or refresh. -- Verify valid changes alter expected vertex/face counts, buffers, and bounds. -- Verify exactly one affected-object data refresh, renderer update, and Scene - details refresh. -- Verify every settings-only field updates one object settings texture and - requests one redraw without tessellation, global buffer rebuild, or Scene - tree rebuild when displayed tree content is unchanged. -- Verify ShapeObject and SurfaceObject use wireframe wording while MeshObject - and GraphObject retain edge wording; verify durable names are unchanged. -- Verify analytic geometry, unrelated objects, and selection are unchanged. -- Verify scene round-trip preserves edited U and V. -- Run Core and Viewer tests, Ruff, Pyright, strict MkDocs, and framework - integration. - -## Exclusions - -- Circle and ellipse polyline counts. -- BRep- or backend-specific tessellation tolerances. -- Camera-distance or screen-space adaptive level of detail. -- Global resolution defaults. -- A speculative maximum-resolution cap. - -## Dependencies - -- Uses Accepted ADRs 015–016's normalized editable-attribute contract. -- Uses ADR 004's existing data/buffer refresh ownership. -- Preserves ADR 002's indexed representation contract. - -## Decision - -Approved on 2026-11-11. Implementation and local verification pass. An exact -native macOS subprocess changed a Torus U resolution from 16 to 64 with a valid -OpenGL context. The subsequent interactive crash was traced to Qt emitter -lifetime and fixed; direct user retesting confirmed the fix at U resolution 64. - -The settings-only refresh and wireframe wording amendment was approved on -2026-11-11. Implementation, local verification, and independent review pass. -The Viewer suite passes 656 tests with two expected offscreen native-OpenGL -skips. Native direct use on 2026-11-11 confirms that a Torus at U resolution -64 toggles **Show wireframe** off and on responsively, accepts the wireframe -wording, and preserves the resolution crash fix. diff --git a/initiatives/scene-viewer-visualisation/decisions/048-referenced-data-domain.md b/initiatives/scene-viewer-visualisation/decisions/048-referenced-data-domain.md deleted file mode 100644 index a71b7ee..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/048-referenced-data-domain.md +++ /dev/null @@ -1,118 +0,0 @@ -# ADR 048: Referenced Data Domain - -## Status - -Accepted on 2026-11-11. Implemented, locally verified, and independently -reviewed. - -## Context - -Scene objects and annotation entries refer to domain `Data` by GUID, but the -default Viewer exposes only the spatial hierarchy and annotation list. The -represented item is available through the existing runtime binding table, yet -there is no flat UI for finding shared or unresolved items independently from -scene-object placement. - -Core `Scene` is deliberately reference-only. Its `item_store` is a non-owning, -non-serialized runtime binding map, and unrelated unattached data belongs to a -future Session aggregate. Viewer must not introduce another owning store or -silently broaden Scene into that aggregate. - -## Recommendation - -Add a fourth top-level Viewer sidebar domain named **Data**. The final order is -**Scene**, **Data**, **Annotations**, **System**. Data is a Viewer-owned flat -projection of items referenced by the current Scene, not an owning data store. - -Build one row per distinct item GUID in deterministic first-reference order: - -1. spatial scene objects in hierarchy order; -2. annotation entries in durable annotation order. - -Deduplicate shared items and show **Name**, **Type**, **Status** (Bound or -Unresolved), and **References**. An unresolved row retains its GUID and -reference inventory without invoking a resolver. A bound shared item appears -once and resolves to the existing instance in `Scene.item_store`. - -Data-list selection is local transient UI state. It does not mutate spatial, -annotation, viewport, or element-table selection and does not serialize. -Preserve the selected GUID across refresh when it remains referenced. - -For one row, expose a main-window-owned, read-only modal **Data Details** -dialog. Its header shows name, concrete type, GUID, binding status, and every -referring scene object and annotation. General bound `Data` shows the same safe -inspected public parameters used by Object Details; do not recursively dump or -eagerly materialize arbitrary `__data__`. - -For Mesh and Graph, reuse ADR 017's lazy domain-table models in read-only mode. -Preserve declared-column order, retrieve values lazily, and omit sparse -undeclared attributes. Unresolved rows show only their GUID and references. - -Refresh after scene replacement, spatial-object add/remove, annotation -add/remove, item binding, and Data-domain activation. Rebuilding the projection -must not mutate data, resolve items implicitly, or rebuild render buffers. - -## Consequences - -- Represented items become discoverable independently from spatial placement. -- Shared identity and unresolved references remain explicit. -- Data selection remains independent and transient. -- No Core API, Scene schema, or ownership change is required. -- “Data” names a UI projection; it does not create an owning store. - -## Exclusions - -- unattached item storage or Session aggregation; -- files, URIs, catalogs, resolvers, loading, or binding; -- deleting, renaming, or editing data or element attributes; -- viewport linkage, batch operations, search, or filtering; -- persisted Data selection; and -- modeless or pinned inspectors. - -The initial projection intentionally uses only references in the active -`Scene`. A separately approved future Session design may replace or extend -that source with an aggregate spanning unattached data and multiple scenes. -That evolution must preserve the ownership boundary: Session, not Viewer, -would own the aggregate, and Viewer would remain a read-only consumer. - -## Verification - -- Deduplicate an item shared by multiple scene objects. -- Include annotation-only items and preserve first-reference order. -- Show bound and unresolved rows without implicit resolution. -- List every reference in Data Details. -- Keep spatial, annotation, Data, viewport, and element selections independent. -- Keep Mesh and Graph tables lazy, declared-column-driven, and read-only. -- Avoid recursive item serialization during generic inspection. -- Refresh after add, remove, bind, activation, and scene replacement. -- Prove no Scene serialization, Core ownership, identity, or buffer changes. - -## Dependencies - -- Preserves ADRs 001, 010, and 013. -- Reuses the read-only part of ADR 017. -- Extends ADR 032's closed sidebar domains. -- Keeps ADR 018 editing outside this initial scope. - -## Decision - -Approved on 2026-11-11 as the narrow first step described above. This approval -does not include Session aggregation, unattached data, multiple-scene -inventory, or Viewer ownership of data. Evolving the inventory source to a -Session aggregate requires a separate ADR and explicit approval. - -## Implementation Note - -Implementation and independent review pass. Direct `add_object` and -`add_reference` operations trigger exactly one immediate Data refresh without -a renderer refresh, and a still-referenced selected GUID remains selected. -Generic shared-item inspection uses safe public parameters and never reads -arbitrary `__data__`; one failing inspected attribute is isolated rather than -preventing the remaining details from opening. - -Final review adds removal, clearing, and batched-deletion regressions and -confirms exactly one Data refresh without extra renderer work. The Viewer suite -passes 672 tests with two expected offscreen OpenGL skips. Ruff, formatting, -Pyright, strict MkDocs, and diff checks pass. The framework direct-source gate -passes 16 tests with one expected exact-VCS skip. Native user direct-use, -refreshed hosted CI, and candidate-artifact verification remain pending. diff --git a/initiatives/scene-viewer-visualisation/decisions/049-viewer-settings-surface.md b/initiatives/scene-viewer-visualisation/decisions/049-viewer-settings-surface.md deleted file mode 100644 index def2eff..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/049-viewer-settings-surface.md +++ /dev/null @@ -1,188 +0,0 @@ -# ADR 049: Viewer Settings Surface - -## Status - -Accepted on 2026-11-14. Implementation, local verification, framework -direct-source integration, and independent re-review pass. Native macOS -modeless focus, high-DPI, and direct-use confirmation plus refreshed hosted CI -remain pending. - -A later review identified a low-severity coverage gap for repeated public -`Viewer(...)` calls against the process-local singleton composition contract. -A permanent regression now proves that later constructor arguments are ignored; -clean follow-up review passes the targeted regression and complete settings -module with no findings. - -## Context - -The default Viewer sidebar currently presents **Scene**, **Data**, -**Annotations**, and **System** as peer domains. The first three are projections -of content in the active session context: spatial scene objects, referenced -data, and durable annotations. System is different. It is a collection of -Viewer controls for Camera, Display, and Grid and Units. - -Treating content and settings as equivalent top-level domains obscures that -ownership distinction. It also makes the content sidebar responsible for a -large settings form even though those controls are not selected objects or -data. The existing controls, configuration paths, and live refresh behavior -are otherwise established and should not be redesigned as part of correcting -their placement. - -## Options - -1. Move the existing settings sections into one modeless **Viewer Settings** - window owned by each Viewer. -2. Use a modal settings dialog. -3. Use a second dock or dockable panel. -4. Use a toolbar popover or viewport drawer. -5. Keep System as a fourth content-sidebar tab. - -## Decision - -Choose option 1. - -The built-in right sidebar contains exactly three top-level content domains, -in this order: - -1. Scene -2. Data -3. Annotations - -`UI` owns one modeless **Viewer Settings** window per Viewer. It contains the -existing sections, in their current order: - -1. Camera -2. Display -3. Grid and Units - -Construct the window after the viewport and keep it hidden initially. Opening -it refreshes controls from the current Viewer state, shows and raises the same -window instance, and optionally focuses one of the closed section identifiers. -Closing the settings window hides rather than destroys it. Its visibility, -geometry, scroll position, and active section remain transient UI state; they -are not serialized and do not extend Viewer configuration. - -The primary entry is **View → Viewer Settings…**. The existing Camera Settings -command opens the same window focused on Camera. Repeated commands must reuse -the owned window rather than create independent surfaces. - -Keep editor-local Escape behavior local. Escape handled by the settings window -hides that window and must not cancel an active measurement or clear spatial -or annotation selection in the main window. Closing the main Viewer window -also closes the owned settings window and releases its Qt resources. - -Use one clear composition and navigation path: - -```python -SidebarTab = Literal["Scene", "Data", "Annotations"] -SettingsSection = Literal["Camera", "Display", "Grid and Units"] - -viewer.ui.settings.show(section: SettingsSection | None = None) -``` - -Remove `SideBarRight.focus_system_section`. Move `CameraSetting`, -`DisplaySetting`, and `GridUnitSetting` from `viewer.sidebar_items` to a new -`viewer.settings_items` composition boundary. If `SystemPanel` and -`SystemSection` remain public, rename them to Viewer-settings terminology. -Retire the old System placement and identifiers without compatibility aliases -or two supported navigation paths. - -The implemented setup-time composition boundary is typed and explicit: - -```python -Viewer( - *, - sidebar_items: Iterable[UIItem] | None = None, - settings_items: Iterable[UIItem] | None = None, -) -``` - -The Viewer shallow-copies supplied iterables before constructing the UI and -uses the built-in definitions when an input is omitted. The process-local -Viewer singleton consumes these definitions only during its first -construction. Later `Viewer(...)` calls return that existing instance and -ignore new composition arguments; mutating either list after construction does -not recompose the UI. No live reload, reset, or second composition path is -part of this decision. - -Preserve the existing `renderer.*`, `measurement.*`, state, configuration, -refresh, and command semantics. This decision changes presentation ownership, -not the controlled values. - -## Alternatives and Tradeoffs - -A modal dialog gives settings a separate surface but blocks viewport orbit, -pan, zoom, and selection while Camera, Display, or Grid values are tuned. That -conflicts with the existing live-feedback behavior. - -A dock keeps controls modeless but competes with the content sidebar and the -generic Side Dock for main-window space. It also introduces docking position, -visibility persistence, and layout-restoration decisions that are not required -to correct the ownership boundary. - -A toolbar popover is too small and lifecycle-sensitive for three scrollable -forms. It would repeat the popup and focus-teardown risks already encountered -by the Viewer controls. A viewport drawer adds new chrome and accessibility -behavior without a current requirement. - -Keeping System in the sidebar preserves the implementation but retains the -content/settings category error identified by direct use. - -## Consequences - -- The right sidebar becomes a coherent content navigator. -- Settings remain available during viewport interaction and provide live - feedback from one reusable surface. -- Viewer, not Scene or Session, continues to own Camera, Display, and Grid and - Units presentation. -- Core APIs, Scene serialization, Viewer configuration schema 4, measurement - semantics, and renderer state do not change. -- Custom applications using `viewer.sidebar_items` for settings, - `set_current_tab("System")`, or `focus_system_section` require a clean - migration. -- The new settings composition boundary must not become a generic dock, - workspace, or persistence framework. - -## Verification - -- Verify exactly Scene, Data, and Annotations in the default content sidebar. -- Verify Data remains read-only and contextual deletion remains limited to - Scene and Annotations. -- Verify one modeless settings window per Viewer, reused across repeated open - and section-focus commands. -- Verify opening refreshes Camera, Display, and Grid and Units from current - state without duplicating signal connections or refresh work. -- Verify close hides the settings window and main-window teardown closes it - without Qt lifetime errors. -- Verify editor-local Escape remains local and window-level Escape hides only - Viewer Settings without cancelling measurement or clearing selection. -- Verify keyboard traversal, accessible names and title, light/dark styling, - high-DPI layout, minimum sizing, and scrolling. -- Verify Camera, Display, grid, unit, and precision edits preserve their - existing live refresh scope. -- Verify typed list and generator composition inputs, shallow-copy ownership, - first-construction singleton behavior, defaults, unsupported item failures, - and the absence of live recomposition. -- Verify configuration schema 4 round-trip and every existing state path are - unchanged. -- Update the Viewer tutorial, user guide, developer composition guide, - executable examples, changelog, package tests, and framework integration - assertions. - -## Dependencies - -- Amends ADR 032's top-level sidebar and navigation contract. -- Moves, but does not change, ADR 041's Camera, Display, and Grid and Units - sections. -- Preserves ADR 038's contextual deletion ownership. -- Preserves ADRs 040, 043, and 046 for controls, theme, and content palette. -- Follows ADR 048 by treating Scene, Data, and Annotations as the content - domains. - -## Approval Record - -The user explicitly approved the modeless Viewer Settings ownership, clean API -migration, and verification contract on 2026-11-14. That approval authorizes -the scoped Viewer implementation and documentation changes above. It does not -authorize compatibility aliases, a dock framework, settings persistence, or -changes to renderer, measurement, state, or configuration semantics. diff --git a/initiatives/scene-viewer-visualisation/decisions/050-read-only-data-item-inspection.md b/initiatives/scene-viewer-visualisation/decisions/050-read-only-data-item-inspection.md deleted file mode 100644 index ad270a4..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/050-read-only-data-item-inspection.md +++ /dev/null @@ -1,157 +0,0 @@ -# ADR 050: Read-Only Data Item Inspection - -## Status - -Accepted on 2026-11-14. Implemented and locally verified in the uncommitted -Viewer working tree based on `0f263f1`. - -## Context - -Accepted ADR 048 makes Data a read-only, non-owning projection of items -referenced by the active Scene. Its Details dialog shows identity, status, and -references. A bound general `Data` item shows safe public constructor -parameters, while Mesh and Graph show lazy read-only component-attribute tables -instead of parameters. - -Users need one coherent snapshot containing the available general parameters, -general datastructure attributes, and supported component-specific attributes. -This must not turn Data into an editing, ownership, resolution, or extension -registry boundary. - -## Options - -1. Expand Data Details with a fixed read-only composition using existing Core - and Viewer contracts. -2. Make Data Details editable. -3. Add a generic per-Data-type inspection registry. -4. Keep the mutually exclusive parameter/table presentation. - -## Recommendation - -Choose option 1. - -Keep the existing identity and references header. For one bound item, place one -read-only tab widget below it with sections in this order: - -1. **Parameters** for safe available public constructor parameters; -2. **General Attributes** when the item is a Core `Datastructure`; and -3. the existing supported component-domain tabs in ADR 017 order. - -The Parameters tab uses the existing public-attribute-first inspection path and -keeps serialized fallback disabled. It must never recursively inspect or dump -arbitrary `__data__`. An item with no exposed parameters has an empty table -rather than losing the section. The table columns remain **Parameter** and -**Value**. - -General Attributes is supported only for verified Core `Datastructure` -instances. It reads the public `attributes` mapping, preserves mapping insertion -order, and displays one name/value row per entry. An empty mapping produces an -empty table. Its columns are **Attribute** and **Value**. Do not infer a general- -attributes contract from an arbitrary `attributes` attribute on other `Data` -subclasses. - -Mesh and Graph retain the existing lazy read-only tables: Mesh vertex, edge, -and face domains; Graph node and edge domains. Preserve declared default-column -order, effective-value lookup, zero-row declared domains, and omission of -sparse undeclared attributes. Parameters and General Attributes appear -alongside these tabs rather than being replaced by them. - -Parameter and general-attribute values use the existing Data Details display -convention: `str(value)`, or `` if formatting -raises. Component tables retain ADR 017's key, scalar, and Boolean formatting; -a failed component read or format produces the same unavailable marker in that -cell. A failure does not prevent the remaining metadata, parameters, -attributes, or domains from opening. Inspection is a snapshot; it does not -track later mutation. - -An unresolved row keeps the existing metadata-only Details view. It does not -invoke a resolver, synthesize parameters or attributes, or create a placeholder -item. - -## Mutation and Ownership Boundary - -This decision is read-only: - -- no parameter, general-attribute, default-attribute, or element-attribute - editing; -- no rename, delete, bind, load, or resolve operation; -- no Data, Scene, Session, or Viewer ownership change; -- no selection coupling, serialization, schema, render-buffer rebuild, redraw, - or referrer refresh; and -- no generic inspector registration or arbitrary `Data` introspection. - -The opt-in editable Scene Attributes component governed by ADR 018 remains a -separate Scene-object context. Editing from the deduplicated Data domain would -need a separate decision covering shared referrers, validation, atomicity, -refresh, reset/default semantics, and undo. - -## Alternatives and Tradeoffs - -Editable Data would satisfy a broader meaning of access but conflicts with ADR -048 and cannot safely refresh only one selected SceneObject when an item is -shared. It is deferred pending an explicit mutation design. - -A generic inspection registry could support VolMesh, CellNetwork, or external -`Data` subclasses, but no current producer contract defines their sections, -columns, ordering, cost, or failure behavior. Adding that extension point now -would be speculative. Additional types require concrete evidence and a later -ADR. - -Keeping the current mutually exclusive presentation is simplest in code but -does not satisfy the requirement to access general and component-specific -information together. - -## Compatibility - -The change is additive within the modal Data Details snapshot. Data inventory, -selection, identity, reference order, unresolved behavior, and public Core -contracts do not change. No migration, compatibility alias, or Core release is -required. - -## Verification - -- Show Parameters for bound general Data and for Mesh/Graph. -- Show General Attributes only for Core Datastructure values, preserving - mapping insertion order for empty and populated mappings. -- Show Mesh/Graph lazy component tabs alongside Parameters and General - Attributes in the exact approved order. -- Preserve declared column order, effective lazy lookup, zero-row declared - domains, and omission of sparse undeclared attributes. -- Isolate parameter, mapping, and value-formatting failures to the affected - entry. -- Keep unresolved rows metadata-only without resolution or synthesized data. -- Prove shared items remain one Data row and every reference remains listed. -- Prove opening Details performs no mutation, selection coupling, - serialization, renderer rebuild, redraw, or Data projection refresh. -- Extend the Viewer tutorial to explain the read-only boundary and add a - focused Mesh/Graph example with general attributes, declared defaults, local - component overrides, and shared Scene references. - -## Dependencies - -- Amends the Details composition of Accepted ADR 048 without changing its - read-only ownership boundary. -- Reuses the read-only part of Accepted ADR 017. -- Preserves ADR 018 editing as an opt-in Scene-context surface. -- Independent of Accepted ADR 051; either decision may be implemented and - verified separately. - -## Implementation Evidence - -The Viewer implementation combines the ordered Parameters, General Attributes, -and supported component-domain tabs without adding a mutation or ownership -path. Focused Data-panel and datastructure-table tests pass 38 tests. The -complete Viewer suite passes 705 tests with two expected offscreen native -OpenGL skips. Viewer Ruff, formatting, package Pyright with zero errors, strict -MkDocs, and `git diff --check` pass. The framework direct-source gate passes 16 -tests with one expected exact-revision skip and includes the ordered-tab, -general-attribute, default/override, and nonmutation contracts. Native visual -and interaction confirmation, refreshed hosted CI, and candidate-artifact -verification remain separate pending layers. - -## Acceptance Scope - -The user accepted the fixed read-only tabs, verified -`Datastructure.attributes` scope, and preserved exclusions on 2026-11-14. -Acceptance does not authorize Data editing, additional datastructure domains, -a generic inspection registry, or Core changes. diff --git a/initiatives/scene-viewer-visualisation/decisions/051-scene-object-details-boundary.md b/initiatives/scene-viewer-visualisation/decisions/051-scene-object-details-boundary.md deleted file mode 100644 index dc66060..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/051-scene-object-details-boundary.md +++ /dev/null @@ -1,156 +0,0 @@ -# ADR 051: Scene Object Details and Settings Boundary - -## Status - -Accepted on 2026-11-14. Implemented and locally verified in the uncommitted -Viewer working tree based on `0f263f1`. - -## Context - -Accepted ADRs 015–016 make Object Settings the editing surface for one -normalized mapping of declared editable SceneObject attributes. Accepted ADR -033 moves descriptive information to a read-only modal Object Details snapshot. -That snapshot currently shows name, represented-item type, visibility, and -safe represented-item parameters for one object. - -Users need access to general SceneObject identity and presentation plus the -declared type-specific state, including noneditable values. Expanding the -snapshot must not create a second editor, infer arbitrary object attributes, or -duplicate the authoritative editability contract. - -## Options - -1. Expand Object Details with explicit read-only SceneObject sections while - retaining Object Settings as the only editing surface. -2. Put every inspected value into Object Settings and make it editable where - possible. -3. Build a generic introspection or metadata registry for SceneObject details. -4. Keep the current minimal snapshot. - -## Recommendation - -Choose option 1. - -For one selected object, keep one main-window-owned modal snapshot and show the -existing read-only scrolling text surface with sections in this order: - -1. **Identity**; -2. **General Scene State**; -3. **Type-Specific Scene State**; and -4. **Represented Item Parameters** when the item is bound. - -Identity contains the SceneObject name, concrete SceneObject type, SceneObject -GUID, represented-item concrete type, item GUID, and Bound or Unresolved -status. Rows use `Label: value` with labels **Name**, **Scene Object Type**, -**Scene Object GUID**, **Represented Type**, **Item GUID**, and **Status** in -that order. - -General Scene State contains the explicit base values already owned by -`SceneObject`: visibility, base color, opacity, and local transformation. These -are displayed even when a corresponding value is not editable in the current -Viewer context, with labels **Visible**, **Base Color**, **Opacity**, and -**Local Transformation** in that order. - -Type-Specific Scene State enumerates only the declarations returned by -`type(obj).scene_state_fields()`. Preserve namespace and field declaration -order. Display each stable `namespace.field` name and read its current value -through the declaration's `attribute`. Include editable and noneditable fields. -Do not inspect unknown extension payloads, `__dict__`, arbitrary properties, or -undeclared adapter caches. - -Represented Item Parameters reuses the existing safe parameter inspection. An -unresolved represented item omits that section while retaining complete -SceneObject identity and declared state. - -Identity values use their canonical string form. General state, type-specific -state, and represented-item parameter values use `repr(value)`. A failure to -read or format one value renders `` for that row -and does not prevent the remainder of the snapshot from opening. Parameter rows -retain the existing `` marker when inspection identifies -a constructor parameter but cannot safely resolve its value. Details remains a -snapshot and does not track later selection or mutation. - -Keep existing multiple-selection Details unchanged: show count, represented -types, and names only. A merged multi-object state inspector, common-value -calculation, or multi-edit surface requires separate evidence. - -## Editing Boundary - -Object Settings remains the single editing surface. It continues to resolve -ADRs 015–016's normalized Viewer-context mapping, use existing presentation -labels and editors, apply atomic mutation, and select the required refresh. -Object Details adds no setters, controls, callbacks, refresh metadata, or -mutation path. - -Represented-item parameters remain descriptive in Details and follow the -separate existing ParameterForm path where that form is explicitly invoked. -This decision does not make arbitrary represented-item parameters editable in -Object Settings. - -## Alternatives and Tradeoffs - -Adding all values to Object Settings would blur inspection with editability, -duplicate or bypass ADRs 015–016, and require editor/validation/refresh -contracts for noneditable state. It is rejected. - -A generic details registry could provide custom labels and sections, but it -would duplicate stable SceneStateField declarations and add speculative -presentation metadata to Core or plugins. Explicit base fields plus declared -scene state satisfy the current requirement without a new extension boundary. - -Keeping the current snapshot avoids UI work but hides object identity, -transformation, presentation, and noneditable type-specific state. - -## Compatibility - -The change is additive within the modal Details snapshot. SceneObject APIs, -editability, serialization, selection, configuration, and refresh behavior do -not change. No Core source, schema, migration, alias, or new public metadata -type is required. - -## Verification - -- Show the exact Identity and General Scene State fields for a bound object. -- Preserve namespace and declaration order for editable and noneditable - `scene_state_fields()` values across representative Geometry, Mesh, Graph, - Shape, Surface, and noneditable-state objects. -- Show declared SceneObject state for an unresolved item while omitting only - Represented Item Parameters. -- Isolate one read/format failure without losing the remaining snapshot. -- Keep Details read-only and prove it causes no mutation, refresh, redraw, - serialization, selection, or history change. -- Preserve the existing multiple-selection count/type/name snapshot. -- Verify Object Settings still contains exactly the normalized editable - Viewer-context mapping and remains the sole editing path. -- Extend the Viewer tutorial and examples to distinguish SceneObject settings, - Object Details, represented-item parameters, Data Details, and Viewer - Settings across representative built-in object types. - -## Dependencies - -- Amends Accepted ADR 033's one-object Details content. -- Preserves Accepted ADRs 015–016 as the authoritative editability and mutation - contract. -- Uses Accepted ADR 013's stable SceneObject and declared scene-state model. -- Independent of Accepted ADR 050; either decision may be implemented and - verified separately. - -## Implementation Evidence - -The Viewer implementation renders the four ordered one-object sections from -explicit base state and declared `scene_state_fields()` while leaving Object -Settings unchanged as the only editor. Focused Scene-form tests pass within the -55-test implementation check. The complete Viewer suite passes 705 tests with -two expected offscreen native OpenGL skips. Viewer Ruff, formatting, package -Pyright with zero errors, strict MkDocs, and `git diff --check` pass. The -framework direct-source gate passes 16 tests with one expected exact-revision -skip and covers declared noneditable state, section ordering, and nonmutation. -Native visual and interaction confirmation, refreshed hosted CI, and -candidate-artifact verification remain separate pending layers. - -## Acceptance Scope - -The user accepted the explicit read-only sections and the retained Object -Settings editing boundary on 2026-11-14. Acceptance does not authorize new -editable attributes, a details registry, merged multi-selection state, -arbitrary introspection, or Core changes. diff --git a/initiatives/scene-viewer-visualisation/decisions/052-executable-viewer-documentation-and-example-coverage.md b/initiatives/scene-viewer-visualisation/decisions/052-executable-viewer-documentation-and-example-coverage.md deleted file mode 100644 index 0243ece..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/052-executable-viewer-documentation-and-example-coverage.md +++ /dev/null @@ -1,194 +0,0 @@ -# ADR 052: Executable Viewer Documentation and Example Coverage - -## Status - -Accepted on 2026-11-14. Implemented and locally verified in the uncommitted -Viewer working tree based on `0f263f1`; no runtime change is authorized by this -decision. - -## Context - -The initiative now has a broad public surface spanning scene and data -inspection, Viewer configuration, selection and transforms, annotations, -serialization, overlays, dynamic updates, and optional geometry backends. -Documentation has grown alongside individual runtime decisions, but the -initiative has not decided what makes that documentation authoritative, -executable, or sufficiently complete. - -This is independent of the runtime ownership decisions. Accepted ADR 049 owns -setup-time sidebar and settings composition. Accepted ADR 050 owns the Data -Details expansion, and Accepted ADR 051 owns the Scene Object Details -expansion. This decision governs only how implemented and verified -behavior is documented. It cannot introduce, amend, or complete those runtime -contracts. - -An uncommitted candidate already replaces the placeholder tutorial, adds an -executable Viewer Settings example, corrects the Object Inspection composition -example, and improves affected public docstrings and Python 3.12 annotations. -That work is evidence for this proposal, not an Accepted decision or a -completed documentation program. - -## Options - -1. Adopt one maintained executable documentation contract with a canonical - tutorial, focused workflow examples, and layered automated and manual - verification. -2. Continue adding ad-hoc prose and examples with no common coverage or - execution contract. -3. Publish one prose-only tutorial and leave examples illustrative. -4. Require a separate executable example for every public symbol. - -## Recommendation - -Choose option 1. - -Maintain one end-to-end Viewer tutorial backed by one authoritative runnable -script under `docs/examples/`. The tutorial should provide the shortest useful -path through the current Viewer architecture and link to focused examples for -deeper workflows. The script, not a duplicated code block, is the tutorial's -source of executable code. - -Examples should cover approved public feature areas at workflow or category -level. They do not need to demonstrate every class, method, field, or private -helper. Each example should use the public API that a user is expected to use, -end in a directly runnable result, and remain small enough for its ownership, -inputs, mutation, and expected outcome to be clear. - -Public APIs changed or added by this initiative, and Python APIs touched while -maintaining their documentation, should have MkDocs/mkdocstrings-compatible -NumPy-style docstrings and Python 3.12 annotations. Documentation-facing -signatures, examples, and annotations must agree. Private helpers need -docstrings or additional annotations only when their behavior or boundary is -otherwise unclear; exhaustive private coverage is not required. - -Documentation claims must describe implemented, verified behavior. A runtime -gap discovered while writing or executing documentation returns to the ADR -that owns that behavior. Documentation work must not patch a gap -speculatively, invent an alias, or present ADR 050 or ADR 051 behavior as -available before the relevant decision is implemented and verified. - -## Required Coverage - -The maintained tutorial and focused examples should jointly cover the current -major public areas as follows. “Automated evidence” is representative rather -than a promise that a headless environment proves native rendering or focus. - -| Area | Required documentation and example coverage | Automated evidence | Separate native or optional evidence | -|---|---|---|---| -| Scene/content domains and inspection boundaries | Explain Scene, Data, and Annotations ownership; distinguish Object Settings, Object Details, Data Details, editable opt-in Scene Attributes, and Viewer Settings; update the inspection material only when ADR 050 or 051 behavior is implemented | Run the authoritative tutorial script and representative inspection/composition examples headlessly; assert the advertised components are actually present | Report modal/modeless focus, scrolling, selection, and visual layout separately | -| Viewer Settings and configuration | Show configuration values, `sidebar_items` and `settings_items` setup-time composition, first-construction singleton behavior, section navigation, reuse, and the difference between persistent configuration and transient window state | Execute the tutorial/Viewer Settings example; check effective copied composition and supported section behavior | Report modeless focus, Escape ownership, high-DPI layout, and native reuse separately | -| Selection, transforms, and refresh | Show shared selection concepts, public transform operations, and the geometry/appearance/transform refresh categories used by dynamic callbacks | Execute representative scripts and assert callback refresh categories without entering the visible event loop | Confirm viewport picking and visual transform results separately where needed | -| Measurements and annotations | Show transient measurement versus durable annotations, fixed/associative ownership, snapping restrictions, format defaults, and durable style/state | Run representative construction and contract tests without claiming that offscreen execution proves interaction or rendering | Report point acquisition, focus, placement, label/background, and rendering checks separately | -| Serialization | Show supported scene and annotation round trips, retained identity/reference behavior, and the exclusion of transient Viewer state | Execute representative round-trip or contract tests | Label backend- or renderer-dependent outcomes explicitly | -| Overlays | Show public scale, legend, and screen-text workflows plus their transient ownership | Perform construction/state smoke checks where meaningful | Verify visual placement, contrast, and resizing in a supported native renderer | -| Dynamic examples | Show public callbacks and categorized refresh for geometry, appearance, and transforms | Execute callbacks and assert the requested public refresh operations | Verify animation cadence and visible results separately | -| Optional geometry backends | Keep BRep, NURBS, and similar examples on stable COMPAS facades and state the required optional backend | Require static Ruff/Pyright checks; run only when the declared optional dependency is available | Label unavailable optional runtime evidence rather than treating it as a pass | - -The matrix is a category contract. It does not require one page per API symbol, -one smoke test per example, or runtime execution of an optional backend that is -not installed. - -## Executability and Verification - -All authoritative Python examples live under `docs/examples/` and are checked -with the package's configured Ruff and Python 3.12 Pyright commands. Drafts, -archives, and intentionally incomplete fragments must stay outside that tree -or be clearly excluded by the documented gate rather than silently skipped. - -The documentation suite should provide: - -- representative headless smoke or contract tests for the canonical tutorial - script and important workflow categories; -- focused assertions that examples advertise effective behavior, not merely - import or construct dead definitions; -- focused doctests where public docstrings contain executable examples; -- strict MkDocs builds with navigation, internal-link, and snippet-path - validation, plus `git diff --check`; and -- explicit reporting of offscreen skips, unavailable optional dependencies, - and checks that were not run. - -Headless tests prove construction and contracts only. Native OpenGL rendering, -visual presentation, platform focus, keyboard behavior, scrolling, and -high-DPI behavior remain separate manual or native-platform evidence. A pass in -one layer must not be used to infer a pass in the other. - -## Maintenance and Failure Ownership - -`compas_viewer` owns the Viewer tutorial, Viewer examples, rendered API pages, -and their package-local checks. A public behavior change is incomplete until -its owning runtime ADR, code, tests, types, docstrings, tutorial or focused -example coverage, and applicable verification evidence agree. - -A failing example is maintained with the public workflow it demonstrates. If -the documented contract is wrong, fix the documentation. If the implementation -violates an accepted contract, return the failure to the owning runtime ADR and -tests. If the desired behavior is not accepted, propose or amend an ADR before -changing runtime code. Optional-dependency failures should identify the -missing backend and remain distinct from failures in the default supported -environment. - -`compas_framework` may verify representative cross-package documentation -contracts, but it does not become the owner of Viewer prose or examples. - -## Alternatives and Tradeoffs - -Ad-hoc prose and examples have the lowest immediate cost, but they do not -identify stale scripts, missing feature areas, or claims that outrun runtime -behavior. - -A prose-only tutorial provides a coherent narrative but duplicates code that -can drift and offers no executable evidence that the demonstrated workflow -still builds. - -An example for every public symbol maximizes enumeration but creates a large, -repetitive maintenance surface. It also encourages artificial snippets instead -of the public workflows users need. Focused category coverage plus API -reference documentation is simpler and more durable. - -The recommended layered approach has a modest test and maintenance cost. It -accepts that headless automation cannot prove native visual behavior and makes -that limitation explicit instead of hiding it. - -## Compatibility - -This decision is documentation-only. It changes no runtime API, behavior, -schema, serialization, configuration, ownership boundary, compatibility alias, -or migration requirement. Docstrings and annotations must describe the -existing public contract without changing runtime semantics. - -## Implementation Evidence - -The uncommitted Viewer working tree now contains the maintained end-to-end -tutorial backed by `docs/examples/ui/viewer_settings.py`, focused workflow -examples and a coverage matrix for every required category, updated navigation -and prose, and aligned public docstrings and Python 3.12 annotations. The -documentation-example suite passes 20 tests, including effective Viewer -Settings composition, Object/Data inspection, serialization, measurements, -and overlays. All `docs/examples/` Python passes Ruff, formatting, and Pyright; -the strict Viewer MkDocs build and `git diff --check` pass. - -The independent review found the runtime and documentation structure sound and -requested follow-up coverage for durable annotation serialization plus two -wording/status corrections. Those findings were corrected and revalidated in -the working tree. Native OpenGL rendering, picking, focus, scrolling, high-DPI -layout, animation cadence, overlay placement, and optional BRep/NURBS backend -execution remain separately reported evidence rather than inferred passes. - -## Dependencies - -- Documents implemented behavior governed by Accepted ADRs 001–049 without - changing their ownership or runtime contracts. -- ADR 049 remains the sole owner of setup-time Viewer composition and settings - behavior. -- ADRs 050 and 051 remain independent Accepted runtime decisions. Their - behavior enters documentation only after it is implemented and verified. -- ADR 052 may be implemented and verified independently of ADRs 050 and 051, - except for documentation that describes their runtime behavior. - -## Acceptance Scope - -The user accepted the executable documentation contract, category coverage -matrix, and layered verification boundary on 2026-11-14. Acceptance authorizes -documentation, docstring, annotation, example, and documentation-test -maintenance only; it does not authorize any runtime behavior change or by -itself establish that the documentation program is complete. diff --git a/initiatives/scene-viewer-visualisation/decisions/README.md b/initiatives/scene-viewer-visualisation/decisions/README.md deleted file mode 100644 index aa63d0f..0000000 --- a/initiatives/scene-viewer-visualisation/decisions/README.md +++ /dev/null @@ -1,228 +0,0 @@ -# Scene, Viewer, and Visualisation Decisions - -ADRs 013–020 are Accepted. ADRs 013–014 supersede the implemented -node/runtime-adapter model of ADR 008, part of ADR 009, and the unaccepted -alternatives in ADRs 011–012. ADR 010 remains Accepted with item references -moved to stable scene objects. ADRs 015–016 authorize contextual object -settings from one normalized mapping: editable `SceneStateField` entries plus -narrowly declared non-state attributes. The earlier `FormField` implementation -has been replaced and verified. ADRs 017–020 authorize lazy datastructure -attribute tables, their editing semantics, configured Viewer identity, and a -configuration lifecycle/field audit. Their implementation is verified locally -and in hosted Viewer and framework CI. ADR 017 is amended to keep the -datastructure inspector out of the default sidebar while preserving opt-in -custom use. ADR 003 is implemented, locally -verified, independently approved, and green in hosted Viewer and refreshed -framework CI. ADR 004 is implemented, locally verified, and independently -approved; refreshed hosted Viewer, core, and framework verification passed. -ADRs 021–031 record the accepted Phase 3 durable annotation ownership, unit -snapshots, clean-break migration, transient/persistent outcomes, overlay -contracts, snapping and acquisition, Viewer measurement presentation, -fixed/associative anchor model, separate annotation collection and UI, -always-visible dimension rendering, and spatial-object deletion behavior. -ADR 032 is Accepted in response to direct-use evidence that the current -stacked sidebar does not provide stable or clearly separated Scene, -Annotations, and System contexts. -ADR 033 is Accepted and authorizes the Details dialog plus independent -Scene-local and Annotations-local splitters. Its approved scroll correction is -implemented and locally verified. ADR 035 is Accepted with its -deterministic world-space layout and initial Spatial Layout details form; -implementation, local verification, and independent review pass. -Accepted ADR 034 adds Mesh-vertex snapping independent of normal glyph visibility; its -implementation, local verification, native OpenGL regression, and independent -review pass. -ADR 036 accepts programmatic, -non-persistent screen-pinned text overlays. Accepted ADRs 037–039 authorize -narrow annotation label backgrounds, contextual deletion, and moving the -existing geometry Add menu under Scene; their implementations, local -verification, and independent review pass. -ADRs 040–042 accept synchronized default-toolbar controls, a Grid and Units -System section with consistent field alignment and no tolerance UI, and -transient selected-object area and volume inspection. Their implementations -are verified locally and in hosted Viewer and framework CI at the recorded -candidate revisions. ADR 040's 2026-11-10 amendment replaces only the View -selector with five state-bound, icon-only buttons and uses event-driven pending -focus restoration. Its local, actual-widget, and native verification passes; -the scripted native probes passed, but the subsequent user retest confirmed -the standard-view buttons and rejected Render Mode dropdown focus. Refreshed -hosted verification remains pending. -ADR 043 accepts one built-in COMPAS Viewer theme with system-following light -and dark variants. It preserves the current appearance values and configuration -schema and limits theme ownership to Qt chrome. Its exact accessible token -table is approved as Viewer-specific styling rather than an organization-wide -brand standard. -ADR 044 accepts validated editing of one selected persistent distance -dimension's unit and 0–15 precision while preserving Grid and Units as defaults -for transient and newly created measurements. Its implementation, local -verification, and independent review pass. -The latest native retest confirms the five standard-view buttons, Camera -population, and general presentation, but rejects Render Mode popup focus. -Approved amendments to ADRs 037 and 040 add label-background editing and replace -the popup/letter-icon composition with semantic render buttons, private fixed -viewport view selection, and existing zoom/capture actions. Accepted ADR 045 -changes Viewer's fixed default background to `#D8DDE2` while preserving Core's -white defaults and ADR 043's theme separation. Implementation, local -verification, independent re-review, and user direct use pass; hosted -verification remains pending. - -New direct-use feedback produced another coordinated presentation revision, -approved on 2026-11-11. ADR 040 replaces the current viewport list and toolbar render buttons -with one grouped viewport menu and add one measurement menu button. ADR 037 -enables scheme-colored backgrounds for newly acquired Viewer dimensions. -Accepted ADR 046 defines scheme-aware Viewer defaults while preserving Core and -explicit/serialized colors; it narrowly amends ADR 043 and would supersede ADR -045's fixed background. It advances Viewer configuration to schema 4 with an -explicit `None` automatic-background marker and defines base/specialized color -precedence for existing supported channels. Implementation and local -verification and native direct use pass; hosted verification remains pending. - -Accepted ADR 047 exposes the existing durable parametric-shape `u` and `v` -resolution only for producers that consume those axes. It adds no field, -alias, or schema version; implementation and local verification pass. Its -accepted settings-only refresh amendment routes visibility, opacity, point -size, and line width through one object settings-texture update and redraw, -while `u` and `v` retain topology rebuilds. Shape and Surface forms use -wireframe wording; Mesh and Graph retain edge wording. Durable names do not -change. Amendment implementation, local verification, and independent review -pass. Native direct use confirms responsive wireframe toggling at Torus U -resolution 64, accepts the wording, and confirms the crash remains fixed. -Accepted ADR 048 adds a read-only Viewer **Data** domain as a flat projection -of Scene-referenced item GUIDs. It does not own, serialize, load, or edit data; -implementation, local verification, and independent review pass. Its checkpoint -sidebar order is Scene, Data, Annotations, System. Unattached and multi-scene -data remain in the separately deferred Session scope, which may later replace -or extend the inventory source without making Viewer an owner. -Accepted ADR 049 responds to the information-architecture distinction between -the Scene, Data, and Annotations content domains and Viewer settings. It leaves -exactly those three content tabs in the sidebar and moves Camera, Display, and -Grid and Units into one Viewer-owned modeless settings window. The user -approved the contract on 2026-11-14. Implementation, local verification, -framework direct-source integration, and independent re-review pass; native -macOS interaction and refreshed hosted verification remain pending. -The implemented composition boundary accepts typed keyword-only -`sidebar_items` and `settings_items` iterables during the first process-local -Viewer construction, shallow-copies them before UI construction, and provides -no post-construction recomposition or singleton-reset path. The Viewer tutorial -and executable examples cover that lifecycle explicitly. A permanent regression -now covers later public singleton constructor calls after a low-severity review -finding; clean follow-up review reports no findings. -Accepted ADR 050 expands the existing read-only Data Details snapshot so -safe constructor parameters, verified general Datastructure attributes, and -the existing lazy Mesh/Graph component tables are available together. Accepted -ADR 051 expands read-only Object Details with explicit identity, base -scene state, all declared type-specific state, and represented-item parameters -while leaving Object Settings as the sole editing surface. The decisions are -independent and are implemented and locally verified. Accepted ADR 052 -separately defines an executable Viewer documentation and example-coverage -contract. It governs documentation quality only; its tutorial, focused -examples, coverage matrix, docstring, typing, and executable checks are -implemented and locally verified without authorizing a runtime change. - -| ADR | Decision | Status | Dependencies | -|---|---|---|---| -| 001 | [Ownership and state boundaries](001-ownership-boundaries.md) | Accepted | Geometry 022/024; Plugin 002 | -| 002 | [Indexed Viewer buffer geometry](002-indexed-buffer-geometry.md) | Accepted | 001; Typing structural inputs | -| 003 | [Viewer state and object selection](003-viewer-state-and-selection.md) | Accepted; implemented, local verification passed | 001 | -| 004 | [Transformations, refresh, and undo](004-transform-refresh-undo.md) | Accepted; implemented and verified | 001, 003 | -| 005 | [Annotations, measurements, and overlays](005-annotations-and-overlays.md) | Accepted, amended by 024/028 | 001, 002, 003 | -| 006 | [Public Viewer integration facade](006-viewer-integration-facade.md) | Accepted | 001, 003, 004, 005 | -| 007 | [Initial scope and verification](007-scope-and-verification.md) | Accepted | 001–006; Plugin 005 | -| 008 | [Serializable scene nodes and runtime adapters](008-scene-nodes-and-runtime-adapters.md) | Superseded by 013–014 | 001; verified round-trip regressions | -| 009 | [Explicit scene-state serialization fields](009-scene-state-fields.md) | Superseded in part by 013 | 008 | -| 010 | [Scene description, item bindings, and aggregation boundary](010-scene-description-and-item-bundling.md) | Accepted | 008, 009 | -| 011 | [Node-first scene construction and adapter lifetime](011-node-first-scene-adapters.md) | Superseded before acceptance | 008; 010 | -| 012 | [Explicit node-backed adapter state](012-explicit-node-backed-adapter-state.md) | Superseded before acceptance | 011 | -| 013 | [Hierarchy-only nodes and stable scene objects](013-hierarchy-nodes-and-stable-sceneobjects.md) | Accepted | Supersedes 008/009 placement; preserves 010 | -| 014 | [Context-keyed scene operation plugins](014-context-keyed-scene-operations.md) | Accepted | 013; replaces backend class registration | -| 015 | [Editable scene-object attributes](015-contextual-scene-form-contributions.md) | Accepted, amended | 013; respects 014 | -| 016 | [Contextual editable-attribute overrides and mutation](016-scene-form-field-bindings.md) | Accepted, amended | 015; respects 014 | -| 017 | [Lazy datastructure element-attribute tables](017-lazy-datastructure-attribute-tables.md) | Accepted; amended 2026-11-09 | 006; sidebar coordination | -| 018 | [Datastructure element-attribute editing](018-datastructure-attribute-editing.md) | Accepted | 017; 006/016 refresh ownership | -| 019 | [Configured Viewer identity](019-configured-viewer-identity.md) | Accepted | Independent | -| 020 | [Viewer configuration lifecycle and field audit](020-viewer-config-lifecycle-and-audit.md) | Accepted | 019; sidebar coordination with 017–018 | -| 021 | [Durable annotation ownership and schema](021-durable-annotation-ownership.md) | Accepted | 005; 010; 013–014; 028 | -| 022 | [Distance-dimension unit semantics](022-distance-dimension-units.md) | Accepted; amended by 044 on 2026-11-10 | 021; 027; 005; 020 | -| 023 | [Clean break for legacy Viewer annotations](023-annotation-clean-break.md) | Accepted | 021; 005 | -| 024 | [Measurement outcomes and persistence](024-measurement-outcomes-and-persistence.md) | Accepted | 005; 021–022; 026 | -| 025 | [Scale and legend overlay contracts](025-scale-and-legend-overlays.md) | Accepted; implementation note added 2026-11-09 | 005–006; 023 | -| 026 | [Measurement interaction and acquisition](026-measurement-interaction-and-acquisition.md) | Accepted; amended 2026-11-09 | 005; 024; 021–022; 003–004; 006; 027–028 | -| 027 | [Viewer measurement settings and UI](027-viewer-measurement-settings.md) | Accepted | 005; 020; 022; 026 | -| 028 | [Fixed and associative dimension anchors](028-dimension-anchor-modes.md) | Accepted | 005; 024; 021; 026 | -| 029 | [Persistent annotation collection and UI](029-persistent-annotation-collection-and-ui.md) | Accepted; extension-line-width amendment implemented and locally verified | 005; 010; 013; 021; 030; coordinates with 035 | -| 030 | [Always-visible persistent dimension rendering](030-always-visible-dimension-rendering.md) | Accepted | 005; 021; 024; 026; independent of 029 | -| 031 | [Spatial object deletion](031-spatial-object-deletion.md) | Accepted | 003–004; 010; 013; 028; annotation removal governed by 029 | -| 032 | [Three-domain Viewer sidebar](032-three-domain-viewer-sidebar.md) | Accepted; implemented and verified | Refines 003, 027, 029, and 031 | -| 033 | [Resizable Scene inspector and Details dialog](033-scene-inspector-details.md) | Accepted; scroll correction implemented and locally verified | Narrowly amends 032 | -| 034 | [Mesh-vertex snapping independent of vertex glyphs](034-hidden-vertex-snapping.md) | Accepted; implemented and independently reviewed | Amends 026; preserves 028 | -| 035 | [Distance-dimension spatial layout](035-distance-dimension-spatial-layout.md) | Accepted; extension-line-width amendment implemented and locally verified | Extends 021, 028–030; preserves 022 | -| 036 | [Viewport text ownership and persistence](036-viewport-text-ownership-and-persistence.md) | Accepted; programmatic, non-persistent initial scope | Extends 005 and 025; optional use of 037 | -| 037 | [Optional annotation label backgrounds](037-annotation-label-backgrounds.md) | Accepted; default-background amendment implemented and locally verified | Extends 021 and 029 | -| 038 | [Contextual Delete Selected](038-contextual-delete-selected.md) | Accepted; implemented and independently reviewed | Amends 032; preserves 029 and 031 primitives | -| 039 | [Scene-owned Add menu](039-scene-add-menu.md) | Accepted; implemented and independently reviewed | Consistent with 001, 013, 024, and 026 | -| 040 | [Default toolbar view shortcuts](040-default-toolbar-view-shortcuts.md) | Accepted; grouped viewport/measurement-menu amendment implemented and locally verified | Extends 006; amends 020 default visibility | -| 041 | [Grid and Units System section](041-grid-and-units-system-section.md) | Accepted; implemented and verified | Amends 027 and 032; preserves 020 | -| 042 | [Selected area and volume inspection](042-selected-area-and-volume-inspection.md) | Accepted; implemented and verified | Uses 003–004; extends 006 and 024; coordinates with 027/041 | -| 043 | [Built-in COMPAS Viewer theme](043-built-in-compas-viewer-theme.md) | Accepted; content-palette amendment implemented and locally verified | Preserves 019–020; covers 032, 040–041; amended by 046 | -| 044 | [Editing persistent distance-dimension format](044-editing-persistent-dimension-format.md) | Accepted; amended 2026-11-10, implemented and independently reviewed | Amends 022, 029, 032; clarifies 027, 041 | -| 045 | [Default viewport and content contrast](045-default-viewport-content-contrast.md) | Accepted baseline; superseded by implemented ADR 046 | Preserves 043; superseded by 046 | -| 046 | [Viewer scheme-aware content palette](046-viewer-content-palette.md) | Accepted; implemented and locally verified | Amends 043; supersedes 045; coordinates with 037 | -| 047 | [Editable parametric shape resolution](047-editable-parametric-shape-resolution.md) | Accepted; implemented, locally verified, independently reviewed, and native user-confirmed | Uses 002, 004, 015–016 | -| 048 | [Referenced Data domain](048-referenced-data-domain.md) | Accepted; implemented, locally verified, and independently reviewed | Preserves 001, 010, 013; reuses 017; extends 032 | -| 049 | [Viewer Settings surface](049-viewer-settings-surface.md) | Accepted on 2026-11-14; typed setup composition, implementation, local verification, and independent re-review pass | Amends 032 and 041; preserves 038, 040, 043, 046, and 048 | -| 050 | [Read-only Data item inspection](050-read-only-data-item-inspection.md) | Accepted on 2026-11-14; implemented and locally verified | Amends 048; reuses 017; preserves 018 | -| 051 | [Scene Object Details and settings boundary](051-scene-object-details-boundary.md) | Accepted on 2026-11-14; implemented and locally verified | Amends 033; preserves 015–016; uses 013 | -| 052 | [Executable Viewer documentation and example coverage](052-executable-viewer-documentation-and-example-coverage.md) | Accepted on 2026-11-14; implemented and locally verified | Documents implemented contracts; coordinates with 050–051 and authorizes no runtime change | - -ADRs 008–010 were accepted on 2026-11-07. ADR 010 refines ADR 008's item store -into non-owning runtime bindings and keeps aggregation outside Scene. A -redesigned Session is the likely aggregate under separate future approval. -ADRs 015–016 were accepted and amended on 2026-11-08. Durable semantic fields -declare editability on their existing `SceneStateField`; only non-state -attributes use `__editable_attributes__`. Context overrides remain runtime-only, -and public `FormField`, item-target, and core refresh-hook semantics are removed. -ADRs 017–020 were accepted on 2026-11-08 and implemented in the required order -ADR 019, ADR 020, ADR 017, then ADR 018 so configuration and sidebar ownership -were established before the attribute tables were added. Local verification, -independent review, and hosted Viewer and framework checks passed. ADR 003 now -has one Viewer-owned ordered object selection, with all interaction paths -migrated and scene-local mutation APIs removed. Local verification, -independent review, the hosted Viewer matrix, and refreshed framework checks -passed. ADR 004 now provides atomic world-space multi-object transforms, four -explicit refresh categories, and a private Viewer-level reversible transform -transaction stack. Local verification and independent review passed; refreshed -hosted Viewer, core, and framework checks passed. -ADRs 021–028 were accepted on 2026-11-08. Durable annotations live -in `compas.scene` and load without Viewer. Persistent dimensions snapshot the -declared Viewer unit and precision without implicit conversion. `Tag`, -`ArrowOverlay`, their aliases, and their serialized dtype paths are removed -rather than preserved through a compatibility layer. Viewer distinguishes live -transient inspection from persistent dimension annotation; persistent -completion creates one `DistanceDimension` with independently fixed or -associative anchors. Both UI modes use snapping, associative acquisition never -silently falls back, and removed components make anchors explicitly unresolved. -ADR 027 adds one Units and Measurement tab with editable Viewer unit and display -precision plus read-only global COMPAS tolerance. It neither restores the old -root unit nor mutates global tolerance; snapping governs correctness. -ADR 025 adds one ordered Viewer overlay layer, a camera-target scale bar, and -an ordered categorical legend without serialization or picking. Its -2026-11-09 implementation note records the transparent widget canvas used to -keep transient painting outside the OpenGL renderer. ADR 026 adds one -nearest-eligible-discrete-point query and one-shot transient and persistent -tool lifecycles. Its 2026-11-09 amendment exposes the hovered object's discrete -point palette, a distinct click winner, and the retained first anchor. -Direct-use refinement adds bright square markers, an 18-logical-pixel radius, -and same-object footprint depth qualification. Only visible Point, -Mesh-vertex, and Graph-node guides are eligible; every invisible line, edge, -face, and surface target is disabled. ADR 030 keeps persistent dimensions -visible in a separate final render pass. ADRs 029 and 031 were accepted on -2026-11-09. ADR 029 moves durable annotations out of the spatial hierarchy, -adds a flat Annotations UI, and separates semantic annotation data from a -narrow durable dimension style. ADR 031 exposes existing spatial deletion -through the default Edit menu while preserving subtree, independent-data, -history-invalidation, and unresolved-association behavior. Their implementation -and refreshed hosted verification passed. Direct-use evidence subsequently -showed that the shared splitter and mixed detail surfaces make the sidebar -unstable and ambiguous. Accepted ADR 032 records the approved three-domain -replacement. Its implementation, documentation, local verification, framework -direct-source gate, independent review, hosted package CI, and exact -source-installed framework gate pass. diff --git a/initiatives/scene-viewer-visualisation/inventory.md b/initiatives/scene-viewer-visualisation/inventory.md deleted file mode 100644 index de658b5..0000000 --- a/initiatives/scene-viewer-visualisation/inventory.md +++ /dev/null @@ -1,441 +0,0 @@ -# Scene, Viewer, and Visualisation Inventory - -Inventory date: 2026-11-07. - -## Audited checkpoints - -| Repository | Branch | Exact head | State | -|---|---|---|---| -| `compas-dev/compas` | `remove-future` | `99b82a6673ff7d05c1c323c8921135c274993f11` | Clean | -| `compas-dev/compas_viewer` | `c3-upgrade` | `cf5a5195bda840a511319d6b7201978af68c15e3` | Clean | -| `BlockResearchGroup/compas_model` | `c3-upgrade` | `83df4167f7ba1539ae205a837e0238afecc0a36b` | Clean | -| `compas-dev/compas_session` | `c3-upgrade` | `e0bdd02aa8490248c6f2f36042651d8ebfc4442b` | Clean | -| `compas-dev/compas_framework` | `initiative/scene-viewer-visualisation` | Based on `e797d49f77ac32b65371497a21925a02b7d048d8` | Clean before initiative documents | - -## Core scene infrastructure - -`compas.scene.Scene` owns a serializable tree, item and scene-object stores, -context selection, hierarchy mutation, drawing traversal, and glTF conversion. -`SceneObject` combines serializable visual configuration with context-adapter -factory dispatch, local/world transformations, renderer identifiers, and -manual cache invalidation. - -The global context registry maps item types to adapter classes and uses plugin -registration. Its lifecycle offers `clear`, `before_draw`, and `after_draw`, -but no renderer capability, event, change-notification, reverse-picking, or -incremental-update contract. Core has no common indexed render-buffer type. - -Core tests cover context registration, hierarchy, transformations, -serialization, glTF conversion, and scene ownership. They do not cover -selection, interaction state, undo, incremental redraw, overlays, or batched -render data. The visualisation introduction is stale in its use of `data`, its -transformation explanation, and its assumptions about available adapters. - -## Viewer architecture - -`Viewer` coordinates the Qt application, `ViewerScene`, renderer, -`ViewerState`, commands, events, and UI as a singleton. `ViewerScene` fixes the -context to `"Viewer"`, maps picking colors, and directly coordinates renderer -and sidebar updates. `ViewerSceneObject` converts items into point, line, -front-face, and back-face channels and reaches the active viewer through that -singleton. - -`BufferManager` efficiently batches ordinary objects into shared GPU-oriented -buffers and can update transforms without rebuilding topology. However, -`BufferGeometry` accepts expanded point, line-vertex, and triangle-vertex -arrays rather than shared vertices plus edge or triangle indices. Examples and -several adapters therefore duplicate vertices manually. `TessellationObject` -and `PolygonalSurfaceObject` already demonstrate indexed paths, but there is no -uniform public convenience layer. - -Viewport and scene-tree multi-selection exist. Selection is stored as mutable -`is_selected` flags on scene objects and synchronized by imperative refresh -calls. There is no separate observable selection model, selection-change -event, complete rectangle-deselection path, or common programmatic mutation -contract. - -Programmatic transforms and efficient transform-buffer updates exist, but -there is no object gizmo, transformation command, multi-object transform UI, -or defined undo contract. `Tag` and `ArrowOverlay` provide useful text and -arrow primitives, but the renderer special-cases their concrete classes. No -measurement, dimension, scale-bar, legend, or general overlay contract exists. - -`ViewerState` provides observable dotted-path access to persistent -configuration. Selection, active tools, gestures, scene mutations, and command -execution live elsewhere. Commands and UI definitions offer useful extension -points, but there is no comparable public dock composition API and no console, -terminal, assistant, or safe execution boundary. - -## Draft model integration evidence - -`compas_model` owns backend-neutral model scene adapters, Viewer-specific -adapters, a `ModelViewer` controller, NumPy-based `RenderGeometry`, quality -settings, a revision-aware CPU cache, hierarchy projections, selection, -inspectors, and contact layers. - -The draft treats `Model.tree` and rendered `Scene` hierarchy as separate. -remain separate. `ModelViewer` constructs and indexes the scene projection, -but reaches into concrete viewer sidebar and renderer APIs. Structural changes -are reconciled through explicit rebuilds rather than an observed projection -contract. - -Draft model render geometry preserves separate indexed filled triangles and visible -line segments, but Viewer-specific adapters expand some arrays back to Python -lists. This makes buffer ownership and reusable conversion responsibilities -unclear. Package tests and documentation describe the current controller, -including multi-selection, visibility, caching, contacts, and offscreen viewer -integration. They establish implementation evidence, not public behavior that -this initiative must preserve. - -## Adjacent packages - -`compas_session` persists a generic core scene, data, settings, and undo/redo -history, but it is not a reactive viewer/UI state store. Notebook and CAD-host -packages consume core scene contracts under different runtime constraints. -They should be checked for compatibility with approved core changes, but -implementation migration would broaden the initial initiative materially. - -## Framework evidence - -Package-local core and Viewer tests provide substantial evidence. Draft model -tests provide additional coupling and regression evidence. The -framework repository currently has no installed cross-package scene/viewer -test. The plugin initiative separately requires a coordinated installed -model/viewer registry and lifecycle test; this initiative should coordinate -that gate rather than duplicate it. - -Focused reconnaissance results: - -- Core scene/plugin/glTF suite: 53 passed; one non-authoritative cache-write - warning because the checkout cache directory was not writable. -- Viewer selection/state/tessellation/tag/overlay suite: 35 passed offscreen. -- Draft model integration behavior was inspected from its existing tests and - build workflow; no new model tests were run and those tests are not treated - as preservation requirements. - -## Principal gaps and risks - -1. Durable scene state, persistent configuration, and transient interaction - state do not have explicit ownership boundaries. -2. Renderer identity has no common reverse mapping to scene objects or domain - elements. -3. Scene mutations, selection, renderer updates, and UI refreshes use - distributed imperative paths. -4. Raw indexed buffers lack a uniform public input and batching contract. -5. Overlay rendering is coupled to concrete Viewer classes. -6. The draft model controller demonstrates coupling to private or concrete - Viewer structure, but its shape is not an architectural constraint. -7. Core appearance serialization and glTF export do not cover all visual - settings consistently. -8. Per-object pickability conflicts with batching for large auxiliary data. -9. Singleton coupling makes state, commands, rendering, and scene behavior - harder to test independently. -10. Scope can expand rapidly across notebook and host adapters unless initial - and compatibility-only packages are explicit. - -## 2026-11-10 direct-use toolbar and presentation evidence - -The latest direct-use retest confirms that the five standard-view buttons, -initial Camera section, and general presentation work. It also supplies -contrary evidence for the remaining Render Mode focus claim: choosing a mode -from the native macOS combo popup still does not reliably return interaction -focus to the viewport. - -The current popup tests do not reproduce that native path. They call -`hidePopup()` when synthetic interaction leaves the popup visible, which -forces the `Hide` event awaited by the implementation. A native popup can -close without sending that event to either cached watched object, leaving the -pending focus restoration stranded. - -Additional verified inventory: - -- `label_background` and `label_background_padding` already persist and render - for text-bearing annotations, but the Annotations details panel has no - controls for them; -- Core materializes white as the default scene-object color, and Viewer also - defaults its viewport background to white. ADR 043 intentionally prevents - the light/dark Qt theme from changing either content or renderer colors; -- the current P, T, F, R, and O SVGs are letter glyphs rather than pictorial - view assets, although the existing palette-aware SVG path can render - semantic monochrome assets; -- Zoom Selected, Zoom Extents, and Capture View already exist as registered - commands and View-menu actions; and -- the approved overlay canvas is paint-only and mouse-transparent. An - interactive fixed view list therefore needs private viewport chrome, not an - expansion of the public overlay layer. - -For the proposal, “view selection” is interpreted as the fixed Perspective, -Top, Front, Right, and Ortho choices. This interpretation remains an explicit -approval point. - -On 2026-11-10 the user approved that standard-view interpretation, the ADR 037 -and ADR 040 amendments, and ADR 045 option 1 with Viewer's fixed default -background set to `#D8DDE2`. Core's white default remains unchanged. - -The approved correction is implemented and locally verified. The Viewer suite -passes 596 tests with one expected offscreen OpenGL skip; six focused -corrected-contract tests and independent re-review pass. Ruff, formatting, -configured Pyright, strict MkDocs, `git diff --check`, and the direct-source -framework gate pass. Direct-use, hosted CI, and candidate artifacts remain -pending. - -## Scene state and serialization follow-up - -The current scene format is not ordinary `SceneObject` serialization. `Scene` -stores every domain item once by GUID and writes hierarchy nodes as an optional -item GUID, a free-form `settings` mapping, and children. Loading replays those -settings through `Scene.add`, which selects and constructs a runtime adapter -before the reconstructed hierarchy is complete. Multiple nodes can correctly -share one item, but node/adapter GUIDs are not preserved. - -Two regressions were reproduced at the audited heads: - -- a Viewer Box/ShapeObject translated by `[2, 0, 0]` reloads without its - transformation because `ViewerSceneObject.settings` replaces the base - mapping; `u=7`, `v=9`, and face color also reload as defaults; -- a `ModelViewer` scene fails to load because constructor replay uses - `ModelObject(add_elements=True)` before attachment, causing its child - creation to raise `RuntimeError: A detached scene object cannot own child - objects.` - -Unrestricted serialization introspection is unsafe. Concrete COMPAS objects -contain cycles, scene/item backreferences, GPU and picking identifiers, native -handles, lazy caches, derived NumPy buffers, and constructor commands. Public -properties can be computed or side-effecting, while persistent descriptor -values are often stored privately. Constructor signatures also lose inherited -state behind `**kwargs`. - -Introspection remains useful when applied to a closed declared schema: it can -validate readable fields, constructor compatibility, and editor metadata. It -cannot safely determine persistence from `__dict__`, public names, -annotations, properties, or constructor parameters alone. - -## Architecture questions - -1. Does core own only scene hierarchy and transformations, or also neutral - render primitives and change events? -2. Where do indexed buffers, picking identities, and reverse lookup live? -3. What observable state model unifies viewport, tree, and programmatic - selection without making UI state serializable scene data? -4. What change categories allow transform-only, style-only, geometry, and - hierarchy updates to remain efficient? -5. Which annotation and overlay objects are durable, transient, or both? -6. Which Viewer capabilities should be public because Viewer-owned tools and - components require them, independently of a draft domain controller? -7. What is the smallest safe extension boundary for docks, consoles, and - optional assistant integrations? -8. Which scene appearance semantics must serialization and glTF preserve? -# COMPAS Viewer theme follow-up - -The current public appearance contract is the closed -`Literal["system", "light", "dark"]` configuration field. Viewer applies a -complete palette to the application-wide Qt instance, observes operating-system -scheme changes for `system`, and currently forces the renderer background when -the effective appearance changes. Renderer background, selection, and grid -colors otherwise remain separately persisted configuration; scene objects, -annotations, measurements, legends, and overlays own their own presentation. - -There is no centralized theme or design-token module. Small component-local -stylesheets coexist with platform Qt typography. The pending System-section -refinement adds another local heading style. The packaged COMPAS application -icon and configurable icon override are already established, while remaining -UI icons are monochrome Font Awesome SVGs. FreeSans is packaged for rendered -annotation text, not registered as the Qt application font. - -The inspected Viewer, Core, and framework repositories do not declare an -authoritative COMPAS brand palette. MkDocs uses blue and light-blue Material -settings, and examples contain blue values, but neither is sufficient evidence -for organization-wide design tokens. Any exact light/dark palette therefore -requires an approved brand source or must be described narrowly as -Viewer-specific COMPAS styling. - -Relevant implementation and verification surfaces include -`compas_viewer.config.UIConfig`, `Viewer.set_appearance`, the View → Appearance -menu, component-local stylesheets, packaged icons, configuration and Viewer -tests, distribution checks, and native Qt rendering across supported -platforms. - -## 2026-11-11 grouped-control and palette findings - -The private viewport currently owns five labeled view buttons, while the -default toolbar owns four render-mode buttons plus Zoom Selected, Zoom Extents, -and Capture View. The existing View menu already provides the requested View -and View Mode groupings through stable commands and state paths. A private -viewport `QToolButton`/`QMenu` can reuse them without extending the public -mouse-transparent overlay layer. Existing Measure commands cover Inspect -Distance, Add Fixed Distance, Add Associative Distance, and Cancel. - -`ObjectSetting` still owns an inline read-only description textbox. Accepted -ADR 033 removes it in favor of a modal Details snapshot and adds independent -domain-local splitters for Scene hierarchy/details and Annotations -list/dimension-details. Neither splitter owns or resizes the other domain. - -Viewer-acquired dimensions currently inherit Core's transparent label -background. The narrow new-default boundary is interactive Viewer completion; -Core and general programmatic construction need not change. - -Core materializes concrete scene colors and serializes them without recording -whether they were omitted or explicit. Viewer therefore cannot safely invert -existing content during a scheme switch. The bounded option is to resolve -scheme-aware Viewer defaults at creation time, preserve explicit and -serialized values, and let only an automatic viewport follow later scheme -changes. Full live inversion requires a separately approved Core provenance -and schema design. - -The automatic viewport itself needs durable provenance. The accepted bounded design -uses Viewer configuration schema 4 with `backgroundcolor=None` as the only -automatic marker; all schema-3 concrete values migrate as explicit. Existing -Geometry, Mesh, Graph, and VolMesh uniform channels can apply scheme tokens -only when both base and specialized arguments are omitted. An explicit base -continues to drive Core's existing specialized-color derivation. Collections -and buffer-backed objects must retain current explicit/per-element behavior. - -## 2026-11-11 ADR 035 implementation checkpoint - -The amended deterministic distance-dimension spatial-layout contract is -Accepted. It adds durable signed world-space offset plus optional plane-normal -presentation, Scene schema 5 migration, displaced dimension and extension-line -rendering, and one atomic single-dimension Spatial Layout form. Unresolved -anchors retain ADR 028 behavior and never render cached or synthesized lines. -Dragging, construction-plane tools, collision avoidance, and multi-dimension -editing remain outside the approved initial scope. Core and Viewer -implementation, documentation, local verification, direct-source framework -integration, and independent review pass. Native direct use, hosted CI, and -candidate-artifact verification remain pending. - -## 2026-11-11 dimension-details refinement - -Direct use shows that the Annotations details widget is the splitter child -itself, with only an 80-pixel minimum height and no scroll viewport. Qt -therefore compresses the visible groups and fields when the lower splitter -allocation shrinks. The implemented, locally verified correction makes a vertical `QScrollArea` -the splitter child and keeps the complete details widget at its natural -minimum height. - -`DimensionStyle.line_width` already defaults to `3.0` and currently controls -the displaced dimension line and both extension lines. The Viewer form exposes -only that one width. The implemented, locally verified narrow amendment adds a durable -`extension_line_width` defaulting to `1.0` for new styles, with separate form -labels and rendering. Because the nested style payload is closed, preserving -legacy appearance requires versioned style data and migration from the legacy -stored `line_width`, not a Viewer-only multiplier. - -## 2026-11-11 parametric-shape resolution findings - -Resolution is already durable rather than fixed in Viewer. Core scene -`ShapeObject` and `SurfaceObject` store `u` and `v` with default `16`, Viewer -accepts and consumes them during polygonal conversion, and existing refresh -paths rebuild representation data and bounds. The missing contract is -editability and applicability filtering. - -Cone and Cylinder consume U only. Sphere and Torus consume U and V with a -minimum of `3`. Capsule consumes U at least `3` and even V at least `4`. -Parametric Surface consumes U and V at least `1`. Box ignores both, and the -current unknown-Shape conversion consumes neither. Accepted ADR 047 therefore -reuses existing fields, filters ineffective controls, and adds no alias or -schema change. Its implementation, local verification, and independent review -pass. A native macOS Torus U-resolution change from 16 to 64 passed in an exact -subprocess with valid OpenGL. A later interactive crash was diagnosed as Qt -emitter lifetime and fixed; direct user retesting remains pending. - -High-resolution direct use then showed slow line visibility changes. The -current edit route treats ShapeObject and SurfaceObject appearance settings as -full data changes: it regenerates representation data, rebuilds renderer -buffers globally, and refreshes the Scene tree. The renderer already exposes a -per-object settings-texture update path for visibility and scalar display -settings, so tessellation is unnecessary for `show`, `show_points`, -`show_lines`, `show_surfaces`, opacity, point size, and line width. In contrast, -`u` and `v` change topology and must retain the representation/buffer/bounds -rebuild. Colors currently use appearance data rather than the settings texture -and remain on that path for this amendment. - -The durable line fields describe a tessellation wireframe for ShapeObject and -SurfaceObject, but edges for MeshObject and GraphObject. The approved UI -wording therefore changes only the Shape/Surface labels to **Show wireframe**, -**Wireframe color**, and **Wireframe width**. It does not rename fields, add -aliases, or change serialization. - -The optimization and wording implementation passes the final 656-test Viewer -suite with two expected offscreen native-OpenGL skips, plus Ruff, formatting, -Pyright, strict documentation, and diff checks. Independent review passes. The -framework direct-source gate passes 15 tests with one expected exact-VCS skip. -The earlier exact native high-resolution Torus probe passes with native OpenGL, -and the Qt emitter-lifetime crash correction remains intact. Direct user -confirmation on 2026-11-11 passes: with Torus U resolution 64, **Show -wireframe** toggles off and on responsively, the wording is accepted, and the -resolution crash remains fixed. - -## 2026-11-11 referenced-data findings - -Every spatial scene object and annotation entry retains an item GUID, and -`Scene.item_store` exposes bound referenced items through one read-only, -non-owning runtime mapping. Shared references resolve to the same item instance; -unresolved GUIDs remain inspectable; bindings are pruned only after their final -scene reference disappears. The binding table is not serialized and rejects -unreferenced items. - -Viewer can derive a flat GUID-deduplicated inventory from public scene objects, -annotations, and `item_store` without changing Core ownership. Existing Object -Details provides safe parameter inspection, and ADR 017's lazy Mesh/Graph -models can support read-only attribute views. Editing from a deduplicated Data -surface would require refreshing every referring render object and is excluded -from accepted ADR 048. The user approved this narrow, read-only first step on -2026-11-11. Implementation, local verification, and independent review pass. -The final sidebar order is Scene, Data, Annotations, System. Direct object and -reference additions refresh the projection once without renderer work; -selection survives while its GUID remains referenced. Shared inspection avoids -arbitrary `__data__` and isolates individual attribute failures. Its source is -only the active Scene's references. A future Session ADR may replace or extend -that source with unattached or multi-scene data while keeping ownership outside -Viewer. - -The completed ADR 048 tree, including final removal, clearing, batched-deletion, -and Scene-name refresh regressions, passes 672 Viewer tests with two expected -offscreen OpenGL skips and 16 framework direct-source tests with one expected -exact-VCS skip. Ruff, formatting, Pyright, strict MkDocs, diff checks, and -independent review pass. Native user direct use, hosted CI, and -candidate-artifact verification remain pending. - -## 2026-11-14 Scene and Data inspection findings - -The accepted Scene and Data surfaces expose different partial views of the -same referenced content. - -`ObjectSetting` is the editing surface for the normalized attributes governed -by ADRs 015–016. It includes general editable values such as name and opacity, -Viewer-context contributions, and applicable type-specific durable state such -as Mesh display fields or Shape/Surface resolution. It intentionally excludes -noneditable state. Its modal Object Details snapshot currently shows name, -represented-item type, visibility, and safe represented-item parameters for -one selection; it does not show SceneObject identity, item identity, base -presentation, transformation, or declared noneditable type-specific scene -state. Multiple-selection Details shows only count, represented types, and -names. - -ADR 048's Data Details dialog shows identity, binding status, and all Scene or -Annotation references. For a bound general `Data` value it shows safe public -constructor parameters without reading arbitrary `__data__`. For Mesh and -Graph it currently shows the accepted lazy read-only element-domain tables -*instead of* the parameter table. It therefore does not provide one combined -view of parameters and component attributes. - -Every verified Core `Datastructure` owns a public ordered `attributes` mapping -for general attributes. Mesh and Graph additionally expose the declared -default-domain mappings and singular APIs already used by ADR 017's lazy -vertex/edge/face or node/edge tables. Data Details does not currently show the -general `Datastructure.attributes` mapping. General attributes supplied through -constructor `**kwargs` are intentionally not recovered by constructor-parameter -inspection. - -The existing component-table contract remains deliberately narrow: only Mesh -and Graph are supported, only declared default-attribute columns are shown, -effective values are read lazily, and sparse undeclared local attributes are -omitted. VolMesh, CellNetwork, arbitrary `Data` subclasses, and a generic -inspection registry have no accepted component-domain contract. - -Data is a GUID-deduplicated, non-owning projection. A shared item may have many -spatial and annotation referrers, while an unresolved row has no bound value to -inspect. Editing from Data would therefore require new ownership, validation, -atomicity, refresh-all-referrers, default/reset, and undo decisions that ADR -048 explicitly excludes. Read-only inspection can be expanded without any -Core API, serialization, schema, selection, or renderer-refresh change. diff --git a/initiatives/scene-viewer-visualisation/objective.md b/initiatives/scene-viewer-visualisation/objective.md deleted file mode 100644 index f1e0231..0000000 --- a/initiatives/scene-viewer-visualisation/objective.md +++ /dev/null @@ -1,113 +0,0 @@ -# Scene, Viewer, and Visualisation Initiative - -## Objective - -Establish a simple, coherent, and scalable visualisation architecture across -COMPAS core scenes and `compas_viewer`. Users should be able to visualise large indexed datasets, -select and transform objects consistently, add measurements and annotations, -and extend the viewer UI without coupling durable scene data to a particular -renderer or Qt widget hierarchy. - -The initiative should clarify ownership before adding features. Core scene -data, renderer-facing geometry, persistent configuration, transient tool and -selection state, and domain-specific controllers must each have one clear -home and contract. - -## Questions to resolve - -1. Which data and behavior belong to backend-neutral `compas.scene`, the - viewer renderer, viewer application state, and package-specific adapters? -2. What indexed point, line, and triangle buffer contract supports efficient - visualisation without requiring heavyweight core geometry objects? -3. How should selection, element picking, hover, and multi-selection be shared - by the viewport, scene graph, and programmatic consumers? -4. What mutation and undo contract supports single- and multi-object - transformations? -5. Which annotations, measurements, scale indicators, legends, and overlays - are durable scene data, and which are transient tool or UI state? -6. How should persistent configuration be separated from reactive session, - tool, and UI state? -7. Which stable extension boundary can support docks, consoles, terminals, or - optional assistants without embedding those concerns in core scene data? -8. Which public Viewer operations are required by its own tools, UI components, - and independent future consumers? -9. Which local, package, framework-integration, and artifact evidence is - required for each approved wave? -10. How can scene nodes reference independently serialized `Data` objects while - leaving optional aggregation to a separately designed Session? - -## Design principles - -- Keep core scene infrastructure backend-neutral. -- Preserve indexed data and batch rendering where possible; do not expand a - large edge or triangle set into one Python object per primitive. -- Keep raw NumPy-compatible buffers valid inputs without forcing conversion - through COMPAS geometry or data objects. -- Keep referenced `Data` independently serializable and algorithm-ready; keep - optional Session aggregation separate from Scene. -- Separate durable scene state, persistent viewer configuration, and transient - interaction state. -- Provide one observable selection path for viewport, scene graph, and code. -- Prefer explicit, small data contracts over renderer-specific base classes or - speculative extension frameworks. -- Keep plugin discovery graphics-free and optional UI/runtime imports lazy. -- Reuse accepted tessellation, typing, plugin, and repository-modernisation - contracts rather than duplicating them. -- Make high-level convenience APIs simple while keeping ownership and - performance costs visible. - -## Refined initial scope - -- `compas`: scene hierarchy, scene-object identity and transformations, and - any approved backend-neutral contracts. -- `compas_viewer`: render buffers, GPU lifecycle, viewport interaction, - selection, overlays, commands, and UI state. -- `compas_framework`: installed cross-package verification. - -## Deliverables - -1. A verified cross-package inventory and approved architecture decisions. -2. Clear ownership and state boundaries across core scene and Viewer runtime - concerns. -3. Efficient convenience APIs for indexed points, edges, and triangles. -4. Consistent observable selection and transformation contracts. -5. An extensible annotation, measurement, and overlay foundation. -6. Public integration boundaries for Viewer tools, components, and optional - UI extensions. -7. Package-local and framework-level tests, examples, and documentation. -8. Reference-only scene descriptions with deterministic GUID binding and - unresolved-reference behavior, plus a clear boundary for a separately - approved Session aggregate. - -## Non-goals without a later scope decision - -- Replacing the core plugin manager or accepted geometry conversion APIs. -- Making Qt, OpenGL, or viewer-specific state a core COMPAS dependency. -- Implementing a chatbot service, shell execution engine, or remote transport - before the UI extension and security boundaries are approved. -- Migrating notebook, Rhino, Grasshopper, or Blender adapters in the initial - wave. -- Turning `compas_session` into a general reactive application store without - a separate persistence decision. -- Preserving the current draft `compas_model.ModelViewer` controller shape or - behavior. It is a later redesign consumer, not an architectural constraint. -- Adding modeling functionality to the viewer or duplicating domain data - structures in the scene graph. - -## Dependencies - -- Geometry-tessellation ADRs 022 and 024 govern transfer-oriented - `Tessellation`, producer conversions, and representation-preserving mesh - triangulation. -- Typing-alignment decisions govern structural NumPy-compatible inputs. -- Plugin-implementations decisions govern lightweight Viewer-context - registration and leave coordinated model/viewer lifecycle evidence open. -- Repository-modernisation decisions govern package workflows and artifact - verification. - -## Current status - -Reconnaissance and architecture are complete. ADRs 013–014 are Accepted and -the scene architecture correction may proceed within the approved initial -scope before Phase 2 resumes. The current draft `ModelViewer` is evidence and -a later redesign target, not a contract. diff --git a/initiatives/scene-viewer-visualisation/proposal.md b/initiatives/scene-viewer-visualisation/proposal.md deleted file mode 100644 index 2a48566..0000000 --- a/initiatives/scene-viewer-visualisation/proposal.md +++ /dev/null @@ -1,1142 +0,0 @@ -# Scene, Viewer, and Visualisation Proposal - -## Summary - -Keep `compas.scene` responsible for durable, backend-neutral scene content and -hierarchy. Put indexed render buffers, picking, selection, transient state, -tools, overlays, GPU synchronization, and UI composition in `compas_viewer`. -Expose only the public operations required by Viewer-owned tools and UI -components. Future integrations may consume that boundary after it is proven. - -The first implementation wave should establish these boundaries and deliver -object selection, efficient indexed geometry, multi-object transforms, -measurements, annotations, scale/legend overlays, and public dock/command -composition. It should not attempt a universal renderer API, a generic reactive -framework, sub-object editing, a shell, or host-application migration. - -ADRs 013–014 are Accepted, implemented, and verified. Session redesign and -Viewer/Session convenience operations remain later work. - -ADRs 015–016 authorize one normalized editable-attribute mapping composed from -editable `SceneStateField` entries, narrowly declared non-state attributes, -and runtime-only contextual overrides. The earlier `FormField` implementation -was replaced; the amended core and Viewer implementation is independently -approved and green in package and exact-candidate integration CI. - -ADRs 017–020 authorize lazy datastructure element-attribute tables and editing, -configured Viewer identity, and an explicit configuration lifecycle/field -audit. Their implementation is verified locally and in hosted Viewer and -framework CI. ADR 003 object selection is also fully verified. ADR 004 -transformations, categorized refresh, and Viewer-level transform history is -implemented, independently approved, and verified locally and in hosted core, -Viewer, and framework CI. - -ADRs 029 and 031 are implemented and verified locally and in hosted package -and exact source-installed integration CI. Direct use then exposed a sidebar -composition problem: one stacked splitter presents spatial, annotation, and -system contexts simultaneously, redistributes unrelated panels, and hides -annotation naming and global deselection behavior. Accepted ADR 032 responds -with three stable top-level domains while preserving separate spatial and -annotation selection models. Its implementation and local verification pass; -hosted package and exact source-installed integration verification also pass. - -## Direct-use follow-ups - -Direct use after ADR 032 identifies seven independent refinements. ADRs 033–034 -and 036–039 are Accepted and implemented. ADR 035 is implemented, locally -verified, and independently reviewed: - -- keep the three-domain root; introduce independent Scene and Annotations - splitters; remove the inline description textbox and expose its information - through a modal Details dialog; -- separate normal Mesh vertex glyph visibility from measurement acquisition by - rendering an invisible measurement-only vertex footprint; -- store a distance dimension's signed world-space offset and captured plane - normal as durable scene presentation, without storing a full construction - plane or changing the measured value; -- treat text pinned to a viewport location as a Viewer overlay in normalized - screen coordinates; initially expose only programmatic add/remove and keep - it outside Scene serialization unless a future Session/view-state decision - and management surface explicitly provide persistence and interactive - authoring; -- add only optional background color and logical-pixel padding to labels, - without introducing a typography or theme abstraction; -- make Delete Selected dispatch to the selection owned by the current - interaction domain, never to both spatial and annotation selections; and -- move the existing geometry creation hierarchy from top-level Add to - **Scene → Add**, while keeping measurement acquisition tools under Measure. - -The spatial dimension offset records only the plane normal needed for stable -layout. A reusable construction plane is an authoring aid and should be -designed separately rather than embedded in each dimension. Viewport text -persistence is likewise deferred to the separately proposed Session/view-state -boundary; configuration and Scene are not suitable owners. - -Further UI and measurement feedback produces three additional independent -proposals: - -- populate and show the default toolbar with a synchronized Render Mode - selector and five exclusive standard-view buttons using the existing - commands and Viewer state; -- replace Units and Measurement with Grid and Units, remove tolerance from the - Viewer UI without changing global COMPAS tolerance, and align every System - form on one two-column field layout; and -- add transient selection-driven area and volume inspection using represented - items' public scalar APIs and exact supported world-transformation rules, - without tessellation fallback or persistent annotations. - -If accepted together, establish the final System ownership and layout first, -then add the synchronized toolbar controls, then add the independent area and -volume inspections. - -## Accepted COMPAS Viewer theme structure - -Treat COMPAS as Viewer's one built-in visual theme and retain `system`, -`light`, and `dark` as color-scheme choices. `system` continues to follow the -operating system; the other values force the corresponding COMPAS theme -variant. Do not add a fourth appearance value, a separate public theme field, -arbitrary stylesheet loading, or a theme registry while no second selectable -theme is required. The configuration shape and schema version remain -unchanged. - -The initial theme owns Qt application chrome only. A private semantic token -module supplies complete light and dark palettes and, only where palette roles -are insufficient, one narrow application stylesheet. Renderer background, -selection, and grid colors and all scene, annotation, measurement, legend, and -overlay presentation retain their existing owners. Appearance switching stops -overwriting the renderer background, so explicit viewport choices survive -theme changes. - -Retain the platform UI font, packaged COMPAS application icon, configurable -icon override, and existing monochrome icons. A new font or icon family is a -separate asset, licensing, fallback, and accessibility decision. Reconcile the -current System-section heading refinement with the private theme without -creating a public typography or spacing framework. - -The inspected repositories do not define an authoritative COMPAS brand token -table. The approved implementation therefore uses ADR 043's Viewer-specific -palette without claiming organization-wide brand authority. Its exact tokens -and contrast requirements were approved on 2026-11-10. Native macOS, Windows, -and Linux visual verification remains part of rollout. ADR 043 records the full -alternatives, compatibility implication, and verification contract. - -## Accepted persistent-dimension format editing - -Keep **Grid and Units** as the presentation default for transient measurements -and dimensions created afterward. Do not retroactively rewrite existing -dimensions. Instead, expose **Coordinate Unit** and **Display Precision** in a -separate **Measurement Format** group when exactly one resolved -`DistanceDimension` is selected in Annotations. - -Core gains validated mutable properties for the already serialized unit and -precision fields. Viewer mutates only the selected dimension and refreshes only -its annotation render layer. Precision uses one shared Core and Viewer domain -of 0–15 inclusive; values outside it raise `ValueError` and are never clamped -or truncated. Units remain declaration-only and perform no conversion. -Explicit labels remain verbatim overrides without bypassing validation. -Existing data or configuration above 15 is rejected without migration or a -schema change. No bulk editor, unit registry, or generic property abstraction -is introduced. -ADR 044 records the complete ownership, validation, and verification contract. -Implementation is present in the Core and Viewer working trees: validated -property assignment and selected-entry Measurement Format controls preserve -the separate ownership of durable snapshots and Viewer defaults. Local -verification and independent review pass. - -## Proposed three-domain sidebar amendment - -Replace the shared vertical splitter with one full-height tab widget containing -Scene, Annotations, and System. Scene owns the hierarchy and selected spatial -object details. Annotations owns the ordered annotation list and an explicit -selected-annotation detail form. System owns Camera, Display, and Units and -Measurement sections. Ordinary layouts provide stable master/detail space; -selection updates must not resize or rebuild unrelated domains. - -Spatial and annotation selections remain independent and can coexist. Tab -changes preserve both. Spatial picking changes only spatial selection and the -annotation list changes only annotation selection. An unmodified empty -viewport click clears both. Escape cancels an active measurement first and -otherwise clears both, while focused editors retain their local Escape -behavior. Annotation and spatial deletion remain separate operations. - -The annotation detail form makes Name editing explicit and presents Type and -the supported narrow dimension style without embedding those controls in the -list. Commands navigate with `sidebar.set_current_tab`, accepting only Scene, -Annotations, or System, and `sidebar.focus_system_section`, accepting only -Camera, Display, or Units and Measurement. Unsupported identifiers raise -`ValueError`; focusing a system section first activates System. The optional -datastructure inspector remains absent by default and routes to Scene when -explicitly configured. The existing Viewer configuration schema, Core Scene -schema, and optional sidebar component types remain unchanged. - -## New evidence requiring amendment - -- A Viewer Box/ShapeObject local translation `[2, 0, 0]` reloads as - `transformation is None` because `ViewerSceneObject.settings` replaces core - settings. A headless ShapeObject with `u=7`, `v=9`, and a face color reloads - with resolution defaults `16`, `16`, and the default face color. -- A ModelViewer scene fails while loading. Runtime factory dispatch constructs - `ModelObject` with its default `add_elements=True`; it calls `self.add` - before attachment and raises `RuntimeError: A detached scene object cannot - own child objects.` The original controller deliberately used - `add_elements=False` and `add_children=False`. Render settings and caches are - absent too, but caches are transient and should stay out of scene files. -- Shared item identity survives through the item GUID store. Scene-object GUIDs - do not survive, so they cannot yet serve as the durable identity assumed by - ADR 001. - -## Recommended architecture - -### Durable scene content and runtime adapters - -Core `Scene` remains the backend-neutral serializable hierarchy, but its -durable entries become scene-owned node/state value objects rather than runtime -`SceneObject` adapters. Nodes preserve their own GUID, optional item GUID, -local transformation, hierarchy, visibility, base appearance, and explicitly -declared extension state. Runtime item bindings preserve shared identity -without making Scene the owner or serialization container of those items. - -Runtime `SceneObject` instances bind a complete node and item to a chosen -visualization context. They are not serialized identities and may be created -only after deserialization has rebuilt the hierarchy and resolved the required -item bindings. -Their constructors do not populate hierarchy. Scene context is runtime binding -configuration; absence of a backend cannot prevent loading durable content. - -Durable node GUIDs are the stable boundary between scene content and Viewer -state. Renderer pick IDs remain short-lived Viewer mappings and are never -serialized. Unknown namespaced adapter state remains inactive but round-trips -without importing that adapter. - -Base node state uses a closed core schema. Additional durable fields use -explicit MRO-composed declarations. Introspection may validate declarations -and support editors, but `__dict__`, public properties, annotations, and -constructor parameters never define persistence automatically. - -### Scene descriptions, item bindings, and aggregation - -Durable scene nodes reference items by stable item GUID. Serialized `Scene` -contains the visual node hierarchy and state but does not require referenced -`Data` objects to live inside it. At runtime Scene binds already loaded objects -to those GUIDs without taking exclusive ownership; the same object remains -independently serializable and directly usable by algorithms. - -A separately loaded description may contain unresolved references. Its -hierarchy and node state remain inspectable, and callers can bind items later. -All nodes sharing one GUID resolve to the same bound instance. Item-dependent -adapter, draw, and packaging operations fail precisely when the required GUID -is unresolved. - -A redesigned `compas_session.Session` is the likely optional aggregate for -independently serialized data, one or more scene descriptions, settings, -history, and their shared identity. Its design and implementation require a -separate dependent decision and scope approval; this initiative does not add a -redundant one-scene `SceneBundle`. Scene remains usable without Session. - -Do not add URI resolution, filesystem search, network loading, or an asset -registry without a concrete future requirement. - -### Indexed render geometry - -`compas_viewer` owns one public indexed `BufferGeometry` contract: - -```python -geometry = BufferGeometry( - vertices=vertices, - points=point_indices, - edges=edge_indices, - triangles=triangle_indices, -) -``` - -Vertices accept the approved structural numerical input, including Python -sequences and NumPy arrays. Index channels are optional and retain their -connectivity. Convenience constructors cover the common direct cases: - -```python -BufferGeometry.from_points(vertices) -BufferGeometry.from_vertices_and_edges(vertices, edges) -BufferGeometry.from_vertices_and_triangles(vertices, triangles) -``` - -Construction normalizes each supplied channel once to the Viewer's required -NumPy dtype and validates only rank, column count, and index bounds. It does -not create `Mesh`, `PolygonalSurface`, `Tessellation`, or one object per -primitive. Styling stays on the scene object; a separate color-buffer decision -is required only when current uniform/per-item styling proves insufficient. - -Existing Viewer adapters should return indexed channels to the buffer manager -instead of expanding geometry. Geometry producers continue to use their approved -`to_tessellation` and `to_polygonal_surface` APIs; this Viewer contract does -not become a geometry-algorithm input. - -### Viewer state and selection - -Separate three state classes: - -| State | Owner | Persistence | -|---|---|---| -| Scene items, hierarchy, local transformations, durable appearance | `compas.scene` | Scene serialization | -| Viewer defaults, appearance, key bindings, layout preferences | `Viewer.config` | Viewer configuration | -| Selection, hover, active tool, gestures, and transient tool results | `Viewer.state` | Session-only | - -`Viewer.state.selection` is the one object-selection model. It stores ordered -scene-object GUIDs and exposes replace, add, remove, toggle, clear, and query -operations plus one change notification. Viewport picking, rectangle -selection, the scene tree, commands, and programmatic consumers all mutate -this model. -The current mutable and serialized `ViewerSceneObject.is_selected` path is -removed rather than retained as a second authority. - -Initial selection is object-level. The architecture reserves no generic -component-token schema; vertex, edge, face, or domain-element selection should -be proposed when a concrete editing workflow requires it. - -The state implementation should be a small Python model with a Qt bridge, not -a generic observable dictionary or third-party reactive framework. The -renderer reads selection state when updating its per-object settings buffer. - -### Transformations and undo - -Core transformations remain authoritative. Viewer exposes one public -multi-object transformation operation and uses it from code, commands, and a -future gizmo: - -```python -viewer.transform_objects(objects, transformation, space="world") -``` - -The initial operation applies one world-space delta to every selected object's -pre-operation world transformation. For each object, Viewer derives the new -local transformation from its parent world transformation. Ancestor/descendant -pairs in one request are rejected initially because applying the same delta to -both is ambiguous. Invalid targets leave all objects unchanged. - -Every successful call is one transaction containing the before and after local -transformations. A small Viewer undo stack handles these explicit reversible -transactions. Existing callback commands remain valid; only mutating commands -that implement the reversible transaction contract enter history. This does -not move general application/session history into Viewer or `compas_session`. - -Viewer retains explicit refresh operations for geometry, appearance, -transform, and hierarchy changes. The initial wave does not add a generic core -scene event bus: direct external mutation still requires the corresponding -public Viewer refresh call. This keeps synchronization costs explicit and -avoids making all core scene properties observable. - -### Annotations and overlays - -Use two explicit paths: - -- World-anchored annotations are serializable scene items with Viewer scene - adapters. The initial types are text annotation and distance dimension. A - distance dimension stores its two world anchors, display unit/precision, and - optional label override; its measured value is derived, not duplicated. -- Screen-space overlays are transient Viewer UI objects. The initial types are - scale indicator and legend. They are not scene items and do not participate - in scene serialization or picking unless a later requirement says so. - -Existing `Tag` and `ArrowOverlay` should be aligned with these two paths rather -than leaving concrete-class checks in the renderer. Do not introduce a -framework-wide overlay registry. One Viewer-owned world-annotation adapter -path and one Viewer overlay layer are sufficient for the approved types. - -The measurement tool owns temporary pointer/preview state in `Viewer.state`. -Completing a measurement creates a durable distance-dimension scene item; -cancelling it leaves no scene mutation. - -### Public Viewer operations - -Expose the small set of operations that Viewer-owned commands, tools, and UI -components need without coupling them to renderer or widget internals: - -- `viewer.scene` for durable content; -- `viewer.state.selection` for selection; -- `viewer.refresh_geometry`, `refresh_appearance`, `refresh_transform`, and - `refresh_hierarchy` for explicit synchronization; -- `viewer.transform_objects` and undo/redo; -- public command registration and menu placement; -- public dock addition/removal using Viewer component/widget content; and -- public annotation and overlay addition. - -These operations are justified and tested inside Viewer. They are not designed -around the current draft `compas_model.ModelViewer`. That controller may be -redesigned freely in a later consumer phase, at which point it can use the -small proven Viewer boundary or motivate a separately approved addition. - -A console, terminal, or assistant can later occupy a public dock and invoke -registered commands, but arbitrary code execution, shell access, credentials, -remote transports, and assistant policy are explicitly outside this wave and -require a security decision. - -## Alternatives and tradeoffs - -### Put render buffers in core - -Rejected for the initial wave. Core would gain renderer-oriented dtype, -channel, and update assumptions while notebook and host backends have not -demonstrated a shared contract. Structural geometry inputs and `Tessellation` -already cover neutral transfer needs; GPU-ready batching belongs to Viewer. - -### Use scene-object flags as selection state - -Rejected. It makes transient interaction state serializable, requires every UI -to poll/mutate objects, and leaves viewport, tree, domain controller, and -renderer synchronization distributed. - -### Add a universal reactive store and scene event bus - -Rejected for the initial wave. It adds a second application framework and -forces observability into core without established semantics for arbitrary -item mutation. Explicit state models and refresh categories satisfy current -requirements more transparently. - -### Make all annotations screen overlays - -Rejected. Measurements and world labels need world anchors, scene hierarchy, -transformations, and persistence. Conversely, scale indicators and legends are -view-dependent and should not become durable geometry. - -### Standardize every visualisation backend now - -Rejected. Notebook and CAD hosts are important compatibility consumers, but -their runtime and rendering models differ. The first wave should avoid breaking -their core scene contracts and record follow-up work only after the Viewer -design is proven. - -## Compatibility implications - -- Removing `ViewerSceneObject.is_selected` is a deliberate Viewer API break. - Commands, tree widgets, shaders, and tests migrate in one coordinated change; - no writable compatibility alias remains. -- `BufferGeometry` construction changes from expanded channel vertices to - shared indexed vertices. Current examples and adapters migrate together. - A deprecated parallel constructor is not proposed. -- Existing core scene serialization is not sufficient for the approved - architecture. ADRs 008–009 define a new explicit node schema without a - compatibility loader for existing scene files. ADR 010 separates - reference-only descriptions from a possible future Session aggregate; its - accepted replacement is implemented and verified. -- Current `Tag` and `ArrowOverlay` data may require a documented migration to - the accepted annotation/overlay types. Exact compatibility should be checked - against serialized fixtures before implementation; do not silently reinterpret - ambiguous old data. -- The current draft `compas_model.ModelViewer` behavior, hierarchy projections, - selection behavior, controller shape, and cache arrangement are not - compatibility requirements. Its failure remains evidence for the scene - reconstruction problem, and its redesign is deferred. -- Viewer plugin discovery remains graphics-free and function-local under the - accepted plugin ADRs. - -## Affected packages - -| Package | Responsibility | -|---|---| -| `compas` | Preserve scene identity, hierarchy, transformations, durable appearance, and serialization; clarify stale documentation. | -| `compas_viewer` | Implement indexed buffers, state/selection, transforms/history, annotations, overlays, facade, rendering, and UI. | -| `compas_model` | Later redesign consumer and regression evidence; no current draft controller behavior is preserved by this wave. | -| `compas_framework` | Pin exact candidates and verify installed cross-package scene, plugin, selection, transform, and buffer behavior. | - -`compas_session`, `compas_notebook`, Rhino, Grasshopper, and Blender are -compatibility-reviewed but not implementation targets in the initial wave. - -## Tests and examples - -### Core - -- Preserve scene serialization, shared-item identity, hierarchy, and local/ - world transformation tests. -- Add the verified Viewer transformation/ShapeObject settings regression. - Preserve the ModelViewer detached-child failure as evidence and cover its - core failure mode with a minimal adapter whose constructor must not run - during hierarchy deserialization; the draft controller itself is deferred. -- Preserve durable node GUIDs separately from shared item GUIDs and round-trip - unknown namespaced extension state without its runtime adapter. -- Load independently serialized items, bind them to reference-only scene - descriptions, preserve shared identity, and verify unresolved-reference - behavior without Session. -- Add regression coverage proving transient Viewer state is absent from core - scene data and serialization. -- Correct and test the core scene/visualisation guide against current APIs. - -### Viewer - -- Accept list and NumPy vertices/indices; verify shapes, bounds, dtypes, - non-mutation, and retained indices. -- Compare large indexed edge/triangle input with expected buffer counts and - assert it does not create one scene object per primitive. -- Exercise selection replacement/add/remove/toggle from viewport, tree, and - code through the same observable model. -- Verify renderer picking IDs resolve to scene GUIDs and are not serialized. -- Test world-space multi-object transforms, parent conversion, atomic failure, - undo/redo, and ancestor/descendant rejection. -- Test distance derivation, unit/precision formatting, tool cancel/complete, - annotation serialization, and transient overlay non-serialization. -- Test public dock/command composition without importing optional integrations - during plugin discovery. - -### Framework and later consumers - -- Use the current draft ModelViewer load failure as regression evidence for - two-phase scene reconstruction, not as a public behavior suite. -- Add an installed exact-candidate test for core Scene and Viewer contracts. -- Redesign and verify model integration only in a later approved consumer phase. -- Keep candidate-artifact evidence separate from source-build integration. - -Examples remain direct scripts and demonstrate, in order: - -1. vertices and edges; -2. vertices and triangles; -3. shared indexed geometry with selection; -4. multi-object transformation and undo; -5. distance measurement and world annotation; and -6. scale/legend overlays and a custom dock. - -## Dependency order - -```text -ADR 001 --> ADR 008 --> ADR 009 --> ADR 010 - | - +--------> ADR 002 - +--------> ADR 003 --> ADR 004 - -ADRs 001–003 ----------> ADR 005 -ADRs 001, 003–005 -----> ADR 006 -ADRs 001–010 ----------> ADR 007 rollout gate -``` - -Core geometry, typing, plugin, and repository-modernisation decisions remain -upstream constraints. Implementation starts only after all ADRs required for a -wave are Accepted. - -## Architecture correction after Phase 1 - -Implementation evidence invalidates the detached/bound adapter mechanism used -for the first implementation of ADRs 008–009. It duplicates provisional and -node state, changes GUID meaning at binding, and requires hidden attribute -interception. Removal and context replacement can expose stale values on old -adapter references. Backend class substitution adds another ambiguity: the -type returned for one scene entry depends on which visualization plugins are -installed and selected. - -The preferred correction assigns one purpose to each concept: - -- `SceneNode` stores only ordered hierarchy through a scene-object GUID; -- stable backend-neutral `SceneObject` values own item references, identity, - transformation, appearance, visibility, and semantic type-specific state; -- independently serialized `Data` items remain external and bind by GUID; and -- visualization backends register context-keyed `draw` and `clear` functions - rather than replacement scene-object classes. - -`scene.add(data, ...)` remains the primary convenience path and returns the -stable scene object. One node is allowed per scene object; repeated appearances -of one item use multiple scene objects. The scene-object GUID is the hierarchy -key, so there is no second durable node identity. A scene serializes stable -object records plus a hierarchy of GUID references and loads without any -backend installed. - -The general COMPAS plugin dispatcher cannot select a `draw` implementation -from an invocation's explicit visualization context. The preferred design does -not complicate it. Lightweight discovery plugins populate a small scene -operation registry keyed by `(context, scene-object type, operation)`. Runtime -buffers, host handles, picking state, and caches live outside durable objects. - -ADRs 011–012 record the unaccepted first node-first alternative. Accepted ADRs -013–014 record the selected design, which is now implemented and verified. - -## Accepted editable scene-object declarations - -Durable semantic fields use their existing `SceneStateField` as the single -source of persistence and editability. That field gains only `editable=False` -and an optional synchronous atomic data-side `update(owner, value) -> None` -callback; providing `update` while not editable is invalid. Ordinary mutation -uses `setattr`. - -`SceneObject.__editable_attributes__` is reserved for genuinely editable -non-state attributes, initially `name` and `opacity`. Its values are only -optional update callbacks. `SceneObject.editable_attributes()` composes both -sources base-to-derived into one ordered `name -> optional callback` mapping -without duplicating subclass state-field names. Core contains no labels, -editors, arbitrary data, form identifiers, refresh categories, or context -metadata. Viewer infers presentation and does not maintain a parallel built-in -field list or expose public `FormField` values. - -Graphics-free context plugins may extend, replace, or remove entries through -the same mapping. They compose general-to-specific by stable scene-object MRO. -Their key is `(context, stable SceneObject type, contribution ID)`. Within each -MRO specificity, contributions apply by lexical contribution ID while -preserving mapping insertion order. Duplicate exact registrations and -same-specificity edits or removals of one attribute are errors rather than -load-order overrides. Contributions and resolved mappings are runtime-only and -never serialized. - -After a successful mutation, Viewer exclusively decides whether to rebuild -render data, redraw, and refresh UI. Context plugins only modify neutral -editable-attribute declarations. Core contains no refresh callback, refresh -category, or context protocol. Failed mutation restores the control and -triggers no view refresh. - -The initial scope is only stable scene-object attributes in object settings. -Represented-item parameters remain on the existing `ParameterForm` path. The -amended ADRs explicitly supersede the earlier public `FormField`, item-target, -and field-level refresh design and the first uncommitted separate -`EditableAttribute` declaration design. The replacement is implemented and -verified. - -## Accepted datastructure element-attribute tables - -Viewer may add lazy `QAbstractTableModel` views for Mesh and Graph element -attributes without changing core. Domains and columns come from existing -`default_*_attributes` mappings and matching singular APIs. Default mapping -insertion order defines columns; sparse undeclared attributes are not scanned -or shown. Tabs exist only for domains with declared attributes. - -The accepted editing contract supports Boolean, integer, float, and text -defaults. Other types are read-only. Cells show effective values, mutate -through singular setters, and reset through singular unset operations. Table -selection remains local, and Viewer refreshes conservatively after successful -mutation. Default-schema editing, sparse-column discovery, batch editing, -undo, and viewport component selection remain outside the first version. - -## Accepted Viewer identity and configuration lifecycle - -The existing `WindowConfig.title` should consistently supply Qt application -name, display name, and window title. `icon=None` selects the packaged icon; -otherwise the icon is an absolute path. Identity and window behavior are -startup-only, fullscreen is honored, and configuration is applied before Qt -application construction. This identity decision is independent of schema -migration and unrelated field cleanup. - -Viewer should retain nested dataclasses and gain explicit path-aware -validation rather than Pydantic, arbitrary plugin dictionaries, or a reactive -configuration promise. Schema version 2 connects fullscreen and status-bar -visibility; removes `about`, obsolete sidebar fields, renderer `opacity`, and -the duplicated `display` group; removes root `unit` until a unit-aware workflow -has an approved owner and lifecycle; adds `ortho` to renderer view choices; and -keeps active `vectorsize`. Schema-1 migration drops known retired fields, -preserves retained values, and rejects unknown fields; schema 2 rejects -explicit retired fields. Typed Viewer subclasses may add typed dataclass -configuration fields with their own validation. Direct mutation is setup-time -only, replacing `viewer.config` is unsupported, and dotted-path `ViewerState` -access is transitional rather than an extension API. - -## Architectural watchpoint - -The user has reserved judgment on whether the overall relationship between -`Data`, durable scene state, and extension mechanisms is the final model. The -current Accepted ADRs remain authoritative and implementation should proceed -as specified. If implementation evidence exposes duplicated ownership, -non-transparent extension paths, forced representation changes, or another -concrete mismatch, bring that evidence back for an explicit amendment or new -decision. Do not preemptively reopen the accepted architecture or add a -speculative replacement model. - -## Decision record - -1. [ADR 001 — Ownership and state boundaries](decisions/001-ownership-boundaries.md) -2. [ADR 002 — Indexed Viewer buffer geometry](decisions/002-indexed-buffer-geometry.md) -3. [ADR 003 — Viewer state and object selection](decisions/003-viewer-state-and-selection.md) -4. [ADR 004 — Transformations, refresh, and undo](decisions/004-transform-refresh-undo.md) -5. [ADR 005 — Annotations, measurements, and overlays](decisions/005-annotations-and-overlays.md) -6. [ADR 006 — Public Viewer integration facade](decisions/006-viewer-integration-facade.md) -7. [ADR 007 — Initial scope and verification](decisions/007-scope-and-verification.md) -8. [ADR 008 — Serializable scene nodes and runtime adapters](decisions/008-scene-nodes-and-runtime-adapters.md) -9. [ADR 009 — Explicit scene-state serialization fields](decisions/009-scene-state-fields.md) -10. [ADR 010 — Scene description, item bindings, and aggregation boundary](decisions/010-scene-description-and-item-bundling.md) -11. [ADR 011 — Node-first scene construction and adapter lifetime](decisions/011-node-first-scene-adapters.md) -12. [ADR 012 — Explicit node-backed adapter state](decisions/012-explicit-node-backed-adapter-state.md) -13. [ADR 013 — Hierarchy-only nodes and stable scene objects](decisions/013-hierarchy-nodes-and-stable-sceneobjects.md) -14. [ADR 014 — Context-keyed scene operation plugins](decisions/014-context-keyed-scene-operations.md) -15. [ADR 015 — Editable scene-object attributes](decisions/015-contextual-scene-form-contributions.md) -16. [ADR 016 — Contextual editable-attribute overrides and mutation](decisions/016-scene-form-field-bindings.md) -17. [ADR 017 — Lazy datastructure element-attribute tables](decisions/017-lazy-datastructure-attribute-tables.md) -18. [ADR 018 — Datastructure element-attribute editing](decisions/018-datastructure-attribute-editing.md) -19. [ADR 019 — Configured Viewer identity](decisions/019-configured-viewer-identity.md) -20. [ADR 020 — Viewer configuration lifecycle and field audit](decisions/020-viewer-config-lifecycle-and-audit.md) -21. [ADR 021 — Durable annotation ownership and schema](decisions/021-durable-annotation-ownership.md) -22. [ADR 022 — Distance-dimension unit semantics](decisions/022-distance-dimension-units.md) -23. [ADR 023 — Clean break for legacy Viewer annotations](decisions/023-annotation-clean-break.md) -24. [ADR 024 — Measurement outcomes and persistence](decisions/024-measurement-outcomes-and-persistence.md) -25. [ADR 025 — Scale and legend overlay contracts](decisions/025-scale-and-legend-overlays.md) -26. [ADR 026 — Measurement interaction and acquisition](decisions/026-measurement-interaction-and-acquisition.md) -27. [ADR 027 — Viewer measurement settings and UI](decisions/027-viewer-measurement-settings.md) -28. [ADR 028 — Fixed and associative dimension anchors](decisions/028-dimension-anchor-modes.md) -29. [ADR 029 — Persistent annotation collection and UI](decisions/029-persistent-annotation-collection-and-ui.md) -30. [ADR 030 — Always-visible persistent dimension rendering](decisions/030-always-visible-dimension-rendering.md) -31. [ADR 031 — Spatial object deletion](decisions/031-spatial-object-deletion.md) -32. [ADR 032 — Three-domain Viewer sidebar](decisions/032-three-domain-viewer-sidebar.md) -33. [ADR 033 — Resizable Scene inspector and Details dialog](decisions/033-scene-inspector-details.md) -34. [ADR 034 — Mesh-vertex snapping independent of vertex glyphs](decisions/034-hidden-vertex-snapping.md) -35. [ADR 035 — Distance-dimension spatial layout](decisions/035-distance-dimension-spatial-layout.md) -36. [ADR 036 — Viewport text ownership and persistence](decisions/036-viewport-text-ownership-and-persistence.md) -37. [ADR 037 — Optional annotation label backgrounds](decisions/037-annotation-label-backgrounds.md) -38. [ADR 038 — Contextual Delete Selected](decisions/038-contextual-delete-selected.md) -39. [ADR 039 — Scene-owned Add menu](decisions/039-scene-add-menu.md) -40. [ADR 040 — Default toolbar view shortcuts](decisions/040-default-toolbar-view-shortcuts.md) -41. [ADR 041 — Grid and Units System section](decisions/041-grid-and-units-system-section.md) -42. [ADR 042 — Selected area and volume inspection](decisions/042-selected-area-and-volume-inspection.md) -43. [ADR 043 — Built-in COMPAS Viewer theme](decisions/043-built-in-compas-viewer-theme.md) -44. [ADR 044 — Editing persistent distance-dimension format](decisions/044-editing-persistent-dimension-format.md) -45. [ADR 045 — Default viewport and content contrast](decisions/045-default-viewport-content-contrast.md) -46. [ADR 046 — Viewer scheme-aware content palette](decisions/046-viewer-content-palette.md) -47. [ADR 047 — Editable parametric shape resolution](decisions/047-editable-parametric-shape-resolution.md) -48. [ADR 048 — Referenced Data domain](decisions/048-referenced-data-domain.md) -49. [ADR 049 — Viewer Settings surface](decisions/049-viewer-settings-surface.md) -50. [ADR 050 — Read-only Data item inspection](decisions/050-read-only-data-item-inspection.md) -51. [ADR 051 — Scene Object Details and settings boundary](decisions/051-scene-object-details-boundary.md) -52. [ADR 052 — Executable Viewer documentation and example coverage](decisions/052-executable-viewer-documentation-and-example-coverage.md) - -ADRs 013–016 are Accepted. ADRs 008–009 and 011–012 are superseded as recorded -in the decision index; ADR 010 remains Accepted with amended terminology. -The amended ADR 015–016 implementation is complete and verified; the -superseded `FormField` implementation was replaced. -ADRs 017–020 are Accepted and were implemented in order ADR 019, ADR 020, ADR -017, then ADR 018 so configuration and sidebar ownership were established -first. Local verification, independent review, and hosted verification passed. -ADRs 050–052 were accepted on 2026-11-14 and remain independent. ADR 050 -completes the existing read-only Data Details surface without changing Data -ownership. ADR 051 completes the read-only Scene Object Details snapshot while -retaining Object Settings as the sole editing surface. ADR 052 adopts an -executable Viewer documentation and category-level example contract without -changing runtime behavior. -ADR 003 is fully verified. ADR 004 is implemented, locally verified, and -independently approved; refreshed hosted core, Viewer, and framework -verification passed. - -ADRs 033–039 respond to direct-use feedback. ADR 036 is Accepted with a -screen-pinned, non-persistent, programmatic-first contract. ADRs 037–039 are -implemented, locally verified, and independently reviewed. ADRs 040–042 are -also Accepted. ADR 034 is implemented, locally verified, and independently -reviewed. Its measurement-only Mesh-vertex footprints do not enter ordinary -rendering or add edge, face, or broader object-type acquisition. ADR 033 is -implemented and user-confirmed. ADR 035 was accepted on 2026-11-11, -implemented, locally verified, and independently reviewed; native direct use -and hosted verification remain pending. - -The 2026-11-10 amendment to ADR 040 keeps the compact Render Mode dropdown but -replaces the native View combo popup with exclusive icon-only Perspective, Top, -Front, Right, and Ortho buttons. They use the existing palette-aware P, T, F, -and R assets plus a matching O asset; semantic titles remain tooltips and -accessible names. Native direct use showed that combo-popup teardown could -still disrupt viewport focus. One pending event-driven restoration now waits -for `focusWindowChanged` or a queued readiness check to observe the main window -focused and active with the popup cycle complete. It uses no arbitrary delay or -retry loop. The amendment narrowly extends an existing toolbar `button` item -with `state`, `value`, and optional `icon_only`, preserves custom text-only, -text-plus-icon, and unbound buttons, and does not authorize a general widget -registry. - -The narrow 2026-11-10 amendment to ADR 029 changes only the color used by a -new default `DimensionStyle` from white to magenta. Explicit and serialized -colors remain authoritative, the Scene schema remains version 4, and no -adaptive or universal contrast guarantee is introduced. - -## Approved direct-use presentation follow-up - -The latest native retest accepts the standard-view button behavior, Camera -population, and general presentation, but rejects the remaining Render Mode -combo focus behavior. It also identifies missing label-background editing, -non-semantic letter icons, useful existing command candidates for the toolbar, -and insufficient contrast between the default white surface and white -viewport. - -The proposed response is split by ownership: - -1. Amend ADR 037 to expose the implemented optional label background and - logical-pixel padding in the selected annotation's details. Disabling the - background writes `None`; enabling it uses an explicit selected color. This - changes no Core schema or serialization contract. -2. Amend ADR 040 again to remove the unreliable default Render Mode popup. - Use four exclusive semantic buttons with original monochrome SVGs: a filled - cube for Shaded, face-shaded cube for Lighted, translucent or dashed cube - for Ghosted, and outline cube for Wireframe. Move Perspective, Top, Front, - Right, and Ortho into one private fixed viewport control synchronized - through the existing command and state path. This interprets the requested - fixed view list as those five standard views. Add the existing Zoom - Selected, Zoom Extents, and Capture View commands to the default toolbar - with semantic magnifier/selection, framing, and camera assets. -3. Apply Accepted ADR 045 by changing Viewer's fixed default viewport - background to `#D8DDE2` while preserving Core defaults and ADR 043's theme - separation. - -The fixed viewport control is private Viewer chrome, not a new public -interactive-overlay type or general widget registry. All icon titles remain -tooltips and accessible names. Asset provenance, licensing, palette behavior, -high-DPI rendering, checked state, and disabled state require verification. - -These changes were approved on 2026-11-10, including the standard-view -interpretation and ADR 045's Viewer-owned `#D8DDE2` background. Package source -implementation, local verification, direct-source framework integration, and -independent re-review pass, and user direct use confirms the correction works -well. Hosted CI and candidate-artifact verification remain pending. - -## Accepted grouped controls, Details, splitters, and content palette follow-up - -The next direct-use checkpoint accepts the corrected implementation and asks -for a more compact composition: - -1. Amend ADR 040 to replace the viewport's fixed view list and the toolbar's - four render buttons with one private viewport menu. Its titled exclusive - groups are **View** (Perspective, Top, Front, Right, Ortho) and **View - Mode** (Shaded, Lighted, Ghosted, Wireframe). Add one default measurement - menu button for Inspect Distance, Add Fixed, Add Associative, and Cancel; - retain Zoom Selected, Zoom Extents, and Capture View. -2. Apply ADR 033's removal of the inline description and modal Details - snapshot. Add independent resizable splitters for Scene hierarchy/details - and Annotations list/dimension-details; neither domain resizes the other. -3. Amend ADR 037 so newly completed Viewer distance dimensions start with a - two-pixel label background: `#FAFAFAE6` in light and `#10161BE6` in dark. - Existing, explicit, serialized, text-annotation, and Core programmatic - behavior remains unchanged. -4. Adopt ADR 046's exact Viewer defaults: - - | Role | Light | Dark | - |---|---:|---:| - | Viewport | `#FAFAFA` | `#10161B` | - | Surface and face | `#D8DEE4` | `#3A4650` | - | Line and edge | `#4B5563` | `#B8C2CC` | - | Point and vertex | `#111827` | `#F2F6F8` | - -Viewer resolves omitted geometry and dimension presentation when content is -created. Explicit and serialized values remain authoritative, Core defaults do -not change, and existing objects are not recolored on a live scheme switch. -The automatic viewport does follow the scheme unless explicitly configured. -Full live content inversion is deferred because it requires durable -automatic-versus-explicit provenance in Core rather than color-value guessing. - -Viewer configuration advances to schema 4 with -`RendererConfig.backgroundcolor: Color | None`; `None` is automatic. Every -schema-3 concrete background, including `#D8DDE2`, migrates as explicit. -For Geometry, Mesh, Graph, and VolMesh, an explicit specialized color wins; an -omitted specialized channel continues to derive from an explicit base color; -scheme tokens apply only when both base and specialized channel are omitted. -Collections and buffer-backed objects keep existing explicit/per-element -semantics and receive tokens only through an already supported omitted uniform -channel. - -These changes, including both domain-local splitters, were approved on -2026-11-11. Implementation, local verification, independent review, and native -direct use pass; hosted verification remains pending. - -## Accepted ADR 035 initial editing surface - -The preferred first authoring path for deterministic spatial dimension layout -is a **Spatial Layout** group in Annotations details for one selected, bound -distance dimension. It exposes a finite signed world-space Offset, optional -Plane Normal X/Y/Z components, derived read-only resolution Status, and Reset -Layout. All normal fields blank means no normal; otherwise all three finite -components are required. - -Field edits remain a local draft, and tabbing preserves partial input. -**Apply Layout** replaces the complete layout atomically; invalid Apply and -Escape restore durable values without refresh. **Reset Layout** immediately -restores the default layout. A changed Apply or Reset refreshes only the -selected annotation once. Offset zero is resolved without a normal, regardless -of normal or anchor layout inputs. For nonzero offsets, -status precedence is unresolved anchor, coincident anchors, missing normal, -zero normal, parallel normal, then resolved. Missing, zero, or parallel layout -direction falls back to the current zero-offset line only when both anchors -resolve. An unresolved anchor preserves ADR 028 behavior and produces no -cached, stale, synthesized, or fallback dimension line. Viewer never falls -back to the camera. - -Core gains the validated immutable-value-style layout data, while Scene -serialization advances from schema 4 to schema 5 and annotation-entry schema -version 2. Because `DataDecoder` reconstructs nested entries before the parent -Scene version is visible, current versioned entries require `layout` and reject -missing or unsupported versions. Only legacy unversioned schema-4 entries may -omit it; they retain `None` until binding normalizes distance entries and -preserves or validates text/arrow entries. -Viewer adds extension lines, displaced bounds, derived statuses, and the -single-selection form. Viewport dragging, construction-plane tools, collision -avoidance, and multi-dimension editing remain excluded. This amended ADR 035 -was explicitly approved on 2026-11-11. Implementation, local verification, -and independent review pass. Native direct -use and hosted verification remain pending. - -## Approved dimension-details and extension-line refinement - -The accepted Annotations splitter must scroll rather than compress its details -form when the lower allocation is smaller than the content's natural height. -Use a vertical `QScrollArea` as the splitter child, retain natural group and -field spacing through a minimum-size layout constraint, disable horizontal -scrolling, and preserve transient splitter allocation across refreshes. This -is an approved correction to ADR 033 and is implemented and locally verified. - -The independent line-weight request is a durable style change. Amend ADRs 029 -and 035 with `extension_line_width`, a positive finite logical-pixel value. -The existing main-line default remains `3.0`; new extension lines default to -`1.0`. Viewer exposes **Dimension Line Width** and **Extension Line Width** and -uses the latter only for anchor-to-displaced-endpoint lines. A zero-offset -dimension has no extension lines. - -Preserve existing serialized appearance through Scene schema 6, -annotation-entry schema 3, and dimension-style schema 2. Genuine schema-5 -styles migrate `extension_line_width=line_width`; schema-6 requires the -versioned field. Explicit values remain authoritative. No extension color, -dash, opacity, or arrow-style surface is proposed. This style amendment -was approved on 2026-11-11. Implementation and local verification pass. - -## Approved editable parametric-shape resolution - -Core already owns durable `ShapeObject.u`, `ShapeObject.v`, -`SurfaceObject.u`, and `SurfaceObject.v` values with default `16`; Viewer -already consumes them when generating polygonal representations. ADR 047 -approves exposing those fields without adding a second resolution API or -changing serialization. - -Viewer shows **U Resolution** for Cone and Cylinder; **U Resolution** and -**V Resolution** for Sphere and Torus; U plus an even V for Capsule; and both -axes for parametric Surface objects. Box and unknown Shape producers expose no -ineffective controls. Values are whole integers with producer-specific minima. -Invalid edits roll back atomically without refresh. A valid edit rebuilds only -the affected object's representation, buffers, and bounds while preserving the -analytic shape, selection, unrelated objects, and scene round-trip. - -Circle/Ellipse discretization, BRep/backend tolerances, adaptive level of -detail, global defaults, and a speculative maximum cap remain outside scope. -ADR 047 was accepted on 2026-11-11. Implementation, local verification, and -independent review pass. An exact native macOS Torus U-resolution change from -16 to 64 passed with a valid OpenGL context. The later interactive crash was -traced to Qt emitter lifetime and fixed. Native direct use on 2026-11-11 -confirmed the resolution crash remains fixed at Torus U resolution 64. - -Direct use at higher resolution also exposed an avoidable full rebuild for -ordinary display toggles. The accepted ADR 047 amendment routes `show`, -`show_points`, `show_lines`, `show_surfaces`, opacity, point size, and line -width through one selected-object settings-texture update and one redraw. These -edits do not tessellate, rebuild global buffers, or rebuild the Scene tree -unless displayed tree content changed. Resolution fields `u` and `v` remain -topology edits. Colors remain on the current appearance-data path for now. - -ShapeObject and SurfaceObject forms label the existing line controls **Show -wireframe**, **Wireframe color**, and **Wireframe width**. MeshObject and -GraphObject retain edge terminology. The wording introduces no durable alias, -API, or serialization change. This amendment is accepted and implementation is -locally verified and independently reviewed. Native direct use confirms that a -Torus at U resolution 64 toggles **Show wireframe** off and on responsively and -accepts the wireframe wording. - -## Accepted referenced Data domain - -Scene already exposes a non-owning runtime binding map for item GUIDs referred -to by spatial objects and annotations. Accepted ADR 048 adds a fourth top-level -Viewer **Data** domain as a flat projection of those references, not a second -store. One row per distinct GUID is ordered by first spatial-hierarchy then -annotation reference and shows name, type, bound/unresolved status, and -reference count. Shared items are deduplicated; unresolved GUIDs remain visible -without implicit resolution. - -Data selection is transient and independent from Scene, Annotations, viewport, -and element-table selection. A read-only modal Data Details snapshot shows -identity/reference metadata and safe inspected parameters. Mesh and Graph -reuse ADR 017's lazy tables in read-only mode with declared columns only. - -The projection refreshes after scene replacement, reference add/remove, item -binding, and Data-domain activation while preserving selection by GUID where -possible. It neither mutates data nor rebuilds render buffers. Unattached data, -Session aggregation, files and resolvers, loading, editing, deletion, search, -persisted selection, and modeless inspectors remain outside scope. The user -approved this narrow first step on 2026-11-11. Implementation, local -verification, and independent review pass, with the final sidebar order Scene, -Data, Annotations, System. Direct object/reference additions refresh Data once -without renderer work, selection survives refresh while still referenced, and -safe shared inspection isolates attribute failures without reading arbitrary -`__data__`. The active Scene is the initial inventory source. A future Session -ADR may replace or extend it with unattached or multi-scene data, but Viewer -must remain a read-only consumer rather than the aggregate owner. - -## Accepted Viewer Settings surface - -Direct use identifies a category mismatch in the resulting four-tab sidebar: -Scene, Data, and Annotations are content domains, while System is a collection -of Viewer settings. Accepted ADR 049 leaves exactly the three content domains -in the right sidebar and moves the existing Camera, Display, and Grid and Units -sections into one per-Viewer modeless **Viewer Settings** window. - -The window is opened from **View → Viewer Settings…**, refreshed and -raised on reuse, hidden rather than destroyed on close, and owned by the main -Viewer lifecycle. Its visibility, geometry, and focused section remain -transient, as does its scroll position. Window-level Escape hides only Viewer -Settings; it does not cancel measurement or clear content selection. Existing -renderer, measurement, state, and configuration paths stay unchanged. - -The accepted decision replaces the System sidebar identifier and -`focus_system_section` with one settings-window API and moves the three -components from `viewer.sidebar_items` to `viewer.settings_items`, without -aliases or overlapping supported paths. The public navigation boundary is -`viewer.ui.settings.show(section)`, and `default_settings_items()` provides the -built-in composition. The implemented setup path accepts typed keyword-only -`sidebar_items` and `settings_items` iterables on the first `Viewer(...)` -construction, shallow-copies them before UI construction, and uses built-in -definitions when omitted. Because Viewer is a process-local singleton, later -constructor calls ignore new composition inputs, and post-construction list -mutation does not live-recompose the interface. No reset or reload framework -is added. A modal dialog would block live -viewport tuning; a dock would introduce layout and persistence decisions; and -a popover or drawer would be too small and focus-sensitive for the existing -forms. The user approved ADR 049 on 2026-11-14. Implementation and verification -now pass locally, including independent re-review and the framework -direct-source gate. The Viewer tutorial and executable Viewer Settings example -cover the setup-time composition and navigation contract. A permanent public -singleton regression now verifies that later `Viewer(...)` composition inputs -are ignored; clean follow-up review reports no findings. Native macOS modeless -focus, high-DPI, and direct-use confirmation -plus refreshed hosted CI remain pending. - -## Accepted Scene and Data inspection completion - -The current Scene and Data surfaces expose complementary but incomplete views. -Object Settings edits the normalized declared Viewer-context attributes, while -Object Details shows only a small descriptive snapshot. Data Details shows safe -parameters for general Data, but substitutes Mesh/Graph element tables for -those parameters and does not expose general `Datastructure.attributes`. - -The recommended correction is two independent read-only decisions. - -### Data Details interface - -Accepted ADR 050 preserves ADR 048's identity/reference header and gives every -bound item one ordered tab surface: - -1. **Parameters** — safe available public constructor parameters with no - serialized fallback or arbitrary `__data__` traversal; -2. **General Attributes** — the ordered public `attributes` mapping for verified - Core `Datastructure` values only; and -3. the existing lazy read-only Mesh vertex/edge/face or Graph node/edge tabs. - -Empty Parameters or General Attributes tables remain visible. Component tabs -retain ADR 017's declared-column, effective-value, lazy-read, and sparse-omission -semantics. Unresolved items remain metadata-only. Each value-formatting failure -is isolated to its row or cell. Parameter and General Attributes tables use -**Parameter/Attribute** plus **Value** columns and the existing `str(value)` or -`` convention. Component tables retain their -existing key, scalar, and Boolean presentation. - -The Data projection remains non-owning and read-only. No edit, bind, resolve, -rename, delete, selection-coupling, serialization, renderer-refresh, or generic -inspection registry is added. VolMesh, CellNetwork, external Data types, and -undeclared sparse attributes remain unsupported until concrete evidence -justifies a later decision. - -### Scene Object Details interface - -Accepted ADR 051 preserves Object Settings as the only editing surface and -expands the one-object modal Details snapshot into four ordered sections: - -1. **Identity** — name, concrete SceneObject type and GUID, represented-item - type and GUID, and binding status; -2. **General Scene State** — visibility, base color, opacity, and local - transformation; -3. **Type-Specific Scene State** — every editable or noneditable declaration - from `scene_state_fields()`, in namespace and declaration order; and -4. **Represented Item Parameters** — existing safe parameters when bound. - -Type-specific rows use stable `namespace.field` identifiers and read values -through each declaration's `attribute`. The snapshot does not inspect unknown -extension payloads, `__dict__`, arbitrary properties, or adapter caches. One -read/format failure is isolated without hiding other state. Unresolved items -still show complete SceneObject state, and the existing multiple-selection -count/type/name snapshot remains unchanged. - -The existing scrolling text snapshot remains the presentation surface. Each -section has its exact heading; identity and base-state rows use the labels in -ADR 051, declared state uses `namespace.field: repr(value)`, and parameter rows -use `name: repr(value)`. A failed value is shown as -``. - -Object Settings continues to resolve ADRs 015–016's normalized editability -mapping, own editor/validation behavior, and select refresh after atomic -mutation. Object Details adds no second setter or refresh path. - -### Alternatives and tradeoffs - -Editable Data is not recommended. A deduplicated item may have many referrers, -so editing requires new decisions for validation, atomicity, referrer-wide -refresh, defaults/reset, and undo. It conflicts with ADR 048's accepted -read-only boundary and needs a separate future ADR. - -A generic Data or Scene-details registry is also not recommended. Existing -public Datastructure and SceneStateField contracts satisfy the demonstrated -Mesh/Graph and SceneObject needs. A registry would introduce extension and -presentation metadata without evidence for additional producers. - -Keeping the current surfaces avoids implementation work but fails the stated -need to access general and component-specific data together and to inspect -noneditable SceneObject state. - -### Affected packages and compatibility - -Only `compas_viewer` runtime, tests, examples, and documentation change. -`compas` already provides the required public contracts; no Core source, -schema, serialization, or migration change is proposed. `compas_framework` -adds direct-source integration assertions for the resulting read-only surfaces. - -Both changes are additive inside existing modal snapshots. Existing Data and -Scene selection, editing, refresh, identity, and configuration behavior remain -unchanged. ADRs 050 and 051 may be implemented and verified independently. - -### Required tests and examples - -- Verify Parameters and General Attributes order, emptiness, safe formatting, - and failure isolation. -- Verify Mesh/Graph component tabs appear alongside general sections while - retaining lazy declared-column behavior and sparse omission. -- Verify unresolved and shared Data identity/reference behavior and prove - Details causes no mutation or renderer/UI refresh. -- Verify exact Object Details identity/base-state fields and namespace/field - declaration order across representative SceneObject types. -- Verify unresolved-item, read/format failure, multiple-selection, and - no-mutation/no-refresh behavior. -- Verify Object Settings remains exactly the normalized editable mapping and - the only editing surface. -- Add one focused example with Mesh general attributes, declared defaults, - local component overrides, and shared Scene references; extend the Viewer - tutorial and representative built-in examples to document the distinctions - among Object Settings, Object Details, Data Details, opt-in editable Scene - Attributes, and Viewer Settings. - -The user accepted ADRs 050 and 051 on 2026-11-14. Their uncommitted Viewer -implementation, focused and full package tests, typing and formatting gates, -strict documentation, direct-source framework integration, and independent -runtime review pass. Native interaction/visual evidence, refreshed hosted CI, -and candidate artifacts remain separately pending. - -## Accepted executable Viewer documentation contract - -Accepted ADR 052 separates documentation quality from the runtime ownership in -ADRs 049–051. It recommends one maintained end-to-end tutorial backed by one -authoritative runnable script, plus focused workflow/category examples rather -than ad-hoc prose, a prose-only tutorial, or an exhaustive example for every -public symbol. Public and touched Python APIs use MkDocs-compatible NumPy -docstrings and Python 3.12 annotations without changing runtime semantics. - -The exact coverage matrix in ADR 052 spans Scene/content domains and inspection -boundaries, Viewer Settings/configuration, selection/transforms/refresh, -measurements/annotations, serialization, overlays, dynamic examples, and -optional geometry backends. Python under `docs/examples/` is checked by Ruff -and Pyright. The canonical tutorial and representative workflows receive -headless smoke or contract coverage; strict MkDocs, link/snippet validation, -focused doctests where applicable, and diff checks complete the automated -documentation gate. Native rendering, visual layout, focus, scrolling, -keyboard behavior, and high-DPI checks remain separately reported evidence. -Optional backend examples must name their dependency and must not convert an -unavailable runtime into a claimed pass. - -Documentation may describe only implemented and verified behavior. Runtime -gaps found while documenting a workflow return to the ADR that owns the -contract; they are not fixed speculatively under ADR 052. The uncommitted -end-to-end tutorial, Viewer Settings and Object/Data inspection examples, -coverage matrix, and affected docstring/type work now implement the accepted -documentation contract and follow the verified disposition of ADRs 050 and -051. - -Only `compas_viewer` documentation-facing source, examples, documentation -tests, and package documentation configuration are in scope. ADR 052 changes -no runtime API, behavior, schema, serialization, ownership, or migration -contract. The user accepted ADR 052 on 2026-11-14. The documentation-example -suite passes 20 tests; authoritative examples pass Ruff, formatting, and -Python 3.12 Pyright; strict MkDocs and `git diff --check` pass. Independent -review findings on annotation serialization coverage and scope wording were -corrected and revalidated. Native and optional-backend evidence remains -separately pending. diff --git a/initiatives/scene-viewer-visualisation/ui.md b/initiatives/scene-viewer-visualisation/ui.md deleted file mode 100644 index 19ed212..0000000 --- a/initiatives/scene-viewer-visualisation/ui.md +++ /dev/null @@ -1,67 +0,0 @@ -# UI - -> **Status:** Exploratory design sketch. This file records possible UI ideas -> for discussion; it is not an accepted specification, implementation plan, or -> backlog. Individual ideas require reconciliation with the accepted ADRs and -> explicit approval before implementation. - -## Menu - -* File - * New Session - * --- - * Open Session - * Save Session - * Save As (Session) - * --- - * ? -* Edit - * Undo - * Redo - * --- - * Edit Data Parameters - * Edit Object Parameters - * ? -* Select(ion) (same as now) -* Measure -* Scene - * Clear Scene - * --- - * Load Scene - * Save Scene - * --- - * Add Geometry - * Add Datastructure - * --- - * ? -* View (same as now) -* Help - -## Sidebar - -* Section 1 - * Scene Tree - * Data store -* Section 2 - * Object: Properties of selected object(s) - * Camera - * Display - * Units - -In the scene tree, every node provides a link to a form with two tabs: one for the scene object, one for the data item. - -The tree uses icons to give an indication of the type of object. - -## Toolbar - -A fixed or floating toolbar provides toolbar buttons with often used tools: - -* Zoom? -* Selection? -* Screen capture? -* Measurements? - -## Other - -The entire UI config shoould be accessible somehwere as well. -Transformations using a gimball would be amazing. diff --git a/initiatives/typing-alignment/README.md b/initiatives/typing-alignment/README.md deleted file mode 100644 index 18c2242..0000000 --- a/initiatives/typing-alignment/README.md +++ /dev/null @@ -1,66 +0,0 @@ -# Typing Alignment - -This initiative aligns Python typing across `compas`, `compas_occ`, -`compas_cgal`, and `compas_libigl`, with particular attention to NumPy and -native-library boundaries. - -Current phase: **Complete for the approved source, distribution, and installed -integration scope**. - -- [Objective](objective.md) -- [Inventory](inventory.md) -- [Proposal](proposal.md) -- [Architecture decisions](decisions/README.md) - -ADRs 001–017 and Geometry ADRs 022–023 are approved. Together they define the -exact geometry signatures, layered semantic -`PointLike`/`VectorLike` and neutral `VerticesFaces` vocabulary, -NumPy-compatible core constructors, and complete CGAL/libigl native stub policy -required for WP7–WP8. The source slices and exact installed-candidate evidence -are complete without adding typing-only runtime conversions. - -Current draft-PR heads are: - -- core [PR 1539](https://github.com/compas-dev/compas/pull/1539), - `99b82a6673ff7d05c1c323c8921135c274993f11`; -- OCC [PR 32](https://github.com/compas-dev/compas_occ/pull/32), - `7fdf2ffb57d1de16308020e14ec626d79e65a034`; -- CGAL [PR 81](https://github.com/compas-dev/compas_cgal/pull/81), - `bb3624e714719d543c61768320d91811ba96cc6c`; and -- libigl [PR 47](https://github.com/compas-dev/compas_libigl/pull/47), - `710b2b6714839a203fc8a6c62c437c0f6735ba0e`. - -All four packages have complete green hosted evidence at those heads. CGAL run -`42231235319` attempt 2 passed quality, minimum/current NumPy, sdist, every -platform wheel build, and all Python 3.12/3.14 wheel-smoke jobs. - -WP7.4–WP7.7 and WP8.1 are source-complete. CGAL WP8.2 and libigl WP8.3 reach -the approved native-stub/public-wrapper contract and are hosted green. -Framework draft -[PR 2](https://github.com/compas-dev/compas_framework/pull/2) implements the -WP8.4 exact-artifact mechanism and live manifest at -`d0c9d4ef939ebbd4da4e14446e2e11f83a8a97b0`. Schema/semantic validation, -exact hashes, offline revalidation and staging, versions, installed plugin/OCC -behavior, strict exact-wheel typing, and all 54 focused contract/tooling checks -pass locally. - -The framework build, docs, candidate-contract/actionlint, package, and release -metadata workflows are green at that head. Protected run -[`42299118381`](https://github.com/compas-dev/compas_framework/actions/runs/42299118381) -also passes exact artifact retrieval and secret-free Linux execution: all four -required installed runtime contracts pass without skips, including the -CGAL→core→libigl and OCC paths, and the external typing consumer reports zero -errors and warnings. WP8.4 and final WP6 are therefore complete. `main` remains -untouched. - -Known limitation: `compas_cgal` skeletonisation currently produces incorrect -results. Typing, stub, boundary, and packaging checks for that module do not -constitute validation of its geometric output. Correctness requires a separate -investigation and regression fixtures before skeletonisation can be reported as -verified. - -`compas_libigl` joined the initiative on 2026-11-05. Its -`initiative/typing-alignment` branch starts from local `c3-upgrade` commit -`70acf99`; the current hosted-green checkpoint includes structural plugin -alignment, lazy plugin discovery, complete native stubs and public wrappers, -and installed-wheel verification under Accepted ADR 017. diff --git a/initiatives/typing-alignment/decisions/001-supported-baseline.md b/initiatives/typing-alignment/decisions/001-supported-baseline.md deleted file mode 100644 index 1f86cde..0000000 --- a/initiatives/typing-alignment/decisions/001-supported-baseline.md +++ /dev/null @@ -1,42 +0,0 @@ -# Title: What version and checker baseline should typing alignment use? - -## Status - -Accepted - -## Context - -Core and CGAL require Python 3.12+, while OCC still declares Python 3.9+ and an -unbounded COMPAS dependency. Pyright configuration and CI invocation differ by -repository. NumPy lower bounds do not reflect the supported Python baseline. - -## Options - -1. Preserve each package's current independent baseline. This avoids metadata - changes but makes cross-package overrides and fixtures unreliable. -2. Align on Python 3.12+, COMPAS 3.x, NumPy 1.26+, and one pinned Pyright. -3. Target multiple historical baselines through conditional annotations. This - adds compatibility complexity without a current requirement. - -## Recommendation - -Choose option 2. Require Python 3.12+, `compas>=3,<4` in integration packages, -NumPy 1.26+ where NumPy is declared, and pin Pyright 1.1.414 initially. Use -`compas3` for authoritative local checks and test both NumPy 1.26.x and current -2.x. Do not add mypy. - -## Consequences - -- Type syntax and override checks share one baseline. -- Unsupported Python/COMPAS combinations are removed from metadata and CI. -- CI, development dependencies, and contributor documentation change. -- Tests must exercise the lowest and latest supported NumPy lines. -- Future baseline changes require coordinated updates. - -## Affected packages - -`compas`, `compas_occ`, `compas_cgal`, and `compas_framework`. - -## Dependencies - -None. diff --git a/initiatives/typing-alignment/decisions/002-numeric-array-inputs.md b/initiatives/typing-alignment/decisions/002-numeric-array-inputs.md deleted file mode 100644 index c14381f..0000000 --- a/initiatives/typing-alignment/decisions/002-numeric-array-inputs.md +++ /dev/null @@ -1,61 +0,0 @@ -# Title: Which Python and NumPy scalar and array values should public APIs accept? - -## Status - -Accepted - -## Context - -Core sequence aliases reject NumPy arrays statically even where runtime calls -succeed. Numeric scalar acceptance varies between built-in checks and -`Real`/`Integral`. `ArrayLike` would be broader than many geometry APIs. - -## Options - -1. Keep sequence-only annotations and document NumPy as unsupported. -2. Use `ArrayLike` for every numerical input. -3. Define a small explicit core vocabulary for supported Python/NumPy real and - integral scalars, coordinates, coordinate collections, and index arrays. -4. Introduce a generic tensor abstraction with shape parameters. - -## Recommendation - -Choose option 3. Core aliases explicitly include supported NumPy scalar and -array types alongside Python/COMPAS inputs. Use `ArrayLike` only in APIs whose -real behavior is broad `np.asarray` coercion. Consolidate duplicated -datastructure coordinate aliases into the core vocabulary. - -Where bool exclusion, dimension, shape, finiteness, or range is a stated -invariant, runtime behavior remains authoritative. Enforce it at the narrow -boundary that needs it; do not pre-screen all inputs nominally or traverse them -solely for typing. Do not widen annotations beyond tested runtime support. - -These aliases identify verified common Python and NumPy families; they are not -runtime nominal allow-lists. Do not reject an otherwise usable value merely -because its concrete class is absent from a union. Prefer documented operations -such as iteration, indexing, unpacking, and numeric arithmetic. Retain targeted -semantic checks, such as bool rejection, only where the public contract requires -them. - -When an intentionally supported, stable capability extends beyond the listed -concrete families, express it with a small structural Protocol backed by real -consumers and static/runtime fixtures. Do not use concrete unions to falsely -reject that supported capability, and do not add speculative Protocols. - -## Consequences - -- Existing supported NumPy calls type-check. -- Public signatures import a small NumPy typing vocabulary; NumPy is already a - core dependency. -- Static consumer and runtime matrix tests are required for every alias. -- Widening annotations alone must not create new runtime behavior. -- Documentation must list accepted Python and NumPy forms. -- Tests include representative custom duck-typed scalar and sequence objects. - -## Affected packages - -`compas`, `compas_occ`, `compas_cgal`. - -## Dependencies - -- [001 — Supported baseline](001-supported-baseline.md) diff --git a/initiatives/typing-alignment/decisions/003-array-guarantees.md b/initiatives/typing-alignment/decisions/003-array-guarantees.md deleted file mode 100644 index 407b974..0000000 --- a/initiatives/typing-alignment/decisions/003-array-guarantees.md +++ /dev/null @@ -1,50 +0,0 @@ -# Title: Which array guarantees should annotations express statically? - -## Status - -Accepted - -## Context - -NumPy typing expresses dtype better than shape. Current `Annotated` shape -metadata is descriptive but not enforced. Rank, contiguity, writability, -ownership, and value constraints are runtime properties. - -## Options - -1. Encode shapes through extensive generics and `Annotated` metadata. -2. Use unparameterized `NDArray[Any]` everywhere. -3. Express meaningful dtypes with simple aliases and document/runtime-validate - all shape and layout constraints. - -## Recommendation - -Choose option 3. Define simple numeric, floating, integer, `float64`, and -`int32` array aliases. State expected ranks/shapes in docstrings and enforce -them at the boundary where the invariant is required for object validity, -mutation, or native safety. Treat contiguity, writability, ownership, finiteness, -and range as documented runtime guarantees. Do not claim `Annotated` shape -metadata is checker enforcement and do not add a shape-typing framework. - -Ordinary Python algorithms validate only invariants needed before mutation or -retention, or needed for a clear and safe failure. Exact dtype, rank, and layout -checks belong at native ABI boundaries. Do not eagerly walk or convert inputs -solely to prove an annotation; inspect required capabilities and observable -properties instead of concrete types. - -## Consequences - -- Annotations remain readable and truthful. -- Invalid shapes may still pass static checking and must fail clearly at - runtime. -- Native adapter tests must cover dtype, rank, shape, layout, and ownership. -- Documentation must distinguish static from runtime guarantees. - -## Affected packages - -`compas`, `compas_cgal`, and NumPy-facing `compas_occ` adapters. - -## Dependencies - -- [001 — Supported baseline](001-supported-baseline.md) -- [002 — Numeric and array inputs](002-numeric-array-inputs.md) diff --git a/initiatives/typing-alignment/decisions/004-tessellation-buffers.md b/initiatives/typing-alignment/decisions/004-tessellation-buffers.md deleted file mode 100644 index 0110625..0000000 --- a/initiatives/typing-alignment/decisions/004-tessellation-buffers.md +++ /dev/null @@ -1,51 +0,0 @@ -# Title: How should Tessellation type retained zero-copy buffers? - -## Status - -Accepted - -## Context - -`Tessellation` intentionally retains NumPy and native buffers without copying, -but its generic bounds reject those buffers statically. Always normalizing to -lists or arrays would change ownership and allocation semantics. - -## Options - -1. Copy every buffer to Python lists. -2. Copy every buffer to canonical NumPy arrays. -3. Return broad unions and abandon concrete buffer-type preservation. -4. Expand generic buffer bounds to the supported Python, NumPy, and native - retained-buffer contract. - -## Recommendation - -Choose option 4. Preserve the existing generic design and broaden its bounds to -supported nested sequences, NumPy arrays, and compatible native buffers. -Construction checks the minimal structural invariants required for a valid -retained object but does not coerce, copy, or take ownership. Preserve the -concrete buffer type in properties where Pyright can infer it. Apply the same -contract to optional normals, UVs, and polylines. - -Construction checks only the minimal structural invariants required for a valid -retained `Tessellation`; it does not apply an elementwise nominal type allow-list. -Tests verify compatible duck-typed buffers, identity preservation, source -non-mutation, and absence of unnecessary conversion. - -## Consequences - -- CGAL and other native plugins no longer require ignores at this boundary. -- Ownership, mutability, lifetime, dtype, and shape must be explicitly - documented and tested. -- Serialization still normalizes buffers to built-in data. -- Ordinary core containers do not inherit zero-copy semantics from this - deliberate exception. - -## Affected packages - -`compas`, `compas_cgal`, and native consumers of `Tessellation`. - -## Dependencies - -- [002 — Numeric and array inputs](002-numeric-array-inputs.md) -- [003 — Array guarantees](003-array-guarantees.md) diff --git a/initiatives/typing-alignment/decisions/005-native-normalization.md b/initiatives/typing-alignment/decisions/005-native-normalization.md deleted file mode 100644 index 6ed64bd..0000000 --- a/initiatives/typing-alignment/decisions/005-native-normalization.md +++ /dev/null @@ -1,55 +0,0 @@ -# Title: Where should broad public inputs become exact native buffers? - -## Status - -Accepted - -## Context - -CGAL needs exact dtype/layout buffers. PythonOCC accepts values inconsistently -by dtype because SWIG conversion is accidental. Public annotations currently -conflate coercible inputs with exact native ABI requirements. - -## Options - -1. Require exact native arrays in every public API. -2. Pass broad inputs directly to native libraries and rely on their coercion. -3. Accept approved broad inputs in public wrappers and normalize them in a - private backend adapter before native calls. - -## Recommendation - -Choose option 3. CGAL adapters normalize coordinates to C-contiguous `float64` -and indices to C-contiguous `int32`. OCC adapters validate shape and convert -each value to Python `float`/`int` before SWIG calls. OCC returns core objects -and Python containers unless a separately approved API requires NumPy output. - -Do not broaden an OCC annotation until its adapter implements and tests the -promised normalization. - -Normalization is a single private last-mile native-boundary operation, not a -general public-wrapper policy. Reuse an input that already satisfies the exact -ABI contract when backend ownership and lifetime permit. Otherwise perform only -the required conversion. OCC scalar conversion occurs immediately before SWIG -only where PythonOCC demonstrably requires built-ins; repeated normalization is -not allowed. - -## Consequences - -- Native ABI requirements become explicit and localized. -- Public callers need not pre-normalize valid inputs. -- Conversion may allocate; documentation must state when this occurs. -- Tests cover dtype, shape, contiguity, non-contiguous input, source mutation, - and errors. -- Native helper modules own the few justified third-party casts/ignores. -- Tests instrument conversion and copy counts to detect redundant work. - -## Affected packages - -`compas_occ`, `compas_cgal`, and core plugin boundaries in `compas`. - -## Dependencies - -- [002 — Numeric and array inputs](002-numeric-array-inputs.md) -- [003 — Array guarantees](003-array-guarantees.md) -- [004 — Tessellation buffers](004-tessellation-buffers.md) diff --git a/initiatives/typing-alignment/decisions/006-plugin-conformance.md b/initiatives/typing-alignment/decisions/006-plugin-conformance.md deleted file mode 100644 index 712ef40..0000000 --- a/initiatives/typing-alignment/decisions/006-plugin-conformance.md +++ /dev/null @@ -1,52 +0,0 @@ -# Title: How should backend plugin signatures conform to core contracts? - -## Status - -Accepted - -## Context - -The plugin decorator preserves local callable typing, but registered methods -are stored broadly and backend packages repeat signatures manually. OCC plugin -modules frequently use untyped `*args, **kwargs`. Cross-package parity is not -statically verified. - -## Options - -1. Continue relying on runtime registration and duplicated annotations. -2. Define a separate Protocol for every plugin operation. -3. Let core own documented public invariants and narrow private pluggables, - require explicit matching backend signatures, and verify conformance in - integration. - -## Recommendation - -Choose option 3. Core enforces only documented public invariants before dispatch -when early validation is necessary; it does not nominally gate otherwise usable -duck-typed inputs. Private pluggables expose the narrow backend contract. Backend -implementations use explicit parameter and return annotations. Add runtime -signature comparison for names, kinds, and defaults plus typed integration -fixtures for argument and result compatibility. - -Do not duplicate the same validation in both the public wrapper and backend. - -Do not add per-operation Protocol classes unless a concrete non-plugin consumer -requires one. - -## Consequences - -- Plugin differences fail in focused tests rather than downstream use. -- Some public wrappers/private selectors need separation. -- OCC generic forwarding functions must become explicit. -- Runtime signature checks cannot prove semantic return compatibility, so typed - consumer fixtures remain required. -- Plugin documentation identifies public versus backend contracts. - -## Affected packages - -`compas`, `compas_occ`, `compas_cgal`, and `compas_framework`. - -## Dependencies - -- [002 — Numeric and array inputs](002-numeric-array-inputs.md) -- [005 — Native normalization](005-native-normalization.md) diff --git a/initiatives/typing-alignment/decisions/007-backend-substitutability.md b/initiatives/typing-alignment/decisions/007-backend-substitutability.md deleted file mode 100644 index 92b49c8..0000000 --- a/initiatives/typing-alignment/decisions/007-backend-substitutability.md +++ /dev/null @@ -1,49 +0,0 @@ -# Title: How should OCC subclasses and native uncertainty align with core APIs? - -## Status - -Accepted - -## Context - -OCC Curve, Surface, NURBS, and BRep subclasses currently narrow parameters, -return invariant backend lists, disagree on properties versus methods, and call -removed core APIs. PythonOCC downcasts and overload uncertainty are spread -through broad ignores. - -## Options - -1. Preserve backend-specialized annotations even when they violate base-class - substitutability. -2. Loosen core and OCC types to `Any`. -3. Treat core signatures as authoritative and isolate native uncertainty in - small typed boundary helpers. - -## Recommendation - -Choose option 3. Overrides accept the same or broader inputs and return -compatible core public types. `__eq__` accepts `object`. Preserve property/ -method contracts. Annotate public invariant lists with the base item type rather -than changing core lists to `Sequence` solely for covariance. Keep stable -mutable native attributes typed to their native base class and centralize -downcasts/overload workarounds in narrow helpers with explained ignores. - -## Consequences - -- OCC loses some backend-specific precision in overridden public annotations, - while runtime items remain backend instances. -- Real stale-API/runtime defects must be fixed rather than suppressed. -- Backend-specific access may use explicit native properties only when a real - consumer requires them. -- Tests cover base-typed use of OCC instances and native conversion helpers. -- No module-wide ignores or global diagnostic suppression are allowed. - -## Affected packages - -`compas` and `compas_occ`. - -## Dependencies - -- [001 — Supported baseline](001-supported-baseline.md) -- [005 — Native normalization](005-native-normalization.md) -- [006 — Plugin conformance](006-plugin-conformance.md) diff --git a/initiatives/typing-alignment/decisions/008-return-normalization.md b/initiatives/typing-alignment/decisions/008-return-normalization.md deleted file mode 100644 index 67b78ad..0000000 --- a/initiatives/typing-alignment/decisions/008-return-normalization.md +++ /dev/null @@ -1,59 +0,0 @@ -# Title: When should public APIs return Python, COMPAS, or NumPy values? - -## Status - -Accepted - -## Context - -Ordinary APIs, numerical modules, Tessellation, and plugins currently expose a -mixture of Python containers, core objects, arrays, and NumPy scalar results. -Some backend results disagree with the core declaration. - -## Options - -1. Standardize every return on NumPy. -2. Standardize every return on Python lists and built-in scalars. -3. Use Python/core values by default, NumPy for explicitly numerical APIs, and - retained buffers only for explicitly buffer-backed representations. - -## Recommendation - -Choose option 3. Ordinary geometry/datastructure APIs return core objects, -Python containers, and Python `int`/`float`. Explicit NumPy-oriented operations -return typed arrays. `Tessellation` retains buffers by design. Plugins conform -to the core return representation. Serialization normalizes arrays/scalars to -lists and built-ins. - -Declare Python built-in scalar representations for logical counts and ranks -unless the API is explicitly NumPy-oriented. Ordinary Python producers should -naturally return those representations; normalize a backend-specific scalar -once at the public or plugin boundary only when needed to satisfy the declared -contract. Do not introduce broad serialization `TypedDict` hierarchies; type -only stable versioned records. - -Built-in scalar or container normalization happens once at a declared public, -plugin, or serialization return boundary only when representation is part of -the contract. Do not scatter `float()`, `int()`, or `list()` calls through -internal Python code or convert compatible values solely for checker -satisfaction. - -## Consequences - -- Return behavior becomes predictable across backends. -- Some scalar normalization is a runtime change and needs focused approval, - tests, and documentation. -- Backend arrays may need wrapping or conversion at the plugin boundary. -- Zero-copy behavior remains limited to APIs that state it explicitly. - -## Affected packages - -`compas`, `compas_occ`, `compas_cgal`. - -## Dependencies - -- [002 — Numeric and array inputs](002-numeric-array-inputs.md) -- [004 — Tessellation buffers](004-tessellation-buffers.md) -- [005 — Native normalization](005-native-normalization.md) -- [006 — Plugin conformance](006-plugin-conformance.md) -- [007 — Backend substitutability](007-backend-substitutability.md) diff --git a/initiatives/typing-alignment/decisions/009-typed-distribution.md b/initiatives/typing-alignment/decisions/009-typed-distribution.md deleted file mode 100644 index 43eb532..0000000 --- a/initiatives/typing-alignment/decisions/009-typed-distribution.md +++ /dev/null @@ -1,49 +0,0 @@ -# Title: How should COMPAS packages distribute typing and native stubs? - -## Status - -Accepted - -## Context - -Only CGAL contains `py.typed` and native `.pyi` files. Source checks do not -prove wheel contents. CGAL stubs are hand-maintained without export parity; -OCC relies on upstream PythonOCC typing and broad local ignores. - -## Options - -1. Keep typing development-only and do not advertise PEP 561 support. -2. Generate all stubs automatically immediately. -3. Ship `py.typed` from all packages, retain maintained CGAL stubs initially, - and verify source/runtime/wheel parity. - -## Recommendation - -Choose option 3. Add `py.typed` and wheel-content tests to core and OCC; retain -CGAL's marker. Every compiled CGAL module has a maintained stub, exported-name -parity test, and typed smoke calls. Defer generation until it demonstrably -improves these contracts. OCC uses inline typing and upstream PythonOCC stubs, -with narrow local helpers for proven upstream defects rather than duplicated -native stubs. - -## Consequences - -- Downstream checkers consume COMPAS annotations by default. -- Incorrect annotations become user-visible and therefore release-relevant. -- Wheel builds must include markers and stubs on all platforms. -- Export parity catches missing/stale names but not semantic dtype or ownership; - focused tests remain necessary. -- Documentation states the supported checker/baseline. - -## Affected packages - -`compas`, `compas_occ`, `compas_cgal`, and release checks in -`compas_framework`. - -## Dependencies - -- [001 — Supported baseline](001-supported-baseline.md) -- [005 — Native normalization](005-native-normalization.md) -- [006 — Plugin conformance](006-plugin-conformance.md) -- [007 — Backend substitutability](007-backend-substitutability.md) -- [008 — Return normalization](008-return-normalization.md) diff --git a/initiatives/typing-alignment/decisions/010-verification-ratchet.md b/initiatives/typing-alignment/decisions/010-verification-ratchet.md deleted file mode 100644 index 490de94..0000000 --- a/initiatives/typing-alignment/decisions/010-verification-ratchet.md +++ /dev/null @@ -1,64 +0,0 @@ -# Title: How should typing correctness be verified and existing errors removed? - -## Status - -Accepted - -## Context - -Source-only green checks miss consumer and wheel failures. OCC has a material -error baseline. NumPy dtype/layout and native ABI behavior need runtime tests, -while current ignores mix justified third-party gaps with contract debt. - -## Options - -1. Require only each package's source Pyright check. -2. Suppress existing errors through exclusions or a frozen baseline. -3. Combine source, consumer, runtime, native, and installed-wheel checks and - ratchet errors to zero through scoped work packages. - -## Recommendation - -Choose option 3. Verify: - -- source and typed consumer fixtures; -- accepted and expected-error Python/NumPy calls; -- scalar/dtype/layout/ownership runtime matrices; -- native imports and wrapper-to-ABI normalization; -- CGAL stub export parity; -- installed-wheel `py.typed`, stubs, and external consumers; -- custom duck-typed scalar, sequence, and buffer fixtures that are not tied to - the listed concrete classes; -- instrumented fixtures proving that ordinary Python paths avoid unnecessary - copies and conversions and that required native normalization occurs once; -- Ruff, formatting, relevant/full feasible tests, Pyright, and documentation. - -Reduce OCC errors to zero by owned module family. Do not introduce global -suppression or baseline files. Every remaining ignore is narrow, explained, -and located at a demonstrated third-party/native boundary. - -## Consequences - -- CI becomes broader and slower but verifies the distributed contract. -- Environmental/native limitations must be reported explicitly rather than - counted as passes. -- Error reduction is measurable per work package. -- Tests and documentation change with every contract correction. -- Verification tests observable behavior and capabilities rather than - reinforcing nominal runtime allow-lists. - -## Affected packages - -`compas`, `compas_occ`, `compas_cgal`, and `compas_framework`. - -## Dependencies - -- [001 — Supported baseline](001-supported-baseline.md) -- [002 — Numeric and array inputs](002-numeric-array-inputs.md) -- [003 — Array guarantees](003-array-guarantees.md) -- [004 — Tessellation buffers](004-tessellation-buffers.md) -- [005 — Native normalization](005-native-normalization.md) -- [006 — Plugin conformance](006-plugin-conformance.md) -- [007 — Backend substitutability](007-backend-substitutability.md) -- [008 — Return normalization](008-return-normalization.md) -- [009 — Typed distribution](009-typed-distribution.md) diff --git a/initiatives/typing-alignment/decisions/011-brep-query-truthfulness.md b/initiatives/typing-alignment/decisions/011-brep-query-truthfulness.md deleted file mode 100644 index bf3c2f9..0000000 --- a/initiatives/typing-alignment/decisions/011-brep-query-truthfulness.md +++ /dev/null @@ -1,81 +0,0 @@ -# Title: How should partially supported BRep queries report their results? - -## Status - -Accepted - -## Context - -Typing the OCC BRep plugins exposed a semantic mismatch that annotations cannot -repair. Core currently groups classification and topology into complete records. -Their public properties promise semantic answers, including that a closed BRep -has no naked boundaries and that the topology record contains its parametric -trims. - -The OCC implementation cannot currently satisfy the complete records: - -- `TopoDS_Shape` orientable, closed, infinite, and convex flags are native - shape flags, not demonstrated computations of the documented COMPAS - predicates; -- manifoldness is hardcoded to `False`; -- OCC has no `BrepTrim` implementation and returns an empty trim list even for - trimmed faces. - -Casting these values to the core records makes Pyright pass while presenting -unknown or unsupported results as authoritative `False` or empty values. This -violates the approved rule that annotations and plugin results describe actual -public behavior. - -## Options - -1. Preserve the current OCC flags, hardcoded value, and empty trim list. -2. Change the record fields to optional values or make their keys optional. -3. Implement every promised classification algorithm and OCC trim type before - exposing any BRep classification or topology query. -4. Keep truthful public properties, but separate unsupported semantic queries - from grouped supported results. Implement a query only where the backend can - satisfy its documented meaning; otherwise raise a documented - `NotImplementedError` for that query alone. - -## Recommendation - -Choose option 4. - -Unknown must not be represented as `False` or `[]`. Preserve the existing -public property meanings and isolate unsupported capabilities so that one -unsupported query, such as convexity, manifoldness, or trims, does not disable -reliable queries such as type, validity, vertices, edges, loops, faces, shells, -and solids. - -The implementation should make the smallest core plugin-contract adjustment -that permits independent failure. It should not add a general capability -framework, compatibility aliases, or nominal runtime type checks. OCC should -implement each query only with a native operation or algorithm that is tested -against the documented COMPAS meaning. - -WP3 may align and verify the other curve, surface, and BRep plugin signatures -independently. The OCC implementations of `brep_classification` and -`brep_topology` must follow this decision and must not encode the known -placeholders as truthful results. - -## Consequences - -- Unsupported BRep properties fail explicitly rather than silently returning a - plausible but incorrect value. -- Supported topology and classification queries remain usable independently. -- Core and backend plugin contracts, tests, and documentation require a narrow - coordinated update after approval. -- Full classification algorithms and an OCC trim representation can be added - later without changing the meaning of existing boolean or list results. -- This may expose previously silent OCC limitations as documented runtime - errors. - -## Affected packages - -`compas` and `compas_occ`. - -## Dependencies - -- [006 — Plugin conformance](006-plugin-conformance.md) -- [007 — Backend substitutability](007-backend-substitutability.md) -- [008 — Return normalization](008-return-normalization.md) diff --git a/initiatives/typing-alignment/decisions/012-structural-triangle-mesh-boundaries.md b/initiatives/typing-alignment/decisions/012-structural-triangle-mesh-boundaries.md deleted file mode 100644 index f5c0840..0000000 --- a/initiatives/typing-alignment/decisions/012-structural-triangle-mesh-boundaries.md +++ /dev/null @@ -1,93 +0,0 @@ -# Title: What should triangle-mesh algorithms accept at numerical boundaries? - -## Status - -Accepted - -## Context - -`Tessellation` is useful as a retained discrete representation produced by -parametric geometry and handed to visualization or transfer systems. It is now -also a nominal gate for more than eighteen numerical mesh operations. Native -CGAL requires only coordinate and index arrays, and `compas_cgal` already has a -split API in which closely related functions accept raw buffers. Requiring a -core geometry object therefore adds coupling that the algorithm and native ABI -do not need. - -## Options - -1. Keep `Tessellation` as the mandatory algorithm input and result. -2. Permanently accept both `Tessellation` and raw buffers at every operation. -3. Use one structural triangle-buffer contract for numerical algorithms and - retain `Tessellation` only as an explicit representation. - -## Recommendation - -Choose option 3. Define a single structural input contract equivalent to -`tuple[CoordinatesInput, IndicesCollectionInput]`. Core wrappers dispatch that -contract without converting to NumPy or recomputing mesh topology. Private -plugin hooks use the same structural contract. Native backends normalize once -at their ABI boundary and may return concrete NumPy-backed tuples. - -After conversion, a backend enforces only the minimal array-level preconditions -needed for memory-safe native execution, such as matrix column counts and index -bounds when the native helper performs unchecked access. Operation-specific -geometric validity—closedness, manifoldness, orientation, degeneracy, or -self-intersection—is an algorithm precondition, not a Python pre-validation -pass. Native success/failure must be propagated, and returned buffer shapes -must be checked at the backend boundary. - -Keep `Tessellation` as a retained triangular representation with explicit -conversion to and from vertex/triangle buffers. Do not implicitly convert -`Mesh`, `PolygonalSurface`, or `Tessellation` inside numerical algorithms. A -triangle-only operation validates face arity; quad or polygonal inputs must be -triangulated explicitly. - -Replace the nominal `tessellation_pluggable` gate with ordinary public -wrapper/private-hook pairs. `compas_cgal` raw functions remain directly usable -without constructing core geometry objects. - -## Decision - -Approved on 2026-11-04. The retained representation role of `Tessellation` is -preserved, while numerical algorithms and plugin contracts move to one -structural vertex/triangle-buffer path. Permanent object/raw overloads and -implicit representation conversion are not part of the approved design. -The Boolean pilot subsequently established that core-side topology validation -was unnecessary complexity: normalization and minimal process-safety checks -belong at the backend boundary, while native operation failures remain -authoritative. - -## Consequences - -- Lists, tuples, and suitable NumPy buffers are first-class inputs. -- Existing `Tessellation` callers must explicitly export their buffers. -- Algorithm results are shape-checked structural buffers; callers construct a representation - only when they need one. -- There is one public numerical path rather than permanent object/raw overloads. -- ADR 004 remains valid for retained `Tessellation` buffers, but it no longer - implies that algorithms should consume or return `Tessellation`. -- ADRs 005–006 become simpler: core owns semantic validation, and backends own - native dtype/layout normalization. - -## Affected packages - -`compas`, `compas_cgal`, `compas_occ` where it implements the same plugin -contracts, and cross-package consumer tests in `compas_framework`. - -## Verification - -- Python list/tuple and NumPy float32/64 plus int32/64 inputs. -- C/Fortran, sliced, and read-only buffers and source non-mutation. -- Backend conversion, safe matrix shapes and index ranges, native failure - propagation, and output shapes. -- Plugin signature parity and direct backend use without core objects. -- Explicit conversion to `Tessellation`, `PolygonalSurface`, and `Mesh`. - -## Dependencies - -- [002 — Numeric and array inputs](002-numeric-array-inputs.md) -- [003 — Array guarantees](003-array-guarantees.md) -- [004 — Tessellation buffers](004-tessellation-buffers.md) -- [005 — Native normalization](005-native-normalization.md) -- [006 — Plugin conformance](006-plugin-conformance.md) diff --git a/initiatives/typing-alignment/decisions/013-explicit-algorithms-and-discretization-controls.md b/initiatives/typing-alignment/decisions/013-explicit-algorithms-and-discretization-controls.md deleted file mode 100644 index 8e795a3..0000000 --- a/initiatives/typing-alignment/decisions/013-explicit-algorithms-and-discretization-controls.md +++ /dev/null @@ -1,94 +0,0 @@ -# Title: How should algorithms and discretization controls be selected? - -## Status - -Accepted - -## Context - -The top-level geometry namespace exports policy objects such as `Delaunay`, -`ConstrainedDelaunay`, `Native`, and `UVGrid`. Some are empty dispatch flags; -others mix unrelated producer-specific controls into universal hierarchies. -Their names look like geometry constructors or algorithms even when they only -select an implementation. - -## Options - -1. Keep the strategy hierarchies and top-level exports. -2. Replace empty flags only, leaving the universal tessellation hierarchy. -3. Use named algorithm functions and explicit producer-specific keyword - controls; use a small literal only where alternatives truly share a - contract. - -## Recommendation - -Choose option 3. - -Expose named triangulation operations such as `delaunay_triangulation`, -`constrained_delaunay_triangulation`, and -`conforming_delaunay_triangulation`. Their names perform the operation users -expect and their parameters expose only applicable controls. They return -structural vertex/triangle buffers under ADR 012. - -All Delaunay operations are restricted to planar domains. Input coordinates -must lie in one plane within the documented geometric tolerance. An optional -explicit frame defines that plane; otherwise the operation uses its documented -default plane. The implementation must not silently flatten a curved domain -and describe the result as Delaunay. Any separate decision to add native 2D -coordinate input does not change this planarity contract. - -Triangulation of non-planar polygons remains a separate polygonal operation, -including the existing `PolygonalSurface` capabilities. Support for slightly -curved domains is deferred and, if added, requires a separately named -approximation contract with explicit projection, deviation, and failure rules. - -Keep `tessellate()` as a convenient producer of a `Tessellation`, but replace -the universal public strategy hierarchy with keyword-only controls owned by -each geometry producer. A no-argument call uses documented defaults for generic -scene conversion. Resolution counts, approximation bounds, and numerical -tolerances remain distinct and state their units. - -Use separate named polygon-triangulation functions when algorithms have -different parameters. Use `method=Literal[...]` only when implementations -share the same input and option contract. Do not retain empty nominal flags or -nested policy objects without a demonstrated serialization requirement. - -## Decision - -Approved on 2026-11-04. Named functions replace dispatch-only strategy classes, -and parametric producers own explicit keyword-only discretization controls. -Resolution, approximation bounds, and numerical tolerance remain separate -concepts with documented units. Delaunay operations remain planar; curved -domain approximation is not part of the approved contract. - -## Consequences - -- `Delaunay()` no longer masquerades as an algorithm or result. -- The top-level geometry namespace loses policy/configuration nouns. -- Producers may expose different tessellation keywords because their controls - are materially different. -- Existing strategy imports, serialization, tests, and documentation require - direct migration on the C3 initiative branch. -- Resolution controls mesh density; approximation bounds limit geometric - error; tolerance remains for numerical predicates and validation. - -## Affected packages - -`compas`, `compas_cgal`, `compas_occ`, documentation, examples, and typed -consumer fixtures. - -## Verification - -- Named operations dispatch to matching plugin hooks. -- Delaunay operations reject non-planar 3D input outside the documented - tolerance and preserve accepted source coordinates. -- Non-planar polygon triangulation remains independent of Delaunay dispatch. -- Producer defaults support generic visualization conversion. -- Every public control has documented meaning, units, validation, and failure - behavior. -- Removed strategy symbols are absent from exports and documentation. -- Equivalent core/backend operations retain matching signatures. - -## Dependencies - -- [012 — Structural triangle-mesh boundaries](012-structural-triangle-mesh-boundaries.md) diff --git a/initiatives/typing-alignment/decisions/014-discrete-curvature-contracts.md b/initiatives/typing-alignment/decisions/014-discrete-curvature-contracts.md deleted file mode 100644 index 0846ef9..0000000 --- a/initiatives/typing-alignment/decisions/014-discrete-curvature-contracts.md +++ /dev/null @@ -1,87 +0,0 @@ -# Title: Which discrete triangle-mesh curvature operations belong in core? - -## Status - -Accepted - -## Context - -The three remaining `tessellation_pluggable` consumers are Gaussian, mean, and -principal triangle-mesh curvature. Their contracts are not interchangeable: - -- Core Gaussian curvature has a tested angle-defect implementation. Boundary - vertices use $\pi-\sum\theta$ and interior vertices use - $2\pi-\sum\theta$. -- Core mean curvature has no implementation and does not define whether its - result is an integrated measure or a pointwise density. -- Core principal curvature documents direction pairs, while the only - registered Rhino implementation returns maximum/minimum scalar values. -- Rhino Gaussian uses a different boundary convention. Its source is not in a - managed Git checkout or importable in the initiative environment. -- The direct libigl API returns both principal directions and values from a - neighborhood-fitting estimator, and deliberately is not registered as a - core plugin. - -Truthful annotations cannot make these mathematically different operations -substitutable. - -## Options - -1. Preserve principal direction pairs and discard the incompatible Rhino - registration. -2. Redefine principal curvature as maximum/minimum scalar-value lists and - separately define an integrated mean-curvature convention. -3. Return principal directions and values together, following libigl. -4. Keep only the verified core Gaussian angle-defect operation; remove the - unsupported core mean/principal plugin APIs until a concrete cross-backend - requirement and implementation exist. - -## Recommendation - -Choose option 4. - -Migrate `trimesh_gaussian_curvature` to a direct function accepting -`TriangleMeshInput`. It retains its documented, tested boundary-aware -angle-defect semantics and is not replaceable by plugins with different -boundary conventions. - -Remove core `trimesh_mean_curvature` and `trimesh_principal_curvature` rather -than retaining public operations without a verified conforming backend. -Package-owned Rhino and libigl curvature functions remain direct backend APIs. -If scalar principal values, direction fields, or an integrated mean-curvature -measure become a concrete cross-package requirement, introduce separately -specified operations with explicit normalization, units, estimator, and -boundary behavior. - -After this correction, delete `_tessellation_plugin.py`, its imports, and its -decorator-specific tests. - -## Decision - -Approved on 2026-11-05. Core retains only the verified boundary-aware Gaussian -angle-defect operation. Unsupported core mean and principal curvature plugin -APIs are removed. Backend-specific curvature estimators remain package-owned; -future cross-package operations require explicit mathematical contracts rather -than compatibility adapters. - -## Consequences - -- Core exposes one verified curvature quantity with unambiguous semantics. -- No backend-specific estimator is presented as universally substitutable. -- Two existing but unsupported core public names are removed on the unreleased - C3 initiative branch. -- Direct libigl curvature remains available without lossy adaptation. -- No new result classes, compatibility aliases, or plugin shims are added. - -## Verification - -- Python and NumPy raw mesh inputs for core Gaussian curvature. -- Boundary and interior angle-defect regression values. -- Source non-mutation and no implicit representation conversion. -- Removed symbols absent from exports, documentation, and typed consumers. -- No remaining `tessellation_pluggable` references. -- Ruff, Pyright, strict MkDocs, full feasible tests, and independent review. - -## Dependencies - -- [012 — Structural triangle-mesh boundaries](012-structural-triangle-mesh-boundaries.md) diff --git a/initiatives/typing-alignment/decisions/015-exact-triangulation-and-discretization-apis.md b/initiatives/typing-alignment/decisions/015-exact-triangulation-and-discretization-apis.md deleted file mode 100644 index 612c409..0000000 --- a/initiatives/typing-alignment/decisions/015-exact-triangulation-and-discretization-apis.md +++ /dev/null @@ -1,470 +0,0 @@ -# Title: What are the exact triangulation and discretization APIs? - -## Status - -Accepted. - -## Context - -Accepted ADR 013 chose named algorithms and producer-specific keyword controls -over public strategy hierarchies. Accepted Geometry-tessellation ADR 022 was -introduced in response to the user-authored operation definitions and -distinguishes -structured polygonization, discrete triangulation, and precision-controlled -BRep tessellation. - -This ADR supplies the exact signatures and invariants needed by WP7.4–WP7.7. -It depends on accepted Geometry ADRs 022–023 and Typing ADR 016. If any of -those decisions changes, this table must be reconciled before the affected -implementation changes. - -Accepted Geometry ADR 024 makes one such amendment: -`Mesh.triangulated(...) -> Self` while the other aggregate return contracts -remain `Tessellation`. This ADR's shared aggregate return clause is superseded -for `Mesh` only; its other aggregate contracts remain unchanged. - -Final implementation evidence also clarified the already accepted duck-typed -callable intent: triangulators return structural iterables of index-supporting -values, not necessarily concrete nested Python lists. This admits NumPy integer -arrays without changing normalization or validation behavior. - -## Polygon triangulation functions - -### Default operation - -```python -def triangulate_polygon(vertices: PointsLike) -> list[list[int]]: ... -``` - -The function: - -- raises `ValueError` for fewer than three vertices; -- returns the input triangle topology unchanged for three vertices; -- splits a quadrilateral along its shortest diagonal; -- uses planar ear clipping for five or more vertices; and -- raises `ValueError` when a polygon with five or more vertices is non-planar. - -### Named alternatives - -```python -def triangulate_quadrilateral( - vertices: PointsLike, - *, - diagonal: Literal["shortest", "02", "13"] = "shortest", -) -> list[list[int]]: ... - -def triangulate_polygon_earclip( - vertices: PointsLike, -) -> list[list[int]]: ... - -def triangulate_polygon_projected( - vertices: PointsLike, - *, - max_deviation: float, -) -> list[list[int]]: ... - -def triangulate_polygon_minimum_area( - vertices: PointsLike, -) -> list[list[int]]: ... -``` - -`triangulate_polygon_projected` projects to a best-fit plane only within the -explicit positive finite `max_deviation` bound. -`triangulate_polygon_minimum_area` accepts an ordered non-planar 3D polygon and -uses the O(n³) minimum-area triangulation. The ear-clipping function is the -explicit planar polygon operation. Delaunay processing of a concave boundary -uses the named constrained planar-domain operation below rather than an -implicit face-triangulation fallback. - -### Polygon result invariants - -For a valid polygon with `n` vertices, every polygon triangulator: - -- does not mutate or reorder the source coordinates and introduces no new - vertices; -- returns exactly `n - 2` triangles; -- returns three distinct integer indices in `[0, n)` for every triangle; -- references only source vertices; and -- produces triangles with nonzero area within `TOL`. - -Invalid or degenerate input raises instead of returning partial topology. -Planar and projected triangulations wind triangles consistently with the -ordered boundary in the working plane. Reversing the boundary reverses that -winding. Minimum-area triangulation preserves cyclic source-index orientation, -but makes no global-normal promise for a non-planar polygon. - -Ear clipping rejects non-simple polygons, repeated vertices, zero-length -edges, zero-area boundaries, and non-planarity. Projected triangulation applies -the same checks after projection within the deviation bound. Region -triangulation applies the corresponding checks to its exterior and holes. A -simple warped quadrilateral is supported, provided both triangles selected by -the requested diagonal are nondegenerate. - -## Aggregate customization - -### Options - -1. Do not expose aggregate customization; always use `triangulate_polygon`. -2. Add a `Literal` method switch to every aggregate. -3. Add multiple aggregate methods for every named algorithm. -4. Retain the strategy hierarchy. -5. Accept a duck-typed triangulator callable. - -### Recommendation - -Choose option 5: - -```python -Triangulator = Callable[ - [PointsLike], - Iterable[Iterable[SupportsIndex]], -] - -def triangulated( - self, - triangulator: Triangulator | None = None, -) -> Tessellation: ... -``` - -The structural iterable result truthfully accepts ordinary Python collections, -generators, and NumPy integer arrays. Core materializes and normalizes each -index exactly once with the index protocol before validating the complete -triangulation; the callback does not have to allocate nested Python lists. - -`Polygon`, `PolygonalSurface`, and `Polyhedron` expose the `Tessellation` -return contract above. Under Accepted Geometry ADR 024, `Mesh` instead exposes: - -```python -def triangulated( - self, - triangulator: Triangulator | None = None, -) -> Self: ... - -def triangulate( - self, - triangulator: Triangulator | None = None, -) -> None: ... -``` - -An omitted selector and an explicit `None` both resolve to -`triangulate_polygon`. This keeps the normal aggregate call concise and lets -callers forward an optional selector without substituting the default -themselves. A provided callable remains the sole customization mechanism; the -removed nominal strategy classes are not accepted. - -The callable keeps aggregate code independent of nominal strategy types and -allows algorithm-specific options to be bound transparently with -`functools.partial`. An aggregate stages all face results before mutating a -`Mesh`. Generated faces inherit source face attributes; vertex keys are -preserved, while generated face keys are not promised. - -Alternatives 1–4 are not recommended: no customization is unnecessarily -closed; a literal cannot express algorithm-specific options; multiple -aggregate methods duplicate APIs; and strategies preserve the abstraction -being removed. - -## Planar region triangulation and conversion - -`PlanarRegion` deliberately does not expose the aggregate triangulator -callable. Its exterior-and-holes contract has one no-insertion operation: - -```python -def triangulated(self) -> Tessellation: ... -def to_polygonal_surface(self) -> PolygonalSurface: ... -def to_mesh(self) -> Mesh: ... -``` - -The latter two are representation conversions, not polygonization operations. -The tessellation vertex buffer is flattened deterministically: exterior -vertices first, followed by every hole in stored order. Every returned triangle -indexes that flattened buffer. The operation introduces no Steiner vertices. -Triangle winding agrees with `region.plane.normal` regardless of the winding -of individual hole rings. Both conversions delegate to `triangulated` so they -preserve the same vertex mapping and topology. - -Users who need constrained or conforming refinement call the named planar -domain functions directly. Region triangulation rejects invalid, touching, or -intersecting rings rather than silently repairing them. - -## Named planar Delaunay functions - -```python -def delaunay_triangulation( - points: PointsLike, - *, - frame: Frame | None = None, -) -> VerticesFaces: ... - -def constrained_delaunay_triangulation( - boundary: PointsLike, - *, - holes: PointGroupsLike = (), - constraints: PointGroupsLike = (), - points: PointsLike = (), - frame: Frame | None = None, -) -> VerticesFaces: ... - -def conforming_delaunay_triangulation( - boundary: PointsLike, - *, - holes: PointGroupsLike = (), - constraints: PointGroupsLike = (), - points: PointsLike = (), - max_edge_length: float | None = None, - frame: Frame | None = None, -) -> VerticesFaces: ... -``` - -The matching private hooks are `_delaunay_triangulation`, -`_constrained_delaunay_triangulation`, and -`_conforming_delaunay_triangulation` with identical parameters and result -contracts. - -Inputs are planar within `TOL`. With `frame=None`, the domain is interpreted in -world XY. An explicit frame defines the planar domain. The operations do not -project curved inputs, return raw structural vertex/triangle buffers, and -preserve accepted source coordinates. `max_edge_length`, when provided, is -positive and finite. No `min_angle` or `max_area` control is introduced. - -The result is a concrete `(coordinates, triangles)` structural tuple, not a -`Tessellation`. Every triangle contains three distinct in-range integer -indices, has nonzero signed area in frame coordinates, and is counterclockwise -in frame XY. Its winding therefore agrees with the frame normal, or world +Z -when no frame is provided. - -Every distinct accepted source location appears in the result with its -original 3D coordinate. Repeated shared endpoints coalesce. Conflicting 3D -coordinates at the same planar location are rejected. Result vertex order is -unspecified. Unconstrained Delaunay and valid nonintersecting constrained -Delaunay introduce no Steiner vertices. Conforming Delaunay may introduce -planar Steiner vertices. - -Boundary and hole rings are simple and mutually disjoint. Constraints remain -inside the domain and may meet only at shared endpoints. Crossings and -unsupported touching configurations are rejected. No operation mutates Python -or NumPy source buffers. - -## Structured shape and surface conversions - -`Shape` and untrimmed `Surface` types expose `to_polygonal_surface` as the -conversion backed by structured polygonization: - -| Producer | Exact signature | Validation and polygonal result | -|---|---|---| -| `Box` | `to_polygonal_surface()` | No controls; six quadrilateral faces. | -| `Cone`, `Cylinder` | `to_polygonal_surface(*, nu: int = 64)` | `nu >= 3`; structured side cells and required cap/pole triangles. | -| `Sphere` | `to_polygonal_surface(*, nu: int = 64, nv: int = 64)` | `nu >= 3`, `nv >= 3`; quads where regular and required pole triangles. | -| `Torus` | `to_polygonal_surface(*, nu: int = 64, nv: int = 64)` | `nu >= 3`, `nv >= 3`; a periodic quadrilateral grid. | -| `Capsule` | `to_polygonal_surface(*, nu: int = 64, nv: int = 64)` | `nu >= 3`; `nv >= 4` and even; quads where regular and required pole triangles. | -| untrimmed `Surface` | `to_polygonal_surface(*, nu: int = 64, nv: int = 64)` | Both counts `>= 1`; `(nu + 1) * (nv + 1)` vertices and `nu * nv` quads. | - -Counts are cell resolution, not approximation-error targets. Booleans and -non-integral values raise `TypeError`; values below the stated minima raise -`ValueError`. No generic adaptive control is introduced. - -For a `Surface` grid, vertices use lexicographic `(u, v)` order with `v` -varying fastest. Periodic seams retain separate endpoint samples. Cell corners -`a, b, c, d` follow increasing parameter directions. Analytic normals follow -`du × dv`; arbitrary coarse chord faces do not have a universal orientation -guarantee relative to those normals on curved or folded cells. - -Singular cells may remain. The conversion does not silently delete or reindex -them, so universal face nondegeneracy is not guaranteed at parameter -singularities. This limitation is documented rather than hidden by a -topology-changing cleanup. - -## Shape and surface triangle conversion - -The same producers expose `to_tessellation` for visualization and transfer, -with signatures identical to their `to_polygonal_surface` calls: - -```python -shape.to_tessellation(*, same_resolution_keywords) -> Tessellation -surface.to_tessellation(*, nu: int = 64, nv: int = 64) -> Tessellation -``` - -This is an exact composition, not an independent approximation algorithm: - -```python -geometry.to_tessellation(**options) -# has the same vertices and triangles as -geometry.to_polygonal_surface(**options).triangulated() -``` - -Every polygonal face uses the default `triangulate_polygon` policy. The -conversion inserts no vertices beyond the structured polygonization and may -not choose a backend-specific alternative. A caller needing another policy -uses `to_polygonal_surface(...).triangulated(custom_callable)`. - -For `Surface`, the result may additionally carry analytic vertex normals and UV -coordinates sampled in the same vertex order. UV coordinates are -`[i / nu, j / nv]`. Analytic normals follow `du × dv`; no universal agreement -between those normals and coarse chord-triangle winding is promised for an -arbitrary curved or folded surface. Attributes are attached only when one -valid same-index value exists per polygonized vertex. The conversion never -duplicates vertices to manufacture seam or crease attributes. - -## BRep tessellation conversion - -`Brep` and `BrepFace` do not expose a polygonal-surface conversion. They expose -only the representation-oriented method backed by BRep tessellation: - -```python -def to_tessellation( - self, - *, - linear_deflection: float | None = None, - angular_deflection: float | None = None, -) -> Tessellation: ... -``` - -`BrepFace.to_tessellation` delegates through `as_brep`. Public methods resolve -`None` before plugin dispatch: linear deflection uses -`TOL.lineardeflection`, and angular deflection uses the degree equivalent of -`TOL.angulardeflection`. - -The plugin hook receives the BRep positionally and concrete required keyword -arguments: - -```python -def brep_to_tessellation( - brep: Brep, - *, - linear_deflection: float, - angular_deflection: float, -) -> Tessellation: ... -``` - -The hook does not accept or resolve `None`. Linear deflection is in model -units; angular deflection is in degrees. Public resolution and explicit values -use the same validation: booleans and non-real values raise `TypeError`; -non-finite or non-positive values raise `ValueError`; angular values greater -than 180 raise `ValueError`. OCC converts degrees to radians exactly once at -the native boundary. Tessellation preserves face winding and relevant boundary -polylines. - -There is no `Brep.to_polygonal_surface` or -`BrepFace.to_polygonal_surface`. The old `brep_tessellate` and -`brep_polygonize` hooks are removed; `brep_to_tessellation` is the sole BRep -conversion hook. Converting its result to a `PolygonalSurface` afterward is a -separate representation conversion and does not claim structured BRep -polygonization. - -## Numerical triangle-mesh boundaries - -Numerical mesh operations use the structural contract accepted in ADR 012: - -```python -VerticesFaces = tuple[PointsLike, IndexGroupsLike] -``` - -They accept suitable Python sequences and NumPy buffers directly and return -shape-checked structural buffers. They do not require or implicitly convert -`Tessellation`, `PolygonalSurface`, or `Mesh`. Backend normalization occurs -once at the native ABI boundary with only the minimal safety checks required -for native access and operation-specific result validation. - -## Direct removal and migration - -Remove the following without aliases, adapters, deprecation shims, or duplicate -public paths: - -- `TriangulationStrategy`, `FaceTriangulation`, `DiagonalSplit`, - `EarClipping`, `ProjectedEarClipping`, and `MinimumAreaTriangulation`; -- `_PlanarTriangulationStrategy`, `Delaunay`, `ConstrainedDelaunay`, - `ConformingDelaunay`, and `TriangulationQuality`; -- strategy-selected `triangulate_planar_*` functions and private hooks; -- `TessellationStrategy`, `Native`, `UGrid`, `UVGrid`, `Adaptive`, and - `Deflection`; -- strategy serialization, exports, documentation, and examples; -- generic `Shape` strategy handling and `_tessellation_strategy`; and -- public `polygonize`/`tessellate` methods, BRep/BRepFace polygonal-surface - conversion, and the old `brep_polygonize`/`brep_tessellate` hooks. - -| Removed path | Replacement | -|---|---| -| Polygon strategy object | Named polygon function or aggregate callable. | -| Delaunay strategy flag | Matching named planar Delaunay function. | -| `TriangulationQuality` | `max_edge_length` on conforming Delaunay only. | -| Shape/surface policy strategy | Producer-owned `to_polygonal_surface` and `to_tessellation` `nu`/`nv` keywords. | -| BRep `Deflection` | Linear and angular `to_tessellation` keywords. | -| Shape/surface `polygonize`/`tessellate` | Representation-oriented `to_polygonal_surface`/`to_tessellation`. | -| BRep polygonization | No direct conversion; explicitly convert the resulting `Tessellation` if needed. | -| `brep_polygonize`/`brep_tessellate` | Sole `brep_to_tessellation` hook. | -| Strategy serialization and exports | No replacement. | - -## Verification - -- Assert exact public and plugin signatures, defaults, keyword-only controls, - and producer-family operation availability. -- Cover Python and NumPy coordinate inputs and source non-mutation. -- Verify polygon triangle counts, index bounds and distinctness, source-only - references, nonzero areas, winding, reversed boundaries, warped quads, - degeneracy rejection, and minimum-area cyclic orientation. -- Verify aggregate face mapping, atomic mutation, attribute transfer, omitted - and explicit-`None` default equivalence, and callable customization including - `functools.partial`. -- Verify no-argument `PlanarRegion` triangulation, either hole winding, - exterior-then-holes flattening, region-normal winding, no Steiner vertices, - invalid ring rejection, and conversion delegation. -- Verify Delaunay result shapes, signed frame area, winding, rotated frames, - source-coordinate retention, coalescing/rejection rules, allowed Steiner - insertion, crossing rejection, and input non-mutation. -- Verify polygonal cell counts and order for every producer. Compare direct - shape/surface `to_tessellation` against - `to_polygonal_surface(...).triangulated()` for identical vertices and - triangles, including singular-cell behavior. -- Verify Surface normals and UVs use the same vertex order without affecting - topology, document that chord-triangle orientation may differ from analytic - normals on folded/coarsely sampled cells, and omit attributes that require - vertex duplication. -- Assert BRep polygonal conversion and old operation hooks are absent. Verify - exact `brep_to_tessellation` parity, BRep deflection defaults, validation, - degree-to-radian conversion exactly once, face delegation, winding, and - boundary polylines. -- Exercise structural numerical operations directly with Python and NumPy - buffers without core geometry-object construction. -- Assert removed symbols are absent from exports, serialization, examples, - documentation, typed fixtures, and built packages. -- Run focused and full feasible tests, Ruff, formatting, Pyright, strict docs, - distribution checks, and cross-package integration. - -## Consequences - -- Operation names follow the geometry being processed rather than the desired - face arity alone. -- Structured producers have one primary discretization path and one exact - triangle representation conversion. -- BRep `to_tessellation` has a precision-controlled tessellation contract and - no misleading polygonal-surface twin. -- Aggregate customization follows Python duck typing. -- Delaunay remains planar and structural at numerical boundaries. -- The C3 branch makes a direct clean break without compatibility layers. - -## Affected packages - -`compas`, `compas_cgal`, `compas_occ`, `compas_model`, `compas_viewer`, -`compas_framework`, documentation, examples, serialization fixtures, plugin -fixtures, and installed consumers. - -## Dependencies - -- [012 — Structural triangle-mesh boundaries](012-structural-triangle-mesh-boundaries.md) -- [013 — Explicit algorithms and discretization controls](013-explicit-algorithms-and-discretization-controls.md) -- [016 — Core structural type vocabulary](016-core-structural-type-vocabulary.md) -- Geometry-tessellation ADR 022 — operation terminology and producer boundaries -- Geometry-tessellation ADR 023 — BRep deflection defaults - -## Decision - -Approved on 2026-11-05 together with Geometry ADRs 022–023 and Typing ADRs -016–017. The accepted contract uses named planar algorithms, duck-typed -aggregate triangulators, producer-specific conversion controls, raw structural -numerical boundaries, and one BRep tessellation hook. The rationale is to keep -the public API explicit and composable without nominal strategy objects or -mandatory core representation wrappers. - -On 2026-11-06, the aggregate selector contract was clarified by explicit user -direction: omitted and explicit `None` selectors both mean the default -`triangulate_polygon` operation. This does not restore the removed strategy -hierarchy or add a second customization path. diff --git a/initiatives/typing-alignment/decisions/016-core-structural-type-vocabulary.md b/initiatives/typing-alignment/decisions/016-core-structural-type-vocabulary.md deleted file mode 100644 index 3d0abf6..0000000 --- a/initiatives/typing-alignment/decisions/016-core-structural-type-vocabulary.md +++ /dev/null @@ -1,496 +0,0 @@ -# Title: What structural type vocabulary should core and numerical packages share? - -## Status - -Accepted. - -## Context - -The accepted numeric-input decisions established that appropriate Python and -NumPy values are first-class inputs, but the current core vocabulary does not -express that contract consistently: - -- `TriangleMeshInput` is used for both parameters and results, so its - direction suffix is false. It also cannot enforce triangle arity. -- `MeshType` is a tuple of vertices and faces, not a `Mesh`. It overlaps - `TriangleMeshInput`, excludes NumPy arrays, and conflicts lexically with - several actual `Mesh`-bounded type variables. -- `Coordinate`, `CoordinateType`, and `CoordinateInput`, and their plural - counterparts, expose overlapping meanings that are not apparent from their - names or connected to the familiar geometric idea of a point-like value. -- `PolygonalSurface`, `Polyhedron`, `Polygon`, `Polyline`, and `Pointcloud` - reject suitable NumPy values statically even where their copying runtime - paths can consume them. -- `PolygonalSurface` and therefore `Polyhedron` additionally reject NumPy - integer face indices at runtime through a concrete `int` check, despite the - accepted integral-input contract. -- `compas_cgal` duplicates broad public aliases as `Vertices`, `Faces`, and - `VerticesFaces`; `compas_libigl` uses both the core aliases and casts around - `MeshType`. The packages can therefore type the same structural value - differently. - -Measured consumers confirm that CGAL's normal `float64` vertex and `int32` -face result is accepted directly by `Mesh.from_vertices_and_faces` and -`Tessellation`, but rejected by `PolygonalSurface` and `Polyhedron`. Calls that -add `.tolist()` or `cast(...)` conceal this mismatch rather than resolving the -shared contract. - -Focused Pyright 1.1.414 experiments through `compas3` show that neither a -single exact indexing protocol nor an iteration-only protocol is sufficient: - -- a protocol with `__len__`, `__iter__`, and only - `__getitem__(int) -> SupportsFloat` rejects `list[float]`, `list[int]`, - tuples, memoryviews, COMPAS `Point` and `Vector`, and NumPy arrays because - their real indexing signatures are overloaded or include slices; -- a protocol with only `__len__` and - `__iter__ -> Iterator[SupportsFloat]` accepts those one-dimensional values, - but does not prove the indexing and slicing used throughout current geometry - code; and -- a layered alias combining a rich generic protocol, ordinary `Sequence`, and - `NumericArray` accepts the same values while typing both integer indexing and - slicing without pretending a slice is another point. - -The successful protocol overloads integer access to its scalar type and slice -access to `Sequence` of that type. The public aliases add `Sequence` and -`NumericArray` branches because built-ins and NumPy arrays need not match the -protocol's exact overload implementation. Under the same checker, the layered -design passed with zero errors for float/int lists, tuples, memoryviews, -one-dimensional float64/int32 arrays, COMPAS `Point` and `Vector`, a nominal -protocol implementation, nested point/index lists, two-dimensional -point/index arrays, three-dimensional point-group arrays, and empty tuple -defaults. The integer-indexed collection protocol also accepts current -`Line`, `Plane`, `Frame`, and overloaded `Polyline` implementations. The probe -verified `point[0]`, `point[:2]`, `float(point[0])`, and -`list(point[:2])` for every coordinate-alias branch. - -A further arithmetic probe exposed an important tradeoff. `SupportsFloat` -proves conversion, not direct arithmetic: a consumer cannot safely write -`point[0] * point[0]` without adding conversions that do not exist today. -Using the already approved `RealInput` scalar family preserves current direct -arithmetic for Python and NumPy real scalars. The complete layered alias with -`RealInput` passed lists, tuples, float32/float64 NumPy vectors, nominal point -implementations, indexing, slicing, and direct arithmetic with zero Pyright -errors. - -## Options - -1. **Keep the current names and add more unions.** This minimizes renaming but - retains two overlapping mesh-tuple aliases and directionally false names. -2. **Define nominal `TriangleMesh` and `QuadMesh` classes.** This makes arity - visible but adds representations that duplicate `Tessellation`, - `PolygonalSurface`, and `Mesh`, and still does not describe raw arrays. -3. **Use one core-owned structural vocabulary with explicit protocol, input, - and concrete-result names.** Express face arity as an operation invariant, - and make owning core constructors accept the same supported numerical - inputs. -4. **Use `numpy.typing.ArrayLike` everywhere.** This is concise but promises - coercions and scalar/object forms that many geometry APIs do not support. - -Within option 3, `RealInput` describes the Python and NumPy numeric scalars on -which existing consumers perform arithmetic directly. `SupportsFloat` would -describe a broader conversion capability but require new `float(...)` calls, -casts, or ignores throughout those consumers. The recommendation chooses -`RealInput`: annotations follow existing runtime behavior and must not create -runtime work solely to satisfy static typing. - -## Recommendation - -Choose option 3. - -### Naming rules - -- A public duck-typed boundary uses a familiar semantic name with a `Like` - suffix. The name describes the argument's geometric role, not a nominal - runtime category. -- A reusable structural interface uses a `Protocol` suffix. It exists to - express operations and runtime duck membership; it is not an input gate. -- An `Input` suffix is used only for a value accepted at a call boundary, not - for a result or bidirectional interchange value. -- A neutral structural tuple is named for its contents, not for a COMPAS class - that it is not. -- A concrete returned representation is annotated concretely rather than with - a broader accepted-input alias. -- Raw geometric tuples use a `Data` suffix rather than a generic `Type` - suffix. - -The coordinated migration is: - -| Current name | Decision | Replacement | -|---|---|---| -| `FloatSequence` protocol and `FloatSequenceType` union | Preserve a neutral role for quaternion and generic linear-algebra inputs without duplicating the coordinate protocol. | `FloatSequenceLike`; use `PointLike` or `VectorLike` where the argument has that semantic role, and an exact type for concrete results | -| `RawCoordinateType` | Remove; it is unused and narrower than the accepted contract. | None | -| runtime-checkable `Coordinate` | Retain one technical structural capability with truthful index/slice operations. | `CoordinateProtocol[T_co]` | -| `CoordinateType`, `CoordinateInput`, `PointCoordinates` | Replace ambiguous coordinate names according to geometric argument role. | `PointLike` or `VectorLike`; exact outputs remain explicit tuples/lists | -| runtime-checkable `Coordinates` | Retain the collection capability required by existing equality guards. | `PointsProtocol` | -| `CoordinatesType`, `CoordinatesInput` | Use one NumPy-aware collection alias. | `PointsLike` | -| `Indices`, `IndicesInput` | Separate the technical row protocol from the public NumPy-aware alias. | `IndicesProtocol`, `IndicesLike` | -| `IndicesCollection`, `IndicesCollectionInput` | Name the nested structural role rather than its container. | `IndexGroupsProtocol`, `IndexGroupsLike` | -| `CoordinatesCollection`, `CoordinatesCollectionInput` | Name collections of point groups explicitly. | `PointGroupsProtocol`, `PointGroupsLike` | -| `TriangleMeshInput` | Remove the directional and unenforced triangle name. | `VerticesFaces` | -| tuple-valued `MeshType` | Remove the name that conflicts with the actual `Mesh`. | `VerticesFaces` | -| `SphereType` | Rename the raw center/radius tuple and make its payload explicit. | `SphereData = tuple[PointLike, RealInput]` | -| `RayType` | Rename the raw origin/direction tuple and make its semantic roles explicit. | `RayData = tuple[PointLike, VectorLike]` | -| `RayMeshHit` | Keep; it is neutral and descriptive. | `RayMeshHit` | - -`RealInput`, `IntegralInput`, `NumericArray`, `FloatingArray`, `IntegerArray`, -`Float64Array`, and `Int32Array` remain. Their names accurately distinguish -accepted scalars from concrete array representations. - -### Authoritative structural aliases - -Core owns the common vocabulary in the public `compas.typing` module. Package -code and integrations import shared aliases from that module; they do not -import the private `compas._typing` path. After every in-scope import migrates, -remove `_typing.py` directly without re-exports or a forwarding shim. - -In Python 3.12 notation, the relevant shape is conceptually: - -```python -@runtime_checkable -class CoordinateProtocol[T_co](Protocol): - def __len__(self) -> int: ... - def __iter__(self) -> Iterator[T_co]: ... - - @overload - def __getitem__(self, key: int) -> T_co: ... - - @overload - def __getitem__(self, key: slice) -> Sequence[T_co]: ... - -type FloatSequenceLike = ( - CoordinateProtocol[RealInput] - | Sequence[RealInput] - | NumericArray -) -type PointLike = FloatSequenceLike -type VectorLike = FloatSequenceLike - -@runtime_checkable -class PointsProtocol(Protocol): - def __len__(self) -> int: ... - def __iter__(self) -> Iterator[PointLike]: ... - def __getitem__(self, key: int) -> PointLike: ... - -class IndicesProtocol(Protocol): - def __len__(self) -> int: ... - def __iter__(self) -> Iterator[SupportsIndex]: ... - def __getitem__(self, key: int) -> SupportsIndex: ... - -type PointsLike = PointsProtocol | Sequence[PointLike] | NumericArray -type IndicesLike = IndicesProtocol | Sequence[SupportsIndex] | IntegerArray - -class IndexGroupsProtocol(Protocol): - def __len__(self) -> int: ... - def __iter__(self) -> Iterator[IndicesLike]: ... - def __getitem__(self, key: int) -> IndicesLike: ... - -class PointGroupsProtocol(Protocol): - def __len__(self) -> int: ... - def __iter__(self) -> Iterator[PointsLike]: ... - def __getitem__(self, key: int) -> PointsLike: ... - -type IndexGroupsLike = ( - IndexGroupsProtocol | Sequence[IndicesLike] | IntegerArray -) -type PointGroupsLike = ( - PointGroupsProtocol | Sequence[PointsLike] | NumericArray -) -type VerticesFaces = tuple[PointsLike, IndexGroupsLike] -type SphereData = tuple[PointLike, RealInput] -type RayData = tuple[PointLike, VectorLike] -``` - -`FloatSequenceLike`, `PointLike`, and `VectorLike` deliberately have the same -accepted structure without duplicate protocol bodies. `FloatSequenceLike` is -the neutral name for quaternions and generic linear-algebra inputs. The -semantic aliases make signatures such as -`Plane(point: PointLike, normal: VectorLike)` read according to geometry -semantics; they do not create nominally distinct runtime categories, and a -point does not structurally reject a vector or vice versa. - -The coordinate slice overload returns `Sequence[T_co]`, not `PointLike` or -`VectorLike`. A two-component slice is not semantically a point or vector, and -recursively typing it as one causes false structural failures. Collection -protocols are defined only with the integer access used by current common -consumers. Lists and tuples still expose slicing through their concrete -`Sequence` branch, but the shared `PointsLike` contract does not promise -slicing for every custom point collection. No speculative `Like` hierarchy is -added. - -Neither `Sequence` nor current NumPy typing encodes coordinate arity or array -rank in these aliases. One-dimensionality and required component count remain -operation contracts enforced by existing constructor or native-boundary -behavior. The aliases do not authorize a separate eager validation pass. - -Explicit NumPy union members remain necessary for nested matrices and higher -collections: Pyright does not model them as satisfying the nested iterable -protocols reliably. Protocols support stable duck-typed consumers; they do not -replace the array members or justify nominal runtime checks. - -### Runtime preservation - -`RealInput` is the shared point/vector element contract because it supports the -arithmetic current consumers already perform. Implementations continue using -those values directly. They must not add `float(...)`, `np.asarray(...)`, -copies, validation passes, casts, or ignores merely to make an annotation -type-check. - -An individual constructor or setter may use `SupportsFloat` only when its -existing implementation already calls `float(...)` on that parameter and the -annotation is documenting that established behavior. `Point` and `Vector` -constructor components and their `x`/`y`/`z` setters are the initial examples: -they already store `float(value)`. Such a local scalar annotation does not -broaden the element contract of `FloatSequenceLike`, `PointLike`, or -`VectorLike`. Any broader runtime acceptance or new normalization requires a -separate explicit behavior decision. - -Every alternative of `RealInput` must remain statically assignable to -`SupportsFloat`. Therefore a scalar obtained from a one-dimensional -`PointLike` or `VectorLike` can be passed directly to an existing normalizing -scalar API—for example, `point.x = point_like[0]`—without a call-site -conversion, cast, or ignore. Any future expansion of `RealInput` must preserve -this invariant or require a separate explicit decision. - -### Static capability and runtime membership - -`CoordinateProtocol` and `PointsProtocol` are `@runtime_checkable` only because -existing public equality behavior and tests use structural coordinate and -coordinate-collection membership. Runtime guards use the corresponding -unparameterized protocol, never `PointLike`, `VectorLike`, or `PointsLike`: -the semantic aliases are static unions, not runtime allow-lists. Constructors, -numerical wrappers, and native adapters must not add protocol membership gates. - -Runtime protocol membership checks method presence, not overload signatures or -element types. Lists, tuples, NumPy vectors, and COMPAS `Point`/`Vector` retain -their current duck behavior because all are indexable and iterable. Core -`Point` and `Vector` explicitly declare `CoordinateProtocol[float]` conformance -so their intended relationship is checked rather than inferred accidentally; -their existing integer and slice overloads satisfy the measured protocol. - -Runtime protocol checks cannot inspect iterator element types. Equality still -uses its existing length and component-comparison behavior; the protocol alone -does not turn invalid elements into a validated geometric value. Focused tests -pin current `False` and exception outcomes for -`Point`, `Vector`, `Plane`, `Line`, `Frame`, and `Polyline` equality with -ordinary sequences, COMPAS objects, iterable-only ducks, invalid iterables, -and NumPy values. - -Iterable-only and indexing-only ducks do not satisfy the complete runtime -protocol. Migration fixtures record whether each remains dynamically usable by -a particular operation through Python's ordinary fallback behavior; neither is -silently promoted to the shared static contract. - -### Indexed-consumer migration - -Migration is not a mechanical annotation rename. WP8.1 inventories every -consumer of the removed coordinate aliases that subscripts its operand. - -- Use the rich protocol's integer and slice operations where current code - genuinely indexes. Prefer iteration, unpacking, or `zip` where that already - expresses the operation more directly and preserves behavior. -- Do not introduce another operation-specific coordinate protocol merely to - avoid an accurate `PointLike`/`VectorLike` annotation, and do not hide a - mismatch with `Any`, a cast, or an ignore. -- Preserve currently tested runtime duck behavior unless a separate approved - contract explicitly removes it. Static aliases need not enumerate every - object that Python can consume dynamically. - -Each changed consumer has accepted static fixtures, runtime duck fixtures, -and an expected-error case. The migration may alter implementation mechanics -only where tests prove the observable values, order, exceptions, mutation, and -allocation contract remain unchanged. - -`VerticesFaces` is the sole public structural vertices/faces interchange -alias. It is suitable for both arguments and results. Whether its faces are -triangles, quads, or arbitrary polygons is an operation contract documented -and checked at the boundary that requires that invariant; the current Python -and NumPy type systems cannot enforce row length here. Do not add synonymous -`VerticesTriangles`, `TriangleMeshData`, or `MeshLike` aliases. - -Core owns the primitive `Float64Array` and `Int32Array` aliases but does not own -an ABI-specific vertices/faces tuple. A native package may define an internal -`VerticesFacesNumpy = tuple[Float64Array, Int32Array]` alias when that exact -pair is repeatedly returned. Such an alias describes concrete package output; -it is not a competing public input vocabulary or a new geometry -representation. - -### Input and output policy - -Public Python and plugin parameters use the narrowest applicable core input -or structural alias. They do not use backend-local copies of those aliases. - -Results state what is actually returned: - -- a normalized Python result uses `float`, `int`, `list[...]`, or an exact - tuple of those values; -- a retained or native NumPy result uses `Float64Array`, `Int32Array`, or an - exact package-local array tuple; -- a result intentionally permitted to vary between compatible Python and - NumPy structural buffers uses `VerticesFaces`; -- sparse matrices and heterogeneous tuples use their actual library and - element types, not `NDArray` or `Any`. - -Using a broad accepted-input alias as a result annotation is allowed only when -the public contract deliberately permits every representation in that union. -It is not a shortcut for an unknown native return type. - -Representative semantic signatures use the aliases consistently: - -```python -class Plane: - def __init__(self, point: PointLike, normal: VectorLike) -> None: ... - -class Line: - def __init__(self, start: PointLike, end: PointLike) -> None: ... - -class Frame: - def __init__( - self, - point: PointLike, - xaxis: VectorLike, - yaxis: VectorLike, - ) -> None: ... -``` - -The same role rule applies to functions: positions, locations, and vertices -use `PointLike`; directions, normals, axes, and translations use `VectorLike`. -This is documentation and static intent, not runtime discrimination. - -### Core constructor matrix - -The following owned constructors accept appropriate NumPy inputs because their -existing semantics copy or normalize the supplied values: - -| Constructor | Accepted annotation | Ownership and normalization | -|---|---|---| -| `Point`, `Vector` constructor components and `x`/`y`/`z` setters | `SupportsFloat` | Document their existing `float(value)` storage normalization; no new conversion is introduced. | -| `Plane` and its point/normal setters | `PointLike`, `VectorLike` | Copy point and normal into owned core objects. | -| `Line` and its start/end setters | `PointLike`, `PointLike` | Copy start and end into owned points. | -| `Frame` and its point/xaxis/yaxis setters | `PointLike`, `VectorLike`, `VectorLike` | Copy origin and axes into owned core objects. | -| `Polyline`, `Polygon`, `Pointcloud` | `PointsLike` | Copy coordinates into owned points. | -| `PolygonalSurface`, `Polyhedron` | `PointsLike`, `IndexGroupsLike` | Copy coordinates and normalize each non-boolean copied index through the integer-index protocol. | -| `PolygonalSurface.vertices` and `.faces` setters | `PointsLike`, `IndexGroupsLike` | Apply the same ownership and normalization contract as construction. | -| `Mesh.from_vertices_and_faces` | `PointsLike`, `IndexGroupsLike` | Preserve its existing broad copying contract. | -| `Tessellation` | its generic coordinate/index buffer bounds | Retain compatible buffers without copying, as already documented. | - -Quaternion and generic linear-algebra functions that currently use -`FloatSequenceType` migrate to `FloatSequenceLike`, not to a geometric alias. -Functions returning a concrete normalized list say `list[float]`; the few -zero-length normalization paths that deliberately return their original input -may retain `FloatSequenceLike` as the result until that runtime contract is -separately changed. - -The `PolygonalSurface` index correction is an approved runtime contract change -if this ADR is accepted: reject Python and NumPy booleans as face indices, and -otherwise use the integer-index protocol while performing the existing -ownership copy. Python and NumPy integral scalars are accepted and stored as -Python `int`. Do not add a separate eager validation/conversion pass. Preserve -existing shape, bounds, failure, and mutation behavior unless another accepted -contract explicitly changes it. - -Copying and normalization preserve vertex order, face order, index order, face -winding, and source values apart from the stated scalar representation change. -They never sort, deduplicate, triangulate, or repair topology. - -Constructors that retain buffers continue to document identity, ownership, -and mutation. Constructors that own Python values normalize once as part of -their existing copy. No conversion is added merely to satisfy Pyright. -Corresponding public setters or mutators are widened only when they already -share the same verified runtime normalization path; unrelated mutation APIs -are not broadened speculatively. - -## Compatibility and migration - -This is a coordinated C3 breaking migration. Add `compas.typing`, migrate core -and every in-scope integration, then remove the superseded aliases and -`compas._typing` directly. Do not leave aliases, re-exports, forwarding modules, -or parallel package-local public vocabularies. - -The tuple-valued `MeshType` is distinct from local type variables bounded by -the actual `Mesh`; those local type variables may remain but should use a less -ambiguous name such as `MeshT` when touched. - -CGAL and libigl may retain package-local aliases for genuinely package-specific -heterogeneous results. Such aliases are built from the core primitive array -types and must not redefine `VerticesFaces` or the accepted point/index -families. - -## Verification - -- Static accepted/error fixtures for Python lists, tuples, custom structural - objects, NumPy float32/float64 coordinates, and int32/int64 indices. -- A focused Pyright protocol matrix covering lists of float/int, tuples, - memoryviews, COMPAS `Point`/`Vector`, one-dimensional NumPy arrays, nested - Python points, and NumPy point matrices. It proves the rich protocol plus - `Sequence`/`NumericArray` union, usable scalar/index and sequence/array slice - unions for `point[0]` and `point[:2]`, unchanged direct arithmetic, and - nominal `Point`/`Vector` conformance. It does not claim exact scalar - inference for an unshaped NumPy branch and retains error fixtures for the - rejected single-signature and iteration-only alternatives. -- A focused Pyright scalar-handoff matrix proving that the complete - `RealInput` union and representative Python `int`/`float` and NumPy - integer/floating values satisfy `SupportsFloat`, and that - `point.x = point_like[0]` plus the corresponding representative `Vector` - setter assignment require no conversion, cast, or ignore. Point/vector - element access in this fixture is subject to the one-dimensional operation - contract; it does not infer shape from the unshaped `NumericArray` alias. -- Static fixtures for `Plane(PointLike, VectorLike)`, `Line(PointLike, - PointLike)`, and `Frame(PointLike, VectorLike, VectorLike)` using Python, - COMPAS, and NumPy values. -- Runtime structural-membership and equality fixtures for lists, tuples, - NumPy vectors, COMPAS objects, iterable-only, indexing-only, and invalid - ducks, including the existing `isinstance` behavior through unparameterized - protocols. -- An indexed-consumer inventory proving that every removed coordinate alias is - migrated to a semantic alias or exact result type without casts or ignores. -- Runtime matrices for contiguous, Fortran-order, sliced, non-contiguous, - read-only, and empty arrays, with source non-mutation and explicit boolean - index rejection. -- Direct construction of `Point`, `Vector`, `Polyline`, `Polygon`, - `Pointcloud`, `PolygonalSurface`, `Polyhedron`, `Mesh`, and `Tessellation` - from applicable CGAL/libigl results without `.tolist()` or `cast`. -- Assignment of supported NumPy scalars and buffers through the corresponding - verified `Point`, `Vector`, and `PolygonalSurface` public setters. -- Exact inferred result assertions for Python, NumPy, sparse, and mixed tuple - results. -- Repository-wide absence checks for every removed alias and package-local - duplicate, including private `compas._typing` imports. -- Constructor checks that preserve vertex, face, and index order and face - winding exactly. -- Core and cross-package Pyright, relevant runtime tests, Ruff, formatting, - strict documentation, installed-wheel consumers, and `git diff --check`. - -## Consequences - -- Public names describe structures rather than call direction or nonexistent - geometry classes. -- Core becomes the single dependency direction for shared numerical types. -- Appropriate NumPy results flow directly into equivalent core constructors. -- Triangle and quad invariants remain explicit runtime/operation contracts, - not nominal classes or misleading aliases. -- The intentional NumPy-integral widening and boolean-index rejection are - visible and tested rather than hidden behind `.tolist()` calls. - -## Affected packages - -`compas`, `compas_cgal`, `compas_libigl`, `compas_occ` where it imports the -shared aliases, and `compas_framework` integration fixtures. - -## Dependencies - -- [002 — Numeric and array inputs](002-numeric-array-inputs.md) -- [003 — Array guarantees](003-array-guarantees.md) -- [004 — Tessellation buffers](004-tessellation-buffers.md) -- [005 — Native normalization](005-native-normalization.md) -- [008 — Return normalization](008-return-normalization.md) -- [012 — Structural triangle-mesh boundaries](012-structural-triangle-mesh-boundaries.md) - -## Decision - -Approved on 2026-11-05. Core owns one public structural vocabulary with -semantic `PointLike` and `VectorLike` roles, NumPy-aware collection aliases, -and neutral `VerticesFaces` interchange. Misleading and overlapping names are -removed without aliases. The rationale is to make static types describe -existing duck-typed runtime behavior, including direct Python/NumPy handoff, -without adding conversions, validation, casts, or nominal input gates merely -for typing. diff --git a/initiatives/typing-alignment/decisions/017-native-binding-stubs-and-public-contracts.md b/initiatives/typing-alignment/decisions/017-native-binding-stubs-and-public-contracts.md deleted file mode 100644 index b42759b..0000000 --- a/initiatives/typing-alignment/decisions/017-native-binding-stubs-and-public-contracts.md +++ /dev/null @@ -1,192 +0,0 @@ -# Title: How should native bindings and public wrappers publish coordinated typing? - -## Status - -Accepted. - -## Context - -The two nanobind packages currently take materially different approaches: - -- `compas_cgal` ships `py.typed` and one maintained `.pyi` for each of its 14 - extension modules. Symbol coverage is complete, but - `pyright --verifytypes compas_cgal --ignoreexternal` reports 83% public type - completeness and runtime inspection found inaccurate parameter and result - declarations. -- `compas_libigl` ships `py.typed` but committed source suppresses imports of - all 13 extension modules with unqualified `# type: ignore`. Only 8 of 21 - public wrappers are fully annotated, and verify-types completeness is 51.6%. - -Both packages normalize broad public values to exact native arrays, but they -do not share a complete public vocabulary or a common rule for native stubs. -Green source Pyright and wheel-marker checks therefore do not prove that a -native call has the right arguments, that its result is known, or that a -backend result is accepted by core. - -## Options - -1. **Permit each package to choose stubs or ignores.** This minimizes migration - but makes `py.typed` mean different things and allows `Unknown` to escape. -2. **Annotate only public Python wrappers.** This can hide the compiled seam - behind casts but cannot verify native names, signatures, or results. -3. **Require accurate private native stubs plus coordinated public wrappers.** - Stubs describe exact ABI values; wrappers use core structural types, - normalize once, and return the actual public representation. -4. **Generate all stubs automatically and treat them as authoritative.** This - is repeatable, but generated declarations still need semantic dtype, - ownership, sparse-result, and wrapper-contract review. - -## Recommendation - -Choose option 3. Generation may bootstrap a stub, but reviewed source and -runtime evidence remain authoritative. - -### Native extension contract - -Every private compiled module has a packaged `.pyi` that describes its actual -Python ABI: - -- parameters are the exact post-normalization NumPy arrays, scalar types, or - STL-like values accepted by the binding; -- results use exact NumPy dtypes, SciPy sparse classes, Python containers, or - heterogeneous tuples observed from the binding; -- rank, column count, contiguity, ownership, and value restrictions that - static typing cannot express are documented and verified at runtime; -- nanobind vector wrappers are modeled structurally by their real methods and - iteration behavior, not falsely as `list` subclasses; -- no unqualified import ignore suppresses a missing compiled module or stale - symbol; -- a narrow ignore is permitted only for a demonstrated checker/upstream-stub - defect, with its reason and a regression fixture at that exact boundary. - -The `.pyi` contract is intentionally narrower than the public wrapper. It must -not claim that a compiled function accepts general COMPAS coordinate protocols -when the wrapper performs the conversion first. - -### Public wrapper and plugin contract - -Public direct wrappers: - -1. accept core-owned aliases from the public `compas.typing` module in ADR - 016; -2. normalize once in a private package adapter to the native ABI; -3. perform only native-safety and operation-specific result-shape checks; -4. return the documented representation with an exact annotation; and -5. expose a complete public signature without `Any`, `Unknown`, casts, or - ignores masking the binding result. - -Plugin registration wrappers match the core hook exactly in names, kinds, -defaults, input structure, and semantic result. A backend implementation may -return a statically narrower concrete subtype, such as `VerticesFacesNumpy`, -when the core hook permits `VerticesFaces`. Exact ABI/result tuple aliases such -as `VerticesFacesNumpy` remain package-local implementation vocabulary built -from core primitive array aliases; they are not redefined public input types. -Discovery modules remain -lightweight and import native implementation code only inside wrapper bodies. - -Do not convert a correct native array or sparse result to a list merely for -typing. Normalize a result only when the approved public/plugin contract -requires a different representation. Conversely, do not annotate a concrete -result with a broad input union to avoid learning its actual type. - -### CGAL corrections - -The CGAL slice must: - -- replace package-local `Vertices`, `Faces`, and `VerticesFaces` with imports - from `compas.typing`, while retaining only package-specific concrete and - heterogeneous result aliases; -- correct straight-skeleton list-versus-array results, meshing fixed-vertex - input, native vector-wrapper models, Boolean literals, and native vector - return declarations identified by runtime inspection; -- annotate all public straight-skeleton and other currently incomplete - wrappers; -- make public `__all__` boundaries explicit so imported helper aliases are not - accidental API; and -- retain its useful stub/export parity and wheel-content checks while adding - semantic signature/result fixtures. - -### libigl corrections - -The libigl slice must: - -- add one reviewed `.pyi` for every one of its 13 private extension modules; -- remove the extension-import ignores after those stubs are in scope; -- annotate all 21 public wrappers and their exported results; -- distinguish `scipy.sparse.csc_matrix` results from dense NumPy arrays and - distinguish Python list/tuple results from native arrays; -- replace `MeshType` casts and package-local mesh shapes with core - `VerticesFaces`; and -- expand the installed consumer beyond its current curated eight functions to - every supported public wrapper and plugin implementation. - -No private native module becomes public merely because it has a stub. - -## Typed distribution and verification - -For each native package, completion requires: - -- `pyright --verifytypes --ignoreexternal` with 100% known types for - the intentionally exported public surface; -- strict source Pyright with no unknown native imports; -- a stub/export parity test for every compiled module; -- runtime ABI fixtures for every native function family, covering actual - result class, dtype, rank/shape, ownership, and representative failures; -- package tests proving every `.pyi` and `py.typed` is present in the wheel and - that no stub exists only in the checkout; -- an external clean installed-wheel consumer with `assert_type` coverage for - every public wrapper and plugin family; -- direct handoff of applicable native results into core constructors under ADR - 016; and -- lowest/current supported dependency jobs where NumPy/SciPy typing or runtime - representation can differ. - -`py.typed` is a package-wide promise. A marker plus a small curated green -fixture is not sufficient evidence when public functions still expose unknown -types. - -## Compatibility and migration - -This work corrects annotations and the accepted structural inputs; it does not -redesign numerical algorithms. Preserve runtime result representations unless -an existing public annotation already promises a different approved contract. -Any such mismatch is recorded and tested as a deliberate compatibility choice, -not silently converted during stub cleanup. - -CGAL and libigl migrate in parallel only after ADR 016 supplies the common -vocabulary. Core/plugin conformance and installed consumers integrate the two -packages before the typing initiative can be closed. - -## Consequences - -- Both native packages give `py.typed` the same enforceable meaning. -- Stubs verify the compiled seam instead of merely suppressing it. -- Public wrappers remain convenient and duck-typed while native ABIs remain - exact. -- Backend result types become directly usable by core constructors without - casts or list conversions. -- Stub maintenance grows, but parity, runtime, and artifact tests make that - maintenance observable. - -## Affected packages - -`compas_cgal`, `compas_libigl`, shared hook declarations in `compas`, and -installed integration fixtures in `compas_framework`. - -## Dependencies - -- [005 — Native normalization](005-native-normalization.md) -- [006 — Plugin conformance](006-plugin-conformance.md) -- [008 — Return normalization](008-return-normalization.md) -- [009 — Typed distribution](009-typed-distribution.md) -- [010 — Verification ratchet](010-verification-ratchet.md) -- [016 — Core structural type vocabulary](016-core-structural-type-vocabulary.md) - -## Decision - -Approved on 2026-11-05. CGAL and libigl must publish accurate private native -stubs and complete public wrapper contracts coordinated through core-owned -structural types. The rationale is that `py.typed` must represent a verified -package-wide promise rather than conceal native seams with broad ignores; -runtime representations remain unchanged unless another accepted contract -explicitly requires a change. diff --git a/initiatives/typing-alignment/decisions/README.md b/initiatives/typing-alignment/decisions/README.md deleted file mode 100644 index 6633e23..0000000 --- a/initiatives/typing-alignment/decisions/README.md +++ /dev/null @@ -1,79 +0,0 @@ -# Typing Alignment Architecture Decisions - -Decisions 001–017 are **Accepted** and implemented for the approved initiative -scope. Their source, distribution, package-hosted, and exact installed-candidate -verification gates pass on the recorded initiative heads. - -## Decision index - -| Order | ADR | Status | Depends on | Main tradeoff | -|---:|---|---|---|---| -| 1 | [001 — Supported baseline](001-supported-baseline.md) | Accepted | None | One truthful modern baseline versus historical package combinations. | -| 2 | [002 — Numeric and array inputs](002-numeric-array-inputs.md) | Accepted | 001 | Explicit Python/NumPy unions versus sequence-only or overly broad ArrayLike. | -| 3 | [003 — Array guarantees](003-array-guarantees.md) | Accepted | 001, 002 | Static dtype plus runtime shape/layout versus speculative shape typing. | -| 4 | [004 — Tessellation buffers](004-tessellation-buffers.md) | Accepted | 002, 003 | Preserve zero-copy concrete buffers versus normalized containers. | -| 5 | [005 — Native normalization](005-native-normalization.md) | Accepted | 002, 003, 004 | Broad public input with exact private ABI buffers versus exposing native requirements. | -| 6 | [006 — Plugin conformance](006-plugin-conformance.md) | Accepted | 002, 005 | Core-owned validated signatures versus generic backend forwarding. | -| 7 | [007 — Backend substitutability](007-backend-substitutability.md) | Accepted | 001, 005, 006 | Core-compatible OCC APIs versus backend-specialized incompatible overrides. | -| 8 | [008 — Return normalization](008-return-normalization.md) | Accepted | 002, 004, 005, 006, 007 | Python/core defaults with explicit NumPy exceptions versus one universal representation. | -| 9 | [009 — Typed distribution](009-typed-distribution.md) | Accepted | 001, 005, 006, 007, 008 | Verified PEP 561 packages and maintained stubs versus development-only typing. | -| 10 | [010 — Verification ratchet](010-verification-ratchet.md) | Accepted | 001–009 | Full consumer/native/wheel verification versus source-only checks or suppression baselines. | -| 11 | [011 — BRep query truthfulness](011-brep-query-truthfulness.md) | Accepted | 006–008 | Explicit independent failure for unsupported semantics versus false or empty placeholders. | -| 12 | [012 — Structural triangle-mesh boundaries](012-structural-triangle-mesh-boundaries.md) | Accepted | 002–006 | Raw structural buffers versus mandatory `Tessellation` objects at numerical boundaries. | -| 13 | [013 — Explicit algorithms and discretization controls](013-explicit-algorithms-and-discretization-controls.md) | Accepted | 012 | Named operations and producer-specific keywords versus public strategy-object hierarchies. | -| 14 | [014 — Discrete curvature contracts](014-discrete-curvature-contracts.md) | Accepted | 012 | Keep only verified core Gaussian curvature versus preserving unsupported or incompatible plugin contracts. | -| 15 | [015 — Exact triangulation and discretization APIs](015-exact-triangulation-and-discretization-apis.md) | Accepted | 012–013, 016, Geometry 022–023 | Duck-typed triangulation plus exact representation-oriented structured/BRep conversion signatures versus inventing the API during implementation. | -| 16 | [016 — Core structural type vocabulary](016-core-structural-type-vocabulary.md) | Accepted | 002–005, 008, 012 | One layered coordinate protocol with semantic NumPy-aware `PointLike`/`VectorLike` aliases and one neutral `VerticesFaces` vocabulary versus overlapping names. | -| 17 | [017 — Native binding stubs and public contracts](017-native-binding-stubs-and-public-contracts.md) | Accepted | 005–006, 008–010, 016 | Exact private native stubs plus coordinated complete wrappers versus package-specific stubs and ignores. | - -## Dependency graph - -```text -001 <- none -002 <- 001 -003 <- 001, 002 -004 <- 002, 003 -005 <- 002, 003, 004 -006 <- 002, 005 -007 <- 001, 005, 006 -008 <- 002, 004, 005, 006, 007 -009 <- 001, 005, 006, 007, 008 -010 <- 001, 002, 003, 004, 005, 006, 007, 008, 009 -011 <- 006, 007, 008 -012 <- 002, 003, 004, 005, 006 -013 <- 012 -014 <- 012 -016 <- 002, 003, 004, 005, 008, 012 -015 <- 012, 013, 016, Geometry 022, Geometry 023 -017 <- 005, 006, 008, 009, 010, 016 -``` - -## Recommended review order - -1. Approve the baseline and public numeric/array vocabulary (001–003). -2. Decide zero-copy and native boundaries (004–005). -3. Decide cross-package API conformance (006–008). -4. Decide distribution and verification commitments (009–010). -5. Decide how partially supported OCC BRep queries fail (011). -6. Reconsider triangle-mesh algorithm boundaries and public strategy objects - in light of direct NumPy use and namespace clarity (012–013). -7. Resolve the shared structural vocabulary and core constructor contract - (016), then approve the exact polygon, Delaunay, shape/surface, and BRep - migration table, especially the aggregate triangulator callable (015). -8. Approve the common CGAL/libigl native-stub, public-wrapper, completeness, - and artifact-verification policy (017). - -## Highest-impact approvals - -- NumPy arrays/scalars become first-class inputs only where tested runtime - support is intentional. -- `Tessellation` remains a zero-copy retained-buffer exception. -- Public coercible inputs and exact native buffers are separate contracts. -- OCC aligns to core signatures rather than preserving incompatible override - annotations. -- Ordinary APIs return Python/core values; NumPy outputs remain explicit. -- Core, OCC, CGAL, and libigl become verified PEP 561 typed distributions. -- Core owns one `VerticesFaces` structural type; `TriangleMeshInput` and the - tuple-valued `MeshType` are removed without aliases. -- CGAL and libigl native modules ship accurate stubs, and supported public - surfaces reach 100% known type completeness. diff --git a/initiatives/typing-alignment/inventory.md b/initiatives/typing-alignment/inventory.md deleted file mode 100644 index 7721a9c..0000000 --- a/initiatives/typing-alignment/inventory.md +++ /dev/null @@ -1,316 +0,0 @@ -# Typing Alignment Inventory - -## Scope and method - -This inventory records read-only reconnaissance of `compas`, `compas_occ`, -and `compas_cgal`, plus their shared tooling and integration checks. Commands -used the `compas3` environment with Python 3.12, NumPy 2.5.2, and Pyright -1.1.414. No package source was modified. - -## Executive summary - -The packages do not currently share one typing contract: - -- `compas` accepts many NumPy arrays and scalars at runtime, but central - sequence-based aliases reject them statically. -- `compas_cgal` has useful NumPy/native conventions, but public coercible input - types, normalized ABI buffers, and returned zero-copy buffers are not clearly - separated. -- `compas_occ` is not a typed distribution, has no Pyright configuration, and - exposes numerous backend overrides incompatible with current core APIs. -- Plugin implementations are not statically checked against their core - pluggable signatures. -- Only `compas_cgal` contains `py.typed` and native `.pyi` files; wheel contents - and stub/runtime parity are not verified. - -The initiative should first define the core runtime/static contract, then align -native boundaries and backend overrides. Removing ignores before those -contracts are explicit would hide rather than solve the design problems. - -## Follow-up structural and native-binding audit - -The 2026-11-05 follow-up expanded the initial CGAL/OCC inventory to -`compas_libigl` and rechecked core constructor interoperability. - -- Core has two overlapping vertices/faces tuple aliases: - `TriangleMeshInput`, despite its use for results and inability to prove - triangle arity, and a NumPy-incompatible tuple-valued `MeshType` that can be - confused with the real `Mesh` class. -- CGAL ships stubs for all 14 extension modules, but verify-types completeness - is 83% and runtime inspection found inaccurate list/array, parameter, native - vector, and literal contracts. -- Libigl ships `py.typed` while committed source suppresses all 13 native - imports. Only 8 of 21 public wrappers are fully annotated; verify-types - completeness is 51.6%. -- Exact CGAL/libigl `float64` vertex and `int32` face arrays are accepted by - `Mesh.from_vertices_and_faces` and `Tessellation`, but not consistently by - `Polygon`, `Polyline`, `Pointcloud`, `PolygonalSurface`, or `Polyhedron`. -- `PolygonalSurface` and `Polyhedron` reject NumPy integer face indices at - runtime through a concrete `int` check, making the documented direct CGAL - handoff fail without `.tolist()`. -- Pyright 1.1.414 rejects lists, tuples, memoryviews, COMPAS `Point`/`Vector`, - and NumPy arrays against a point protocol that requires only the exact - signature `__getitem__(int) -> SupportsFloat`, because their real indexing - signatures include slices or overloads. A length-plus-iteration protocol - accepts those values but cannot prove current indexing. A measured layered - design passes both cases: one rich `CoordinateProtocol[T_co]` overloads - integer access to `T_co` and slice access to `Sequence[T_co]`, while semantic - `PointLike` and `VectorLike` aliases add ordinary `Sequence` and - `NumericArray` branches. Nested NumPy matrices still require explicit array - branches because of NumPy stub limitations. -- A follow-up arithmetic probe confirmed that `SupportsFloat` cannot type the - direct multiplication and addition used by existing consumers without new - runtime conversion. The same layered design with `RealInput` passed Python - and NumPy values, indexing, slicing, nominal point implementations, and - direct arithmetic with zero errors. ADR 016 therefore keeps neutral - quaternion/generic inputs under `FloatSequenceLike` and introduces no new - runtime conversion for typing. - -Accepted ADRs 016–017 record the resulting core vocabulary, constructor, -native-stub, public-wrapper, and installed-artifact decisions. Package source -correction is authorized in the implementation-plan dependency order but is -not yet verified. - -## Baseline - -| Repository | Python metadata | Pyright scope | Baseline | Typed distribution | -|---|---|---|---:|---| -| `compas` | `>=3.12` | `src/compas` | 0 errors | no `py.typed` | -| `compas_occ` | `>=3.9` | none configured | 66 source errors; 94 including tests in the audit configuration | no `py.typed` or package stubs | -| `compas_cgal` | `>=3.12` | `src/compas_cgal` | 0 errors with explicit core source/interpreter | `py.typed` plus native stubs | -| `compas_framework` | `>=3.12` | source and tests | 0 errors | integration package only | - -The green core and CGAL counts do not prove cross-package correctness. Their -configured scopes exclude typed consumer fixtures, and CGAL needs an explicit -interpreter and local core source path for a reproducible check. - -## Core COMPAS - -### Central aliases reject supported NumPy inputs - -[`compas._typing`](https://github.com/compas-dev/compas/blob/943d9fdc366bf4bc55a2942dad259d112b23ab6c/src/compas/_typing.py) defines: - -```python -CoordinateType = Coordinate | Sequence[float] -CoordinatesType = Coordinates | Sequence[CoordinateType] -MeshType = tuple[CoordinatesType, Sequence[Sequence[int]]] -``` - -NumPy arrays do not satisfy these nested sequence protocols in Pyright, even -though runtime calls succeed. Static probes rejected: - -- one-dimensional `float32` and `float64` coordinate arrays; -- two-dimensional coordinate arrays; -- NumPy vertex and face arrays passed to `Mesh.from_vertices_and_faces`; -- NumPy vertex and triangle arrays passed to `Tessellation`. - -Equivalent point-coordinate aliases are duplicated in Mesh, VolMesh, and -CellNetwork type modules, creating drift from the central aliases. - -### `Tessellation` has a contradictory buffer contract - -[`Tessellation`](https://github.com/compas-dev/compas/blob/943d9fdc366bf4bc55a2942dad259d112b23ab6c/src/compas/geometry/tessellation.py) -documents and preserves zero-copy NumPy/native buffers. Runtime validation uses -`numbers.Real` and `numbers.Integral`, correctly accepting NumPy scalar values. -Its generic bounds and optional normal/UV/polyline annotations remain -sequence-centric and reject those arrays statically. CGAL currently needs -Pyright suppressions at this boundary. - -### Numeric scalar behavior is inconsistent - -Newer APIs use `Real` and `Integral`; older APIs often test only built-in -`int`/`float`. Therefore `np.float64`, `np.float32`, `np.int32`, and `np.int64` -acceptance varies between otherwise equivalent operations. Some linalg -functions return NumPy scalar integers where ordinary geometry APIs normally -return Python built-ins. - -### Different array boundaries are conflated - -The code needs distinct contracts for: - -1. general coordinate inputs; -2. coercible numerical computation inputs; -3. exact retained zero-copy buffers; -4. native ABI buffers; -5. serialized normalized data; -6. sparse matrices. - -`numpy.typing.ArrayLike` is already used successfully in linalg, but many -returns remain `NDArray[Any]` or unparameterized. NumPy typing expresses dtype -more reliably than shape; documented/runtime shape validation remains -necessary. - -### Plugins - -The plugin decorator preserves a callable signature locally, but registered -implementations are stored as `Callable[..., Any]`. Backend conformance depends -on repeating signatures manually and is not checked across repositories. The -validated-public-wrapper/private-pluggable pattern used by planar -triangulation is a useful precedent: core owns broad input validation and the -plugin receives a narrower contract. - -## COMPAS OCC - -### Version and distribution mismatch - -`compas_occ` still declares Python `>=3.9`, while current core requires 3.12+. -Its COMPAS dependency is unbounded. It has no Pyright configuration or CI type -check, no `py.typed`, and no package-owned native stubs. - -### Backend subclasses are not substitutable - -Pyright exposes repeated incompatibilities in Curve, Surface, NURBS, and BRep -subclasses: - -- narrowed parameters in overrides and constructors; -- missing core parameters such as `world` or domains; -- property/method disagreements for length and bounds; -- invariant `list[BackendSubtype]` returns overriding `list[CoreBase]`; -- narrowed mutable native attributes; -- `__eq__` methods narrowed from `object` to a concrete OCC class; -- stale calls to removed core materialization APIs. - -These are cross-package API defects, not checker noise. - -### PythonOCC/SWIG boundary - -The source and tests contain many broad ignores around overloads and native -downcasts. Repeated topology conversions should be localized in typed boundary -helpers. Narrow documented ignores may remain only where upstream stubs are -incorrect. - -Plugin modules contain many unannotated functions and generic `*args, -**kwargs`, preventing signature comparison with core pluggables. Some plugins -still expose legacy tessellation contracts. - -### NumPy behavior is accidental and dtype-dependent - -OCC conversion functions are typed as concrete lists. Runtime probes show that -some `float64` arrays work while `float32` or integer arrays fail at SWIG -setters. NumPy support therefore requires explicit rank/shape checks and -normalization with `float(...)` and `int(...)` at the Python-to-SWIG boundary. -Simply widening annotations would be incorrect. - -OCC should normally return core objects and Python containers. Introducing -NumPy outputs is unnecessary unless a separate real performance contract -requires them. - -## COMPAS CGAL - -### Existing native convention - -CGAL's strongest pattern is its native tessellation boundary: - -- coordinates normalized to C-contiguous `float64`; -- indices range-checked and normalized to C-contiguous `int32`; -- native output buffers retained by `Tessellation`. - -Tests verify dtype, contiguity, and ownership. `NDArray` annotations cannot -express C-contiguity, so this must remain a documented runtime contract. - -### Public input versus native buffer types - -[`compas_cgal.types`](https://github.com/compas-dev/compas_cgal/blob/d31ec0f0cdbadc326d587b2b217763e19e8720e7/src/compas_cgal/types.py) -contains dtype aliases such as `FloatNx3` and `IntNx3`. Their `Annotated` shape -metadata is descriptive; Pyright does not enforce it. - -Wrappers inconsistently accept nested lists, `Point` objects, raw/unparameterized -arrays, or exact dtype arrays, even when all immediately call `np.asarray`. -The architecture should distinguish: - -- broad public coercible input; -- exact native buffer passed to compiled code; -- retained native output. - -### Return and plugin mismatch - -Some modern operations return `Tessellation`; older APIs return raw NumPy -tuples. Some plugin implementations return NumPy polyline arrays while the -core contract declares nested Python lists. These must be aligned at the core -boundary rather than left as backend-specific static behavior. - -### Native stubs - -The repository has hand-written `.pyi` files for compiled modules, but no stub -generation or parity check against nanobind exports. Shape and contiguity remain -runtime concerns. Package tests check source-file presence, not installed-wheel -contents or signature agreement. - -## Serialization - -Core deliberately serializes NumPy arrays and scalars to Python lists and -built-ins. This normalized data contract is separate from retained zero-copy -operation buffers. OCC BRep/NURBS serialization uses largely unparameterized -dictionaries; stable public schemas may benefit from typing, but speculative -`TypedDict` proliferation should be avoided. - -## Tooling and CI - -- Pyright is the shared checker; no package uses mypy. -- Pyright should be pinned and run through `compas3` for the initiative. -- `compas_occ` needs a first-class Pyright configuration and ratchet to zero. -- Core and CGAL need typed consumer fixtures in addition to source checking. -- Python metadata and CI matrices are inconsistent, especially OCC and the - framework integration repository. -- Minimum supported NumPy claims are not verified against the current Python - baseline. -- Built-wheel tests should verify `py.typed`, `.pyi` inclusion, compiled-module - imports, and external consumer type checking. - -## Existing runtime test coverage - -Useful existing coverage includes: - -- core NumPy JSON arrays/scalars; -- core NumPy transformations and NumPy-backed `Tessellation`; -- CGAL native dtype, contiguity, ownership, triangulation, and meshing output. - -Important gaps include: - -- Python versus NumPy scalar matrices; -- `float32`/`float64` and `int32`/`int64` inputs; -- contiguous, sliced/non-contiguous, Fortran-order, read-only, and zero- - dimensional arrays; -- typed consumer fixtures with accepted and expected-error cases; -- OCC NumPy normalization tests; -- native stub/runtime parity and installed-wheel typing tests; -- lowest supported NumPy and current NumPy 2.x CI. - -## Architectural decisions required - -1. Supported Python, COMPAS, NumPy, and Pyright version baseline. -2. Public numeric scalar policy, including input acceptance and output - normalization. -3. Core coordinate, mesh, and retained-buffer contracts for NumPy support. -4. Boundary between coercible public inputs and exact native ABI buffers. -5. Shape/dtype guarantees expressed statically versus documented and validated - at runtime. -6. Plugin signature ownership and cross-repository conformance verification. -7. Backend subclass substitutability and collection variance policy. -8. PythonOCC/SWIG isolation and ignore policy. -9. Native stub generation/parity and PEP 561 distribution policy. -10. NumPy-versus-core-object return conventions. -11. Serialization schema typing scope. -12. Verification and ratcheting strategy for existing OCC errors. - -## Principal risks - -- Widening annotations beyond actual runtime acceptance. -- Adding runtime conversion only to appease static typing. -- Treating dtype or shape annotations as runtime enforcement. -- Changing list returns to abstract covariant collections solely to silence - override errors. -- Spreading `Any` from native boundaries into public APIs. -- Shipping inline annotations or stubs that are absent or stale in wheels. -- Attempting to fix all annotations before agreeing on the shared contracts. - -## Recommended dependency order - -1. Align version/tooling baseline. -2. Decide core scalar and array boundary contracts. -3. Make core aliases and `Tessellation` truthful. -4. Align plugin signatures and backend public wrappers. -5. Normalize CGAL and OCC native boundaries. -6. Establish stub/distribution verification. -7. Ratchet ignores and OCC errors down through small independently tested work - packages. diff --git a/initiatives/typing-alignment/objective.md b/initiatives/typing-alignment/objective.md deleted file mode 100644 index b2d6387..0000000 --- a/initiatives/typing-alignment/objective.md +++ /dev/null @@ -1,121 +0,0 @@ -# Typing Alignment Initiative - -## Objective - -Establish one simple, explicit, and consistent typing contract across the core -COMPAS framework, initially focusing on: - -- `compas` -- `compas_occ` -- `compas_cgal` -- `compas_libigl` - -The initiative should make public Python APIs, plugin boundaries, native -extension adapters, tests, and documentation agree on the values they accept -and return. A specific priority is correct and practical support for NumPy -types without weakening ordinary Python sequence support or obscuring runtime -requirements. - -## Questions to resolve - -1. Which public APIs accept Python sequences, NumPy arrays, NumPy scalar types, - or COMPAS geometry objects? -2. Which reusable aliases, protocols, or overloads should express those - contracts without introducing speculative abstraction? -3. How should array dtype, dimensionality, shape, contiguity, mutability, and - ownership be documented and typed when Python's type system cannot express - every runtime constraint? -4. Where should conversion and validation occur: core API, plugin boundary, - backend adapter, or native extension? -5. How should `compas_occ` isolate untyped PythonOCC/SWIG APIs? -6. How should `compas_cgal` type NumPy/native buffers and distribute stubs for - compiled extension modules? -7. How should `compas_libigl` replace native import suppressions with accurate - stubs and coordinate its public results with core and CGAL? -8. Which uses of `Any`, casts, ignores, forward references, and broad concrete - unions can be removed or localized? -9. Which Pyright, Ruff, test, and CI configuration should be shared across the - four packages? - -## Design principles - -- Prefer simple, readable annotations that describe actual runtime behavior. -- Prefer capability- and operation-based duck typing at public Python - boundaries. Type aliases describe verified common inputs; they are not - runtime nominal allow-lists. -- Do not add nominal type checks, copies, or conversions solely to mirror an - annotation. Validate eagerly only to protect a stated invariant, preserve - object validity, or make a native call safe. -- Align with established COMPAS terminology and naming. -- Do not add conversions or runtime validation solely to satisfy a type - checker. -- Keep NumPy optional where the runtime API is genuinely sequence-based. -- Use NumPy-specific types where dtype, buffer layout, or vectorized behavior - is part of the real contract. -- Isolate untyped native-library boundaries instead of spreading `Any` through - public APIs. -- Be explicit about constraints that annotations cannot enforce. -- Avoid speculative generic frameworks, shape-typing systems, or compatibility - layers without current consumers. -- Keep code, annotations, runtime validation, tests, documentation, and stubs - consistent. - -## Initial deliverables - -1. `inventory.md` describing current conventions, inconsistencies, NumPy - boundaries, tooling, tests, and risks in all four packages. -2. `proposal.md` defining recommended public and native-boundary contracts, - alternatives, migration effects, verification, and implementation phases. -3. One ADR per significant independent typing decision. -4. An implementation plan with package/file ownership, dependencies, and safe - opportunities for parallel work. - -## Verification target - -Use the `compas3` environment. Before completion, affected packages must pass: - -- relevant and full feasible tests; -- Ruff check and format verification; -- Pyright with zero errors; -- NumPy compatibility tests covering supported scalar, array, dtype, shape, - and layout cases; -- native-extension import and stub checks where applicable; -- documentation verification for changed public contracts. - -## Non-goals for the initial phase - -- Changing runtime behavior merely to make annotations easier. -- Typing every optional COMPAS ecosystem package. -- Introducing a universal tensor/array abstraction. -- Replacing NumPy or PythonOCC/native APIs. -- Preserving incorrect or misleading annotations for compatibility. -- Editing package source before the architecture and ADRs are approved. - -## Current status - -Implementation and verification are complete for the approved scope. ADRs -001–017 and Geometry ADRs 022–023 are Accepted. The approved source slices are -implemented at the current core, OCC, CGAL, and libigl candidate heads while -preserving duck typing and localizing normalization to explicit native, -serialization, ownership, and retained-representation boundaries. - -WP7.4–WP7.7 and WP8.1 are source-complete. Native-stub/public-wrapper work is -complete and hosted green for CGAL WP8.2 and libigl WP8.3. CGAL run -`42231235319` attempt 2 passed every quality, compatibility, distribution, -platform-wheel, and Python 3.12/3.14 wheel-smoke job. Accepted ADR 021 is -implemented and independently reviewed in `compas_framework` for WP8.4 at -`d0c9d4ef939ebbd4da4e14446e2e11f83a8a97b0`. The exact live manifest and local -schema/semantic, hash, offline staging, version, discovery, OCC behavior, -strict typing, and tooling contracts pass. - -The framework workflow matrix is fully green at this head. Protected run -`42299118381` verifies the exact four candidate artifacts and executes the -secret-free Linux x86-64 CGAL→core→libigl and OCC runtime contracts: four tests -pass with no skips, and the installed typing consumer reports zero errors and -warnings. WP8.4 and final WP6 are complete. `main` remains untouched. - -`compas_libigl` joined the initiative on 2026-11-05 to align its native mesh -plugins and replace incomplete native typing with the shared contract. CGAL -skeletonisation output remains a known correctness limitation: typing, stub, -or packaging checks must not be treated as functional validation of that -module. diff --git a/initiatives/typing-alignment/proposal.md b/initiatives/typing-alignment/proposal.md deleted file mode 100644 index 057784e..0000000 --- a/initiatives/typing-alignment/proposal.md +++ /dev/null @@ -1,377 +0,0 @@ -# Typing Alignment Architecture Proposal - -## Status - -Typing ADRs 001–017 and Geometry ADRs 022–023 are Accepted. Their approved -source slices and verification gates are implemented on the recorded -initiative heads. - -## Summary - -Align `compas`, `compas_occ`, `compas_cgal`, and `compas_libigl` around one -truthful rule: - -> Public annotations describe values the public API genuinely accepts; native -> adapters normalize those values to exact backend buffers; return annotations -> describe the representation callers actually receive. - -The design distinguishes three boundaries that are currently conflated: - -1. **Coercible public input**: Python/COMPAS values and supported NumPy values. -2. **Exact native ABI buffer**: validated dtype, rank, shape, and memory layout. -3. **Retained result buffer**: a zero-copy buffer whose ownership and concrete - type remain visible to the caller. - -This is deliberately not a universal array framework. It uses small explicit -aliases, runtime validation for constraints Python typing cannot express, and -localized native-boundary uncertainty. - -Public Python APIs remain duck typed. Aliases describe verified common inputs, -not nominal runtime allow-lists. Code should use values through their documented -operations and should not add `isinstance` checks, copies, or conversions merely -to mirror annotations. Early validation is reserved for stated invariants, -object validity, and safe native calls. Repeated capability contracts may use a -small Protocol only when concrete consumers and tests justify it. - -## Recommended contracts - -### Version and tooling baseline - -- Python 3.12+ in all four packages. -- Integration packages require `compas>=3,<4`. -- NumPy 1.26+ as the tested Python 3.12 baseline, plus current NumPy 2.x. -- Pin Pyright 1.1.414, the version verified in `compas3` for the approved - implementation baseline. -- Use Pyright only; do not add mypy. -- Run authoritative checks through `compas3`. - -### Numeric and coordinate inputs - -Core owns aliases for Python and NumPy real/integral scalar inputs, coordinate -inputs, coordinate collections, and index collections. The aliases include -NumPy arrays and NumPy scalar values only where runtime behavior intentionally -supports them. - -Accepted ADR 016 refines the coordinate vocabulary around one rich -`CoordinateProtocol`: length, iteration, integer indexing, and slicing with -distinct scalar and `Sequence` overloads. Semantic `PointLike` and -`VectorLike` aliases combine that protocol with ordinary `Sequence` and -`NumericArray` branches. The aliases accept the same structures but make -position and direction roles legible in signatures. This layered form is -necessary because an exact protocol alone rejects built-ins and NumPy arrays, -while an iteration-only protocol cannot prove current indexing. Explicit -NumPy branches remain necessary where NumPy's stubs do not satisfy nested -collection protocols. - -Their shared element boundary is `RealInput`, so existing Python and NumPy -scalar arithmetic remains unchanged and typing introduces no conversion. -Generic linear-algebra and quaternion inputs use the neutral -`FloatSequenceLike` name over the same capability instead of a geometric alias. -`SupportsFloat` is reserved for an individual scalar parameter only when its -existing implementation already performs that conversion. -Every current `RealInput` alternative satisfies `SupportsFloat`, so a scalar -from a one-dimensional `PointLike` or `VectorLike` can be assigned directly to -a normalizing `Point` or `Vector` component setter without call-site -conversion. - -Do not use `numpy.typing.ArrayLike` as the default geometry input type. It is -appropriate for APIs that really call `np.asarray` on broad numerical input, -but it overstates many ordinary geometry contracts. - -### Dtype, shape, and layout - -Annotations express dtype where NumPy supports it reliably. Shape, rank, -contiguity, writability, ownership, finiteness, and index range remain explicit -docstring and runtime-validation contracts. Descriptive `Annotated` shape -metadata must not be presented as checker enforcement. - -### Tessellation buffers - -`Tessellation` remains the explicit zero-copy exception to ordinary normalized -containers. Its generic bounds accept supported nested Python sequences, -NumPy arrays, and compatible native buffers while preserving the concrete -buffer type. Construction checks only the minimal structural invariants needed -for a valid retained object and does not coerce or take ownership. - -### Native adapters - -Public wrappers accept the approved broad input contract. Private adapters -normalize it before native calls. - -- CGAL: C-contiguous `float64` coordinates and `int32` indices. -- OCC: enforce required dimensions at the native boundary and convert only - scalars PythonOCC demonstrably requires to Python `float`/`int`, immediately - before SWIG calls. OCC continues returning core objects/Python containers. - -### Plugins - -Core owns documented public invariants and plugin signatures. A public wrapper -validates only when early enforcement is necessary, does not nominally gate -usable duck-typed values, and does not duplicate backend validation. It may -dispatch to a narrow private pluggable. Backend functions use explicit matching -signatures instead of generic `*args, **kwargs`. - -Conformance is checked with runtime signature tests and typed integration -fixtures. Do not create a separate Protocol for every plugin operation. - -Plugin typing must not turn unsupported backend semantics into authoritative -values. In particular, unknown BRep predicates must not be represented as -`False`, and unavailable trim extraction must not be represented as an empty -topology. ADR 011 requires an independently failing query boundary for these -cases; other plugin signature alignment remains independent. - -### OCC subclassing and native isolation - -Core base-class signatures are authoritative. OCC overrides accept the same or -broader inputs and return compatible public types. Backend-specialized items do -not justify incompatible invariant list annotations. PythonOCC downcasts and -incorrect upstream overloads are localized in small boundary helpers with -narrow, explained ignores. - -### Returns and serialization - -- Ordinary geometry/datastructure APIs return COMPAS objects, Python - containers, and Python scalar values. -- Explicit numerical APIs may return NumPy arrays. -- `Tessellation` may retain NumPy/native buffers. -- Plugins return the representation declared by core. -- Serialization normalizes NumPy arrays/scalars to lists and Python built-ins. - -When a backend result differs from a declared public representation, -normalization occurs once at that public, plugin, or serialization boundary and -only when needed. - -Do not introduce a broad hierarchy of serialization `TypedDict` definitions. -Type only stable, versioned public records where it materially helps. - -### Typed distribution - -The Accepted base requires typed distributions for core, OCC, and CGAL. -Accepted ADR 017 extends the complete native-stub contract to libigl and -strengthens CGAL's existing stubs: both native packages maintain -accurate private `.pyi` files with exported-name parity, typed smoke tests, -semantic runtime fixtures, and wheel-content verification. Stub generation may -bootstrap declarations but does not replace review. OCC relies on inline typing -and upstream PythonOCC stubs, adding only narrow local corrections where -evidence requires them. - -## Alternatives and tradeoffs - -### Keep sequence-only public types - -Simple, but rejects NumPy inputs already supported at runtime and leaves native -plugins dependent on ignores. Rejected. - -### Use `ArrayLike` everywhere - -Compact, but accepts scalars, strings, and shapes that many geometry APIs do not -support. Rejected as an over-promise. - -### Introduce shape-typed tensor generics - -Potentially expressive, but Pyright cannot enforce the important runtime -layout/ownership constraints and COMPAS has no current consumer requiring that -complexity. Rejected. - -### Normalize all data to NumPy - -Would simplify native adapters but changes allocation, ownership, dependency, -and public return semantics across core. Rejected. - -### Normalize everything to Python lists - -Would remove typing ambiguity but destroy approved zero-copy tessellation and -native interoperability. Rejected. - -### Suppress existing backend errors - -Fast, but hides real override and stale-API defects. Rejected. OCC errors are -ratcheted down through scoped work packages. - -### Generate all native stubs immediately - -Generation cannot infer dtype, ownership, or semantic contracts and may produce -worse APIs. Retain maintained stubs plus parity checks first. - -## Package effects - -### `compas` - -- Consolidate central numeric/coordinate/index aliases. -- Make `Tessellation` buffer generics truthful for NumPy/native buffers. -- Align Mesh construction and selected scalar returns. -- Add validated plugin wrappers and typed consumer fixtures. -- Ship `py.typed`. - -### `compas_cgal` - -- Separate broad wrapper inputs from exact native arrays. -- Apply `float64`/`int32` C-contiguous normalization consistently. -- Align plugin signatures and result representations with core. -- Remove suppressions made unnecessary by truthful core buffer types. -- Verify stubs and typed wheel contents. - -### `compas_libigl` - -- Add one accurate stub for every private native module. -- Replace native import suppressions with verified ABI declarations. -- Align public structural inputs and plugin signatures with core. -- Type dense arrays, sparse matrices, Python containers, and heterogeneous - results as actually returned. -- Verify the complete public surface and installed stubs, not only a curated - consumer subset. - -### `compas_occ` - -- Align Python and COMPAS version metadata. -- Add Pyright, `py.typed`, and CI checks. -- Correct Curve, Surface, NURBS, BRep, and plugin substitutability. -- Centralize PythonOCC/SWIG conversion and downcast helpers. -- Add intentional NumPy input normalization only where the public contract - supports it. - -### `compas_framework` - -- Own cross-package consumer fixtures, version matrix, wheel checks, and status. - -## Compatibility implications - -- Most core NumPy work widens annotations to match existing runtime behavior. -- Typed consumers may see deliberate changes where current annotations are - wrong or backend overrides are incompatible. -- Python/NumPy metadata alignment removes unsupported combinations. -- Python scalar return normalization for ordinary APIs is a small runtime - change and requires explicit tests. -- Adding `py.typed` exposes annotations to downstream checkers; wheel checks - must precede that claim. -- OCC stale-API and override corrections may reveal real runtime defects and - must be tested per family. - -No compatibility shims or duplicate old annotations are recommended. - -## Tests and documentation - -### Static consumer fixtures - -Cover accepted and expected-error calls for: - -- Python lists/tuples and COMPAS objects; -- NumPy `float32`/`float64`, `int32`/`int64` arrays; -- NumPy scalar inputs; -- invalid dtype/rank/shape calls; -- plugin results and subclass returns. - -### Runtime matrix - -Cover contiguous, sliced/non-contiguous, Fortran-order, read-only, and -zero-dimensional arrays. Assert acceptance, normalization, rejection, output -dtype, shape, contiguity, ownership, and source non-mutation as applicable. - -### Native and distribution checks - -- Import every compiled module in `compas3`. -- Verify wrapper-to-ABI normalization. -- Verify every native module has a stub and matching exported names. -- Install built wheels and type-check an external consumer. -- Verify `py.typed` and `.pyi` files are present in wheels. - -### Documentation - -Document broad inputs separately from native ABI constraints. State which -properties annotations express and which runtime validation enforces. Include -examples for Python and NumPy inputs and ownership-sensitive results. - -## Accepted decisions - -1. Supported baseline and checker. -2. Numeric scalar and array input policy. -3. Dtype versus shape/layout guarantees. -4. Retained Tessellation buffer contract. -5. Public-to-native normalization boundary. -6. Plugin signature ownership and conformance. -7. Backend subclass substitutability and OCC isolation. -8. Public return normalization. -9. Typed distribution and native stubs. -10. Verification and error ratchet. -11. Truthful independently failing BRep queries. -12. Structural numerical mesh boundaries rather than representation gates. -13. Named algorithms and producer-owned discretization controls. -14. Verified discrete curvature contracts. - -ADRs 001–017 and Geometry ADRs 022–023 are Accepted and authorize their phased -implementation below. - -## Phased implementation - -1. Align metadata/tooling and add consumer fixtures. -2. Establish core scalar/array vocabulary. -3. Make core retained buffers and selected returns truthful. -4. Align plugin boundaries. -5. Normalize CGAL wrappers/stubs and OCC SWIG boundaries in parallel. -6. Correct OCC public subclass families in independent owned work packages. -7. Verify source, wheels, native imports, documentation, and downstream use. - -See the [implementation plan at the migration checkpoint](https://github.com/compas-dev/compas_framework/blob/81ec5252559ce8a902bd68c8acc5ae0a856c9dca/initiatives/typing-alignment/implementation-plan.md) -for the dependencies and ownership that informed this proposal. - -## Accepted refinement: one structural vocabulary and typed native seams - -Follow-up evidence from core, CGAL, and libigl shows that the accepted broad -numeric policy is implemented through inconsistent names and incomplete native -typing. Accepted ADRs 016–017 refine the architecture without introducing new -geometry representations: - -1. replace the directionally false `TriangleMeshInput` and tuple-valued - `MeshType` with one core-owned neutral `VerticesFaces` structural alias; -2. make protocol names, input unions, and concrete result types visibly - distinct; -3. accept appropriate NumPy coordinate/index buffers consistently in copying - core constructors, including NumPy integral faces in `PolygonalSurface` and - `Polyhedron`; -4. require exact private native `.pyi` files for both CGAL and libigl, while - public wrappers accept the broad core contract and normalize once; and -5. verify the complete exported surface and installed artifacts rather than a - curated subset of functions. - -This refinement keeps face arity as an operation invariant, retains -`Tessellation`, `PolygonalSurface`, and `Mesh` in their existing representation -roles, and adds no `TriangleMesh` or `QuadMesh` class. Package source work is -authorized in the implementation-plan dependency order. - -## Accepted architecture correction: representations are not algorithm gates - -New evidence from the core and `compas_cgal` implementation shows that the -current design conflates retained discrete representations, numerical mesh -boundaries, and algorithm selection. Native CGAL consumes raw arrays, while a -core decorator nominally requires `Tessellation` for more than eighteen mesh -operations. Empty strategy objects such as `Delaunay` and `Native` also expose -dispatch choices as top-level geometry classes. - -The proposed correction is: - -1. retain `Tessellation` as an explicit discrete representation for parametric - conversion, visualization, and transfer; -2. make numerical triangle-mesh and plugin boundaries structural - `(vertices, triangles)` contracts that accept Python and NumPy buffers; -3. replace nominal `Tessellation` gates with public validation wrappers and - private backend hooks; -4. replace empty triangulation flags with named operations; -5. replace universal tessellation strategy objects with explicit, - producer-specific keyword controls. - -Named Delaunay operations remain planar-domain algorithms. Three-dimensional -coordinates are accepted only when coplanar in the explicit or documented -default frame; there is no implicit curved-domain flattening. Non-planar -polygon triangulation remains the responsibility of the polygon and -`PolygonalSurface` algorithms. Slightly curved domains are deferred to a -future, separately named approximation contract. - -Do not add `TriangleMesh` or `QuadMesh` classes. Face arity is an operation -invariant, and existing `Mesh`, `PolygonalSurface`, and `Tessellation` -representations already cover the required object roles. Do not retain -permanent dual object/raw algorithm paths. - -This correction is specified by Accepted ADRs 012–013. It supersedes only the -algorithm-gating interpretation of ADR 004; retained-buffer semantics remain -accepted. The decisions were approved on 2026-11-04. Implementation proceeds -from an affected-API migration table before package source changes. diff --git a/pyproject.toml b/pyproject.toml index 68bd950..dbd034c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -189,7 +189,7 @@ max-doc-length = 179 [tool.ruff.format] docstring-code-format = true docstring-code-line-length = "dynamic" -exclude = ["docs/**/*.md", "initiatives/**/*.md"] +exclude = ["docs/**/*.md"] [tool.pyright] include = [