Commit Graph

6 Commits

Author SHA1 Message Date
dbe29bfb82 fix(consul): fix gRPC health checks and add API Gateway Consul registration 2025-11-06 22:04:55 +01:00
b1b895e818 feat(epic2): Implement core authentication and authorization services
- Implement Audit Service (2.5)
  - gRPC server with Record and Query operations
  - Database persistence with audit schema
  - Service registry integration
  - Entry point: cmd/audit-service

- Implement Identity Service (2.2)
  - User CRUD operations
  - Password hashing with argon2id
  - Email verification and password reset flows
  - Entry point: cmd/identity-service
  - Fix package naming conflicts in user_service.go

- Implement Auth Service (2.1)
  - JWT token generation and validation
  - Login, RefreshToken, ValidateToken, Logout RPCs
  - Integration with Identity Service
  - Entry point: cmd/auth-service
  - Note: RefreshToken entity needs Ent generation

- Implement Authz Service (2.3, 2.4)
  - Permission checking and authorization
  - User roles and permissions retrieval
  - RBAC-based authorization
  - Entry point: cmd/authz-service

- Implement gRPC clients for all services
  - Auth, Identity, Authz, and Audit clients
  - Service discovery integration
  - Full gRPC communication

- Add service configurations to config/default.yaml
- Create SUMMARY.md with implementation details and testing instructions
- Fix compilation errors in Identity Service (password package conflicts)
- All services build successfully and tests pass
2025-11-06 20:07:20 +01:00
c05038ccf2 fix: resolve test race conditions and update golangci-lint action
Some checks failed
CI / Test (pull_request) Successful in 24s
CI / Lint (pull_request) Failing after 18s
CI / Build (pull_request) Successful in 15s
CI / Format Check (pull_request) Successful in 1s
- Fix race condition in gateway tests by using TestMain to set Gin mode once
  - Remove duplicate gin.SetMode(gin.TestMode) calls from individual tests
  - Add TestMain function to initialize test environment before all tests
  - Prevents race conditions when tests run in parallel with -race flag

- Update golangci-lint-action from v6 to v7
  - v6 doesn't support golangci-lint v2.x versions
  - v7 supports golangci-lint v2.x and automatically selects compatible version
  - Change version from v2.6.0 to latest for automatic compatibility

All tests now pass with race detector enabled.
2025-11-06 09:57:58 +01:00
260bc07114 test: add comprehensive tests for API Gateway implementation
- Add unit tests for gateway service (services/gateway/gateway_test.go)
  - Test gateway creation, route setup, service discovery, and error handling
  - Achieve 67.9% code coverage for gateway service
  - Test all HTTP methods are properly handled
  - Test route matching and 404 handling

- Add tests for API Gateway main entry point (cmd/api-gateway/main_test.go)
  - Test DI container setup and structure
  - Test service instance creation logic
  - Test lifecycle hooks registration

- Add testify dependency for assertions (go.mod)

All tests pass successfully. Proxy forwarding tests are noted for integration
test suite as they require real HTTP connections (per ADR-0028 testing strategy).
2025-11-06 09:52:16 +01:00
8ac85f9b1c chore: Remove duplicate gateway.go file from internal directory
Some checks failed
CI / Test (pull_request) Failing after 1m20s
CI / Lint (pull_request) Failing after 3s
CI / Build (pull_request) Successful in 53s
CI / Format Check (pull_request) Successful in 3s
2025-11-06 09:25:26 +01:00
16731fc1d1 refactor: Align Epic 0 & Epic 1 with true microservices architecture
Refactor core kernel and infrastructure to support true microservices
architecture where services are independently deployable.

Phase 1: Core Kernel Cleanup
- Remove database provider from CoreModule (services create their own)
- Update ProvideHealthRegistry to not depend on database
- Add schema support to database client (NewClientWithSchema)
- Update main entry point to remove database dependency
- Core kernel now provides only: config, logger, error bus, health, metrics, tracer, service registry

Phase 2: Service Registry Implementation
- Create ServiceRegistry interface (pkg/registry/registry.go)
- Implement Consul registry (internal/registry/consul/consul.go)
- Add Consul dependency (github.com/hashicorp/consul/api)
- Add registry configuration to config/default.yaml
- Add ProvideServiceRegistry() to DI container

Phase 3: Service Client Interfaces
- Create service client interfaces:
  - pkg/services/auth.go - AuthServiceClient
  - pkg/services/identity.go - IdentityServiceClient
  - pkg/services/authz.go - AuthzServiceClient
  - pkg/services/audit.go - AuditServiceClient
- Create ServiceClientFactory (internal/client/factory.go)
- Create stub gRPC client implementations (internal/client/grpc/)
- Add ProvideServiceClientFactory() to DI container

Phase 4: gRPC Service Definitions
- Create proto files for all core services:
  - api/proto/auth.proto
  - api/proto/identity.proto
  - api/proto/authz.proto
  - api/proto/audit.proto
- Add generate-proto target to Makefile

Phase 5: API Gateway Implementation
- Create API Gateway service entry point (cmd/api-gateway/main.go)
- Create Gateway implementation (services/gateway/gateway.go)
- Add gateway configuration to config/default.yaml
- Gateway registers with Consul and routes requests to backend services

All code compiles successfully. Core services (Auth, Identity, Authz, Audit)
will be implemented in Epic 2 using these foundations.
2025-11-06 09:23:36 +01:00