- Added logging when HTTP server OnStart hook is called
- Added error logging for database migration failures
- This will help identify if hooks are being called and where failures occur
- Added better error detection for HTTP server startup
- Added connectivity check to verify server is actually listening
- Increased wait time to 500ms for better error detection
- Added warning log if server connectivity check fails (may still be starting)
- Improved logging messages for server startup
This should help diagnose why the HTTP server isn't starting and provide better visibility into the startup process.
Fixes:
- Added database connection logging with masked DSN
- Added migration progress logging
- Added HTTP server startup logging with address
- Fixed database provider to accept logger parameter
- Improved error visibility throughout initialization
Documentation:
- Moved Story 1.7 (Service Client Interfaces) to Epic 2 as Story 2.7
- Updated Epic 1 and Epic 2 READMEs
- Updated COMPLETE_TASK_LIST.md
- Updated story metadata (ID, Epic, Dependencies)
These changes will help diagnose startup issues and provide better visibility into what the application is doing.
Story 1.6: OpenTelemetry Distributed Tracing
- Implemented tracer initialization with stdout (dev) and OTLP (prod) exporters
- Added HTTP request instrumentation via Gin middleware
- Integrated trace ID correlation in structured logs
- Added tracing configuration to config files
- Registered tracer provider in DI container
Documentation and Setup:
- Created Docker Compose setup for PostgreSQL database
- Added comprehensive Epic 1 summary with verification instructions
- Added Epic 0 summary with verification instructions
- Linked summaries in documentation index and epic READMEs
- Included detailed database testing instructions
- Added Docker Compose commands and troubleshooting guide
All Epic 1 stories (1.1-1.6) are now complete. Story 1.7 depends on Epic 2.
Implemented Epic 1 core kernel and infrastructure stories:
Story 1.1: Enhanced DI Container
- Added providers for database, health, metrics, and error bus
- Extended CoreModule to include all core services
Story 1.2: Database Layer with Ent ORM
- Created Ent schema for User, Role, Permission, AuditLog entities
- Implemented many-to-many relationships (User-Role, Role-Permission)
- Created database client wrapper with connection pooling
- Added database provider to DI container with migration support
Story 1.3: Health Monitoring and Metrics System
- Implemented health check registry and interface
- Added database health checker
- Created Prometheus metrics system with HTTP instrumentation
- Added health and metrics providers to DI container
Story 1.4: Error Handling and Error Bus
- Implemented channel-based error bus
- Created ErrorPublisher interface
- Added error bus provider with lifecycle management
Story 1.5: HTTP Server Foundation
- Created HTTP server with Gin framework
- Implemented comprehensive middleware stack:
- Request ID generation
- Structured logging
- Panic recovery with error bus integration
- Prometheus metrics collection
- CORS support
- Registered core routes: /healthz, /ready, /metrics
- Integrated with FX lifecycle for graceful shutdown
All components are integrated via DI container and ready for use.
- Remove t.Parallel() from tests that use gin.SetMode()
- gin.SetMode() modifies global state and is not thread-safe
- Tests affected:
* TestRequestIDMiddleware_GenerateNewID
* TestRequestIDMiddleware_UseExistingID
* TestLoggingMiddleware
* TestLoggingMiddleware_WithRequestID
* TestRequestIDMiddleware_MultipleRequests
- Add comments explaining why these tests cannot run in parallel
- All tests now pass with race detector enabled (-race flag)
This fixes data race warnings that were occurring when running tests
with the race detector, specifically when multiple tests tried to set
Gin's mode concurrently.
- Add tests for internal/config package (90.9% coverage)
- Test all viperConfig getter methods
- Test LoadConfig with default and environment-specific configs
- Test error handling for missing config files
- Add tests for internal/di package (88.1% coverage)
- Test Container lifecycle (NewContainer, Start, Stop)
- Test providers (ProvideConfig, ProvideLogger, CoreModule)
- Test lifecycle hooks registration
- Include mock implementations for testing
- Add tests for internal/logger package (96.5% coverage)
- Test zapLogger with JSON and console formats
- Test all logging levels and methods
- Test middleware (RequestIDMiddleware, LoggingMiddleware)
- Test context helper functions
- Include benchmark tests
- Update CI workflow to skip tests when no test files exist
- Add conditional test execution based on test file presence
- Add timeout for test execution
- Verify build when no tests are present
All tests follow Go best practices with table-driven patterns,
parallel execution where safe, and comprehensive coverage.
Implemented all 5 stories from Epic 0:
Story 0.1: Project Initialization
- Initialize Go module with path git.dcentral.systems/toolz/goplt
- Create complete directory structure (cmd/, internal/, pkg/, modules/, config/, etc.)
- Add comprehensive .gitignore for Go projects
- Create README.md with project overview and setup instructions
Story 0.2: Configuration Management System
- Define ConfigProvider interface in pkg/config
- Implement Viper-based configuration in internal/config
- Create configuration loader with environment support
- Add default, development, and production YAML config files
Story 0.3: Structured Logging System
- Define Logger interface in pkg/logger
- Implement Zap-based logger in internal/logger
- Add request ID middleware for Gin
- Create global logger export with convenience functions
- Support context-aware logging with request/user ID extraction
Story 0.4: CI/CD Pipeline
- Create GitHub Actions workflow for CI (test, lint, build, fmt)
- Add comprehensive Makefile with development commands
- Configure golangci-lint with reasonable defaults
Story 0.5: Dependency Injection and Bootstrap
- Create FX-based DI container in internal/di
- Implement provider functions for Config and Logger
- Create application entry point in cmd/platform/main.go
- Add lifecycle management with graceful shutdown
All acceptance criteria met:
- go build ./cmd/platform succeeds
- go test ./... runs successfully
- go mod verify passes
- Config loads from config/default.yaml
- Logger can be injected and used
- Application starts and shuts down gracefully