备份一下
This commit is contained in:
@@ -68,17 +68,17 @@
|
||||
|
||||
### Unit Tests for User Story 1
|
||||
|
||||
- [ ] T018 [P] [US1] Unit test for config loading and validation in pkg/config/loader_test.go
|
||||
- [ ] T019 [P] [US1] Unit test for config hot reload mechanism in pkg/config/watcher_test.go
|
||||
- [ ] T020 [P] [US1] Test invalid config handling (malformed YAML, validation errors) in pkg/config/config_test.go
|
||||
- [X] T018 [P] [US1] Unit test for config loading and validation in pkg/config/loader_test.go
|
||||
- [X] T019 [P] [US1] Unit test for config hot reload mechanism in pkg/config/watcher_test.go
|
||||
- [X] T020 [P] [US1] Test invalid config handling (malformed YAML, validation errors) in pkg/config/config_test.go
|
||||
|
||||
### Implementation for User Story 1
|
||||
|
||||
- [ ] T021 [US1] Implement atomic config pointer swap in pkg/config/config.go (sync/atomic usage)
|
||||
- [ ] T022 [US1] Implement config change callback with validation in pkg/config/watcher.go
|
||||
- [ ] T023 [US1] Add config reload logging with Zap in pkg/config/watcher.go
|
||||
- [ ] T024 [US1] Integrate config watcher with context cancellation in cmd/api/main.go
|
||||
- [ ] T025 [US1] Add graceful shutdown for config watcher in cmd/api/main.go
|
||||
- [X] T021 [US1] Implement atomic config pointer swap in pkg/config/config.go (sync/atomic usage)
|
||||
- [X] T022 [US1] Implement config change callback with validation in pkg/config/watcher.go
|
||||
- [X] T023 [US1] Add config reload logging with Zap in pkg/config/watcher.go
|
||||
- [X] T024 [US1] Integrate config watcher with context cancellation in cmd/api/main.go
|
||||
- [X] T025 [US1] Add graceful shutdown for config watcher in cmd/api/main.go
|
||||
|
||||
**Checkpoint**: Config hot reload should work independently - modify config and see changes applied
|
||||
|
||||
@@ -92,17 +92,17 @@
|
||||
|
||||
### Unit Tests for User Story 2
|
||||
|
||||
- [ ] T026 [P] [US2] Unit test for logger initialization in pkg/logger/logger_test.go
|
||||
- [ ] T027 [P] [US2] Unit test for log rotation configuration in pkg/logger/rotation_test.go
|
||||
- [ ] T028 [P] [US2] Test structured logging with fields in pkg/logger/logger_test.go
|
||||
- [X] T026 [P] [US2] Unit test for logger initialization in pkg/logger/logger_test.go
|
||||
- [X] T027 [P] [US2] Unit test for log rotation configuration in pkg/logger/rotation_test.go
|
||||
- [X] T028 [P] [US2] Test structured logging with fields in pkg/logger/logger_test.go
|
||||
|
||||
### Implementation for User Story 2
|
||||
|
||||
- [ ] T029 [P] [US2] Create appLogger instance with Lumberjack writer in pkg/logger/logger.go
|
||||
- [ ] T030 [P] [US2] Create accessLogger instance with separate Lumberjack writer in pkg/logger/logger.go
|
||||
- [ ] T031 [US2] Configure JSON encoder with RFC3339 timestamps in pkg/logger/logger.go
|
||||
- [ ] T032 [US2] Export GetAppLogger() and GetAccessLogger() functions in pkg/logger/logger.go
|
||||
- [ ] T033 [US2] Add logger.Sync() call in graceful shutdown in cmd/api/main.go
|
||||
- [X] T029 [P] [US2] Create appLogger instance with Lumberjack writer in pkg/logger/logger.go
|
||||
- [X] T030 [P] [US2] Create accessLogger instance with separate Lumberjack writer in pkg/logger/logger.go
|
||||
- [X] T031 [US2] Configure JSON encoder with RFC3339 timestamps in pkg/logger/logger.go
|
||||
- [X] T032 [US2] Export GetAppLogger() and GetAccessLogger() functions in pkg/logger/logger.go
|
||||
- [X] T033 [US2] Add logger.Sync() call in graceful shutdown in cmd/api/main.go
|
||||
|
||||
**Checkpoint**: Both app.log and access.log should exist with JSON entries, rotate at configured size
|
||||
|
||||
@@ -116,18 +116,18 @@
|
||||
|
||||
### Unit Tests for User Story 3
|
||||
|
||||
- [ ] T034 [P] [US3] Unit test for Success() response helper in pkg/response/response_test.go
|
||||
- [ ] T035 [P] [US3] Unit test for Error() response helper in pkg/response/response_test.go
|
||||
- [ ] T036 [P] [US3] Test response serialization with sonic JSON in pkg/response/response_test.go
|
||||
- [X] T034 [P] [US3] Unit test for Success() response helper in pkg/response/response_test.go
|
||||
- [X] T035 [P] [US3] Unit test for Error() response helper in pkg/response/response_test.go
|
||||
- [X] T036 [P] [US3] Test response serialization with sonic JSON in pkg/response/response_test.go
|
||||
|
||||
### Implementation for User Story 3
|
||||
|
||||
- [ ] T037 [P] [US3] Implement Success() helper function in pkg/response/response.go
|
||||
- [ ] T038 [P] [US3] Implement Error() helper function in pkg/response/response.go
|
||||
- [ ] T039 [P] [US3] Implement SuccessWithMessage() helper function in pkg/response/response.go
|
||||
- [ ] T040 [US3] Configure Fiber to use sonic as JSON serializer in cmd/api/main.go
|
||||
- [ ] T041 [US3] Create example health check endpoint using response helpers in internal/handler/health.go
|
||||
- [ ] T042 [US3] Register health check route in cmd/api/main.go
|
||||
- [X] T037 [P] [US3] Implement Success() helper function in pkg/response/response.go
|
||||
- [X] T038 [P] [US3] Implement Error() helper function in pkg/response/response.go
|
||||
- [X] T039 [P] [US3] Implement SuccessWithMessage() helper function in pkg/response/response.go
|
||||
- [X] T040 [US3] Configure Fiber to use sonic as JSON serializer in cmd/api/main.go
|
||||
- [X] T041 [US3] Create example health check endpoint using response helpers in internal/handler/health.go
|
||||
- [X] T042 [US3] Register health check route in cmd/api/main.go
|
||||
|
||||
**Checkpoint**: Health check endpoint returns unified response format with proper structure
|
||||
|
||||
@@ -141,18 +141,18 @@
|
||||
|
||||
### Integration Tests for User Story 4
|
||||
|
||||
- [ ] T043 [P] [US4] Integration test for requestid middleware (UUID v4 generation) in tests/integration/middleware_test.go
|
||||
- [ ] T044 [P] [US4] Integration test for logger middleware (access log entries) in tests/integration/middleware_test.go
|
||||
- [ ] T045 [P] [US4] Test request ID propagation through middleware chain in tests/integration/middleware_test.go
|
||||
- [X] T043 [P] [US4] Integration test for requestid middleware (UUID v4 generation) in tests/integration/middleware_test.go
|
||||
- [X] T044 [P] [US4] Integration test for logger middleware (access log entries) in tests/integration/middleware_test.go
|
||||
- [X] T045 [P] [US4] Test request ID propagation through middleware chain in tests/integration/middleware_test.go
|
||||
|
||||
### Implementation for User Story 4
|
||||
|
||||
- [ ] T046 [P] [US4] Configure Fiber requestid middleware with google/uuid in cmd/api/main.go
|
||||
- [ ] T047 [US4] Implement custom logger middleware writing to accessLogger in internal/middleware/logger.go
|
||||
- [ ] T048 [US4] Add request ID to Fiber Locals in logger middleware in internal/middleware/logger.go
|
||||
- [ ] T049 [US4] Add X-Request-ID response header in logger middleware in internal/middleware/logger.go
|
||||
- [ ] T050 [US4] Log request details (method, path, status, duration, IP, user_agent) to access.log in internal/middleware/logger.go
|
||||
- [ ] T051 [US4] Register requestid and logger middleware in correct order in cmd/api/main.go
|
||||
- [X] T046 [P] [US4] Configure Fiber requestid middleware with google/uuid in cmd/api/main.go
|
||||
- [X] T047 [US4] Implement custom logger middleware writing to accessLogger in internal/middleware/logger.go
|
||||
- [X] T048 [US4] Add request ID to Fiber Locals in logger middleware in internal/middleware/logger.go
|
||||
- [X] T049 [US4] Add X-Request-ID response header in logger middleware in internal/middleware/logger.go
|
||||
- [X] T050 [US4] Log request details (method, path, status, duration, IP, user_agent) to access.log in internal/middleware/logger.go
|
||||
- [X] T051 [US4] Register requestid and logger middleware in correct order in cmd/api/main.go
|
||||
|
||||
**Checkpoint**: Every request should have unique UUID v4 in header and access.log, with full request details
|
||||
|
||||
@@ -166,17 +166,17 @@
|
||||
|
||||
### Integration Tests for User Story 5
|
||||
|
||||
- [ ] T052 [P] [US5] Integration test for panic recovery in tests/integration/middleware_test.go
|
||||
- [ ] T053 [P] [US5] Test panic logging with stack trace in tests/integration/middleware_test.go
|
||||
- [ ] T054 [P] [US5] Test subsequent requests after panic recovery in tests/integration/middleware_test.go
|
||||
- [X] T052 [P] [US5] Integration test for panic recovery in tests/integration/recover_test.go
|
||||
- [X] T053 [P] [US5] Test panic logging with stack trace in tests/integration/recover_test.go
|
||||
- [X] T054 [P] [US5] Test subsequent requests after panic recovery in tests/integration/recover_test.go
|
||||
|
||||
### Implementation for User Story 5
|
||||
|
||||
- [ ] T055 [US5] Implement custom recover middleware with Zap logging in internal/middleware/recover.go
|
||||
- [ ] T056 [US5] Add stack trace capture to recover middleware in internal/middleware/recover.go
|
||||
- [ ] T057 [US5] Add request ID to panic logs in internal/middleware/recover.go
|
||||
- [ ] T058 [US5] Return unified error response (500, code 1000) on panic in internal/middleware/recover.go
|
||||
- [ ] T059 [US5] Register recover middleware as FIRST middleware in cmd/api/main.go
|
||||
- [X] T055 [US5] Implement custom recover middleware with Zap logging in internal/middleware/recover.go
|
||||
- [X] T056 [US5] Add stack trace capture to recover middleware in internal/middleware/recover.go
|
||||
- [X] T057 [US5] Add request ID to panic logs in internal/middleware/recover.go
|
||||
- [X] T058 [US5] Return unified error response (500, code 1000) on panic in internal/middleware/recover.go
|
||||
- [X] T059 [US5] Register recover middleware as FIRST middleware in cmd/api/main.go
|
||||
- [ ] T060 [US5] Create test panic endpoint for testing in internal/handler/test.go (optional, for quickstart validation)
|
||||
|
||||
**Checkpoint**: Panic in handler should be caught, logged with stack trace, return 500, server continues running
|
||||
@@ -205,19 +205,19 @@
|
||||
|
||||
### Implementation for User Story 6
|
||||
|
||||
- [ ] T069 [US6] Create TokenValidator struct with Redis client in pkg/validator/token.go
|
||||
- [ ] T070 [US6] Implement TokenValidator.Validate() with Redis GET operation in pkg/validator/token.go
|
||||
- [ ] T071 [US6] Add context timeout (50ms) for Redis operations in pkg/validator/token.go
|
||||
- [ ] T072 [US6] Implement Redis availability check (Ping) with fail-closed behavior in pkg/validator/token.go
|
||||
- [ ] T073 [US6] Implement custom keyauth middleware wrapper in internal/middleware/auth.go
|
||||
- [ ] T074 [US6] Configure keyauth with header lookup "token" in internal/middleware/auth.go
|
||||
- [ ] T075 [US6] Add validator callback to keyauth config in internal/middleware/auth.go
|
||||
- [ ] T076 [US6] Store user_id in Fiber Locals after successful validation in internal/middleware/auth.go
|
||||
- [ ] T077 [US6] Implement custom ErrorHandler mapping errors to response codes in internal/middleware/auth.go
|
||||
- [ ] T078 [US6] Add auth failure logging with request ID in internal/middleware/auth.go
|
||||
- [ ] T079 [US6] Register keyauth middleware after logger in cmd/api/main.go
|
||||
- [ ] T080 [US6] Create protected example endpoint (/api/v1/users) in internal/handler/user.go
|
||||
- [ ] T081 [US6] Register protected routes with middleware in cmd/api/main.go
|
||||
- [X] T069 [US6] Create TokenValidator struct with Redis client in pkg/validator/token.go
|
||||
- [X] T070 [US6] Implement TokenValidator.Validate() with Redis GET operation in pkg/validator/token.go
|
||||
- [X] T071 [US6] Add context timeout (50ms) for Redis operations in pkg/validator/token.go
|
||||
- [X] T072 [US6] Implement Redis availability check (Ping) with fail-closed behavior in pkg/validator/token.go
|
||||
- [X] T073 [US6] Implement custom keyauth middleware wrapper in internal/middleware/auth.go
|
||||
- [X] T074 [US6] Configure keyauth with header lookup "token" in internal/middleware/auth.go
|
||||
- [X] T075 [US6] Add validator callback to keyauth config in internal/middleware/auth.go
|
||||
- [X] T076 [US6] Store user_id in Fiber Locals after successful validation in internal/middleware/auth.go
|
||||
- [X] T077 [US6] Implement custom ErrorHandler mapping errors to response codes in internal/middleware/auth.go
|
||||
- [X] T078 [US6] Add auth failure logging with request ID in internal/middleware/auth.go
|
||||
- [X] T079 [US6] Register keyauth middleware after logger in cmd/api/main.go
|
||||
- [X] T080 [US6] Create protected example endpoint (/api/v1/users) in internal/handler/user.go
|
||||
- [X] T081 [US6] Register protected routes with middleware in cmd/api/main.go
|
||||
|
||||
**Checkpoint**: Protected endpoints require valid token, reject invalid/missing tokens with correct error codes
|
||||
|
||||
@@ -237,11 +237,11 @@
|
||||
|
||||
### Implementation for User Story 7
|
||||
|
||||
- [ ] T085 [US7] Implement rate limiter middleware wrapper (COMMENTED by default) in internal/middleware/ratelimit.go
|
||||
- [ ] T086 [US7] Configure limiter with IP-based key generator (c.IP()) in internal/middleware/ratelimit.go
|
||||
- [ ] T087 [US7] Configure limiter with config values (Max, Expiration) in internal/middleware/ratelimit.go
|
||||
- [ ] T088 [US7] Add custom LimitReached handler returning unified error response in internal/middleware/ratelimit.go
|
||||
- [ ] T089 [US7] Add commented middleware registration example in cmd/api/main.go
|
||||
- [X] T085 [US7] Implement rate limiter middleware wrapper (COMMENTED by default) in internal/middleware/ratelimit.go
|
||||
- [X] T086 [US7] Configure limiter with IP-based key generator (c.IP()) in internal/middleware/ratelimit.go
|
||||
- [X] T087 [US7] Configure limiter with config values (Max, Expiration) in internal/middleware/ratelimit.go
|
||||
- [X] T088 [US7] Add custom LimitReached handler returning unified error response in internal/middleware/ratelimit.go
|
||||
- [X] T089 [US7] Add commented middleware registration example in cmd/api/main.go
|
||||
- [ ] T090 [US7] Document rate limiter usage in quickstart.md (how to enable, configure)
|
||||
- [ ] T091 [US7] Add rate limiter configuration examples to config files
|
||||
|
||||
|
||||
Reference in New Issue
Block a user