Skip to content

Commit a352c2c

Browse files
committed
docs(breg): note the client geometry break and what a geometry contract change costs
Record the polygon feature and the client geometry type change in the BReg changelog, with migration steps for Rust, TypeScript and Python. Say in the spatial queries guide that changing a geometry field's precision, bbox or maximumPositions is a field type change that needs a reviewed migration, and what happens when a retained value violates a tightened contract. Drop a Point validator assertion that pinned a precision-9 refusal of a valid coordinate; issue #2645 tracks the validator. BREAKING CHANGE: the geometry of a GeoJSON Feature in the Rust, Node.js and Python clients is a union of Point, Polygon and MultiPolygon. In Rust, match BRegGeoJsonGeometry::Point(point) before reading coordinates. In TypeScript, narrow on geometry.type === "Point". In Python, type checkers see the union. Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
1 parent 7133183 commit a352c2c

3 files changed

Lines changed: 29 additions & 7 deletions

File tree

‎crates/registry-breg-client/src/actions.rs‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,7 +1890,7 @@ mod tests {
18901890
}
18911891

18921892
#[test]
1893-
fn polygon_precision_nine_accepts_near_zero_coordinates_without_changing_point() {
1893+
fn polygon_precision_nine_accepts_near_zero_coordinates() {
18941894
let coordinate = json!(0.000000001);
18951895
assert!(coordinate.to_string().contains('e'));
18961896
assert!(valid_action_input(
@@ -1905,11 +1905,6 @@ mod tests {
19051905
}),
19061906
None,
19071907
));
1908-
assert!(!valid_action_input(
1909-
&json!({"type":"Point","coordinates":[0.000000001,0.000000001]}),
1910-
&json!({"type":"crs84-point","precision":9}),
1911-
None,
1912-
));
19131908
}
19141909

19151910
#[test]

‎products/breg/CHANGELOG.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@
55
- `bregctl project-dev` runs BReg projects, including spatial projects, from a
66
`breg/project-dev` v1alpha1 plan. It is an alpha format and may change.
77
`rstack dev` is its entry point.
8+
- A `crs84-polygon` field stores a bounded `Polygon` or `MultiPolygon` in
9+
WGS 84 longitude and latitude. It takes `precision`, `maximumPositions` and
10+
an optional `bbox`, and the compiler validates it with PostGIS and generates
11+
a stored geometry column with a GiST index. A bbox grant in an access
12+
profile filters Polygon and MultiPolygon fields by bounding-box
13+
intersection, as it does for a Point. The GIS profile and the spatial
14+
clients carry the new geometry types.
15+
- BREAKING: The geometry of a GeoJSON Feature in the Rust, Node.js and Python
16+
clients is a union of Point, Polygon and MultiPolygon, where it was always
17+
a Point. The wire format of a Point is unchanged. In Rust, `geometry` is
18+
`Option<BRegGeoJsonGeometry>` instead of `Option<BRegGeoJsonPoint>`; match
19+
`BRegGeoJsonGeometry::Point(point)` before reading `coordinates`. In
20+
TypeScript, `GeoJsonGeometry` replaces `GeoJsonPoint` on a feature; narrow
21+
on `geometry.type === "Point"` before reading `coordinates`. In Python the
22+
`.pyi` stubs describe the union, so a type checker flags code that assumes a
23+
Point.
824

925
## 0.46.0 - 2026-11-08
1026

‎products/breg/SPATIAL-QUERIES.md‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,25 @@ history or exports. PostGIS types, functions and operators are schema-qualified.
186186

187187
Adding or changing the geometry binding or bbox grant requires the normal
188188
reviewed successor lifecycle. The compiler derives the projection/index DDL.
189-
an author does not write dummy SQL to enable spatial storage or bbox.
189+
An author does not write dummy SQL to enable spatial storage or bbox.
190190
Missing prerequisites refuse before maintenance begins. An apply failure
191191
after maintenance begins keeps records unavailable until the existing
192192
reviewed recovery procedure completes. Removing the last bbox grant removes
193193
the helper. It also removes a Point's generated projection and index when no
194194
other bbox grant needs them. A Polygon keeps its generated projection and index.
195195
Stored data, history and the administrator-owned extension and role remain.
196196

197+
Changing a Point or Polygon field's `precision`, `bbox` or `maximumPositions`
198+
is a field type change, even when it only loosens the contract. It needs a
199+
[reviewed migration](../../docs/site/src/content/docs/operate/breg-changes.mdx#write-a-reviewed-migration-descriptor)
200+
with at least one SQL step, a backup binding and a rehearsal receipt. A
201+
tightening that a retained value violates is not caught by a pre-check: the
202+
apply fails on the generated check constraint, the target stays non-ready, and
203+
[the failed-activation recovery](../../docs/site/src/content/docs/operate/breg-changes.mdx#recover-a-failed-activation)
204+
applies. Issue
205+
[#2646](https://github.com/registrystack/registry-stack/issues/2646) proposes
206+
treating a loosening as a compatible change.
207+
197208
Adding the stored projection can rewrite existing rows, and creating its index
198209
takes locks and additional disk space. Plan a maintenance window and a tested
199210
backup/restore path for an existing registry. The small quickstart does not

0 commit comments

Comments
 (0)