# Changelog

Alle bedeutenden Änderungen am Gateway Abstraction Layer (GAL) Projekt werden in dieser Datei dokumentiert.

Das Format basiert auf [Keep a Changelog](https://keepachangelog.com/de/1.0.0/),
und dieses Projekt folgt [Semantic Versioning](https://semver.org/lang/de/).

## [Unreleased]

## [1.2.0] - 2025-10-18

### Hinzugefügt

#### Neue Gateway Provider

- **Nginx Provider (Open Source)**
  - Vollständige nginx.conf Generierung
  - Alle Load Balancing Algorithmen: Round Robin, Least Connections, IP Hash, Weighted
  - Rate Limiting (limit_req_zone, limit_req)
  - Basic Authentication (auth_basic, htpasswd)
  - Request/Response Header Manipulation
  - CORS Policies (add_header directives)
  - Passive Health Checks (max_fails, fail_timeout)
  - Template-Variablen ({{uuid}} → $request_id, {{now}} → $time_iso8601)
  - OpenResty Integration für JWT und API Key Auth
  - Provider: `gal/providers/nginx.py` (223 Zeilen, 99% Coverage)
  - Tests: 25 Tests (test_nginx.py)
  - Dokumentation: [docs/guides/NGINX.md](docs/guides/NGINX.md) (1000+ Zeilen, Deutsch)
  - Beispiele: [examples/nginx-example.yaml](examples/nginx-example.yaml) (15 Szenarien)

- **HAProxy Provider**
  - Vollständige haproxy.cfg Generierung
  - Advanced Load Balancing: roundrobin, leastconn, source, weighted
  - Active & Passive Health Checks (httpchk, fall/rise)
  - Rate Limiting (stick-table basiert, IP/Header tracking)
  - ACLs (Access Control Lists) für komplexes Routing
  - Sticky Sessions (cookie-based, source-based)
  - Header Manipulation (http-request/http-response)
  - CORS (Access-Control-* Headers)
  - Provider: `gal/providers/haproxy.py` (187 Zeilen, 86% Coverage)
  - Tests: 10 Tests (test_haproxy.py)
  - Dokumentation: [docs/guides/HAPROXY.md](docs/guides/HAPROXY.md) (1100+ Zeilen, Deutsch)
  - Beispiele: [examples/haproxy-example.yaml](examples/haproxy-example.yaml) (16 Szenarien)

#### Erweiterte Features

- **WebSocket Support**
  - Real-time bidirectional communication für alle 6 Provider
  - Konfigurierbare idle_timeout, ping_interval, max_message_size
  - Per-Message Deflate Compression Support
  - Provider-spezifische Implementierungen:
    - Envoy: upgrade_configs + idle_timeout
    - Kong: read_timeout/write_timeout
    - APISIX: enable_websocket flag
    - Traefik: passHostHeader + flushInterval
    - Nginx: proxy_http_version 1.1 + Upgrade headers
    - HAProxy: timeout tunnel
  - Config Model: `WebSocketConfig` in gal/config.py
  - Tests: 20 Tests (test_websocket.py)
  - Dokumentation: [docs/guides/WEBSOCKET.md](docs/guides/WEBSOCKET.md) (1100+ Zeilen, Deutsch)
  - Beispiele: [examples/websocket-example.yaml](examples/websocket-example.yaml) (6 Szenarien)

- **Request/Response Body Transformation**
  - Request Transformations: add_fields, remove_fields, rename_fields
  - Response Transformations: filter_fields, add_fields
  - Template-Variablen: {{uuid}}, {{now}}, {{timestamp}}
  - PII Filtering für Compliance (GDPR, PCI-DSS)
  - Legacy System Integration durch Field Renaming
  - Provider-Implementierungen:
    - Envoy: Lua Filter (100% Support)
    - Kong: request-transformer & response-transformer Plugins (95%)
    - APISIX: Serverless Lua Functions (100%)
    - Traefik: Limitation Warning (0% - nicht unterstützt)
    - Nginx: OpenResty Lua Blocks (100%)
    - HAProxy: Lua Function References (90% - manuelle Setup)
  - Config Models: `BodyTransformationConfig`, `RequestBodyTransformation`, `ResponseBodyTransformation`
  - Tests: 12 Tests (test_body_transformation.py)
  - Dokumentation: [docs/guides/BODY_TRANSFORMATION.md](docs/guides/BODY_TRANSFORMATION.md) (1000+ Zeilen, Deutsch)
  - Beispiele: [examples/body-transformation-example.yaml](examples/body-transformation-example.yaml) (15 Szenarien)

- **Timeout & Retry Policies**
  - Connection, Send, Read, Idle Timeouts
  - Automatic Retries mit Exponential/Linear Backoff
  - Konfigurierbare retry_on Bedingungen (connect_timeout, http_5xx, etc.)
  - Base Interval & Max Interval für Backoff
  - Provider-Implementierungen:
    - Envoy: cluster.connect_timeout, retry_policy
    - Kong: Service-level timeouts (Millisekunden), retries field
    - APISIX: timeout object + proxy-retry plugin
    - Traefik: serversTransport, retry middleware
    - Nginx: proxy_*_timeout, proxy_next_upstream
    - HAProxy: timeout directives, retry-on
  - Config Models: `TimeoutConfig`, `RetryConfig`
  - Tests: 22 Tests (test_timeout_retry.py)
  - Dokumentation: [docs/guides/TIMEOUT_RETRY.md](docs/guides/TIMEOUT_RETRY.md) (1000+ Zeilen, Deutsch)
  - Beispiele: [examples/timeout-retry-example.yaml](examples/timeout-retry-example.yaml) (12 Szenarien)

- **Logging & Observability**
  - Structured Logging (JSON/Text Format)
  - Log Sampling für High-Traffic Scenarios (sample_rate)
  - Custom Fields für Kontext (environment, cluster, version)
  - Header Inclusion für Distributed Tracing (X-Request-ID, X-B3-TraceId)
  - Path Exclusion (Health Checks, Metrics Endpoints)
  - Prometheus Metrics Export
  - OpenTelemetry Integration (Envoy, Traefik)
  - Provider-Implementierungen:
    - Envoy: JSON access logs, sampling, Prometheus + OpenTelemetry stats_sinks
    - Kong: file-log + prometheus Plugins
    - APISIX: file-logger + prometheus Global Plugins
    - Traefik: accessLog + prometheus EntryPoint
    - Nginx: log_format JSON + nginx-prometheus-exporter
    - HAProxy: syslog logging + haproxy_exporter
  - Config Models: `LoggingConfig`, `MetricsConfig`
  - Tests: 19 Tests (test_logging_observability.py)
  - Dokumentation: [docs/guides/LOGGING_OBSERVABILITY.md](docs/guides/LOGGING_OBSERVABILITY.md) (1000+ Zeilen, Deutsch)
  - Beispiele: [examples/logging-observability-example.yaml](examples/logging-observability-example.yaml) (15 Szenarien)

#### Umfassende Provider-Dokumentation

- **Provider-Guides** für alle 6 Gateway Provider:
  - [ENVOY.md](docs/guides/ENVOY.md) (1068 Zeilen) - CNCF cloud-native proxy, Filter-Architektur, xDS API
  - [KONG.md](docs/guides/KONG.md) (750 Zeilen) - Plugin-Ökosystem, Admin API, DB-less mode
  - [APISIX.md](docs/guides/APISIX.md) (730 Zeilen) - Ultra-high performance, etcd integration, Lua scripting
  - [TRAEFIK.md](docs/guides/TRAEFIK.md) (800 Zeilen) - Auto-discovery, Let's Encrypt, Cloud-native
  - [NGINX.md](docs/guides/NGINX.md) (1000+ Zeilen) - Open Source, ngx_http modules, OpenResty
  - [HAPROXY.md](docs/guides/HAPROXY.md) (1100+ Zeilen) - Advanced Load Balancing, ACLs, High performance
  - Jeder Guide enthält: Feature-Matrix, Installation, Konfiguration, Best Practices, Troubleshooting

### Geändert

- **Test Suite Expansion**
  - Test Count erhöht: 291 Tests → 364 Tests (+73 Tests)
  - Neue Testdateien:
    - test_nginx.py (25 Tests)
    - test_haproxy.py (10 Tests)
    - test_websocket.py (20 Tests)
    - test_body_transformation.py (12 Tests)
    - test_timeout_retry.py (22 Tests)
    - test_logging_observability.py (19 Tests)
  - Code Coverage: 89% maintained

- **CLI Integration**
  - Nginx Provider in allen Befehlen registriert
  - HAProxy Provider in allen Befehlen registriert
  - Extensions Map erweitert: nginx → .conf, haproxy → .cfg

- **Config Model Erweiterungen**
  - `WebSocketConfig` Dataclass (enabled, idle_timeout, ping_interval, max_message_size, compression)
  - `BodyTransformationConfig`, `RequestBodyTransformation`, `ResponseBodyTransformation`
  - `TimeoutConfig` (connect, send, read, idle)
  - `RetryConfig` (enabled, attempts, backoff, base_interval, max_interval, retry_on)
  - `LoggingConfig` (enabled, format, level, sample_rate, include_headers, exclude_paths, custom_fields)
  - `MetricsConfig` (enabled, exporter, prometheus_port, opentelemetry_endpoint, custom_labels)
  - `Route` erweitert um websocket, body_transformation, timeout, retry
  - `GlobalConfig` erweitert um logging, metrics

- **README Updates**
  - Provider Count: 4 → 6 (Nginx, HAProxy added)
  - Test Count: 291 → 364 Tests
  - Feature Liste erweitert um WebSocket, Body Transformation, Timeout & Retry, Logging & Observability
  - Provider-Guides Section hinzugefügt

### Verbessert

- **Code Quality**
  - Black Formatting für alle Python-Dateien
  - Isort Import Sorting
  - Flake8 Linting (kritische Fehler behoben)
  - Pre-Push Skill für automatisierte Code Quality Checks

- **Dokumentation**
  - Über 10.000 Zeilen deutschsprachige Dokumentation
  - 12 Feature-Guides (6 Provider + 6 Features)
  - 70+ Production-Ready Beispiel-Szenarien
  - Alle Guides in Deutsch übersetzt

### Statistik

- **6 Gateway Provider** (Envoy, Kong, APISIX, Traefik, Nginx, HAProxy)
- **364 Tests** mit **89% Code Coverage**
- **10.000+ Zeilen Dokumentation**
- **70+ Produktions-Szenarien**
- **12 Umfassende Feature-Guides**

## [1.1.0] - 2025-10-18

### Hinzugefügt

#### Traffic Management Features

- **Rate Limiting & Throttling**
  - Konfigurierbare Requests pro Sekunde und Burst-Limits
  - Mehrere Schlüsseltypen: IP-Adresse, Header, JWT Claim
  - Anpassbare Antwortmeldungen bei Überschreitung des Limits
  - Provider-Unterstützung: Envoy (local_ratelimit), Kong (rate-limiting), APISIX (limit-count), Traefik (RateLimit Middleware)
  - Dokumentation: [docs/guides/RATE_LIMITING.md](docs/guides/RATE_LIMITING.md)
  - 15+ neue Tests, 90% Code Coverage

- **Circuit Breaker Pattern**
  - Automatische Fehlererkennung und Wiederherstellung
  - Konfigurierbare Fehlerschwellwerte und Timeouts
  - Half-Open-State Testing
  - Provider-Unterstützung: APISIX (api-breaker), Traefik (CircuitBreaker), Envoy (Outlier Detection)
  - Kong: Benötigt Third-Party Plugin
  - Dokumentation: [docs/guides/CIRCUIT_BREAKER.md](docs/guides/CIRCUIT_BREAKER.md)
  - 30+ neue Tests

- **Health Checks & Load Balancing**
  - Active Health Checks (periodisches HTTP/TCP Probing)
  - Passive Health Checks (Traffic-basierte Fehlererkennung)
  - Mehrere Backend-Targets mit Gewichtungen
  - Load Balancing Algorithmen: Round Robin, Least Connections, IP Hash, Weighted
  - Sticky Sessions Unterstützung
  - Provider-Unterstützung: Alle 4 Provider (APISIX, Kong, Traefik, Envoy)
  - Dokumentation: [docs/guides/HEALTH_CHECKS.md](docs/guides/HEALTH_CHECKS.md)
  - 50+ neue Tests
  - 15 Beispiel-Szenarien in examples/health-checks-example.yaml

#### Security Features

- **Authentication & Authorization**
  - Basic Authentication (Benutzername/Passwort)
  - API Key Authentication (Header/Query-basiert)
  - JWT Token Validation (JWKS, Issuer/Audience Verifizierung)
  - Claims to Headers Mapping
  - Provider-Unterstützung: Alle 4 Provider mit nativen Plugins
  - Dokumentation: [docs/guides/AUTHENTICATION.md](docs/guides/AUTHENTICATION.md)
  - 33 neue Tests (21 Authentication + 12 Config)
  - 9 Beispiel-Szenarien in examples/authentication-test.yaml

- **Request/Response Header Manipulation**
  - Headers hinzufügen, setzen und entfernen für Requests und Responses
  - Route-Level und Service-Level Konfiguration
  - Template-Variablen-Unterstützung (UUID, Timestamps)
  - Security Headers (X-Frame-Options, CSP, etc.)
  - Provider-Unterstützung: Alle 4 Provider
  - Dokumentation: [docs/guides/HEADERS.md](docs/guides/HEADERS.md)
  - 30 neue Tests (16 Headers + 14 Config)
  - 10 Beispiel-Szenarien in examples/headers-test.yaml

- **CORS Policies**
  - Origin Whitelisting (spezifische Domains oder Wildcard)
  - Granulare HTTP Methoden und Header Kontrolle
  - Credentials Support (Cookies, Auth Headers)
  - Konfigurierbare Preflight Caching (max_age)
  - Provider-Unterstützung: Alle 4 Provider (Kong/APISIX native CORS, Traefik Headers, Envoy CORS Policy)
  - Dokumentation: [docs/guides/CORS.md](docs/guides/CORS.md)
  - 28 CORS Tests + 8 Config Tests
  - 15 Beispiel-Szenarien in examples/cors-example.yaml

#### Distribution & Publishing

- **PyPI Publication**
  - Package veröffentlicht als `gal-gateway` auf PyPI
  - Installation: `pip install gal-gateway`
  - Automatisierte Release-Pipeline über GitHub Actions
  - TestPyPI Unterstützung für Pre-Release Testing
  - Conditional Publishing basierend auf Tag-Format:
    - Pre-Release Tags (alpha/beta/rc) → TestPyPI
    - Stable Tags (vX.Y.Z) → PyPI
  - Package-Validierung mit `twine check`
  - Aktualisierte Keywords: rate-limiting, authentication, cors, circuit-breaker, health-checks, jwt, security
  - Aktualisierte Classifiers: HTTP Servers, Security, AsyncIO
  - Dokumentation: [docs/PYPI_PUBLISHING.md](docs/PYPI_PUBLISHING.md)
  - PyPI Package: https://pypi.org/project/gal-gateway/
  - TestPyPI Package: https://test.pypi.org/project/gal-gateway/

#### Dokumentation

- Umfassende Guides für alle neuen Features:
  - [RATE_LIMITING.md](docs/guides/RATE_LIMITING.md) - 600+ Zeilen
  - [AUTHENTICATION.md](docs/guides/AUTHENTICATION.md) - 923 Zeilen (Deutsch)
  - [HEADERS.md](docs/guides/HEADERS.md) - 700+ Zeilen
  - [CORS.md](docs/guides/CORS.md) - 1000+ Zeilen (Deutsch)
  - [CIRCUIT_BREAKER.md](docs/guides/CIRCUIT_BREAKER.md) - 1000+ Zeilen (Deutsch)
  - [HEALTH_CHECKS.md](docs/guides/HEALTH_CHECKS.md) - 1000+ Zeilen (Deutsch)
  - [PYPI_PUBLISHING.md](docs/PYPI_PUBLISHING.md) - 400+ Zeilen

- Beispiel-Konfigurationen:
  - examples/rate-limiting-example.yaml
  - examples/authentication-test.yaml
  - examples/headers-test.yaml
  - examples/cors-example.yaml (15 Szenarien)
  - examples/circuit-breaker-example.yaml (10+ Szenarien)
  - examples/health-checks-example.yaml (15 Szenarien)

- Aktualisierte README.md:
  - PyPI Installationsanweisungen
  - PyPI Badges (Version, Python-Versionen, Downloads)
  - Links zu PyPI und TestPyPI Packages

#### CI/CD Verbesserungen

- GitHub Actions CI/CD Workflows
  - Automatisierte Tests auf Python 3.10, 3.11, 3.12
  - Docker Image Building und Pushing zu GitHub Container Registry
  - Automatisierte Releases mit Changelog-Generierung
  - PyPI/TestPyPI Publishing bei Tags
- CHANGELOG.md für Tracking von Projekt-Änderungen
- VERSION Datei für Semantic Versioning

#### Claude Code Skills (Development Workflow)

- `documentation` Skill: Verwaltet und aktualisiert GAL Dokumentation
- `release` Skill: Automatisiert den kompletten Release-Prozess
- `actions-monitor` Skill: Überwacht GitHub Actions nach git push

### Geändert

- **Config Model Erweiterungen**
  - `RateLimitConfig` Dataclass hinzugefügt
  - `AuthenticationConfig` mit Basic/API Key/JWT Support hinzugefügt
  - `HeaderManipulation` Dataclass hinzugefügt
  - `CORSPolicy` Dataclass hinzugefügt
  - `CircuitBreakerConfig` Dataclass hinzugefügt
  - `HealthCheckConfig` mit Active/Passive Checks hinzugefügt
  - `LoadBalancerConfig` mit mehreren Algorithmen hinzugefügt
  - `Route` erweitert um alle neuen Features zu unterstützen
  - `Upstream` erweitert um mehrere Targets zu unterstützen

- **Provider Implementierungen**
  - Alle 4 Provider (Envoy, Kong, APISIX, Traefik) aktualisiert um neue Features zu unterstützen
  - Provider-spezifische Dokumentation für jedes Feature

- **Test Coverage**
  - Erhöht von 101 Tests (89% Coverage) auf 400+ Tests
  - Umfassende Test-Abdeckung für alle neuen Features
  - Provider-spezifische Tests für alle Features

### Behoben

- Verschiedene Bugfixes und Verbesserungen über alle Provider hinweg

## [1.0.0] - 2025-01-17

### Added

#### Core Features
- Gateway Abstraction Layer core implementation
- Support for 4 major API gateway providers:
  - Envoy Proxy (static configuration with Lua transformations)
  - Kong API Gateway (declarative DB-less mode)
  - Apache APISIX (JSON configuration with serverless functions)
  - Traefik (dynamic YAML configuration)

#### Configuration System
- YAML-based configuration format
- Service definitions with upstream targets
- Route configuration with path prefixes and HTTP methods
- Global gateway settings (host, port, admin port, timeout)
- Plugin system for gateway extensions

#### Request Transformations
- Default value injection for missing fields
- Computed fields with generators:
  - UUID generation with custom prefixes
  - Timestamp generation
- Request validation with required fields
- Provider-specific transformation implementations:
  - Envoy: Lua filters
  - Kong: request-transformer plugin
  - APISIX: serverless-pre-function with Lua
  - Traefik: middleware plugins (placeholder)

#### CLI Tool
- `generate`: Generate provider-specific configuration
- `generate-all`: Generate configurations for all providers
- `validate`: Validate configuration files
- `info`: Display configuration details
- `list-providers`: List all available providers
- `--log-level` option for controlling verbosity (debug, info, warning, error)

#### Deployment
- Provider deploy methods for all 4 providers:
  - File-based deployment
  - Admin API integration where available
  - Health check and verification
- Docker support with multi-stage builds
- Example configurations for all providers

#### Testing
- Comprehensive test suite with 101 tests:
  - Unit tests for all modules
  - Provider tests
  - CLI tests with Click CliRunner
  - End-to-end workflow tests
  - Deployment tests with mocking
  - Real-world scenario tests
- 89% code coverage
- pytest with pytest-cov

#### Logging
- Structured logging across all modules
- Hierarchical loggers (gal.manager, gal.providers.*, etc.)
- Multiple log levels: DEBUG, INFO, WARNING, ERROR
- CLI integration with --log-level flag
- Detailed operation tracking for debugging

#### Documentation
- Comprehensive README with quick start guide
- Architecture documentation (ARCHITECTURE.md)
- Provider comparison guide (PROVIDERS.md)
- Quick start guide (QUICKSTART.md)
- Transformation guide (TRANSFORMATIONS.md)
- Docker usage guide (DOCKER.md)
- Example configurations for all use cases
- Google-style docstrings for all classes and methods

#### Docker
- Multi-stage Dockerfile for optimized images
- Non-root user execution for security
- Health checks
- Generated config directories
- OCI standard labels for container metadata
- Support for amd64 and arm64 architectures

#### Development Tools
- Requirements management
- Git configuration
- Example configurations
- Docker Compose setup (planned)

### Technical Details

#### Architecture
- Provider interface pattern for extensibility
- Dataclass-based configuration models
- YAML configuration parser
- Manager orchestration layer
- Modular provider implementations

#### Dependencies
- Python 3.10+ support
- click >= 8.1.0 (CLI framework)
- pyyaml >= 6.0 (YAML parsing)
- pytest >= 8.0.0 (testing)
- pytest-cov >= 4.1.0 (coverage)
- requests >= 2.31.0 (HTTP client)

#### Code Quality
- Type hints throughout codebase
- Comprehensive docstrings
- Clean code structure
- Modular design
- Error handling and validation

### Security
- Non-root Docker user
- Input validation
- Secure defaults
- No hardcoded credentials (except APISIX default key with warning)

## [0.1.0] - Initial Development

### Added
- Project initialization
- Basic provider structure
- Configuration models
- Initial documentation

---

## Release Notes

### How to Upgrade

#### From Source
```bash
git pull origin main
pip install -r requirements.txt
```

#### Docker
```bash
docker pull ghcr.io/pt9912/x-gal:latest
```

### Breaking Changes
None in v1.0.0 (initial release)

### Deprecations
None

### Known Issues
- Traefik transformations require custom Go middleware (not included)
- Kong transformations use headers instead of body field injection
- Some provider deploy methods have limited test coverage for error paths

### Future Plans
- PyPI package publication
- Additional gateway providers (HAProxy, Nginx, etc.)
- Advanced transformation features
- Kubernetes deployment support
- Web UI for configuration management
- Configuration validation against provider schemas
- Migration tools between providers
- Performance benchmarking

---

## Versioning

This project follows [Semantic Versioning](https://semver.org/):

- **MAJOR** version for incompatible API changes
- **MINOR** version for new functionality in a backwards compatible manner
- **PATCH** version for backwards compatible bug fixes

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) for contribution guidelines.

## License

This project is licensed under the MIT License - see [LICENSE](LICENSE) file for details.
