miroir/notes/bf-4w08.md
jedarden d8d81a12a8 P6.10 Wire §14.8 resource-aware config defaults into Rust + values.yaml
Complete acceptance criteria:
- Each §14.8 key present in crates/miroir-core/src/config/ with documented default
- charts/miroir/values.yaml exposes the same keys with identical defaults
- values.schema.json accepts documented ranges; cross-field validation in _helpers.tpl
- K8s resources block matches §14.8 (500m/2000m CPU, 1Gi/3584Mi mem)
- Unit test: section_14_8_defaults_match compares Config::default() to §14.8 reference
- Drift guard: doc-test at top of MiroirConfig struct validates defaults

All defaults sized for 2 vCPU / 3.75 GB envelope per plan §14.8.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-20 07:35:03 -04:00

64 lines
3 KiB
Markdown

# P6.10 Wire §14.8 resource-aware config defaults - Verification Summary
## Task: bf-4w08
Verified that all §14.8 resource-aware configuration defaults are properly wired into Rust code and Helm chart.
## Acceptance Criteria Status
### 1. Each §14.8 key present in `crates/miroir-core/src/config/` with documented default
-`server`: max_body_bytes: 104857600, max_concurrent_requests: 500, request_timeout_ms: 30000
-`connection_pool_per_node`: max_idle: 32, max_total: 128, idle_timeout_s: 60
-`task_registry`: cache_size: 10000, redis_pool_max: 50
-`idempotency`: max_cached_keys: 1000000, ttl_seconds: 86400
-`session_pinning`: max_sessions: 100000
-`query_coalescing`: max_subscribers: 1000, max_pending_queries: 10000
-`anti_entropy`: max_read_concurrency: 2, fingerprint_batch_size: 1000
-`resharding`: backfill_concurrency: 4, backfill_batch_size: 1000
-`peer_discovery`: service_name: "miroir-headless", refresh_interval_s: 15
-`leader_election`: enabled: true, lease_ttl_s: 10, renew_interval_s: 3
### 2. `charts/miroir/values.yaml` exposes same keys with identical defaults
- ✅ All §14.8 defaults present in values.yaml (lines 69-120)
- ✅ Values match plan §14.8 exactly
### 3. `values.schema.json` accepts documented ranges; rejects nonsense
- ✅ Schema defines all §14.8 properties with appropriate types
- ✅ Cross-field validation for `lease_ttl_s > renew_interval_s` in `_helpers.tpl`
- ✅ JSON Schema rules 0-6 enforce HA requirements (replicas > 1 requires redis, etc.)
### 4. K8s resources block matches §14.8 (500m/2000m CPU, 1Gi/3584Mi mem)
-`values.yaml` resources block (lines 47-53):
- requests: cpu: 500m, memory: 1Gi
- limits: cpu: 2000m, memory: 3584Mi
- ✅ Deployment template uses these via `{{ .Values.miroir.resources }}`
### 5. Unit test: drift guard comparing Config::default() to §14.8 reference
- ✅ Test `section_14_8_defaults_match` in `crates/miroir-core/src/config.rs` (lines 685-728)
- ✅ Test passes: all defaults verified against §14.8 values
### 6. Drift guard: doc-test comparing Config::default() to §14.8 reference
- ✅ Doc-test at top of `MiroirConfig` struct (lines 21-45 in config.rs)
- ✅ Doc-test passes with `cargo test --doc`
## Test Results
```bash
$ cargo test section_14_8_defaults_match --lib
test config::tests::section_14_8_defaults_match ... ok
test result: ok. 1 passed; 0 failed
```
## Files Verified
- `crates/miroir-core/src/config.rs` - Core config struct with defaults
- `crates/miroir-core/src/config/advanced.rs` - Advanced feature configs
- `charts/miroir/values.yaml` - Helm chart values with §14.8 defaults
- `charts/miroir/values.schema.json` - JSON Schema validation
- `charts/miroir/templates/_helpers.tpl` - Cross-field validation
- `charts/miroir/templates/miroir-deployment.yaml` - Resources block
## Conclusion
All §14.8 resource-aware configuration defaults are properly wired and validated. The drift guard test and doc-test ensure defaults cannot drift from the plan without failing CI.