cleanCoords: Add collection support and typescript fixes #3012
All Vouch review confidence checks passed
Residual risk 0.30 = Change Risk (0.50) × (1 − Review Confidence (0.41)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 395 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.358
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #3012"
general
weight: 0.35
smallsaucepan
Addresses #2998.
Summary
Adds some features to clean-coords:
FeatureCollectionandGeometryCollectiontypes through a recursive call.booleanPointOnLinecalls.Additional Notes
1. I had originally suggested also changing the behavior such that output polygons with < 4 points should not throw but instead return a valid 4 Position polygon. Changed my mind given that these, while technically valid geojson, are not OGC Simple Feature valid polygons and could lead to downstream choking.
2. Wanted to (a) maximize structural sharing to improve performance wherever possible, and (b) ensure we are clear about what gets preserved vs. not. The basic premise is that:
- The geojson objects down to the
Geometryare always reused when mutate=true and always new when mutate=false- All properties, id, bbox, are always reused irrespective of mutate value
- Mutate=false is (as you would expect) guaranteed not to change any coordinates from the original, but otherwise, will reuse or create new or mutate if mutate=true with no specific guarantees
3. The type signature improvement aims to be maximally informative in that it passes the geometry's generic through, requiring that the function always either outputs the same type it receives or throws. If this is too constraining then can back it off, but figured more type inference was better, and it matches the behavior.
4. Benchmarks are variable but more got faster than slower, with the main impacts coming from the structural sharing changes. e.g., the biggest slowdown was in the single point test where we replace the object rather than return it. The better sharing tends to boost performance when few changes are made to larger geometries - i.e., more realistic cases.
Future Work
I do wonder if you would be interested in a follow up PR that adds a
collapseoption? Reason being I am concerned by the workflow of input > truncate > clean throwing errors for valid input. The collapse option would remove the offending geometry at the ring level rather than throw an error. Thoughts?---
Please provide the following when creating a PR:
contributorsfield ofpackage.json- you've earned it! 👏