# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.1.9] - 2026-03-04

### Security

Bug Bounty Security Audit Resolution (15 findings, all resolved).

- **Federation Subsystem Hardening** (`federation.rs`):
  - **Critical**: `resolve_entity` no longer falls back to echoing attacker-supplied representations when a mapping is missing or unimplemented; it now returns a proper schema error (BB-01).
  - **High**: Added length (1–128) and charset (`a-zA-Z0-9_`) validation for the `__typename` field used in dispatch to prevent arbitrary symbol lookups (BB-02).
  - **High**: Capped the maximum number of `representations` processed in a single `_entities` query to `1_000` to prevent memory/CPU exhaustion DoS (BB-03).
  - **Medium**: Validated the derived `type_name` extracted from Protobuf descriptors against a strict alphanumeric charset (BB-04).

- **DataLoader Security Improvements** (`dataloader.rs`):
  - **High**: Enforced a `MAX_BATCH_SIZE` of `500` in `load_many` to prevent unbounded memory allocation DoS (BB-05).
  - **Medium**: Fixed a potential timing side-channel in DataLoader caches where the `Binary` variant used raw bytes; it now stores a constant-time `[u8; 32]` BLAKE3 digest (BB-06).
  - **Medium**: Scrubbed internal protobuf topology and entity type names from client-facing error strings to prevent information leakage, moving details to server-side telemetry only (BB-07).

- **Compression and Data Integrity** (`compression.rs`):
  - **Medium**: Mitigated BREACH/CRIME style compression oracles by enforcing a `256`-byte minimum floor for `min_size_bytes` and bumping the `ultra_fast` preset threshold (BB-08).
  - **Low**: Privatised `CompressionStats` fields and introduced safe setter/getter methods to prevent negative or manipulated values appearing on monitoring dashboards (BB-09).

- **Gateway and WASM Hardening** (`gateway.rs`):
  - **Critical**: Replaced a `futures::executor::block_on` call inside the async `build()` environment with a dedicated OS-thread isolation boundary, eliminating severe deadlocks on single-thread/saturated Tokio runtimes (BB-10).
  - **High**: `load_wasm_plugins_from_dir` now verifies that canonicalised symlink paths reside strictly within the target plugin directory, preventing path traversal via planted symlinks (BB-11).
  - **High**: `serve()` explicitly validates and parses the bind address as a `std::net::SocketAddr`, emitting a warning when binding broadly to `0.0.0.0` (BB-12).
  - **Medium**: Loaded WASM plugins are now capped at a strict maximum of `50` to prevent local resource exhaustion (BB-13).
  - **Medium**: Refactored `with_entity_resolver` to stop double-cloning the integration `Arc`, avoiding double-registrations (BB-14).
  - **Low**: The router now emits a visible `tracing::warn!` if it starts up with health checks disabled (BB-15).

### Changed
- **Dependencies**: Added `blake3 = "1"` to support constant-time binary cache keys.

## [1.1.8] - 2026-03-04

### Security

Second-round security audit (8 findings, all resolved). 602/602 tests passing.

- **Deny-by-default for Metrics & Analytics endpoints** (`runtime.rs`): All four handlers (`/metrics`, `/analytics`, `/analytics/api`, `/analytics/reset`) previously served data to unauthenticated callers when `METRICS_API_KEY` / `ANALYTICS_API_KEY` were unset. Handlers now return `403 Forbidden` when the corresponding env-var is absent or empty. Tests updated to assert 403 on no-key and 200 on valid key (constant-time comparison retained).

- **WebSocket subscription registry cap** (`runtime.rs`): A single client could open unlimited live-query subscriptions without completing them, growing the `active_subscriptions` HashMap without bound. Added a `MAX_SUBSCRIPTIONS_PER_CONNECTION = 100` cap; excess subscriptions receive a GraphQL-over-WebSocket `error` message and are rejected.

- **REST body template JSON injection** (`rest_connector.rs`): `build_request()` previously substituted GraphQL argument values verbatim into raw JSON body templates, allowing attacker-controlled strings to inject extra fields (e.g., `"role": "admin"`). Body substitution now uses `serde_json::to_string()`: quoted template placeholders (`"{key}"`) are replaced with the full JSON representation; bare placeholders receive the raw JSON value.

- **WASM alloc null-pointer guard** (`wasm_plugin.rs`): Host functions (`host_get_header`, `host_get_metadata`, `host_get_config`, `call_guest_fn`) called the guest `alloc` export without checking the returned pointer for zero. A null return now produces an immediate early exit rather than writing to the WASM linear-memory null page.

- **mTLS CA private key world-readable in `/tmp`** (`mtls.rs`): `CertificateAuthority::new_ephemeral()` and `issue_svid()` wrote private key files via `std::fs::write`, which creates files with mode `0o644` on Unix. Added `write_secret_file()` helper that uses `OpenOptions::mode(0o600).create_new(true)` on Unix (owner read/write only). Non-Unix platforms retain the existing behaviour. Affects `gbp_eca_key_*`, `gbp_svid_key_*`, and `gbp_svid_cakey_*` temporary files.

- **APQ TTL TOCTOU race** (`persisted_queries.rs`): `PersistedQueryStore::get()` previously acquired a read lock, dropped it, then acquired a write lock to evict an expired entry — a window where a concurrent `put()` could insert a fresh entry for the same hash, which the eviction would then silently delete. When TTL is configured, a single write lock now covers the full check-and-remove operation. The no-TTL fast path retains the cheaper read lock.

- **Unbounded `user_budgets` HashMap** (`query_cost_analyzer.rs`): `check_user_budget()` inserted one entry per unique user ID with no upper bound. An attacker flooding the endpoint with synthetic user IDs could exhaust heap memory. The map is now capped at `MAX_USER_BUDGET_ENTRIES = 50_000`; when the cap is reached for a new user the function performs an inline cleanup of expired budget windows before inserting, and returns an error if still at capacity.

- **Live-query trigger word-boundary matching** (`runtime.rs`): The trigger heuristic previously used `query_string.contains(op_name)`, causing a configured trigger for `getUser` to match inside `getUserById` (false positive) and allowing injection via comments or string literals. Replaced with a byte-level scan that only accepts a match when the surrounding characters are non-alphanumeric and non-underscore.

## [1.1.7] - 2026-03-03

### Security

First-round security audit (14 findings, all resolved). 601/601 tests passing.

- **Request body limit** (`runtime.rs`): Applied `DefaultBodyLimit::max(1 MB)` to the Axum router, preventing oversized payload DoS.

- **CORS wildcard** (`runtime.rs`): Hardcoded `Access-Control-Allow-Origin: *` replaced by a configurable value read from `CORS_ALLOWED_ORIGIN`; defaults to `*` with a startup warning.

- **IP spoofing via `X-Forwarded-For`** (`middleware.rs`): `Context::from_request()` now calls `is_valid_ip()` to validate each hop before trusting the header; malformed entries are discarded.

- **Custom WAF patterns — flat string check** (`waf.rs`): User-supplied custom patterns were tested with a flat `str::contains` rather than the recursive JSON walker. Replaced with `check_custom_recursive` so nested variable values are also scanned.

- **API key timing attack** (`runtime.rs`): Metrics and analytics API key comparisons switched from `==` to `constant_time_eq` to prevent byte-by-byte brute-force via timing side-channels.

- **Custom WAF patterns recompiled per request** (`waf.rs`): `WafMiddleware` now pre-compiles user-supplied regex patterns once in its constructor (`WafMiddleware::new`) instead of re-compiling on every request, preventing ReDoS amplification.

- **O(n) LRU eviction** (`query_cost_analyzer.rs`): `Vec::drain` eviction replaced with `VecDeque::pop_front` for O(1) removal at the tail of the sliding window.

- **Percentile index out-of-bounds** (`query_cost_analyzer.rs`): Index clamped to `len - 1` before slicing the sorted cost history, preventing a panic when the slice length changed between sort and access.

- **Weak XOR encryption** (`middleware.rs`): `Context::encrypt_value` / `decrypt_value` marked `deprecated` and made to return `Error::Internal` with an explanatory message. The XOR implementation is removed; callers must use a proper AEAD cipher.

- **Hardcoded CORS `*`** (`runtime.rs`): See CORS wildcard fix above.

- **Redis `clear()` FLUSHDB** (`cache.rs`): `ResponseCache::clear()` previously issued `FLUSHDB`, wiping all keys in the database including those belonging to other tenants or services. Replaced with a `SCAN` + targeted `DEL` loop scoped to the cache's key prefix.

- **SSTI regex too broad** (`waf.rs`): Server-Side Template Injection patterns were matching legitimate GraphQL variable syntax (e.g., `$variable`). Patterns tightened to require template engine delimiters (`{{`, `{%`, `<%`, `#{`) rather than bare `$`.

- **`SystemTime::elapsed().unwrap()` panic** (`cache.rs`): Clock regression (system clock moved backwards) caused a panic. Replaced with `unwrap_or_default()` returning `Duration::ZERO`.

- **`AuthMiddleware::allow_all` semantics** (`middleware.rs`): `allow_all()` previously required a valid `Authorization` header even though its intent is to make auth optional. Corrected to truly allow unauthenticated requests; added `allow_any_token()` for cases requiring a present-but-unvalidated token.

## [1.1.6] - 2026-02-26

### Fixed
- **macOS CI/CD Flakiness** (`cache.rs`): Fixed intermittent test failures in macOS runners for `cache::tests::test_stale_while_revalidate`. Increased TTL and stale-while-revalidate timeouts locally for this test to account for slower CI execution environments and replaced blocking `std::thread::sleep` with `tokio::time::sleep`.

### Changed
- **Code Formatting**: Applied `cargo fmt` --all across the workspace to ensure consistent styling.

## [1.1.5] - 2026-02-26

### Fixed
- **mTLS Windows CI: Extended-Length Path Prefix** (`mtls.rs`): Fixed all 7 mTLS tests failing on Windows CI runners with `openssl req failed: Could not open file or uri for loading private key from \\gbp_ca_key_*.pem: No such file or directory`.
  - **Root Cause**: `std::fs::canonicalize(std::env::temp_dir())` on Windows GitHub Actions runners returns a path with the `\\?\` extended-length UNC prefix (e.g., `\\?\C:\Users\runneradmin\AppData\Local\Temp`). The OpenSSL CLI does not understand this kernel-level prefix and fails to locate the file, collapsing the directory component entirely.
  - **Fix**: Replaced the two inline `canonicalize` calls in `CertificateAuthority::new_ephemeral()` and `CertificateAuthority::issue_svid()` with a new `resolve_temp_dir()` helper. The helper canonicalizes (to expand 8.3 short-names) and then strips the `\\?\` prefix on Windows via `#[cfg(windows)]`, leaving a plain `C:\...` path that OpenSSL accepts. On Linux/macOS the helper is a zero-cost passthrough.

## [1.1.4] - 2026-02-26

### Fixed
- **mimalloc / ring SIGSEGV on macOS** (`high_performance.rs`): Extended the `#[global_allocator]` cfg guard to also disable `mimalloc` on macOS (`#[cfg(all(not(feature = "quic"), not(target_os = "macos")))]`). The `ring` C/ASM cryptographic primitives — always linked through reqwest's `rustls-tls` backend — segfault under mimalloc's malloc override on macOS x86_64. Previously the guard only protected the `quic` feature path, but the conflict exists on all macOS builds.
- **mTLS PKCS#8 Key Format** (`mtls.rs`): Switched EC key generation from `openssl ecparam -genkey` (SEC 1 / `BEGIN EC PRIVATE KEY`) to `openssl genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256` (PKCS#8 / `BEGIN PRIVATE KEY`). The `rustls` TLS backend used by reqwest cannot parse SEC 1 keys, causing `Identity::from_pem()` failures. Affects both `CertificateAuthority::new_ephemeral()` and `CertificateAuthority::issue_svid()`.

## [1.1.3] - 2026-02-26

### Fixed
- **mTLS Windows CI: OpenSSL Path Handling** (`mtls.rs`): Fixed `test_svid_rotation` (and all certificate operations) failing on Windows CI runners.
  - **Root Cause**: `std::env::temp_dir()` on Windows GitHub Actions runners returns an 8.3 short-name path (e.g., `C:\Users\RUNNER~1\AppData\Local\Temp\`). The code previously replaced backslashes with forward slashes for all OpenSSL arguments, producing paths like `C:/Users/RUNNER~1/...`. OpenSSL's store loader misinterpreted these forward-slash paths containing `~` as URI/store locators rather than file paths, triggering `inner_loader_fetch:unsupported`.
  - **Fix — Native Paths for File Arguments**: Removed `.replace('\\', '/')` from all file path arguments (`-key`, `-in`, `-CA`, `-CAkey`, `-extfile`, `-out`). Windows OpenSSL handles native backslash paths correctly. The `MSYS_NO_PATHCONV=1` env var already prevents MSYS mangling of the `-subj` argument (the only argument that needed protection).
  - **Fix — Canonicalize Temp Dir**: Added `std::fs::canonicalize()` on `std::env::temp_dir()` to resolve Windows 8.3 short names (e.g., `RUNNER~1` → `runneradmin`) before constructing temp file paths.
  - Affects both `CertificateAuthority::new_ephemeral()` and `CertificateAuthority::issue_svid()`.

## [1.1.2] - 2026-02-26

### Added
- **HTTP/3 QUIC Transport** (`--features quic`): Full HTTP/3 server over QUIC/UDP alongside the existing TCP/HTTP2 stack.
  - **`quic` module** (`src/quic.rs`): Complete HTTP/3 implementation using `quinn` (IETF QUIC, RFC 9000) and `h3` (HTTP/3 framing, RFC 9114).
  - **`QuicServer`**: Binds a UDP endpoint on the same port as the TCP listener; handles QUIC connection acceptance, TLS 1.3 handshake, and HTTP/3 stream dispatch.
  - **`QuicConfig`**: Full configuration via `router.yaml` — max concurrent streams, idle timeout, initial MTU, keep-alive interval, connection/stream flow-control windows.
  - **TLS 1.3 Auto-Configuration**: Self-signed ephemeral certificates generated via `rcgen` for development; PEM file loading for production.
  - **`Alt-Svc` Header Injection**: TCP/HTTP responses automatically include `Alt-Svc: h3=":PORT"; ma=86400` so that browsers, gRPC clients, and HTTP libraries discover and upgrade to HTTP/3 on subsequent connections (RFC 7838).
  - **`QuicStatus`**: Runtime status struct for health endpoints and observability dashboards.
  - **Connection Migration**: Enabled by default — mobile clients that switch networks (WiFi → cellular) keep their QUIC connection alive via connection IDs.
  - **Stub Module**: When compiled without `--features quic`, a zero-cost stub provides the same public types (`QuicConfig`, `QuicStatus`, `alt_svc_header_value`) so downstream code compiles unconditionally.
  - **Feature-Gated Dependencies**: `quinn`, `h3`, `h3-quinn`, `rustls`, `rustls-pemfile`, `rcgen`, `http-body-util`, `webpki-roots` are all optional and only pulled in with `--features quic`.

- **`h3_client` Test Binary** (`src/bin/h3_client.rs`): Native Rust HTTP/3 test client using the same `quinn` + `h3` stack as the server.
  - macOS system `curl` (8.7.x) does **not** support HTTP/3 — this client fills that gap for end-to-end QUIC testing.
  - Supports `GET`, `POST`, `--verbose` headers dump, `--repeat N` latency benchmarking, and `--secure` / `--insecure` TLS modes.
  - Self-signed certificate bypass for development (custom `ServerCertVerifier`).
  - Pretty-printed JSON response output and per-request timing.

- **QUIC Test Infrastructure**:
  - **`examples/router-quic-test.yaml`**: Minimal router config with QUIC enabled, WAF/mTLS disabled, zero subgraphs — purpose-built for transport-layer testing.
  - **`scripts/test-quic.sh`**: Comprehensive end-to-end test harness (15 tests) that builds, starts the router, validates TCP (curl) and HTTP/3 (`h3_client`) connectivity, checks `Alt-Svc` headers, verifies security headers, runs latency benchmarks, and inspects router logs.

- **CI/CD Improvements** (`.github/workflows/ci.yml`):
  - **Windows CI**: Added `windows-latest` (MSVC) build-and-test job; compiles lib-only to avoid `mimalloc`/MSVC CRT conflicts.
  - **Clippy**: Added `cargo clippy --all-targets -- -D warnings` to the Linux CI pipeline.
  - **Action Versions**: Pinned `actions/checkout@v4` and `actions/cache@v4` for reproducibility.

### Fixed
- **mimalloc / ring Segfault** (`high_performance.rs`): Gated `#[global_allocator] mimalloc::MiMalloc` behind `#[cfg(not(feature = "quic"))]`. The `mimalloc` `override` feature replaces `malloc`/`free` at the C level, which causes `ring`'s C/ASM cryptographic primitives to segfault on macOS x86_64. When QUIC is compiled in, the system allocator is used instead.
- **rustls CryptoProvider Panic** (`router.rs`, `h3_client.rs`): Added explicit `rustls::crypto::ring::default_provider().install_default()` calls before QUIC/TLS initialization. Without this, `rustls` panics at runtime because it cannot auto-detect the process-level `CryptoProvider` when multiple feature flags are present.
- **mTLS SVID Rotation Race Condition** (`mtls.rs`): Fixed a race condition where concurrent calls to `get_svid()` could trigger multiple simultaneous certificate rotations against the CA.
  - Added a `rotation_lock: Arc<Mutex<()>>` field to `MtlsProvider`.
  - Implemented double-check locking pattern: fast-path read under `RwLock`, then acquire exclusive `Mutex`, re-check freshness (another task may have rotated), then rotate only if still needed.
  - Extracted `rotate_locked()` internal method; public `rotate()` now acquires the lock automatically.
- **GBP Decoder Value Pool Sync** (`gbp.rs`): Fixed a critical bug where columnar-encoded arrays were not pooled in the decoder's `value_pool`, causing subsequent `BackRef` (0x08) tags to resolve to wrong indices.
  - Columnar array results are now pushed into `value_pool` after construction, keeping the decoder's pool in sync with the encoder's `value_counter`.
- **GBP Encoder Shape Homogeneity Check** (`gbp.rs`): Strengthened the `is_homogeneous_array` function to compare object keys positionally (not just count), preventing shape ID mismatches in columnar mode when objects have the same number of keys but different key names.
  - Added explicit `None` handling for non-object array items instead of `unwrap()`.

### Changed
- **Dependencies**: Added `webpki-roots v0.26` (optional, gated behind `quic` feature) for Mozilla CA bundle support in `h3_client --secure` mode.
- **Public API** (`lib.rs`): Exported `quic` module and `QuicConfig`, `QuicStatus`, `alt_svc_header_value` from the crate root.

### Performance

| Feature | TCP/HTTP2 | QUIC/HTTP3 |
|---|---|---|
| Head-of-line blocking | Per-connection | **Eliminated** (per-stream) |
| Connection setup | 1–3 RTT | **0–1 RTT** |
| Multiplexed subscriptions | Yes | **Yes (no HOL blocking)** |
| Mobile network handover | Reconnect | **Seamless (Connection ID)** |
| Loss recovery | TCP SACK | **QUIC ACK ranges** |

HTTP/3 latency benchmark (10 sequential requests, local, self-signed TLS):
- **Average: 3 ms/request** over QUIC/UDP
- **TLS**: 1.3 (RFC 8446)
- **ALPN**: `h3`

### How to Enable

```bash
# Build with QUIC support
cargo build --bin router --features quic

# Run with QUIC-enabled config
cargo run --bin router --features quic -- examples/router-quic-test.yaml

# Test HTTP/3 connectivity
cargo run --bin h3_client --features quic

# Run the full QUIC test suite
./scripts/test-quic.sh
```

Add to `router.yaml`:
```yaml
quic:
  enabled: true
  # cert_path: "/path/to/cert.pem"   # omit for self-signed dev cert
  # key_path:  "/path/to/key.pem"
  max_concurrent_streams: 100
  idle_timeout_secs: 30
```

## [1.1.1] - 2026-02-25

### Fixed
- **GBP Encoder Memory Management**: Fixed an issue where the `GbpEncoder` state (string pools, shape pools, and counters) was not cleared between sequential encodings.
- **GBP Decoder Stability**: Improved error handling and logging when encountering out-of-bounds value references, preventing potential panics and providing clear error messages.

## [1.1.0] - 2026-02-25

### Security
- **Wasmtime Security Update**: Upgraded `wasmtime` dependency to `41.0.4` to address multiple security vulnerabilities:
  - **RUSTSEC-2026-0021**: Panic adding excessive fields to a `wasi:http/types.fields` instance.
  - **RUSTSEC-2026-0020**: Guest-controlled resource exhaustion in WASI implementations.
  - **RUSTSEC-2026-0006**: Wasmtime segfault or unused out-of-sandbox load with `f64.copysign` operator on x86-64.

## [1.0.9] - 2026-02-25

### Changed
- **Dependencies**: Upgraded `wasmtime` dependency from version `29` to `38.0.4`.

## [1.0.8] - 2026-02-25

### Added
- **WASM Plugin Sandboxing**: Expand the plugin ecosystem to support WebAssembly (WASM) modules with strict sandboxing.
  - **`WasmPluginEngine`**: Create and configure a wasmtime-based WASM runtime with fuel metering and Cranelift AOT compilation.
  - **`WasmPlugin`**: Compiled WASM module that implements the native `Plugin` trait (`on_request`, `on_response`, `on_subgraph_request`).
  - **`WasmPluginManager`**: Lifecycle manager for loading, registering, and health-checking multiple WASM plugins.
  - **`WasmPluginConfig`**: Per-plugin configuration with `name`, `path`, `max_memory_bytes`, `max_fuel`, and arbitrary JSON `config`.
  - **`WasmResourceLimits`**: Fine-grained resource limits (memory, fuel, tables, instances) per plugin.
  - **Host ABI**: Six host functions exposed to guest modules:
    - `host_log(level, ptr, len)` — structured logging at trace/debug/info/warn/error levels.
    - `host_get_header(key_ptr, key_len) -> i64` — read request headers.
    - `host_set_header(key_ptr, key_len, val_ptr, val_len)` — set response headers.
    - `host_get_metadata(key_ptr, key_len) -> i64` — read metadata.
    - `host_set_metadata(key_ptr, key_len, val_ptr, val_len)` — set metadata (propagated to gRPC MetadataMap).
    - `host_get_config() -> i64` — retrieve plugin JSON configuration.
  - **Fuel-Based CPU Metering**: Each plugin invocation has a configurable instruction budget (default: 1M fuel). Exceeding it produces a clear `WASM_PLUGIN_ERROR` without crashing the host.
  - **Memory Isolation**: Every invocation creates a fresh `Store` with independent linear memory, bounded by `max_memory_bytes` (default: 16 MB).
  - **Crash Isolation**: A trapping WASM module returns a structured error; the router process continues serving.
  - **GatewayBuilder Integration**:
    - `register_wasm_plugin(config)` — load a single `.wasm` file.
    - `load_wasm_plugins_from_dir(dir, limits)` — auto-discover and load all `.wasm` files in a directory.
  - **Feature-Gated**: Enabled with `--features wasm` to keep the default binary lean. Adds `wasmtime v29` as an optional dependency.
  - **Error Handling**: New `Error::WasmPlugin` variant with distinct `WASM_PLUGIN_ERROR` code and production-safe sanitization.
  - **Configuration Example**: Updated `examples/router.yaml` with full WASM plugin configuration section.

### Fixed
- **mTLS Certificate Generation**: Removed invalid `serialNumber` from OpenSSL X.509 v3 extension section — it is not a valid extension and newer OpenSSL versions reject it. Serial numbers are now set correctly via `-set_serial`.
- **mTLS Test Race Conditions**: Replaced per-PID temp file naming with global atomic counters, eliminating file conflicts when tests run in parallel within the same process.
- **SubgraphConfig Tests**: Added missing `mtls: None` field to all `SubgraphConfig` test instances in `router/mod.rs` and `router/security_tests.rs`.

## [1.0.7] - 2026-02-24

### Added
- **Zero-Trust Mutual TLS (mTLS)**: Implemented full mTLS support for subgraph communication with SPIFFE-compatible identities.
  - **`CertificateAuthority`**: In-process ephemeral CA that generates ECDSA P-256 root certificates via OpenSSL. Supports loading CA from existing PEM files for production.
  - **`Svid`** (SPIFFE Verifiable Identity Document): Short-lived workload certificates with SPIFFE ID URIs (`spiffe://{trust_domain}/ns/{namespace}/sa/{service_name}`).
  - **`MtlsProvider`**: Main provider that manages CA initialization, SVID issuance, automatic rotation at 50% lifetime, and building `reqwest::Client` instances with mTLS identity.
  - **`MtlsConfig`**: Full configuration via `router.yaml` — trust domain, service name, namespace, TTL, CA paths, trust bundle export, hostname verification, fallback to plain HTTP.
  - **Automatic SVID Rotation**: Background task checks every 30 seconds and rotates certificates approaching expiry.
  - **Health Check Integration**: `MtlsStatus` struct for observability (certificate validity, remaining TTL, SPIFFE ID, serial).
  - **Subgraph SVID Issuance**: `issue_subgraph_svid()` and `export_svid()` helpers for development/testing scenarios.
  - **Trust Bundle Export**: CA trust bundle can be exported to a file path for subgraph consumption.
  - **Per-Subgraph mTLS**: `SubgraphConfig` extended with optional `mtls` field for per-subgraph mTLS configuration.

## [1.0.6] - 2026-02-22

### Changed
- **Performance**: Added `release` profile optimizations in `Cargo.toml` (`lto = "fat"`, `codegen-units = 1`, `opt-level = 3`, `panic = "abort"`, `strip = true`) for faster and smaller binaries.
- **Code Quality**: Applied remaining `cargo clippy` suggestions and refactoring.

## [1.0.5] - 2026-02-22

### Security
- **WAF Batched Query Protection**: Added protection against deep recursive GraphQL query aliases (Batched Query attacks/Server DoS) using regex-based detection in the Web Application Firewall.

## [1.0.4] - 2026-02-22

### Fixed
- **Code Quality**: Fixed clippy warnings across 27 source files to improve maintainability and correctness.

## [1.0.3] - 2026-02-20

### Added
- **Configuration**: Enabled environment variable interpolation in `router.yaml`. The router now supports `${ENV_VAR}` and `${ENV_VAR:-default}` syntax for dynamic configuration values.
- **Security**: Updated examples to use the `GATEWAY_SECRET` environment variable for subgraph headers instead of hardcoding secrets in configuration files.

## [1.0.2] - 2026-02-20

### Added
- **GBP Tooling**: Added a new `decode_gbp` binary tool (`src/bin/decode_gbp.rs`) to decode and inspect GraphQL Binary Protocol (GBP) payloads directly from the terminal for debugging compression efficiency.

### Fixed
- **Router Authentication**: Fixed an issue where the router failed to send the required `X-Gateway-Secret` authentication header to subgraphs. The router now correctly includes the header in `examples/router.yaml`, resolving 401 Unauthorized errors and empty data responses.

## [1.0.1] - 2026-02-20

### Added
- **`SO_REUSEPORT` Multi-Listener Server** (`serve_reuseport`): New high-throughput server function that spawns one independent `TcpListener` per worker thread, all bound to the same address with `SO_REUSEPORT`.
  - The kernel load-balances incoming connections across listeners at the socket level, eliminating the single shared `accept()` queue bottleneck present with a traditional single listener.
  - Enables true per-core connection handling — the same technique used by nginx and envoy.
  - Best results when combined with `HighPerfConfig::ultra_fast()` and `mimalloc`.
- **`build_tcp_listener_tuned`**: New public helper that creates a TCP listener pre-configured with performance-oriented socket options:
  - `TCP_NODELAY` — disables Nagle's algorithm for lower per-request latency.
  - `SO_REUSEADDR` — allows clean address reuse after a restart.
  - `SO_REUSEPORT` (Linux ≥ 3.9 / macOS ≥ 10.9) — enables multi-listener load balancing.
  - Backlog of **4096** — handles large connection bursts without dropping incoming SYNs.
- **`mimalloc` Global Allocator**: Activated `mimalloc` as the process-wide global allocator in `high_performance.rs`.
  - Replaces the system allocator with thread-local arenas, eliminating cross-thread allocation lock contention under high concurrency.
  - Provides **10–30% throughput improvement** at production concurrency levels with zero application code changes.
- **`perf_compare` Benchmark Binary** (`src/bin/perf_compare.rs`): New A/B benchmark that simulates the full gateway hot path (`Parse → Cache lookup → Execute → Serialize`) and quantifies the improvement from v1.0.0 to v1.0.1.
  - **Scenario A** — Cache HIT, single thread: SIMD JSON + ShardedCache vs. serde_json + global `RwLock` HashMap.
  - **Scenario B** — Cache HIT, N concurrent workers: tests lock-free scaling under production-like concurrency.
  - **Scenario C** — Cache MISS: full execute + cache write path comparison.
  - **Scenario D** — Medium payload (200 B query bodies with variables and operation names).
  - **Scenario E** — Allocation pressure: mimalloc thread-local arena scaling vs. system allocator contention model.
  - Run with: `cargo run --release --bin perf_compare`

### Changed
- **`socket2` dependency**: Added `socket2 = { version = "0.5", features = ["all"] }` to enable low-level per-socket configuration (`TCP_NODELAY`, `SO_REUSEPORT`, backlog tuning) before binding, which is not possible through `std::net::TcpListener` alone.

### Performance

The following improvements are measurable in a release build on Apple Silicon (results vary by hardware):

| Scenario | v1.0.0 (est.) | v1.0.1 | Speedup |
|---|---|---|---|
| Cache hit — 1 thread | baseline | +SIMD parse + lock-free cache | **~2–3×** |
| Cache hit — N threads | baseline | +mimalloc arenas, no lock contention | **~4–6×** |
| Cache miss — 1 thread | baseline | +ShardedCache write | **~1.5–2×** |
| Alloc pressure — N threads | baseline | mimalloc near-linear scaling | **~N×** |

> `SO_REUSEPORT` benefit is not visible in-process benchmarks; it eliminates the kernel `accept()` lock at real production load (1 000+ simultaneous connections).

## [1.0.0] - 2026-02-19

### Added
- **Plugin System**: Introduced a comprehensive plugin system with hooks for request lifecycle and schema modification.
  - `Plugin` trait with `on_request`, `on_response`, `on_schema_build`, and `on_subgraph_request` hooks.
  - Capability to intercept and modify gRPC requests to subgraphs.
  - Dynamic loading support via feature flags.
  - New `examples/plugin_system.rs` demonstrating usage.
- **Documentation**: Added detailed plugin system documentation in `docs/core/plugins.md` and updated summary.

## [0.9.9] - 2026-02-19

### Changed
- **Dependencies**: Updated `async-graphql` to 7.2 for improved performance and feature support.

## [0.9.8] - 2026-02-19

### Added
- **Windows Support**: Implemented `pin_to_core` for Windows using `windows-sys` crate, enabling thread affinity on Windows platforms.

## [0.9.7] - 2026-02-19

### Fixed
- **MacOS Stability**: Resolved a critical segmentation fault on macOS by disabling the `mimalloc` global allocator on Apple platforms.
- **Thread Pinning**: Reimplemented `pin_to_core` for macOS using native Mach `thread_policy_set` API, enabling high-performance thread affinity on Apple Silicon/Intel.
- **Authentication**: Documented the mandatory `GATEWAY_SECRET` environment variable to prevent 401 Unauthorized errors.

### Documentation
- **Incremental Delivery**: Added comprehensive guide `docs/core/defer.md` and updated summary for `@defer` usage.

## [0.9.6] - 2026-02-05

### Added
- **GraphQL @defer Support**: Implemented core support for incremental delivery via the `@defer` directive.
  - Streaming multipart responses.
  - Gateway query splitting and execution.
  - Integration with `async-stream` for efficient response streaming.

## [0.9.5] - 2026-01-28

### Fixed
- **Thread Pinning**: Initial implementation of `pin_to_core` logic (Linux support).

## [0.9.4] - 2026-01-15

### Fixed
- **Stability**: Resolved issue #67 enhancing system reliability.

## [0.9.3] - 2026-01-10

### Changed
- **Dependencies**: Updated `bytes` to 1.11.1 and `audit` dependencies for security and performance.

## [0.9.2] - 2025-12-27

### Added
- Enhanced WAF with user‑provided custom regex patterns for flexible security rule extensions.
- Updated `WafConfig` to include `custom_patterns` field and default implementation.
- Added `check_custom` helper and integrated custom pattern checks into JSON, header, query, and raw validation functions.
- Updated documentation and examples to demonstrate custom WAF usage.

## [0.9.1] - 2025-12-27

### Added
- OpenAPI security scheme parsing and RestConnector authentication support.
- `with_auth` builder method for OpenAPI parser to configure API key and bearer token credentials.
- Updated documentation and tests for security configuration.

## [0.9.0] - 2025-12-27

### Security
- **Router Hardening**: Massive expansion of security headers and browser protections.
  - **HSTS Enforcement**: Added `Strict-Transport-Security` (31536000 seconds, includeSubDomains) to force HTTPS.
  - **CSP Tightening**: Hardened `Content-Security-Policy` with `object-src 'none'`, `base-uri 'self'`, and `frame-ancestors 'none'`.
  - **Browser Isolation**: Added `Cross-Origin-Opener-Policy`, `Cross-Origin-Embedder-Policy`, and `Cross-Origin-Resource-Policy` headers to mitigate side-channel attacks.
  - **Privacy**: Added `X-DNS-Prefetch-Control: off` and restricted strict `Permissions-Policy`.
  - **Caching**: Enforced `no-store, no-cache` for router responses to prevent sensitive data leakage.

## [0.8.9] - 2025-12-27

### Fixed
- **DDoS Protection Panic**: Fixed a critical bug where configuring `global_rps` or `per_ip_rps` to `0` caused a runtime panic.
  - **Zero Config Safety**: The router now safely handles `0` values by strictly blocking traffic instead of crashing.
  - **Input Clamping**: Internal rate limiters are clamped to a minimum of 1 RPS to prevent initialization errors, while the logic layer enforces the zero-limit block.

## [0.8.8] - 2025-12-27

### Added
- **Graceful Shutdown**: Implemented `SIGTERM` and `SIGINT` (Ctrl+C) handling. The router now waits for active requests to complete before shutting down, preventing dropped connections during rolling updates.
- **Config Validation**: Added `--check` / `validate` CLI command to validate `router.yaml` without starting the server. Essential for CI/CD pipelines.

### Fixed
- **Hot Reloading Deadlock**: Fixed a critical concurrency bug where live query subscriptions held a read lock indefinitely, preventing configuration hot-reloading.

## [0.8.7] - 2025-12-27

### Security
- **Circuit Breaker Pattern**: Integrated a robust Circuit Breaker into the GBP Router to prevent cascading failures.
  - **Fail Fast**: Immediately rejects requests to unhealthy subgraphs when the circuit is "Open", preventing resource exhaustion.
  - **Automatic Recovery**: Periodically allows test requests in "Half-Open" state to check for service recovery without overwhelming the backend.
  - **Configurable**: Fully configurable via `router.yaml` (failure threshold, recovery timeout, half-open limit).
  - **State Management**: Tracks success/failure rates per subgraph with atomic counters.

## [0.8.6] - 2025-12-27

### Security
- **WAF Header Validation**: Implemented comprehensive WAF scanning for HTTP headers.
  - **Attack Detection**: Scans all request headers for SQLi, XSS, NoSQLi, CMDI, Path Traversal, LDAP Injection, and SSTI patterns.
  - **Early Blocking**: Malicious headers are rejected before processing the request body.
  - **Logging**: detailed alerts with header name and matched pattern.
- **Improved Query Validation**: Exposed specific `validate_query_string()` function for direct WAF checks on raw GraphQL queries before parsing.
- **Enhanced Security Headers**: 
  - **Content-Security-Policy (CSP)**: Added strict CSP protecting against XSS while allowing safe GraphiQL usage (`default-src 'self'`).
  - **Permissions-Policy**: Added restrictive policy disabling sensitive browser features (camera, mic, geolocation, payment) by default.

### Added
- **Hot Reloading**: Implemented seamless configuration hot-reloading for the Router.
  - **Zero Downtime**: Changes to `router.yaml` (subgraphs, WAF rules, rate limits) are applied instantly without restarting the process.
  - **Dynamic State Management**: Refactored `AppState` to use `RwLock<Arc<InnerState>>` for atomic state swaps.
  - **File Watcher**: Integrated `notify` crate to monitor configuration file changes.
  - **Safe Updates**: Configuration is validated before applying; invalid changes are rejected, keeping the previous valid state active.

### Optimized
- **Router Locking**: Minimized lock contention during hot-reloads by using high-performance `tokio::sync::RwLock`.

## [0.8.4] - 2025-12-26

### Security
- **Router Security Hardening**: Enhanced WAF protection and configuration safety.
  - **Comprehensive WAF Verification**: Verified strict blocking of SQLi, XSS, and NoSQLi attacks in the live router environment.
  - **Configuration Safety**: Updated `QueryCostConfig` to gracefully handle deprecated or missing configuration fields, preventing startup panics during upgrades.
  - **Test Suite Expansion**: Added specific test cases for SQL Injection, XSS, and NoSQL Injection.

### Fixed
- **Configuration Parsing**: Fixed a panic in `QueryCostConfig` deserialization when optional fields were missing in `router.yaml`.
- **Startup Stability**: Improved error handling during router initialization to provide clear feedback on configuration errors.

## [0.8.3] - 2025-12-26

### Security
- **WAF Massive Expansion**: Significantly expanded the Web Application Firewall rule set to cover over 200+ attack patterns across 7 categories.
  - **New Categories**: Added protection for **Command Injection (CMDI)**, **Path Traversal (LFI/RFI)**, **LDAP Injection**, and **Server-Side Template Injection (SSTI)**.
  - **Enhanced SQLi**: Added checks for Blind SQLi, time-based attacks (`pg_sleep`, `waitfor delay`), file system access (`load_file`, `into outfile`), and execution vectors (`xp_cmdshell`).
  - **Enhanced XSS**: Expanded coverage for event handlers (`onmouseover`, `onerror`), dangerous tags (`object`, `embed`), and obfuscated URI schemes.
  - **Enhanced NoSQLi**: Added support for advanced MongoDB operators (`$where`, `$regex`, `$function`) and JavaScript execution.
  - **Validation**: Added `test_waf_security.sh` comprehensive test suite verifying all 7 attack categories against the running router.

## [0.8.2] - 2025-12-26

### Security
- **Web Application Firewall (WAF)**: Added `WafMiddleware` for detecting and blocking SQL Injection (SQLi) attempts.
  - **Regex Detection**: Implemented robust regex-based detection for common SQLi patterns (e.g., `OR 1=1`, `UNION SELECT`).
  - **Variable Inspection**: Explicitly validates GraphQL variables in `router.rs` and `runtime.rs` to prevent injection via query parameters.
  - **Header Inspection**: Checks request headers for malicious payloads.
  - **Router Integration**: Integrated WAF protection directly into the high-performance binary router.

### Fixed
- **Deprecation Warnings**: Resolved `tower_http::timeout::TimeoutLayer` deprecation by using `TimeoutLayer::with_status_code`.
- **Compilation Errors**: Fixed a duplicate code block issue in `handle_http` that caused compilation failures.
- **Code Cleanup**: Removed unused variables and imports in `router.rs` to clean up build warnings.

## [0.8.1] - 2025-12-26

### Security
- **Transparent Field-Level Encryption**: Implemented a Zero-Trust architecture for sensitive data.
  - **Context Support**: Added `encryption_key` and crypto utilities (`encrypt_value`/`decrypt_value`) to the middleware context.
  - **Subgraph Encryption**: Subgraphs can now encrypt sensitive fields (e.g., PII like emails) using the shared gateway secret.
  - **Router Decryption**: The Router automatically detects and decrypts these fields (`recursive_decrypt`) at the edge, ensuring data is encrypted in transit between services but readable by the authorized client.
  - **Validation Errors**: Added `Validation` variant to standard error types for better error reporting during decryption failures.

## [0.8.0] - 2025-12-26

### Security
- **Service-to-Service Authentication**: Implemented strict authentication for subgraph communication.
  - **Dynamic Secret Injection**: The Router now injects an `X-Gateway-Secret` header into all subgraph requests.
  - **Environment Variable Support**: The secret is loaded securely from the `GATEWAY_SECRET` environment variable, removing hardcoded secrets from configuration files.
  - **Subgraph Verification**: Updated `users`, `products`, and `reviews` subgraphs to verify incoming requests against the expected secret, blocking unauthorized access.
- **Configuration Security**: `SubgraphConfig` now supports a `headers` map for defining custom per-subgraph headers (e.g., auth tokens).

### Changed
- **Router Configuration**: Removed hardcoded secrets from `router.yaml`. Use `GATEWAY_SECRET` env var instead.

## [0.7.9] - 2025-12-26

### Security
- **DDoS Protection**: Implemented a robust cleanup mechanism for stale rate limiters.
  - **Memory Leak Fix**: The `DdosProtection` struct now actively tracks and removes IP rate limiters that haven't been accessed recently (`cleanup_stale_limiters`), preventing potential memory exhaustion attacks.
  - **Background Task**: Added a background task to the router to periodically sweep for stale entries.
  - **TrackedLimiter**: Introduced a wrapper struct to track `last_seen` timestamps for granular lifecycle management.

### Fixed
- **Development Experience**: Reduced mock data size in example subgraphs (20k -> 10 items) to prevent massive payload overhead during local development and testing.

## [0.7.8] - 2025-12-25

### Security
- **Router Security Tests**: added a comprehensive suite of security tests for the GBP Router to ensure resilience against common attack vectors.
  - **Input Fuzzing**: Validated router stability against massive input queries (10MB+).
  - **Deep Nesting**: Verified handling of deeply nested queries (500+ levels) to prevent stack overflow.
  - **Response Validation**: ensured graceful handling of malformed and huge JSON responses from subgraphs.
  - **DDoS Protection**: Verified concurrent flooding protection and per-IP rate limiting.
  - **Slow Loris Isolation**: tested resilience against slow subgraphs to prevent system-wide lockups.

## [0.7.7] - 2025-12-25

### Security
- **Hardened Router Security**: Implemented a suite of security enhancements for the GBP Router.
  - **Security Headers**: Added defensive headers to all responses:
    - `X-Frame-Options: DENY` (Clickjacking protection)
    - `X-Content-Type-Options: nosniff` (MIME sniffing prevention)
    - `X-XSS-Protection: 1; mode=block` (XSS filtering)
    - `Referrer-Policy: strict-origin-when-cross-origin` (Privacy protection)
  - **Robust CORS**: Dynamic CORS configuration via `router.yaml`.
    - Support for strict origin allowlists or wildcard `*`.
    - Configurable methods and headers.
  - **Resource Limits**:
    - **Body Size Limit**: Enforced 2MB maximum request size to prevent DoS.
    - **Timeouts**: Added 30-second global request timeout to prevent resource exhaustion.
  - **Dependencies**: Updated `tower-http` to include `set-header` and `timeout` features.

### Cleanup
- **Code Quality**: Removed dead code warnings in configuration structs.
- **Maintainability**: centralized CORS and middleware configuration in `router.rs`.


## [0.7.6] - 2025-12-25

### Added
- **Bidirectional Binary Protocol (GBP)**: Revolutionary GraphQL Binary Protocol support for both requests AND responses
  - **Binary Request Parsing**: Router now accepts GraphQL queries encoded in GBP format
    - Content-Type detection (`application/x-gbp`, `application/graphql-request+gbp`)
    - Automatic decoding of binary request payloads
    - Seamless fallback to JSON for non-binary requests
  - **Binary Response Encoding**: Enhanced response encoding with content negotiation
    - Accept header negotiation (`application/x-gbp`, `application/graphql-response+gbp`)
    - Automatic binary response when request is binary
    - Error responses also returned in requested format
  - **Truly Bidirectional**: Complete request/response cycle in binary format
    - 48% smaller requests (64 bytes JSON → 33 bytes binary for simple queries)
    - 73-98% smaller responses depending on data characteristics
    - Both directions benefit from GBP compression

### Performance Metrics

#### Request Compression
- Simple query (`{ __typename }`): 64 bytes JSON → 33 bytes binary (**48% reduction**)
- Binary requests significantly reduce upstream bandwidth

#### Response Compression by Data Pattern

**Realistic Production Data** (73-74% compression):
- 50,000 users with unique IDs, emails, random enums: **73.2% reduction** (35.26 MB → 9.45 MB)
- 10,000 users: **74.4% reduction** (6.71 MB → 1.71 MB)
- 1,000 users: **79.3% reduction** (493 KB → 102 KB)

**Mid-Case Repetitive Data** (85-91% compression):
- 50,000 products (e-commerce catalog): **91.3% reduction** (28.98 MB → 2.53 MB, **11.4x smaller**)
- Shared pricing, inventory, ratings data
- Real-world use case: product catalogs, analytics dashboards, event logs

**Extreme Repetitive Data** (97-98% compression):
- 50,000 users with highly repeated values: **98.2% reduction** (30.65 MB → 578 KB, **54x smaller**)
- Cache-like scenarios with minimal variance

### Real-World Impact

#### Bandwidth Savings (at 1M requests/month)
- **Realistic data**: Save 25 TB/month (73% compression)
- **Product catalogs**: Save 26 TB/month (91% compression) 
- **Extreme cases**: Save 29 TB/month (98% compression)

#### Cost Savings (AWS CloudFront pricing @ $0.085/GB)
- Realistic scenarios: **$2,125/month** = **$25,500/year**
- Product catalogs: **$2,200/month** = **$26,400/year**
  
#### Performance Benefits
- **3-54x smaller payloads** = faster transfers
- Mobile users download 73-98% less data
- Network-bound requests complete 3-54x faster
- Reduced CDN egress costs
- Lower cloud infrastructure costs

### Technical Implementation

**Router Changes** (`src/bin/router.rs`):
- Modified `graphql_handler` to accept raw `Bytes` instead of typed JSON
- Content-Type detection for binary vs JSON requests
- `GbpDecoder` integration for binary request parsing
- Accept header negotiation for response format
- Encoder pooling for high-performance response encoding
- Error responses in client-requested format

**Why Different Compression Ratios**:
- **73% (Realistic)**: Unique IDs, emails, API keys, session tokens
  - Each user has unique data like `user-1234@example.com`, `key_abc123`
  - GBP compresses field names, shapes, repeated metadata
- **91% (Mid-Case)**: Product catalogs with shared attributes
  - Numeric IDs, short SKUs, repeated prices, categories, inventory
  - Same nested objects repeated across products
- **98% (Extreme)**: Highly repetitive cache-like data
  - Most fields have identical values across records
  - Rare in production except analytics/cache scenarios

### Examples
- **Binary Protocol Client** (`examples/binary_protocol_client.rs`):
  - Comprehensive compression analysis across 9 scenarios
  - Demonstrates all 4 request/response format combinations
  - Real-world use case examples (users, products, catalogs)
  - Monthly bandwidth savings calculations
  - Performance benchmarks

### API
- Router accepts both JSON and binary requests transparently
- Automatic content negotiation based on headers
- Full backward compatibility with existing JSON clients
- No breaking changes - opt-in via headers

### Use Cases
- **High-traffic APIs**: Massive bandwidth reduction at scale
- **Mobile applications**: Reduced data usage for users
- **E-commerce**: Product catalog transmission
- **Analytics dashboards**: Time-series data with shared structure
- **Real-time feeds**: Event streams with templated messages
- **Microservices**: Inter-service communication bandwidth optimization

### Breaking Changes
- None - fully backward compatible. Binary protocol is opt-in via request headers.

## [0.7.5] - 2025-12-24

### Added
- **Advanced Live Query Features**: Complete implementation of sophisticated live query capabilities
  - **Filtered Live Queries**: Server-side filtering with custom predicates (e.g., `users(status: ONLINE) @live`)
    - Reduces bandwidth by 50-90% by only sending relevant data
    - Supports complex filter expressions and multiple conditions
  - **Field-Level Invalidation**: Granular tracking of which specific fields changed
    - Only re-execute queries when relevant fields are modified
    - Prevents unnecessary updates for unrelated mutations
  - **Batch Invalidation**: Intelligent merging of rapid consecutive updates
    - Configurable batching window (default: 100ms)
    - Reduces update messages by 70-95% during high-frequency changes
    - Prevents client-side UI thrashing
  - **Client Caching Hints**: Smart cache directives based on data volatility patterns
    - `max-age`, `stale-while-revalidate`, and `must-revalidate` headers
    - Automatic analysis of mutation frequency per entity type
    - Optimizes both bandwidth and CPU usage

### Performance
- **Combined Optimization**: Up to **99% bandwidth reduction** in optimal scenarios
  - Filtered queries: 50-90% reduction
  - Field tracking: 30-60% fewer updates
  - Batch invalidation: 70-95% message reduction
  - GBP compression: 90-99% payload reduction
- **Real-world Impact**: For a dashboard with 1000 items updating every second:
  - Without optimization: ~100 MB/min
  - With all features: ~1 MB/min or less

### Features
- **Advanced Example**: New `advanced_features_example.rs` demonstrating all capabilities
- **Visual Guide**: Comprehensive `VISUAL_GUIDE.md` with diagrams and architecture explanations
- **Test Suite**: `test_advanced_features.js` for validating filtered queries and batch invalidation
- **Documentation**: Extended `docs/src/advanced/live-queries.md` with detailed usage patterns

### Enhanced API
- Public exports for advanced live query functions:
  - `filter_live_query_results()` - Apply server-side filtering
  - `extract_filter_predicate()` - Parse filter expressions from queries
  - `batch_invalidation_events()` - Merge multiple invalidation events
- LiveQueryStore enhancements:
  - Per-query filter management
  - Field dependency tracking
  - Batch event queue with configurable window

### Use Cases
- High-frequency dashboards (real-time analytics, trading platforms)
- Collaborative applications (document editing, chat with online status)
- IoT monitoring with thousands of devices
- Gaming leaderboards and live stats
- Social media feeds with personalized filtering

## [0.7.4] - 2025-12-21

### Added
- **Comprehensive Test Suite**: Added nearly 500 unit and integration tests across the entire codebase
  - `src/analytics.rs`: 122 tests covering query tracking, performance metrics, and privacy modes
  - `src/cache.rs`: 497 tests for LRU cache, TTL, invalidation, and Redis backend
  - `src/circuit_breaker.rs`: 166 tests for failure detection, automatic recovery, and half-open states
  - `src/compression.rs`: 156 tests for Brotli, Gzip, Deflate, Zstd, and GBP compression
  - `src/dataloader.rs`: 197 tests for batching, caching, and N+1 query prevention
  - `src/error.rs`: 251 tests for error handling, conversions, and GraphQL error formatting
  - `src/federation.rs`: 144 tests for entity resolution, subgraph coordination
  - `src/gateway.rs`: 435 tests for gateway builder, configuration, and runtime
  - `src/gbp.rs`: 267 tests for encoding/decoding, compression ratios, and data integrity
  - `src/grpc_client.rs`: 77 tests for connection management and retry logic
  - `src/headers.rs`: 328 tests for header propagation, security headers, and CORS
  - `src/health.rs`: 348 tests for health checks, readiness probes, and metrics
  - `src/high_performance.rs`: 226 tests for SIMD JSON parsing, sharded cache, and object pooling
  - `src/live_query.rs`: 215 tests for invalidation, strategies, and WebSocket protocol
  - `src/low_level_compression.rs`: 188 tests for LZ4, RLE, and columnar encoding
  - `src/metrics.rs`: 116 tests for Prometheus metrics and request tracking
  - `src/middleware.rs`: 214 tests for auth, logging, and request filtering
  - `src/openapi.rs`: 66 tests for OpenAPI parsing and REST connector generation
  - `src/persisted_queries.rs`: 139 tests for APQ (Automatic Persisted Queries)
  - `src/query_cost_analyzer.rs`: 98 tests for complexity calculation and depth limits
  - `src/query_whitelist.rs`: 22 tests for query whitelisting and enforcement
  - `src/request_collapsing.rs`: 154 tests for request deduplication
  - `src/rest_connector.rs`: 146 tests for REST API integration
  - `src/router/mod.rs`: 139 tests for federation router and scatter-gather
  - `src/runtime.rs`: 377 tests for HTTP/WebSocket handlers and GraphQL execution
  - `src/schema.rs`: 90 tests for schema generation and descriptor parsing
  - `src/shutdown.rs`: 80 tests for graceful shutdown and signal handling
  - `src/smart_ttl.rs`: 190 tests for dynamic cache TTL and mutation tracking
  - `src/subscription.rs`: 188 tests for GraphQL subscriptions and streaming
  - `src/tracing_otel.rs`: 43 tests for OpenTelemetry integration
  - `src/types.rs`: 363 tests for type conversions and data structures

### Improved
- **Test Coverage**: Achieved comprehensive test coverage across all core modules
- **Code Quality**: Tests validate edge cases, error conditions, and performance characteristics
- **Regression Prevention**: Extensive test suite prevents future breaking changes
- **Documentation**: Tests serve as living documentation for API usage patterns

### Fixed
- **Test Warnings**: Eliminated warnings in test code
- **CI/CD**: Tests designed for reliable CI execution (marked `#[ignore]` for resource-intensive tests)

## [0.7.3] - 2025-12-20

### Fixed
- **Build Warnings**: Eliminated all remaining compiler warnings across the entire codebase
  - Removed all unused imports and variables
  - Marked intentionally unused fields with `#[allow(dead_code)]` annotations
  - Fixed unnecessary mutability warnings
  - **Result**: Zero warnings on `cargo build` 🎉

### Improved
- **Code Quality**: Achieved 100% warning-free compilation
  - Library (`--lib`): 0 warnings
  - Binaries: 0 warnings  
  - Examples: 0 warnings
- **Documentation**: Added comprehensive test documentation in `EXAMPLE_TESTS.md`
- **Testing**: Verified all examples compile and run successfully
  - Federation example: All 3 subgraphs tested with cross-subgraph queries
  - Greeter example: Tested with automated curl script
  - Live query example: Compilation verified

## [0.7.2] - 2025-12-20

### Fixed
- **Cargo Configuration**: Disabled automatic example discovery to prevent duplicate build target warnings
  - Added `autoexamples = false` to `Cargo.toml`
  - Resolved "file found in multiple build targets" warnings for examples

### Improved
- **Binary Code Quality**: Fixed warnings in binaries and examples
  - `src/bin/benchmark.rs`: Removed unused `uuid::Uuid` import
  - `src/bin/router.rs`: Removed unused `governor::{Quota, RateLimiter}` imports, marked unused config fields
  - `src/bin/protoc-gen-graphql-template.rs`: Marked unused `enabled` field  
  - `examples/federation/main.rs`: Made `FederationData` public, marked unused `new` method
  - `examples/live_query/main.rs`: Cleaned up unused imports and marked helper functions

## [0.7.1] - 2025-12-20

### Fixed
- **Library Warnings**: Eliminated all compiler warnings in core library code
  - `src/schema.rs`: Removed unused `GraphqlEntity` import
  - `src/runtime.rs`: Fixed unnecessary `mut` on `sender` variable, prefixed unused `ws_tx_clone`
  - `src/analytics.rs`: Marked unused `config` field with `#[allow(dead_code)]`
  - `src/live_query.rs`: Marked unused `stats` field
  - `src/smart_ttl.rs`: Marked unused `avg_interval` field

### Improved
- **Code Quality**: Core library now compiles with zero warnings
- **Testing Infrastructure**: Created automated test scripts
  - `test_greeter.sh`: Automated testing for greeter example with yaml feature support
  - `test-federation.sh`: Comprehensive federation endpoint testing

### Verified
- **Federation Tests**: All tests passing ✅
  - User subgraph queries working
  - Product subgraph with cross-subgraph references working  
  - Review subgraph with complex federated queries working
  - Entity resolution functioning correctly
  - Health checks and metrics operational

## [0.7.0] - 2025-12-20

### Added
- **GBP Compression for WebSocket Live Queries**: Revolutionary compression support for real-time GraphQL subscriptions
  - **Compression Negotiation**: Opt-in GBP compression via `connection_init` payload
  - **Binary Frame Protocol**: Two-frame system (JSON envelope + GBP binary payload)
  - **Automatic Fallback**: Gracefully falls back to JSON if compression fails
  - **Backward Compatible**: Standard JSON mode still works (wscat compatible)
  
### Performance Metrics
- **Small Payloads (13 users)**: 60.62% reduction (617 bytes → 243 bytes)
- **Medium Payloads (1K users)**: ~90% reduction (estimated)
- **Large Payloads (100K users)**: 97.01% reduction (73.5 MB → 2.2 MB)
- **Massive Payloads (1M users)**: 97.06% reduction (726.99 MB → 21.37 MB)
- **Encoding Speed**: 83.38 MB/s
- **Decoding Speed**: 23.05 MB/s

### Real-World Impact
At 10,000 concurrent connections with 1M user updates every 5 seconds:
- **Bandwidth Saved**: 121.9 PB/month
- **Cost Savings**: $9.75M/month (at $0.08/GB)
- **Infrastructure**: 97% fewer network links needed (4× vs 112× 10 GbE)
- **Mobile Friendly**: 34× less data usage

### Protocol Details
```json
// Client requests compression
{
  "type": "connection_init",
  "payload": { "compression": "gbp-lz4" }
}

// Server acknowledges
{
  "type": "connection_ack",
  "payload": {
    "compression": "gbp-lz4",
    "compressionInfo": {
      "algorithm": "GBP Ultra + LZ4",
      "expectedReduction": "90-99%"
    }
  }
}

// Updates sent as: Frame 1 (JSON envelope) + Frame 2 (Binary GBP)
```

### Fixed
- **Live Query Example**: Changed gRPC server port from 50051 to 50052 to avoid conflicts
- **Server Stability**: Fixed `run_services()` to properly keep gRPC server running

### Technical Implementation
- Multi-layer compression: Semantic (shape pooling) + Structural (value dedup) + Block (LZ4 HC)
- Compression scales better with larger datasets (97.06% at 1M vs 60.62% at 13 users)
- Field name and organization object deduplication provides immediate benefits
- Binary frame format preserves full data integrity while achieving maximum compression

### Breaking Changes
- None - fully backward compatible. Compression is opt-in via connection parameters.

## [0.6.9] - 2025-12-20

### Added
- **Comprehensive GBP Compression Benchmarks**: Added three benchmark tests demonstrating GBP performance across different data patterns.
  - **Best-Case**: `test_gbp_ultra_99_percent_miracle` - 99.0% reduction on highly repetitive GraphQL data (typical use case)
  - **Mid-Case**: `test_gbp_mid_case_compression` - 96.1% reduction on realistic production data with moderate variation
  - **Worst-Case**: `test_gbp_worst_case_compression` - 56.6% reduction even on completely random, maximum-entropy data
  
### Performance Analysis
- **Best-Case (20K users, highly repetitive)**:
  - Original: 27.15 MB → Compressed: 0.28 MB
  - Reduction: 99.0% (97:1 ratio)
  - Represents: Typical GraphQL responses with shared values
  
- **Mid-Case (10K users, realistic variation)**:
  - Original: 4.33 MB → Compressed: 0.17 MB
  - Reduction: 96.1% (25:1 ratio)
  - Characteristics: Limited categorical values, shared organizations, unique IDs
  - Throughput: 24.79 MB/s
  - Represents: Real-world production APIs with mixed repetition
  
- **Worst-Case (10K users, completely random)**:
  - Original: 12.27 MB → Compressed: 5.32 MB
  - Reduction: 56.6% (2.3:1 ratio)
  - Throughput: 11.21 MB/s
  - Represents: Theoretical limit with maximum entropy (rare in practice)

### Key Insights
- Production GraphQL APIs can expect **90-99% compression** with GBP Ultra
- Even pathological random data achieves >50% compression due to structural optimizations
- Mid-case test validates that realistic data patterns compress nearly as well as best-case
- GBP's semantic compression (shape pooling, value deduplication, columnar storage) provides significant advantage over traditional JSON compression

### Developer Dependencies
- Added `rand = "0.8"` to dev-dependencies for generating random test data

## [0.6.8] - 2025-12-20


### Fixed
- **RestConnector Path Validation**: Fixed overly aggressive security validation that was incorrectly rejecting GraphQL queries with newlines in the request body.
  - Modified `build_request()` to only validate arguments that are actually used as path parameters.
  - Router now correctly executes federated queries through subgraphs with GBP compression.
  - Prevents false positives for "path traversal or URL injection" errors.

### Performance
- **99.998% Compression on Federation**: Verified GBP Ultra compression reducing 43.5 MB JSON payload to 776 bytes (56,091:1 ratio) on realistic federated datasets with 20,000 products.

## [0.6.7] - 2025-12-20

### Changed
- Internal version bump for consistency.

## [0.6.6] - 2025-12-20

### Added
- **LZ4 High Compression Mode**: Upgraded GBP encoder to use LZ4 HC (High Compression) with level 12 for maximum compression ratio.
  - Achieves **99%+ compression** on realistic GraphQL datasets.
  - Better compression ratio at the cost of slightly slower encoding (still sub-millisecond).

- **Realistic Subgraph Data Generation**: Updated all federation examples with production-like data patterns.
  - `subgraph-products`: 20k products with nested organization, category, metadata, shipping, and permissions.
  - `subgraph-reviews`: 20k reviews with nested author, moderation, analytics, and content objects.
  - `subgraph-users`: 20k users with nested organization, permissions, profile, and metadata.

### Performance
- **Compression Results** (60k total items across 3 subgraphs):
  - JSON Size: 41.51 MB → GBP Size: 266.26 KB
  - **Size Reduction: 99.37%**
  - Network Speedup: 2x faster
  - Decode Time: 13.76ms

### Fixed
- **Empty Array Edge Case**: Fixed `"Invalid value reference"` error when encoding empty arrays in GBP columnar mode.

## [0.6.5] - 2025-12-19

### Added
- **Live Query Auto-Push Updates** 🚀:
  - Connections now stay open for `@live` queries instead of closing immediately.
  - Server automatically re-executes and pushes updates when invalidation events occur.
  - Global `LiveQueryStore` singleton shared across all WebSocket connections.
  - `global_live_query_store()` function to access the shared store from mutations.

- **Invalidation-Driven Updates**:
  - Mutations trigger `InvalidationEvent` which propagates to active live queries.
  - Matching queries are automatically re-executed and results pushed to clients.
  - No client polling required - updates are server-initiated.

### How It Works

```
Client                    Server                    Database
  │                         │                          │
  │──@live query──────────▶│                          │
  │◀──────────initial data──│                          │
  │         (connection stays open)                    │
  │                         │                          │
  │                         │◀────mutation triggers────│
  │                         │   InvalidationEvent      │
  │                         │                          │
  │◀──────────auto-push─────│ (re-executes query)     │
  │         updated data    │                          │
```

### Example

```rust
// In mutation handler - trigger invalidation
let store = grpc_graphql_gateway::global_live_query_store();
store.invalidate(InvalidationEvent::new("User", "create"));
// All @live queries watching User.create will receive updated data
```

## [0.6.4] - 2025-12-19

### Added
- **Live Query WebSocket Integration**:
  - Dedicated `/graphql/live` WebSocket endpoint for `@live` queries.
  - Full `graphql-transport-ws` protocol support (connection_init, subscribe, next, complete).
  - `@live` directive stripping for async-graphql compatibility.
  - HTTP POST support for `@live` queries at `/graphql` endpoint.

- **Runtime Enhancements**:
  - `handle_live_query_ws()` - Custom WebSocket handler for live queries.
  - `handle_live_socket()` - Processes live query subscriptions.
  - Automatic `@live` directive detection and stripping in `handle_http()`.

- **Example Test Script**: `examples/live_query/test_ws.js` demonstrating:
  - WebSocket connection and protocol handshake.
  - `@live` query execution with real-time data retrieval.
  - Mutation integration showing data changes.

### Usage

```javascript
// Connect to live query endpoint
const ws = new WebSocket('ws://localhost:9000/graphql/live', 'graphql-transport-ws');

// Send @live query
ws.send(JSON.stringify({
  id: 'live-1',
  type: 'subscribe',
  payload: { query: 'query @live { users { id name } }' }
}));
```

## [0.6.3] - 2025-12-19

### Added
- **Live Query Core Module** (`src/live_query.rs`):
  - `LiveQueryStore` for managing active queries and invalidation triggers.
  - `InvalidationEvent` system to notify queries when mutations occur.
  - `ActiveLiveQuery` struct with throttling, TTL, and strategy support.
  - Configurable strategies: `INVALIDATION`, `POLLING`, `HASH_DIFF`.

- **Proto Definitions** (`proto/graphql.proto`):
  - `GraphqlLiveQuery` message for RPC-level live query configuration.
  - `LiveQueryStrategy` enum for invalidation vs polling modes.
  - `graphql.live_query` extension on `MethodOptions`.

- **Public API Functions**:
  - `has_live_directive(query)` - Detects `@live` directive in GraphQL queries.
  - `strip_live_directive(query)` - Strips `@live` for execution compatibility.
  - `create_live_query_store()` - Creates shared store for managing live queries.

- **Example**: `examples/live_query/` with full CRUD implementation.

### Proto Configuration

```protobuf
rpc GetUser(GetUserRequest) returns (User) {
  option (graphql.schema) = { type: QUERY, name: "user" };
  option (graphql.live_query) = {
    enabled: true
    strategy: INVALIDATION
    triggers: ["User.update", "User.delete"]
    throttle_ms: 100
  };
}
```


## [0.6.2] - 2025-12-19

### Added
- **GBP Ultra - Parallel Optimization**:
  - Implemented **Parallel Chunk Encoding** (Tag `0x0C`) using Rayon.
  - Automatically splits massive arrays (>50k items) into chunks encoded in parallel.
  - Achieved **1,749 MB/s** throughput on "Behemoth" (1GB) payloads.
  - Reduced 1GB encoding time from ~2.3s to **585ms** (4x speedup).
  - Scales linearly with available CPU cores.

## [0.6.1] - 2025-12-19

### Added
- **GBP Ultra - RLE Optimization**:
  - Implemented **Run-Length Encoding (RLE)** for columnar arrays (Tag `0x0B`).
  - Detects and compresses repetitive primitive values in O(1) space.
  - Achieved **486 MB/s** throughput and **99.26% compression** on "Behemoth" (100MB+) payloads.
  - Reduced encoding latency for repetitive datasets by >50%.

- **Benchmarks**:
  - Added `test_gbp_ultra_behemoth` for validating performance on 100MB+ payloads.
  - Updated `subgraph-products` example to generate realistic large-scale datasets (10,000+ items).

### Fixed
- **Pooling Synchronization**: Fixed critical "Invalid value reference" error by synchronizing value pooling logic between `GbpEncoder` and `GbpDecoder` (Rust & TypeScript).
- **Frontend Compatibility**: Updated `GbpDecoder.ts` to support RLE decompression and BigInt serialization.
- **Federation Compatibility**: Verified end-to-end compression flow with accurate data reconstruction for federated subgraphs.

### Documentation
- **Performance**: Updated `README.md` with new GBP Ultra + RLE benchmarks showing **99.6%** reduction (100MB -> 400KB) and **486 MB/s** throughput.

## [0.6.0] - 2025-12-19

### Added
- **GBP Fast Block Mode**: Significant performance boost for LZ4-compressed payloads.
  - Replaced frame-based encoding with O(1) **LZ4 Block Mode** with a 4-byte size prefix.
  - Achieved **211 MB/s** throughput on massive (100MB+) payloads.
  - Reduced typical payload encoding latency from ~2.5ms to **<0.3ms** (8x faster).
- **Stable Gzip Transport**: Added native `encode_gzip` using `flate2` for maximum frontend stability.
- **TypeScript Compatibility**: Aligned router compression with JS decoder expectations to prevent data corruption.

### Fixed
- **LZ4 Frame Corruption**: Resolved data integrity issues with `lz4js` by switching to stable block-based and Gzip-based streams.
- **Router Encoding Path**: Fixed `graphql_handler` to correctly serve compressed GBP based on client `Accept` headers.

## [0.5.9] - 2025-12-19

### Added
- **GBP O(1) Optimization**: Dramatic performance overhaul for massive (1GB+) payloads.
  - **Positional References**: Replaced expensive value cloning with O(1) buffer position references.
  - **Shallow Hashing**: Implemented O(1) shallow hashing for structural deduplication, eliminating recursive tree traversal.
  - **Memory Efficiency**: Constant memory overhead per unique structure, preventing quadratic memory growth on large datasets.
  - **Throughput**: Verified **195+ MB/s** on 100MB+ Behemoth payloads with 99.25% compression.

## [0.5.8] - 2025-12-18

### Added
- **GBP LZ4 Compression**: Integrated LZ4 compression directly into the GraphQL Binary Protocol (GBP) pipeline.
  - New `encode_lz4` and `decode_lz4` methods.
  - Combined structural deduplication with fast block compression.
  - Significant reduction in network bandwidth for server-to-server traffic.

## [0.5.7] - 2025-12-18

### Added
- **TypeScript GBP Decoder**: Released official `@protocol-lattice/gbp-decoder` npm library.
  - High-performance, browser-compatible implementation of GraphQL Binary Protocol (GBP) v8.
  - Support for Gzip (`pako`) and LZ4 (`lz4js`) decompression.
  - Native support for structural deduplication, shape pooling, and columnar array reconstruction.
  - Fully typed with TypeScript definitions.

## [0.5.6] - 2025-12-18

### Security
- **Data Integrity**: Enhanced `GbpEncoder` to resolve hash collisions by verifying value equality, ensuring 100% data integrity for large-scale datasets while maintaining "Ultra" compression ratios.

## [0.5.5] - 2025-12-18

### Added
- **Federation Example Expansion**: Added `subgraph-reviews` service and configured `router` to orchestrate 3 subgraphs (Users, Products, Reviews).
- **Benchmark Alignment**: Updated `benchmark` tool to target specific entities in the new federation schema.

### Fixed
- **DoS Protection**: Hardened `read_varint` against infinite loops from malformed GBP payloads.
- **Example Compilation**: Fixed `federation` and `smart_ttl_cache` examples to use modern `axum::serve` and correct file paths.
- **Build Warnings**: Resolved multiple build target conflicts in `Cargo.toml`.

### Changed
- **Default Ports**: Standardized federation example ports: Users (`4002`), Products (`4003`), Reviews (`4004`).

## [0.5.4] - 2025-12-18

### Added
- **Router Performance Overhaul**: Major optimizations for 150K+ RPS throughput.
  - **Sharded Response Cache**: 128-shard lock-free cache for sub-microsecond cache hits
  - **SIMD JSON Parsing**: Integrated `FastJsonParser` for 2-5x faster JSON processing
  - **FuturesUnordered**: True streaming parallelism - responses processed as they arrive
  - **Query Hash Caching**: AHash-based cache keys for O(1) lookups
  - **Atomic Metrics**: Lock-free request and cache hit counters
  - **Zero-Copy Buffers**: `Bytes`-based responses eliminate allocation overhead

- **New Router Methods**:
  - `execute_fail_fast()` - Returns immediately on first subgraph error
  - `with_cache_ttl()` - Custom cache TTL configuration
  - `stats()` - Real-time `RouterStats` with hit rate, request count
  - `clear_cache()` - Manual cache invalidation

### Performance
- Cache hit path: **<1μs** response time
- Uncached queries: **150K+ RPS** per router instance
- Memory efficiency: Pre-allocated hashmaps, buffer pooling

### Changed
- `GbpRouter` now uses `AHashMap` for subgraph client storage (faster lookups)
- Default cache: 128 shards × 10K entries = 1.28M cached queries

## [0.5.3] - 2025-12-18

### Added
- **GBP Federation Router**: New `router` module with a high-performance GraphQL Federation Router.
  - `GbpRouter` - Scatter-gather federation router with GBP Ultra compression for subgraph communication
  - `RouterConfig` - Configure subgraphs, GBP settings, and HTTP/2 connections
  - `SubgraphConfig` - Per-subgraph configuration (URL, timeout, GBP enable)
  - `DdosConfig` - Two-tier DDoS protection configuration with presets
  - `DdosProtection` - Token bucket rate limiting with global and per-IP limits
  - Parallel subgraph execution with latency ≈ slowest subgraph
  - ~99% bandwidth reduction between router and subgraphs

### Performance
- GBP-enabled router reduces inter-service bandwidth by 99%
- Scatter-gather pattern minimizes total federation latency
- HTTP/2 connection pooling for efficient subgraph communication

## [0.5.2] - 2025-12-18

### Added
- **DDoS Protection Presets**: Added `DdosConfig::strict()` and `DdosConfig::relaxed()` for common use cases.
- **Router Binary**: New `cargo run --bin router` for standalone federation router deployment.

### Changed
- Improved token bucket algorithm efficiency in `DdosProtection`.
- Enhanced rate limiter cleanup for stale IP entries.

## [0.5.1] - 2025-12-18

### Added
- **GBP Decoder**: Full `GbpDecoder` implementation for decoding GBP Ultra payloads.
  - `decode()` - Decode raw GBP bytes to JSON
  - `decode_lz4()` - Decode LZ4-compressed GBP payloads
  - Value pool reference resolution
  - Columnar array reconstruction

### Fixed
- Fixed value pool synchronization between encoder and decoder (Post-Order traversal).
- Fixed columnar encoding for arrays with 5+ homogeneous objects.

## [0.5.0] - 2025-12-18

### Added
- **GBP Ultra**: Official release of the **GraphQL Binary Protocol v8** with **<1ms encoding latency** and **99.25% compression ratio**.
  - **Zero-Allocation Hashing**: Replaced expensive string serialization with fast structural hashing (`AHashMap` + custom hashers).
  - **LZ4 Optimization**: Tuned encoding for maximum throughput (176 MB/s).
  - **Memory Efficiency**: Reduced memory usage during high-load encoding by ~40%.
## [0.4.9] - 2025-12-18

### Added
- **High-Performance Optimization Mode**:
  - **SIMD-Accelerated JSON Parsing**: Switched to `simd-json` for 2x-5x faster parsing using AVX2/NEON instructions.
  - **Lock-Free Sharded Cache**: Replaced global cache locks with a sharded implementation (128 shards) to eliminate contention in multi-core environments.
  - **Object Pooling**: Pre-allocated request/response buffers to achieve near-zero allocation in steady-state high-traffic scenarios.
  - **100K+ RPS Support**: Validated architecture capable of exceeding 100,000 requests per second per instance.

- **Cost Reduction & Efficiency Suite**:
  - **Advanced Query Cost Analysis**: Implemented a tree-walking algorithm to calculate query complexity and prevent expensive "depth-bomb" or "wide-fetch" queries.
  - **Smart TTL Management**: Dynamic cache TTL adjustment based on object frequency and mutation patterns, significantly improving cache hit rates for expensive entities.
  - **Webhook & Event System**: Direct integration for cache invalidation and external triggers.

- **GraphQL Binary Protocol (GBP) v8**:
  - **99.25% Compression Reduction**: Verified on 100MB+ "Behemoth" payloads (~107MB reduced to ~804KB).
  - **Proven Reliability**: Full data integrity verification on large-scale datasets.
  - **Structural Deduplication**: Efficient "Shape" templates and Value Pooling to eliminate redundant overhead.
  - **Columnar Storage**: Optimized array encoding for maximal LZ4 block compression.

- **Security Hardening**:
  - **Vulnerability Remediation**: Addressed multiple CVEs in dependencies as part of the 0.4.2 and 0.4.4 security bumps.
  - **Enhanced IP Spoofing Protection**: Hardened `X-Forwarded-For` and `X-Real-IP` handling in the middleware.
  - **Query Whitelist Normalization**: Multi-pass normalization to prevent bypasses via whitespace or comment manipulation.

### Changed
- **Performance Profile Refactor**: `CompressionConfig::ultra_fast()` now defaults to `gbp-lz4` for server-to-server traffic.
- **Dependency Upgrades**: Large-scale update of core dependencies including `tonic`, `axum`, and `prost`.

### Fixed
- Fixed data integrity issue in recursive encoding by using Post-Order synchronization for value pooling.
- Fixed borrow checker contention in GBP decoder implementation.
- Fixed `DataLoader` entity resolution bugs in federated environments.

## [0.4.8] - 2025-12-18

### Added
- Refined **LZ4 + GBP Ultra** algorithm with aggressive structural deduplication.
- Updated `GbpEncoder` to v8 for improved performance on deeply nested responses.

## [0.4.7] - 2025-12-18

### Added
- Initial support for **LZ4 algorithm (#49)** integration.
- Performance benchmarks for LZ4 vs standard Gzip.

## [0.4.6] - 2025-12-18

### Changed
- Updated internal buffer handling for high-throughput mode.
- Maintenance bump for dependency synchronization.

## [0.4.5] - 2025-12-18

### Fixed
- Minor fixes in the `protoc` plugin's template generation.

## [0.4.4] - 2025-12-17

### Security
- **Version Bump**: Critical security fixes for dependency vulnerabilities.
- Hardened internal gRPC client request handling.

## [0.4.3] - 2025-12-17

### Changed
- Improved memory management in the sharded cache implementation.

## [0.4.2] - 2025-12-17

### Security
- **Vulnerability Patch**: Fixed multiple security vulnerabilities identified in CI/CD pipeline.
- Improved error handling in `protoc-gen-graphql-template`.

## [0.4.1] - 2025-12-17

### Fixed
- Fixed edge cases in JSON serialization for large integers.

## [0.4.0] - 2025-12-17

### Added
- **High Performance Runtime**: Initial integration of sharded cache and SIMD optimizations into the main serving loop.
- **Protoc Plugin Enhancement**: Metadata support for `.rs` file generation.

## [0.3.9] - 2025-12-16

### Added
- **Redis Cache Backend Integration**: Support for distributed caching across multiple gateway instances.
- **Smart TTL Foundations**: Initial implementation of dynamic TTL logic.

## [0.3.8] - 2025-12-16

### Added
- **Helm Chart Deployment**: Production-ready Kubernetes deployment via Helm charts.
  - `helm/grpc-graphql-gateway/` - Complete Helm chart with templates for deployment, service, HPA, VPA, and LoadBalancer
  - `deploy-federation.sh` - One-click deployment script for federated architecture (3 subgraphs)
  - `validate-chart.sh` - Chart validation and packaging script
  - Pre-configured values files for autoscaling and federation scenarios
  - Support for AWS, GCP, and generic LoadBalancer configurations

- **Docker Containerization**: Multi-stage Dockerfile for optimized production images.
  - `Dockerfile` - Standard gateway image with minimal footprint
  - `Dockerfile.federation` - Federation-ready image for subgraph deployments
  - `docker-compose.federation.yml` - Complete federation example with 3 subgraphs
  - `build-docker.sh` - Build script with version tagging

- **Kubernetes Autoscaling**: Native Kubernetes autoscaling support.
  - **HPA (Horizontal Pod Autoscaler)**: Scale pods based on CPU/memory utilization (5-50 pods configurable)
  - **VPA (Vertical Pod Autoscaler)**: Resource recommendation and automatic adjustment
  - Multi-AZ distribution for high availability
  - External LoadBalancer with cloud provider annotations

- **Deployment Documentation**: Comprehensive guides for production deployment.
  - `DEPLOYMENT.md` - Quick start guide for Docker and Kubernetes
  - `ARCHITECTURE.md` - System architecture documentation
  - `docs/src/production/helm-deployment.md` - Detailed Helm deployment guide
  - `docs/src/production/autoscaling.md` - Autoscaling configuration guide

### Fixed
- **Rustdoc Intra-Doc Links**: Fixed broken documentation links for `add_descriptor_set_bytes` and `add_descriptor_set_file` methods in `gateway.rs` and `schema.rs`, resolving docs.rs build failures.

### Deployment Quick Start
```bash
# Docker
docker build -t grpc-graphql-gateway:latest .
docker run -p 8080:8080 grpc-graphql-gateway:latest

# Kubernetes (Helm)
helm install my-gateway ./helm/grpc-graphql-gateway \
  --namespace grpc-gateway \
  --create-namespace

# Federation
./helm/deploy-federation.sh
```

## [0.3.7] - 2025-12-16

### Security - Production Hardening

#### Comprehensive Security Headers
- **HSTS (Strict-Transport-Security)**: Added `max-age=31536000; includeSubDomains` header to enforce HTTPS
- **Content-Security-Policy**: Added restrictive CSP (`default-src 'self'`) to prevent XSS attacks
- **X-XSS-Protection**: Added `1; mode=block` for legacy browser protection
- **Referrer-Policy**: Added `strict-origin-when-cross-origin` to limit referrer information leakage
- **Cache-Control**: Added `no-store, no-cache, must-revalidate` to prevent caching of sensitive responses
- **CORS Preflight**: Proper OPTIONS method handling with configurable CORS headers

#### Query Whitelist Enforcement
- **Production Mode**: Changed default to `WhitelistMode::Enforce` (rejects non-whitelisted queries)
- **Introspection Disabled**: Set `allow_introspection: false` for production security
- **Improved Normalization**: Enhanced `normalize_query()` to correctly handle:
  - Comment stripping (`# comment` and `"""..."""`)
  - Whitespace collapsing around punctuation
  - String literal preservation
  - Consistent hash generation for semantically equivalent queries

### Changed
- **Redis Crate Upgrade**: Updated `redis` dependency from `0.24` to `0.27`
  - Replaced deprecated `get_async_connection()` with `get_multiplexed_async_connection()`
  - Removed unused `connection_manager` field from `CacheBackend::Redis`
  - Fixed trait bounds for `Pipeline::query_async()` with explicit type annotation

### Fixed
- Fixed query whitelist normalization to correctly match queries with different formatting
- Fixed T3 security test false positive caused by grepping startup banner text
- Fixed Redis cache pipeline operations for `redis` 0.27 API compatibility

### Added
- 31-test comprehensive security assessment script (`test_security.sh`)
- Transport security tests (HSTS, XSS, CSP, CORS)
- Input validation tests (fuzzing, payload limits, depth limits)
- GraphQL protocol tests (introspection, batching, operations)

### Security Test Results (v0.3.7)
```
[PASS] T1-T3:   Core Headers & Normalization
[PASS] T8:      Introspection Disabled
[PASS] T9-T10:  DoS Protection (Large Payload, Deep Query)
[PASS] T11:     Suggestions Disabled
[PASS] T12:     HSTS Enabled
[PASS] T15-T16: HTTP Methods (TRACE blocked, OPTIONS CORS)
[PASS] T17-T22: Input Validation
[PASS] T23-T30: GraphQL Protocol Security
```

## [0.3.6] - 2025-12-16

### Security
- **DoS Protection**: Completely removed `std::sync::RwLock` in favor of `parking_lot::RwLock` across all modules (`cache`, `analytics`, `persisted_queries`, `circuit_breaker`, `grpc_client`, `query_whitelist`, `request_collapsing`). This prevents lock poisoning which could lead to Denial of Service.
- **IP Spoofing Protection**: Added strict IP address validation in `middleware.rs` to prevent `X-Forwarded-For` and `X-Real-IP` header injection attacks.
- **Query Normalization**: Implemented robust query normalization in `QueryWhitelist` to prevent bypasses via whitespace/comment manipulation.
- **SSRF Protection**: Enhanced validation in `RestConnector` to prevent control character injection in URL construction.
- **Security Headers**: Added `X-Content-Type-Options: nosniff` and `X-Frame-Options: DENY` headers to all responses.
- **Safe Lock Access**: Removed all `.unwrap()` calls on locks, replacing them with safe `parking_lot` API access patterns.

### Fixed
- Fixed compilation error in `runtime.rs` related to Axum router state typing.
- Fixed weak hashing usage in `analytics.rs` (now consistently using SHA-256).

## [0.3.5] - 2025-12-16

### Added
- **Redis Distributed Cache Backend**: New optional Redis backend for response caching, enabling horizontal scaling.
  - `CacheConfig.redis_url` - Configure Redis connection URL for distributed caching
  - `CacheBackend::Redis` - Redis-based cache storage with automatic connection management
  - Redis SET/GET operations for cache entries with TTL expiration
  - Redis SETs for type and entity indexes supporting distributed invalidation
  - Atomic pipeline operations for efficient cache updates
  - Automatic fallback to in-memory cache if Redis connection fails

### Features
- **Dual Backend Support**: Choose between in-memory (single instance) or Redis (distributed) caching
- **Distributed Invalidation**: Type-based and entity-based cache invalidation works across all gateway instances
- **Redis Index Sets**: `type:{TypeName}` and `entity:{EntityKey}` sets for efficient distributed invalidation
- **TTL Synchronization**: Cache entries use Redis `SETEX` with configurable TTL
- **Connection Resilience**: Graceful error handling with fallback behavior

### Configuration
```rust
use grpc_graphql_gateway::CacheConfig;
use std::time::Duration;

// In-memory cache (default)
let config = CacheConfig::default();

// Redis-backed distributed cache
let config = CacheConfig {
    max_size: 10_000,
    default_ttl: Duration::from_secs(60),
    stale_while_revalidate: Some(Duration::from_secs(30)),
    invalidate_on_mutation: true,
    redis_url: Some("redis://localhost:6379".to_string()),
};
```

### Use Cases
- Horizontal scaling with multiple gateway instances sharing cached responses
- Kubernetes deployments where pod instances need shared cache state
- High-availability setups requiring cache consistency across replicas
- Microservices architectures with centralized cache management

### Dependencies
- Added `redis` crate (0.24) with `tokio-comp` and `connection-manager` features

## [0.3.4] - 2025-12-14

### Added
- **OpenAPI to REST Connector**: New `openapi` module for automatically generating REST connectors from OpenAPI/Swagger specifications.
  - `OpenApiParser` - Parse OpenAPI 3.0/3.1 and Swagger 2.0 specs
  - `OpenApiSpec` - Parsed specification structure
  - `Operation`, `Parameter`, `Response` - Operation metadata types
  - Support for JSON and YAML formats (YAML requires `yaml` feature)
  - Automatic endpoint generation from paths and operations
  - Schema resolution for request bodies and response types
  - Operation filtering by tags or custom predicates
  - Base URL override for different environments

### Features
- **From File**: `OpenApiParser::from_file("openapi.yaml")?`
- **From URL**: `OpenApiParser::from_url("https://api.example.com/openapi.json").await?`
- **From String**: `OpenApiParser::from_string(json_str, false)?`
- **Filtering**: `.with_tags(vec!["pets"])` or `.filter_operations(|id, _| id.starts_with("get"))`
- **Prefix**: `.with_prefix("api_")` to namespace all operations

### Example Usage
```rust
use grpc_graphql_gateway::{Gateway, OpenApiParser};

// Parse OpenAPI spec and create REST connector
let connector = OpenApiParser::from_file("petstore.yaml")?
    .with_base_url("https://api.petstore.io/v2")
    .with_tags(vec!["pets".to_string()])
    .build()?;

let gateway = Gateway::builder()
    .add_rest_connector("petstore", connector)
    .build()?;
```

## [0.3.3] - 2025-12-14

### Added
- **Request Collapsing**: New `request_collapsing` module for deduplicating identical gRPC calls.
  - `RequestCollapsingConfig` - Configure coalesce window, max waiters, and cache size
  - `RequestCollapsingRegistry` - Thread-safe registry for tracking in-flight requests
  - `RequestKey` - SHA-256 based key generation for request identification
  - `CollapseResult` - Leader/Follower/Passthrough result for request handling
  - `RequestBroadcaster` - Broadcast results to waiting followers
  - `RequestReceiver` - Wait for leader's result
  - `CollapsingMetrics` - Track collapse ratio and request statistics
  - `with_request_collapsing()` - New `GatewayBuilder` method to enable collapsing

### Performance Benefits
- **Reduced gRPC Calls**: Identical requests share a single backend call
- **Concurrent Deduplication**: In-flight requests are automatically deduplicated
- **Configurable Window**: Tune the coalesce window for your workload

### How It Works
When a GraphQL query contains multiple fields calling the same gRPC method:
```graphql
query {
  user1: getUser(id: "1") { name }
  user2: getUser(id: "2") { name }
  user3: getUser(id: "1") { name }  # Duplicate of user1
}
```
- Without collapsing: 3 gRPC calls
- With collapsing: 2 gRPC calls (user1 and user3 share response)

### Configuration Presets
- `RequestCollapsingConfig::default()` - Balanced settings (50ms window, 100 max waiters)
- `RequestCollapsingConfig::high_throughput()` - Longer window (100ms), more waiters
- `RequestCollapsingConfig::low_latency()` - Shorter window (10ms) for speed
- `RequestCollapsingConfig::disabled()` - Disable collapsing entirely

### Metrics
- `total_requests` - Total requests processed
- `leader_requests` - Requests that executed the gRPC call
- `collapsed_requests` - Requests that waited for a leader
- `collapse_ratio` - Percentage of requests that were collapsed

## [0.3.2] - 2025-12-14

### Added
- **Query Analytics Dashboard**: New `analytics` module for comprehensive query performance insights.
  - `AnalyticsConfig` - Configure tracking limits, privacy settings, and retention period
  - `QueryAnalytics` - Thread-safe analytics engine for collecting query metrics
  - `AnalyticsSnapshot` - Point-in-time view of all analytics data
  - `QueryStats` - Per-query statistics including execution count, latency, and error rate
  - `FieldStats` - Track field-level usage across all queries
  - `ErrorStats` - Error pattern analysis with affected query tracking
  - `enable_analytics()` - New `GatewayBuilder` method to enable analytics
  - `AnalyticsGuard` - RAII guard for automatic query timing

### Dashboard Features
- **Beautiful Dark Theme**: Modern, responsive dashboard with real-time updates
- **Most Used Queries**: Track which queries are executed most frequently
- **Slowest Queries**: Identify performance bottlenecks with latency metrics
- **Error Patterns**: Analyze common errors and their affected queries
- **Field Usage Statistics**: See which fields are requested most often
- **Operation Distribution**: Visualize query/mutation/subscription breakdown
- **Cache Hit Rate**: Monitor response cache effectiveness
- **Uptime Tracking**: Server uptime display

### Endpoints
- `GET /analytics` - Interactive analytics dashboard
- `GET /analytics/api` - JSON API for programmatic access
- `POST /analytics/reset` - Reset all analytics data

### Configuration Options
- `AnalyticsConfig::default()` - Balanced settings for most use cases
- `AnalyticsConfig::production()` - Privacy-focused (no query text), shorter retention
- `AnalyticsConfig::development()` - Verbose tracking for debugging

### Privacy
- Optional query text tracking (disable for production privacy compliance)
- Configurable retention periods for automatic data pruning
- LRU eviction when limits are reached

## [0.3.1] - 2025-12-14

### Fixed
- Minor bug fixes and performance improvements

### Changed
- Updated dependencies

## [0.3.0] - 2025-12-14

### Added
- **REST API Connectors**: New `rest_connector` module for hybrid gRPC/REST GraphQL gateways.
  - `RestConnector` - HTTP client with retry logic, caching, and interceptor support
  - `RestConnectorBuilder` - Builder pattern for connector configuration
  - `RestEndpoint` - Define REST endpoints with path templates, query params, and body templates
  - **Typed Responses** - Define GraphQL schemas for REST endpoints to enable field selection (`RestResponseSchema`)
  - **GraphQL Schema Integration** - REST endpoints automatically exposed as query/mutation fields
  - `HttpMethod` - GET, POST, PUT, PATCH, DELETE support
  - `RestConnectorRegistry` - Manage multiple REST connectors for different services
  - `RetryConfig` - Configurable retry with exponential backoff
  - `BearerAuthInterceptor` / `ApiKeyInterceptor` - Built-in authentication interceptors
  - `ResponseTransformer` trait - Custom response transformation
  - `RequestInterceptor` trait - Custom request modification (auth, headers, logging)
  - JSONPath response extraction (e.g., `$.data.users`)
  - Response caching for GET requests
  - `add_rest_connector()` - New `GatewayBuilder` method

### Features
- **Hybrid Architecture**: Mix gRPC and REST backends in one GraphQL API
- **Path Templates**: URL path parameters with `{variable}` syntax
- **Body Templates**: Request body templating for POST/PUT/PATCH
- **Query Parameters**: Templated query string construction
- **Response Extraction**: JSONPath to extract nested data from responses
- **Retry Logic**: Exponential backoff with configurable retry statuses
- **Authentication**: Bearer token and API key interceptors included
- **Caching**: Optional LRU cache for GET request responses

### Use Cases
- Gradual migration from REST to gRPC
- Integrating third-party REST APIs into GraphQL schema
- Bridging legacy REST services with modern gRPC backends
- Multi-protocol microservices architectures

## [0.2.9] - 2025-12-14

### Added
- **Enhanced Authentication Middleware**: Complete rewrite of the authentication system with production-ready features.
  - `EnhancedAuthMiddleware` - New middleware with JWT support, claims extraction, and context enrichment
  - `AuthConfig` - Configurable authentication with required/optional modes and scheme selection
  - `AuthScheme` - Support for Bearer, Basic, ApiKey, and custom authentication schemes
  - `AuthClaims` - Standardized JWT claims structure with roles, expiration, and custom claims
  - `TokenValidator` - Trait for custom token validation logic
  - Claims extraction with `has_role()` and `has_any_role()` helpers
  - Automatic token expiration checking

- **Enhanced Logging Middleware**: Production-ready structured logging with security features.
  - `EnhancedLoggingMiddleware` - New middleware with configurable log levels and structured output
  - `LoggingConfig` - Configure log level, header logging, sensitive data masking, and slow request detection
  - `LogLevel` - Support for Trace, Debug, Info, Warn, and Error levels
  - Sensitive header masking (authorization, cookies, API keys automatically redacted)
  - Preset configurations: `LoggingConfig::minimal()` and `LoggingConfig::verbose()`
  - Slow request threshold detection

- **Improved Context**: Enhanced request context with observability features.
  - `request_id` - Automatic UUID generation or extraction from `x-request-id` header
  - `client_ip` - Client IP extraction from `x-forwarded-for` or `x-real-ip` headers
  - `request_start` - Request timing for performance monitoring
  - `user_id()` / `user_roles()` - Convenience methods for accessing auth context
  - `elapsed()` - Get request duration
  - `get_typed()` - Type-safe extension data retrieval

- **Middleware Chain**: New `MiddlewareChain` struct for combining multiple middleware.
  - Builder pattern for middleware composition
  - Arc-wrapped middleware support

- **Middleware Trait Improvements**: Added `name()` method for debugging and logging.

### Changed
- **AuthMiddleware** (backwards compatible): Added `new()`, `allow_all()`, and `require_token()` constructors.
- **LoggingMiddleware** (backwards compatible): Now uses request ID in log output.
- **RateLimitMiddleware**: Added `per_minute()` constructor and improved logging.

### Security
- Sensitive headers are automatically masked in logs (`authorization`, `x-api-key`, `cookie`, etc.)
- Token expiration checking prevents use of expired credentials
- Request ID propagation enables full request tracing across services

## [0.2.8] - 2025-12-13

### Added
- **Query Whitelisting (Stored Operations)**: New `query_whitelist` module for production security.
  - `QueryWhitelistConfig` - Configure allowed queries, enforcement mode, and introspection
  - `WhitelistMode` - Enforce, Warn, or Disabled modes for flexible deployment
  - `QueryWhitelist` - Hash-based and ID-based query validation
  - `with_query_whitelist()` - Builder method to enable query whitelisting
  - `from_json_file()` - Load allowed queries from JSON configuration

### Security Features
- **Enforce Mode**: Reject non-whitelisted queries in production (required for PCI-DSS compliance)
- **Warn Mode**: Log warnings but allow all queries (useful for staging environments)
- **Introspection Control**: Optionally allow `__schema` and `__type` queries in whitelisted mode
- **Dual Validation**: Validate queries by SHA-256 hash or custom operation ID
- **Runtime Registration**: Dynamically register new allowed queries at runtime

### Benefits
- Prevents arbitrary/malicious queries in production
- Reduces attack surface (no schema exploration or DoS via complex queries)
- Compatible with APQ (Automatic Persisted Queries) for bandwidth + security
- Works with Apollo Client, Relay, and other GraphQL clients
- Required for many security compliance standards (PCI-DSS, SOC 2)

### Use Cases
- Public-facing GraphQL APIs requiring strict query control
- Compliance with PCI-DSS and other security standards
- Mobile apps with pre-defined query sets
- Pre-production query testing and validation

## [0.2.7] - 2025-12-12

### Added
- **Multi-Descriptor Support (Schema Stitching)**: Combine multiple protobuf descriptor sets from different microservices into a unified GraphQL schema.
  - `add_descriptor_set_bytes()` - Add additional descriptor sets by bytes
  - `add_descriptor_set_file()` - Add additional descriptor sets from files
  - `descriptor_count()` - Get the number of configured descriptor sets
  - Seamless merging of services, types, and extensions from multiple sources

### Features
- **Microservice Architecture Support**: Each team can own their proto files independently
- **Schema Stitching**: Combine multiple services into one unified GraphQL API
- **Modular Development**: Add/remove services independently without rebuilding entire schema
- **Duplicate Handling**: Automatically skips duplicate file descriptors

### Use Cases
- Combine `users.bin`, `products.bin`, `orders.bin` from different teams
- Add new microservices to existing gateway without modifying core configuration
- Build federated architectures with independent service deployments

## [0.2.6] - 2025-12-12

### Added
- **Header Propagation**: New `headers` module for forwarding HTTP headers to gRPC metadata.
  - `HeaderPropagationConfig` - Configure which headers are forwarded to gRPC backends
  - `with_header_propagation()` - Builder method to enable header propagation
  - `apply_metadata_to_request()` - Helper to apply extracted metadata to gRPC requests

### Features
- **Allowlist Approach**: Security-first design - only explicitly configured headers are forwarded
- **Exact Header Matching**: `.propagate("authorization")` for specific headers
- **Prefix Matching**: `.propagate_with_prefix("x-custom-")` for header groups
- **Common Presets**: `HeaderPropagationConfig::common()` includes auth and tracing headers
- **Exclusions**: `.exclude("cookie")` to block specific headers even with `propagate_all_headers()`

### Use Cases
- Forward `Authorization` headers for backend authentication
- Propagate `X-Request-ID`, `traceparent` for distributed tracing
- Pass `X-Tenant-ID` for multi-tenant applications
- Forward `Accept-Language` for localization

## [0.2.5] - 2025-12-12

### Added
- **Response Compression**: New `compression` module for automatic HTTP response compression.
  - `CompressionConfig` - Configure compression level, algorithms, and minimum size threshold
  - `CompressionLevel` - Control compression speed vs ratio trade-off (Fast/Default/Best)
  - `with_compression()` - Builder method to enable response compression
  - `CompressionStats` - Statistics for monitoring compression performance
  - `create_compression_layer()` - Create a tower-http compression layer

### Features
- **Multiple Algorithms**: Support for Brotli (`br`), Gzip, Deflate, and Zstd compression
- **Preset Configurations**: `CompressionConfig::fast()`, `::best()`, `::default()`, `::disabled()`
- **Minimum Size Threshold**: Skip compression for small responses where overhead exceeds savings
- **Content-Based Selection**: Gateway selects best algorithm based on client `Accept-Encoding`

### Performance
- JSON responses typically compress 50-90% with Brotli
- Reduces bandwidth usage significantly for large query responses
- Configurable compression level to balance CPU vs compression ratio

## [0.2.4] - 2025-12-12

### Added
- **Response Caching**: New `cache` module for in-memory GraphQL response caching.
  - `CacheConfig` - Configure max size, TTL, stale-while-revalidate, and mutation invalidation
  - `ResponseCache` - Thread-safe LRU cache with automatic eviction
  - `with_response_cache()` - Builder method to enable response caching
  - `CacheLookupResult` - Hit/Stale/Miss result types for cache lookups
  - `CacheStats` - Runtime cache statistics

### Features
- **LRU Eviction**: Oldest entries removed when cache reaches capacity
- **TTL Expiration**: Cached responses expire after configurable duration
- **Stale-While-Revalidate**: Serve stale content immediately while refreshing in background
- **Mutation Invalidation**: Automatic cache invalidation when mutations are executed
- **Type/Entity Tracking**: Fine-grained invalidation by GraphQL type or entity ID (e.g., `User#123`)
- **Cache Key Generation**: SHA-256 hash of normalized query + variables + operation name

### Performance
- Cache hits return in <1ms vs ~50ms for gRPC backend calls
- Reduces gRPC backend load significantly for read-heavy workloads
- Zero external dependencies - purely in-memory using `HashMap` and `RwLock`

## [0.2.3] - 2025-12-11
### Added
- **Graceful Shutdown Support**: New `shutdown` module for production-ready server lifecycle management.
  - `ShutdownConfig` - Configure timeout, signal handling, and force shutdown delay
  - `ShutdownCoordinator` - Tracks in-flight requests and manages shutdown state
  - `with_graceful_shutdown()` - Builder method to enable graceful shutdown
  - `serve_with_shutdown()` - Serve with custom shutdown signal
  - `os_signal_shutdown()` - Handle SIGTERM/SIGINT signals
  - `RequestGuard` - RAII guard for automatic request lifecycle tracking


## [0.2.2] - 2025-12-11

### Added
- **Multiplex Subscription Support**: New `subscription` module implementing the `graphql-transport-ws` protocol without async-graphql dependency.
  - `MultiplexSubscription` - WebSocket handler supporting multiple concurrent subscriptions per connection
  - `MultiplexSubscriptionBuilder` - Builder pattern for configuring subscription handlers
  - `SubscriptionResolver` trait - Custom subscription resolution with gRPC streaming support
  - `GrpcSubscriptionResolver` - gRPC-backed subscription resolver
  - `SubscriptionConfig` - Configure connection init timeout, keep-alive, and max subscriptions
  - `SubscriptionRegistry` - Manage active subscriptions with cancellation support
  - Protocol support: `ConnectionInit`, `Subscribe`, `Next`, `Error`, `Complete`, `Ping/Pong`

### Features
- Multiple concurrent subscriptions per WebSocket connection
- Subscription lifecycle management with proper cleanup
- Keep-alive ping/pong support
- Connection initialization with configurable timeout
- gRPC server-streaming integration for real-time data
- Graceful shutdown with configurable timeout (default: 30s)
- In-flight request draining before shutdown
- Automatic OS signal handling (SIGTERM, SIGINT, Ctrl+C)


## [0.2.1] - 2025-12-11

### Added
- **Circuit Breaker Pattern**: New `with_circuit_breaker()` method on `GatewayBuilder` for backend resilience.
  - `CircuitBreakerConfig` - Configure failure threshold, recovery timeout, and half-open requests
  - `CircuitBreaker` - Per-service circuit breaker with Closed/Open/HalfOpen states
  - `CircuitBreakerRegistry` - Thread-safe registry for managing per-service breakers
  - `CircuitBreakerError` - Proper error handling with `SERVICE_UNAVAILABLE` code
  - Automatic state transitions and exponential recovery testing

### Reliability
- Circuit breaker prevents cascading failures when backend services are unhealthy
- Fast-fail behavior reduces latency when services are known to be down
- Configurable recovery testing allows gradual service restoration

## [0.2.0] - 2025-12-11

### Added
- **Automatic Persisted Queries (APQ)**: New `with_persisted_queries()` method on `GatewayBuilder` for bandwidth optimization.
  - `PersistedQueryConfig` - Configure cache size and TTL
  - `PersistedQueryStore` - Thread-safe LRU cache with SHA-256 hashing
  - `PersistedQueryError` - Proper error handling with `PERSISTED_QUERY_NOT_FOUND` code
  - Follows Apollo APQ protocol for client compatibility
  - Automatic cache eviction when at capacity

### Performance
- APQ reduces bandwidth by allowing clients to send query hashes instead of full query strings
- LRU eviction prevents unbounded memory growth

## [0.1.9] - 2025-12-11

### Added
- **OpenTelemetry Distributed Tracing**: New `enable_tracing()` method on `GatewayBuilder` and `tracing_otel` module for end-to-end visibility.
  - `GraphQLSpan` - Tracks GraphQL operations with attributes for operation name, type, and query
  - `GrpcSpan` - Tracks gRPC backend calls with service, method, and status code
  - `TracingConfig` - Configuration for service name and sampling ratio
  - `init_tracer()` / `shutdown_tracer()` - Lifecycle management for OpenTelemetry
- **Schema Introspection Controls**: New `disable_introspection()` method on both `GatewayBuilder` and `SchemaBuilder`.
  - Blocks `__schema` and `__type` queries in production for security
  - Enabled by default for development convenience
- **OTLP Export Support**: Optional `otlp` feature flag for OpenTelemetry Protocol export.
- **Tests**: Test coverage for tracing configuration and introspection controls.

### Security
- Schema introspection can now be disabled in production to prevent schema discovery attacks.

## [0.1.8] - 2025-12-11

### Added
- **Health Checks**: New `enable_health_checks()` method on `GatewayBuilder` adds `/health` (liveness) and `/ready` (readiness) endpoints for Kubernetes/container orchestration.
  - `GET /health` - Simple liveness probe, returns 200 if server is running
  - `GET /ready` - Readiness probe, checks gRPC client configuration
- **Prometheus Metrics**: New `enable_metrics()` method adds `/metrics` endpoint exposing Prometheus-compatible metrics:
  - `graphql_requests_total` - Total GraphQL requests by operation type
  - `graphql_request_duration_seconds` - Request latency histogram
  - `graphql_errors_total` - Total GraphQL errors
  - `grpc_backend_requests_total` - Total gRPC backend calls
  - `grpc_backend_duration_seconds` - gRPC backend latency histogram
- **Metrics API**: New `GatewayMetrics`, `RequestTimer`, and `GrpcTimer` types for programmatic metrics recording.
- **Health API**: New `HealthResponse`, `HealthStatus`, and `ComponentHealth` types for health check responses.
- **Tests**: Comprehensive test coverage for health and metrics modules.

## [0.1.7] - 2025-12-11

### Added
- **DoS Protection - Query Depth Limiting**: New `with_query_depth_limit(max_depth)` method on both `GatewayBuilder` and `SchemaBuilder` to prevent deeply nested queries that could overwhelm gRPC backends.
- **DoS Protection - Query Complexity Limiting**: New `with_query_complexity_limit(max_complexity)` method to limit the total "cost" of a query.
- **Error Types**: Added `QueryTooDeep` and `QueryTooComplex` error variants with corresponding error codes.

### Security
- Query depth and complexity limiting for DoS protection.


## [0.1.6] - 2025-12-07
### Added
- **Middlewares**: Added middleware support with `RateLimitMiddleware` for rate limiting (#13).
- **Protoc Generator Scaffolding**: Updated `protoc-gen-graphql-template` to support scaffolding (#11).

### Changed
- **Refactor DataLoader**: Improved dataloader implementation (#12).
- **README**: Updated documentation.

### Fixed
- **protoc-gen-graphql-template**: Fixed template generation issues.

## [0.1.5] - 2025-12-04

### Added
- **Documentation**: Comprehensive Rustdoc documentation across all public APIs and internal modules.

### Changed
- **Refactor**: Major codebase refactoring (#8).
- **README**: Updated documentation.

### Removed
- **FEDERATION.md**: Consolidated federation docs into README.

## [0.1.4] - 2025-12-04

### Added
- **Federation v2**: Full support for `@shareable` directive in proto options and schema generation.

### Fixed
- **GraphQL Federation**: Fixed federation composition issues, added shareable directive support.

## [0.1.3] - 2025-12-03

### Added
- **GraphQL Playground**: Added interactive GraphQL Playground UI (#6).
- **Tests**: Added more comprehensive test coverage (#7).

### Changed
- **Crate Name**: Changed crate name to `grpc_graphql_gateway`.

## [0.1.2] - 2025-12-03

### Added
- **Apollo Federation**: Full Apollo Federation v2 support (#5).
- **N+1 Query Fix**: Built-in DataLoader for batching entity resolution requests.

### Fixed
- **Federation**: Fixed federation entity resolution issues.

## [0.1.1] - 2025-12-03

### Added
- **File Uploads**: Support for GraphQL file uploads via multipart requests (#3).

## [0.1.0] - 2025-12-02

### Added
- Initial release
- Basic gRPC to GraphQL gateway functionality
- Query and Mutation support
- Subscription support via WebSocket
- Middleware system
- Example implementation
- **GraphQL Federation v2 support**
  - Entity definitions via `graphql.entity` proto option
  - Entity key support (single and composite keys)
  - Entity extensions with `@extends` directive
  - Field-level federation directives: `@external`, `@requires`, `@provides`
  - Automatic `_entities` query generation for entity resolution
  - `EntityResolver` trait for custom entity resolution logic
