# aphoria-config-access

## AUDIT (2026-02-06)
Pattern: Config cloning vs references, no getter methods
Found: 5 problematic instances across 4 files

### Problematic Cloning Instances

1. **handlers/scan.rs:33-40** - Clones entire config just to modify thresholds for strict mode
   - Should use `with_strict_thresholds()` method or Cow pattern

2. **scan/filter.rs:54** - ClaimProcessor stores `config: AphoriaConfig` (owned, cloned from &)
   - Only uses `config.learning.max_patterns` and `config.learning.min_confidence`
   - Should store references or just the needed values

3. **extractors/high_entropy/mod.rs:43** - Stores `config: EntropyConfig` (cloned)
   - Uses thresholds for entropy checks
   - EntropyConfig is small, clone is acceptable but could be reference

4. **shadow/registry.rs:43** - Stores `config: ShadowConfig` (cloned)
   - Uses config for graduation criteria checks
   - ShadowConfig is small, clone is acceptable but could be reference

### Deeply-Nested Access (Candidates for Helpers)

- `config.learning.promotion.output_dir` - 12+ occurrences
- `config.learning.promotion.min_projects` - 4+ occurrences
- `config.episteme.data_dir` - 8+ occurrences
- `config.shadow.*` - 10+ occurrences

### Recommended Approach

1. **Add builder method** on `AphoriaConfig::with_strict_thresholds()` to avoid clone-and-modify
2. **For structs that store config**, prefer storing `&'a AphoriaConfig` with lifetime
3. **Add convenience getters** for deeply-nested common paths:
   - `config.output_dir()` -> `&Path` (promotion output dir)
   - `config.gaps_path()` -> `PathBuf` (episteme/gaps.json)
   - `config.data_dir()` -> `&Path` (episteme data dir)

## FIX
- [ ] handlers/scan.rs:33-40 - Add with_strict_thresholds() method <- CURRENT
