| name | sedona-audit |
| description | Audit existing sx implementations against SedonaDB sources. Use when reviewing implementations after SedonaDB updates, verifying existing functions match current documentation, or identifying unimplemented functions. |
SedonaDB Implementation Audit Skill
Use this skill to verify that existing sx implementations correctly match current SedonaDB sources, or to identify functions that need updates after a SedonaDB version change.
When to use
- After SedonaDB version updates
- When troubleshooting unexpected behavior
- For periodic quality review
- Before a new sx release
- To identify which functions are not yet implemented
Audit workflow
1. Generate function inventory
List all SedonaDB functions
Read .sync/sedona-db/rust/sedona-functions/src/register.rs and extract all registered UDFs from:
register_scalar_udfs! - Scalar functions
register_aggregate_udfs! - Aggregate functions
List all sx implementations
Find all R/sx_*.R files and extract the function names.
Create inventory table
Create or update .claude/research/sedona/_inventory.md:
# SedonaDB Function Inventory
Last updated: [date]
SedonaDB version: [check .sync/sedona-db]
sx version: [check DESCRIPTION]
## Summary
- Total SedonaDB functions: XX
- Implemented in sx: XX
- Not implemented: XX
## Implemented Functions
| SedonaDB Function | sx Function | File | Tests | Notes |
|-------------------|-------------|------|-------|-------|
| ST_Buffer | sx_buffer | R/sx_buffer.R | Yes | |
| ST_Centroid | sx_centroid | R/sx_centroid.R | Yes | |
| ST_Envelope | sx_envelope | R/sx_envelope.R | Yes | |
| ST_Simplify | sx_simplify | R/sx_simplify.R | Yes | |
| ST_Transform | sx_transform | R/sx_transform.R | Yes | |
| ST_Join predicates | sx_join | R/sx_join.R | Yes | |
## Not Implemented
| SedonaDB Function | sf Equivalent | Priority | Notes |
|-------------------|---------------|----------|-------|
| ST_ConvexHull | st_convex_hull | Medium | |
| ST_Difference | st_difference | Medium | Binary op |
| ST_Intersection | st_intersection | High | Binary op, common |
| ST_Union | st_union | High | Binary op, common |
| ST_Area | st_area | High | Returns numeric |
| ST_Length | st_length | High | Returns numeric |
| ST_Distance | st_distance | High | Returns numeric |
| ... | ... | ... | ... |
## Function Categories
### Constructors (create geometry)
- ST_Point, ST_MakeLine, ST_GeomFromWKT, ST_GeomFromWKB, etc.
### Accessors (extract properties)
- ST_X, ST_Y, ST_Z, ST_M, ST_SRID, ST_CRS, ST_AsText, ST_AsBinary, etc.
### Metrics (return numeric)
- ST_Area, ST_Length, ST_Perimeter, ST_Distance, etc.
### Predicates (return boolean)
- ST_Contains, ST_Within, ST_Intersects, ST_Disjoint, etc.
### Transformations (return geometry)
- ST_Buffer, ST_Centroid, ST_ConvexHull, ST_Simplify, etc.
### Overlay (binary geometry operations)
- ST_Union, ST_Intersection, ST_Difference, ST_SymDifference
### Aggregates (multiple rows to one)
- ST_Union_Agg, ST_Collect_Agg, ST_Envelope_Agg, etc.
2. Individual function audit
For each implemented function, verify:
A. SQL signature match
B. Rust implementation match
C. Test coverage
D. Documentation accuracy
3. Generate audit report
Create or update .claude/research/sedona/_audit_report.md:
# sx SedonaDB Audit Report
Generated: [date]
SedonaDB Version: [from .sync/sedona-db]
sx Version: [from DESCRIPTION]
## Summary
- Functions audited: XX
- Needing updates: XX
- Not implemented: XX
- All tests passing: Yes/No
## Functions Needing Attention
### Updates Required
| Function | Issue | Priority | Action |
|----------|-------|----------|--------|
| sx_buffer | Missing new param from v0.3 | High | Add buffer_style param |
### Missing Tests
| Function | Issue | Priority |
|----------|-------|----------|
| sx_simplify | No sf comparison test | Medium |
### Documentation Issues
| Function | Issue | Priority |
|----------|-------|----------|
| sx_centroid | @seealso link broken | Low |
## Detailed Findings
### sx_buffer
- **Status:** Needs update
- **Issue:** SedonaDB v0.3 added `buffer_style` parameter
- **Current signature:** `ST_Buffer(geom, distance)`
- **New signature:** `ST_Buffer(geom, distance, buffer_style?)`
- **Action:** Add optional `buffer_style` parameter
- **Priority:** High
### sx_centroid
- **Status:** OK
- **Last verified:** [date]
- **Notes:** Matches current SedonaDB implementation
### sx_envelope
- **Status:** OK
- **Last verified:** [date]
[Continue for each function...]
## Recommendations
### High Priority
1. Update sx_buffer to support new parameters
2. Implement ST_Intersection (commonly used)
3. Implement ST_Area (basic accessor)
### Medium Priority
1. Add missing sf comparison tests
2. Implement ST_ConvexHull
3. Implement ST_Union
### Low Priority
1. Fix documentation links
2. Implement less common functions
4. Prioritize findings
Use this priority framework:
| Priority | Criteria |
|---|
| High | Function behavior changed, security issues, broken functionality, commonly used function missing |
| Medium | New optional parameters, documentation updates, moderately used function missing |
| Low | Minor improvements, style consistency, rarely used function missing |
After audit
For functions needing updates:
- Re-run
sedona-research skill to get current state
- Update implementation using findings
- Update tests
- Re-audit to confirm
For unimplemented functions:
- Run
sedona-research skill
- Run
sedona-implement skill
- Add to inventory
Checklist
Quick commands
grep -E "crate::" .sync/sedona-db/rust/sedona-functions/src/register.rs | wc -l
ls R/sx_*.R | wc -l
Rscript -e "devtools::test(filter = '^sx_')"
for f in R/sx_*.R; do
name=$(basename "$f" .R)
if [ ! -f "tests/testthat/test-$name.R" ]; then
echo "Missing tests: $name"
fi
done