-
Notifications
You must be signed in to change notification settings - Fork 0
feat: implement PostGIS table discovery API (#57) #88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement PostGIS table discovery API (#57) #88
Conversation
- Add Honua.AppHost project for local development orchestration - Configure PostgreSQL with PostGIS container (postgis/postgis:16-3.4) - Configure Redis container with Redis Commander for debugging - Add Honua.ServiceDefaults with shared OpenTelemetry configuration - Implement traces (ASP.NET Core, HttpClient), metrics (ASP.NET Core, runtime, custom) - Configure conditional OTLP export when OTEL_EXPORTER_OTLP_ENDPOINT is set - Add service discovery and health checks - Enable AOT compilation for production deployments - Update Honua.Server to integrate with ServiceDefaults Local development: dotnet run in src/Honua.AppHost starts full stack Production build: dotnet publish with native AOT compilation (24MB binary)
Resolved conflicts by integrating Aspire ServiceDefaults into existing trunk implementation: - Added ServiceDefaults project reference to Honua.Server.csproj - Integrated AddServiceDefaults() and Aspire data sources into Program.cs - Preserved existing Serilog, database migrations, and health check infrastructure
- Added copyright headers to ServiceDefaults and AppHost projects - Removed unnecessary using statements via dotnet format - All builds pass with 0 warnings, 0 errors - All tests pass (104/104) - AOT build successful (27MB binary)
- Add GET /api/admin/connections/{id}/tables endpoint
- Implement PostgreSqlTableDiscoveryService for PostGIS table discovery
- Query geometry_columns and geography_columns system views
- Return table metadata including schema, name, geometry info, SRID, and columns
- Add comprehensive integration tests with AOT-compatible JSON serialization
- Include source-generated logging for performance
- Follow greenfield project patterns with feature-based organization
- Resolved merge conflict in Program.cs by preserving both admin and default endpoints - Fixed AOT compilation errors by removing RequiresUnreferencedCode attributes - Replaced generic Map() with MapGet() for true AOT compatibility - Removed unnecessary System.Diagnostics.CodeAnalysis using directive
- Remove RequiresUnreferencedCode and RequiresDynamicCode attributes - Use explicit HttpContext parameter extraction instead of reflection-based binding - Replace method parameter injection with manual route value extraction - Ensures full AOT compatibility for minimal API endpoints
- Replace MapGet with MapMethods using explicit RequestDelegate - Add HandleGetConnectionTables method for proper AOT-compatible endpoint registration - Eliminates all reflection-based parameter binding that caused AOT warnings - Ensures native compilation compatibility with zero warnings
🤖 LLM Architecture Review✅ Assessment: APPROVED 🏗️ Architecture Review Summary ✅ Good Patterns Found:
💡 Recommendations:
📚 Educational Notes:
Overall Assessment: NEEDS_ATTENTION CRITICAL: The PR is linked to a GitHub issue with clear acceptance criteria, and the changes address those criteria. However, the dependency inversion violation is a critical architectural concern that needs resolution before merging. Automated architectural analysis powered by OpenAI GPT-4 |
- Use endpoints.Map() with HttpMethodMetadata for full AOT compatibility - Replace GetConnectionString() with IDatabaseConnectionProvider pattern - Follow proven health endpoint pattern for route registration - Write responses directly to HttpContext instead of returning IResult - Routing now works correctly - admin endpoints are being hit successfully
- Replace ILogger<ITableDiscoveryService> with ILogger<AdminEndpoints> - Removes dependency from presentation layer on core service interfaces - Maintains proper architectural separation per Clean Architecture principles
- Move TestDatabaseConnectionProvider to TestKit for reusability - Add IDatabaseConnectionProvider replacement in WebAppFixture - Fix logger dependency inversion issue with ILoggerFactory approach - Enables proper testing of database-dependent admin endpoints
- Update WebAppFixture to properly handle PostgreSQL service registration - Remove DefaultConnection dependency for test environment - Add comprehensive test database connection setup - Work in progress: still debugging 500 errors in tests
- Fix 500 error by passing DbConnection directly to avoid password extraction - Add DbConnection overload to ITableDiscoveryService interface - Implement catch-all routing to handle empty connection ID case (400 response) - Update PostgreSqlTableDiscoveryService with new connection overload - All 4 admin endpoint integration tests now passing Related to Issue #57: PostGIS table discovery API implementation
Summary
Implements Issue #57: PostGIS table discovery feature that allows users to discover and list all spatial tables in a PostGIS database.
Changes
GET /api/admin/connections/{id}/tablesgeometry_columnsandgeography_columnssystem viewsAPI Response Format
{ "tables": [ { "schema": "public", "table": "parcels", "geometryColumn": "geom", "geometryType": "MULTIPOLYGON", "srid": 4326, "estimatedRows": 50000, "columns": [ { "name": "id", "dataType": "integer", "isNullable": false, "isPrimaryKey": true } ] } ] }Technical Implementation
Verification Steps
dotnet formatapplied and cleanCloses #57
🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 4 [email protected]