Implements the first phase of ADR-0023 selective hot-reloading. Adds
viper.WatchConfig wiring + an OnConfigChange handler that re-unmarshals
the Config struct on file changes and applies the hot-reloadable subset.
Phase 1 reloadable field: logging.level — re-applied via SetupLogging
on every change. The remaining 3 fields listed in ADR-0023
(api.v2_enabled, telemetry sampler type/ratio, auth.jwt.ttl) follow the
same pattern and will land in subsequent phase PRs without further
infrastructure work.
Changes:
- pkg/config/config.go : Config struct gets unexported viper + reloadMu
fields; new WatchAndApply(ctx) method starts the watcher and stops it
on context cancel. Defensive: no-op when no config file is in use.
- pkg/server/server.go Run() : calls WatchAndApply(rootCtx) so the
watcher stops on graceful shutdown.
- pkg/config/config_hot_reload_test.go (new) : 3 unit tests covering
end-to-end reload, no-config-file no-op, nil-viper no-op. Race
detector clean.
- adr/0023-config-hot-reloading.md : Status → Phase 1 Implemented;
remaining fields explicitly Proposed for follow-up phases.
Verifier verdict: APPROVE. Race detector passes. Full BDD suite still
green. The @flaky scenario in features/config/config_hot_reloading.feature
remains @flaky for now — activating it requires reliable cross-process
file-watching behaviour which is sensitive to filesystem semantics on
the CI runner; the unit test exercises the same code path deterministically.
Phase 1 part 2 of ADR-0022 (companion to PR #22 rate-limit). In-memory cache service via go-cache, used by /api/version (60s TTL).
6/6 unit tests pass. ~95% Mistral autonomous via ICM workspace, cost €2.50 stages 01-02 (50% reduction vs T5 thanks to pre-extracted snippets in shared/).
Co-authored-by: Gabriel Radureau <arcodange@gmail.com>
Co-committed-by: Gabriel Radureau <arcodange@gmail.com>
- Add new CLI structure in cmd/cli/
- Implement version, server, and greet commands
- Update build script to compile new CLI binary
- Add Cobra dependency to go.mod
- Update ADR 0015 to reflect implementation status
- Update README and AGENTS.md with CLI usage
- Maintain backward compatibility with existing binaries
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
Implement comprehensive BDD testing framework using Godog:
- Added feature files for greet and health endpoints
- Created test server that runs on port 9191
- Implemented step definitions using Godog's exact patterns
- Fixed undefined step warnings by following Godog conventions
- All tests passing with proper response validation
- Maintained black box testing principles
Key files:
- pkg/bdd/steps/steps.go - Step definitions using StepContext struct
- pkg/bdd/testserver/ - Test server implementation
- features/*.feature - BDD feature files
- pkg/bdd/README.md - Documentation for proper step patterns
The implementation follows Godog's exact pattern suggestions to avoid
undefined step warnings and provides comprehensive API testing.
- Added context-aware server initialization in cmd/server/main.go
- Implemented graceful shutdown handling with SIGINT/SIGTERM signals
- Added 30-second shutdown timeout for active connections
- Updated Greet service to use context.Context as first parameter
- Enhanced Zerolog integration with Trace level logging
- Added context-aware logging in Greet function calls
- Fixed route structure to use /api/v1/greet/* prefix
- Updated all handlers and tests to use context
- Comprehensive AGENTS.md documentation with verified commands
- Added server context management architecture section
- Updated API endpoint documentation with working examples
Changes:
- cmd/server/main.go: Complete rewrite with context and graceful shutdown
- pkg/greet/greet.go: Added context parameter and trace logging
- pkg/greet/api_v1.go: Updated interface and handlers for context
- pkg/greet/greet_test.go: Updated tests to use context
- cmd/greet/main.go: Updated CLI to use context
- pkg/server/server.go: Trace level config and context logging
- AGENTS.md: Comprehensive documentation update
- go.mod/go.sum: Added Zerolog dependency
All tests passing, server working with graceful shutdown verified.
- Add pkg/greet/api_v1.go with ApiV1Greet interface and handler
- Implement Greeter interface for dependency injection
- Return JSON responses with proper Content-Type headers
- Move greet service instantiation to server package
- Separate v1 route registration into registerApiV1Routes function
- Health endpoint at /api level, greet endpoints at /api/v1/greet
- Simplify server entrypoint by removing external dependencies