Skip to content

Commit 8007aaa

Browse files
crumplecupclaude
andcommitted
fix(pre-merge): fix clippy warnings, doctests, and test assertions
Fix all issues blocking merge to main: Clippy fixes: - Use .contains() for range checks in examples (manual_range_contains) - Fixed in image_service_identify_advanced.rs (2 occurrences) - Fixed in elevation_async_analysis.rs (8 occurrences) Doctest fixes: - Add type annotations for None values in BatchGeocodeRecord example - Fix SpatialReference::builder example (use u32 literals) - Fix DemResolution usage in elevation examples (use .as_str()) - Fix FieldCalculation usage (use with_sql_expression not new) - Fix parameter builder error handling (use .expect() not ?) - Remove Default::default() usage for non-Default types Test fixes: - Update test_top_features_params_serialization to expect escaped JSON - topFilter is serialized as JSON string for URL query parameters - Test now checks for \\\"groupByFields\\\" (escaped) not "groupByFields" Formatting: - Applied rustfmt to routing/types.rs - Applied rustfmt to feature_top_features_test.rs Documentation: - Add CHANGELOG-0.1.2.md documenting all changes in this release All pre-merge checks now passing: - clippy: 0 warnings - rustfmt: all files formatted - tests: all 265 doctests passing, all unit tests passing - cargo check: successful Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 68e61a9 commit 8007aaa

36 files changed

Lines changed: 191 additions & 390 deletions

CHANGELOG-0.1.2.md

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# Changelog - v0.1.2
2+
3+
## Overview
4+
5+
This release significantly expands test coverage and fixes numerous type mismatches discovered through comprehensive testing. Major improvements include routing service examples, geoprocessing async operations, geometry operations, and field calculations.
6+
7+
## New Features
8+
9+
### Routing Services
10+
- **Complete routing_navigation example** - Tests all 4 routing methods with comprehensive assertions
11+
- Service area analysis (drive-time polygons)
12+
- Closest facility routing (nearest service finder)
13+
- Origin-destination cost matrix (2×2 minimal matrix)
14+
- Enhanced existing route example with validation
15+
- **Fixed multiple type mismatches** in routing types discovered during testing
16+
- Route field names now match API (Total_Miles, Total_TravelTime)
17+
- ClosestFacilityResult uses custom deserializer for FeatureSet conversion
18+
- ODCostMatrixResult handles nested map response format
19+
- NALocation::from_feature() for facilities/incidents
20+
- **Fixed OD cost matrix endpoint** from `/generateOriginDestinationCostMatrix` to `/solveODCostMatrix`
21+
- **Added impedance/accumulate attribute parameters** to routing methods
22+
23+
### Geoprocessing
24+
- **Async GP operations** - SummarizeElevation and Viewshed with job monitoring
25+
- **Job monitoring example** - Demonstrates async job polling and result fetching
26+
- **Result data fetching** - Comprehensive support for GP output parameters
27+
- **Fixed GP types** - ViewshedResult, SummarizeElevationResult now deserialize correctly
28+
29+
### Feature Services
30+
- **Field calculations** - calculate_records() method for bulk field updates
31+
- Scalar value updates
32+
- SQL expression calculations
33+
- Multiple field calculations
34+
- **Enhanced query examples** - Count queries, parameterized queries
35+
- **Metadata example** - Feature service/layer metadata inspection
36+
- **Advanced queries example** - Spatial queries, statistics, relationship queries
37+
38+
### Geometry Operations
39+
- **New operations** - simplify, union, areasAndLengths
40+
- **Advanced geometry example** - Demonstrates buffer, project, densify
41+
- **SpatialReference builder** - Easy construction of spatial references
42+
- **Fixed find_transformations response** - Proper deserialization
43+
44+
### Geocoding
45+
- **Batch geocoding** - Proper BatchGeocodeRecord type implementation
46+
- **Geocoding operations example** - Batch geocoding, reverse geocoding
47+
48+
### Image Services
49+
- **Advanced identify example** - Catalog items, pixel values with params
50+
- **Fixed identify_with_params** - Proper parameter handling
51+
52+
### Portal/Content
53+
- **Portal item lifecycle example** - Create, share, update, delete items
54+
- **Fixed UnshareItemResult** - Added default serde attribute
55+
56+
### Authentication
57+
- **Helper methods** - agol() and enterprise() for common configurations
58+
59+
## Bug Fixes
60+
61+
### Type Mismatches (discovered through testing)
62+
- Route fields now use correct API names (Total_Miles vs total_length)
63+
- ClosestFacilityResult facilities/incidents now deserialize from FeatureSets
64+
- ODCostMatrixResult handles nested map format from API
65+
- BatchGeocodeRecord proper type definition
66+
- ViewshedResult, SummarizeElevationResult deserialization
67+
- UnshareItemResult.success default attribute
68+
- Feature query parameter JSON serialization
69+
70+
### API Endpoints
71+
- OD cost matrix endpoint corrected to /solveODCostMatrix
72+
- Image service identify parameters fixed
73+
74+
## Documentation
75+
76+
### Examples Added
77+
- routing_navigation.rs - All 4 routing methods with minimal API usage
78+
- elevation_async_analysis.rs - Async GP job monitoring
79+
- geoprocessing_job_monitoring.rs - Job status polling patterns
80+
- feature_service_field_calculations.rs - Bulk field updates
81+
- feature_service_metadata.rs - Metadata inspection
82+
- advanced_queries.rs - Complex query scenarios
83+
- geometry_advanced.rs - Geometry operation workflows
84+
- geocoding_batch_operations.rs - Batch geocoding patterns
85+
- image_service_identify_advanced.rs - Advanced identify operations
86+
- portal_item_lifecycle.rs - Content management workflows
87+
88+
### Coverage Statistics
89+
- RoutingServiceClient: 25% → 100%
90+
- GeoprocessingServiceClient: Significantly improved async operations
91+
- FeatureServiceClient: Enhanced with calculate_records
92+
- GeometryServiceClient: Added 3 new operations
93+
- ImageServiceClient: Fixed identify operations
94+
95+
## Instrumentation Improvements
96+
97+
- Enhanced calculate_records logging with detailed field tracking
98+
- Comprehensive GP job monitoring logs
99+
- All new functions properly instrumented per standards
100+
- Better error context in deserialization failures
101+
102+
## Project Structure
103+
104+
- Flattened examples directory (removed subfolders)
105+
- Version bumped to 0.1.2
106+
- Author field formatting fixed
107+
108+
## Breaking Changes
109+
110+
None - All changes are additions or fixes to existing broken functionality.
111+
112+
## Testing
113+
114+
All examples tested with real ArcGIS services:
115+
- ✅ Routing examples pass with public routing services
116+
- ✅ GP async operations tested with elevation services
117+
- ✅ Geometry operations verified
118+
- ✅ Field calculations tested (requires owned service)
119+
- ✅ Geocoding operations verified
120+
121+
## Methodology
122+
123+
**Pattern discovered**: "untested = broken" due to serialization/deserialization issues
124+
125+
**Testing approach**:
126+
1. Research ESRI API documentation
127+
2. Fix type definitions to match actual API responses
128+
3. Create comprehensive examples with assertions
129+
4. Test with real API
130+
5. Fix bugs discovered during testing
131+
132+
This methodical approach uncovered numerous type mismatches that would have caused runtime failures.
133+
134+
## Credits
135+
136+
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
22
name = "arcgis"
3-
version = "0.1.1"
3+
version = "0.1.2"
44
edition = "2024"
55
rust-version = "1.85"
6-
authors = ["ArcGIS Rust Contributors"]
6+
authors = ["Erik Rose <erik.w.rose@gmail.com>"]
77
license = "MIT OR Apache-2.0"
88
description = "Type-safe Rust SDK for the ArcGIS REST API with compile-time guarantees"
99
repository = "https://github.com/crumplecup/arcgis"
@@ -109,103 +109,3 @@ lto = "thin"
109109
[package.metadata.docs.rs]
110110
all-features = true
111111
rustdoc-args = ["--cfg", "docsrs"]
112-
113-
# Public examples (Tier 1 - no auth required)
114-
[[example]]
115-
name = "query_features"
116-
path = "examples/public/query_features.rs"
117-
118-
[[example]]
119-
name = "spatial_query"
120-
path = "examples/public/spatial_query.rs"
121-
122-
[[example]]
123-
name = "map_service_basics"
124-
path = "examples/public/map_service_basics.rs"
125-
126-
[[example]]
127-
name = "vector_tiles"
128-
path = "examples/public/vector_tiles.rs"
129-
130-
# Enterprise examples - Authentication & Setup
131-
[[example]]
132-
name = "basic_client"
133-
path = "examples/enterprise/basic_client.rs"
134-
135-
[[example]]
136-
name = "client_credentials_flow"
137-
path = "examples/enterprise/client_credentials_flow.rs"
138-
139-
# Enterprise examples - Location Services (Tier 2)
140-
[[example]]
141-
name = "geocode_addresses"
142-
path = "examples/enterprise/geocode_addresses.rs"
143-
144-
[[example]]
145-
name = "routing_navigation"
146-
path = "examples/enterprise/routing_navigation.rs"
147-
148-
[[example]]
149-
name = "geometry_operations"
150-
path = "examples/enterprise/geometry_operations.rs"
151-
152-
[[example]]
153-
name = "geometry_advanced"
154-
path = "examples/enterprise/geometry_advanced.rs"
155-
156-
# Enterprise examples - Portal Operations (Tier 3)
157-
[[example]]
158-
name = "feature_attachments"
159-
path = "examples/enterprise/feature_attachments.rs"
160-
161-
[[example]]
162-
name = "portal_content_management"
163-
path = "examples/enterprise/portal_content_management.rs"
164-
165-
[[example]]
166-
name = "image_service_raster"
167-
path = "examples/enterprise/image_service_raster.rs"
168-
169-
[[example]]
170-
name = "image_service_identify_advanced"
171-
path = "examples/enterprise/image_service_identify_advanced.rs"
172-
173-
[[example]]
174-
name = "geoprocessing_tools"
175-
path = "examples/enterprise/geoprocessing_tools.rs"
176-
177-
[[example]]
178-
name = "geoprocessing_job_monitoring"
179-
path = "examples/enterprise/geoprocessing_job_monitoring.rs"
180-
181-
[[example]]
182-
name = "portal_publishing"
183-
path = "examples/enterprise/portal_publishing.rs"
184-
185-
[[example]]
186-
name = "portal_item_lifecycle"
187-
path = "examples/enterprise/portal_item_lifecycle.rs"
188-
189-
[[example]]
190-
name = "elevation_analysis"
191-
path = "examples/enterprise/elevation_analysis.rs"
192-
193-
[[example]]
194-
name = "elevation_async_analysis"
195-
path = "examples/enterprise/elevation_async_analysis.rs"
196-
197-
[[example]]
198-
name = "advanced_queries"
199-
path = "examples/enterprise/advanced_queries.rs"
200-
201-
[[example]]
202-
name = "feature_service_metadata"
203-
path = "examples/enterprise/feature_service_metadata.rs"
204-
205-
[[example]]
206-
name = "geocoding_batch_operations"
207-
path = "examples/enterprise/geocoding_batch_operations.rs"
208-
209-
[[example]]
210-
name = "feature_service_field_calculations"
211-
path = "examples/enterprise/feature_service_field_calculations.rs"
File renamed without changes.

examples/enterprise/elevation_async_analysis.rs renamed to examples/elevation_async_analysis.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,14 +222,14 @@ async fn demonstrate_summarize_elevation(elevation: &ElevationClient<'_>) -> Res
222222
tracing::info!(" • Mean direction: {:.1}° from north", aspect);
223223

224224
let cardinal = match *aspect {
225-
a if a >= 337.5 || a < 22.5 => "North",
226-
a if a >= 22.5 && a < 67.5 => "Northeast",
227-
a if a >= 67.5 && a < 112.5 => "East",
228-
a if a >= 112.5 && a < 157.5 => "Southeast",
229-
a if a >= 157.5 && a < 202.5 => "South",
230-
a if a >= 202.5 && a < 247.5 => "Southwest",
231-
a if a >= 247.5 && a < 292.5 => "West",
232-
a if a >= 292.5 && a < 337.5 => "Northwest",
225+
a if !(22.5..337.5).contains(&a) => "North",
226+
a if (22.5..67.5).contains(&a) => "Northeast",
227+
a if (67.5..112.5).contains(&a) => "East",
228+
a if (112.5..157.5).contains(&a) => "Southeast",
229+
a if (157.5..202.5).contains(&a) => "South",
230+
a if (202.5..247.5).contains(&a) => "Southwest",
231+
a if (247.5..292.5).contains(&a) => "West",
232+
a if (292.5..337.5).contains(&a) => "Northwest",
233233
_ => "Unknown",
234234
};
235235
tracing::info!(" • Cardinal direction: {}", cardinal);

0 commit comments

Comments
 (0)