Context
The bootstrap left Annotation.geometry: dict. The wire format needs real types now:
exporters, the API contract and the TS generation all depend on it.
Deliverables
- Discriminated union on a
type field: BboxGeometry {x, y, width, height},
PolygonGeometry {points: [[x,y], ...]} (≥3 points, non-self-intersecting not
validated in M1 — document), ClassificationGeometry {} (tag, no coordinates).
- Coordinates in the asset's native reference frame (pixels), floats, never normalized —
documented in docstrings (exporter concern).
- The union is designed to extend (polyline, keypoints, 3D) without breaking the
discriminator.
Acceptance criteria
Context
The bootstrap left
Annotation.geometry: dict. The wire format needs real types now:exporters, the API contract and the TS generation all depend on it.
Deliverables
typefield:BboxGeometry {x, y, width, height},PolygonGeometry {points: [[x,y], ...]}(≥3 points, non-self-intersecting notvalidated in M1 — document),
ClassificationGeometry {}(tag, no coordinates).documented in docstrings (exporter concern).
discriminator.
Acceptance criteria
allowed_geometriesvia the union— satisfied at the model level: the discriminator values ARE
GeometryTypemembers, so thecheck is a direct membership test. Enforcement itself stays with kernel: AnnotationService — schema-validated writes (hard reject: unknown class, disallowed geometry, missing required attribute), provenance, UUID identity #7.