stemedb/applications/aphoria/dogfood/cachewrap/scan-v1.json
jml e758f2ebfb feat(aphoria): implement programmatic extractors for Option<T> semantics
Completes Task #3 of httpclient dogfooding with 100% detection rate (7/7 violations).

## New Extractors

- **OptionBoundsExtractor**: Detects Option<T> fields set to None (unbounded)
- **OptionValueExtractor**: Extracts values from Some(n) for threshold checks

Both extractors use context-aware pattern matching to understand Rust Option<T>
semantics, which declarative extractors cannot handle.

## Implementation

**Files Created**:
- applications/aphoria/src/extractors/option_bounds.rs (257 lines)
- applications/aphoria/src/extractors/option_value.rs (277 lines)
- applications/aphoria/docs/examples/extractors/programmatic-option-semantics.md

**Files Modified**:
- applications/aphoria/src/extractors/mod.rs - Added module declarations
- applications/aphoria/src/extractors/registry.rs - Registered extractors
- applications/aphoria/dogfood/httpclient/.aphoria/claims.toml - Added 4 claims
- applications/aphoria/dogfood/httpclient/TASK-1-SUMMARY.md - Task #3 completion

## Results

| Metric | Value |
|--------|-------|
| Detection Rate | 100% (7/7 violations) |
| Improvement | +29 percentage points (from 71%) |
| New Violations | 2 (max_redirects, max_retries unbounded) |
| Unit Tests | 13 (all passing) |

## Two-Claim Strategy

For each bounded Option<T> field:
1. **configured** claim - Detects None (unbounded)
2. **max_value** claim - Validates Some(n) threshold

Example:
- `max_redirects: None` → CONFLICT (not configured)
- `max_redirects: Some(20)` → CONFLICT (exceeds 10)
- `max_redirects: Some(5)` → PASS

## Enterprise Quality

✓ Proper error handling (no unwrap/expect)
✓ Comprehensive tests (6+7 unit tests)
✓ Full documentation with examples
✓ Reusable for 10+ similar patterns
✓ Screening patterns for performance

## Cachewrap Dogfood

Also includes complete cachewrap dogfood exercise:
- 10 claims for Redis cache wrapper
- Day 1-5 summaries
- Full retrospective and evaluation
- Declarative extractors for all patterns

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-11 06:43:10 +00:00

169 lines
5.9 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Detected 10 new claim marker(s). Run 'aphoria claims list-markers' to review.
{
"claim_verification": [
{
"claim_id": "cache-timeout-001",
"concept_path": "cache/timeout",
"explanation": "No matching observation found",
"invariant": "Cache operation timeout MUST NOT exceed 5 seconds",
"verdict": "MISSING"
},
{
"claim_id": "cache-tls-validation-001",
"concept_path": "cache/tls/certificate_validation",
"explanation": "No matching observation found",
"invariant": "TLS certificate validation MUST be enabled for Redis connections",
"verdict": "MISSING"
},
{
"claim_id": "cache-retry-max-001",
"concept_path": "cache/retry/max_attempts",
"explanation": "No matching observation found",
"invariant": "Cache command retry attempts MUST NOT exceed 3",
"verdict": "MISSING"
},
{
"claim_id": "cache-async-blocking-001",
"concept_path": "cache/async/blocking_forbidden",
"explanation": "No matching observation found",
"invariant": "Async cache operations MUST NOT use blocking calls",
"verdict": "MISSING"
},
{
"claim_id": "cache-max-connections-001",
"concept_path": "cache/connection/max_connections",
"explanation": "No matching observation found",
"invariant": "Cache connection pool MUST have bounded max_connections (10-50 recommended)",
"verdict": "MISSING"
},
{
"claim_id": "cache-connection-lifecycle-001",
"concept_path": "cache/connection/lifecycle",
"explanation": "No matching observation found",
"invariant": "Cache connections MUST be validated (PING) before use",
"verdict": "MISSING"
},
{
"claim_id": "cache-metrics-enabled-001",
"concept_path": "cache/metrics/enabled",
"explanation": "No matching observation found",
"invariant": "Metrics MUST be enabled for production cache clients (hit_rate, miss_rate, latency)",
"verdict": "MISSING"
},
{
"claim_id": "cache-ttl-required-001",
"concept_path": "cache/ttl",
"explanation": "No matching observation found",
"invariant": "TTL (Time To Live) MUST be set for all cached values",
"verdict": "MISSING"
},
{
"claim_id": "cache-key-validation-001",
"concept_path": "cache/key_validation",
"explanation": "No matching observation found",
"invariant": "Cache keys MUST be validated for control characters and length",
"verdict": "MISSING"
},
{
"claim_id": "cache-max-size-001",
"concept_path": "cache/max_size",
"explanation": "No matching observation found",
"invariant": "Cache MUST have bounded max_size to prevent OOM",
"verdict": "MISSING"
},
{
"claim_id": "cache-eviction-policy-001",
"concept_path": "cache/eviction_policy",
"explanation": "No matching observation found",
"invariant": "Eviction policy MUST be configured (LRU, LFU, or TTL-based)",
"verdict": "MISSING"
},
{
"claim_id": "cache-hardcoded-password-001",
"concept_path": "cache/credentials/password",
"explanation": "No matching observation found",
"invariant": "Redis passwords MUST NOT be hardcoded in source code",
"verdict": "MISSING"
},
{
"claim_id": "cache-key-prefix-001",
"concept_path": "cache/key_prefix",
"explanation": "No matching observation found",
"invariant": "Cache keys SHOULD use consistent prefixes for namespacing",
"verdict": "MISSING"
},
{
"claim_id": "cache-serialization-001",
"concept_path": "cache/serialization",
"explanation": "No matching observation found",
"invariant": "Cache values SHOULD use structured serialization (JSON, MessagePack, bincode)",
"verdict": "MISSING"
},
{
"claim_id": "cache-compression-001",
"concept_path": "cache/compression",
"explanation": "No matching observation found",
"invariant": "Compression SHOULD be enabled for values >1KB",
"verdict": "MISSING"
},
{
"claim_id": "cache-consistency-mode-001",
"concept_path": "cache/consistency_mode",
"explanation": "No matching observation found",
"invariant": "Consistency mode MUST be configured (strong, eventual, client-side)",
"verdict": "MISSING"
},
{
"claim_id": "cache-sharding-strategy-001",
"concept_path": "cache/sharding_strategy",
"explanation": "No matching observation found",
"invariant": "Sharding SHOULD use consistent hashing for multi-node deployments",
"verdict": "MISSING"
},
{
"claim_id": "cache-read-through-001",
"concept_path": "cache/read_through",
"explanation": "No matching observation found",
"invariant": "Read-through pattern SHOULD be used for cache-aside workloads",
"verdict": "MISSING"
},
{
"claim_id": "cache-write-through-001",
"concept_path": "cache/write_through",
"explanation": "No matching observation found",
"invariant": "Write-through SHOULD be used for critical data requiring strong consistency",
"verdict": "MISSING"
},
{
"claim_id": "cache-stampede-prevention-001",
"concept_path": "cache/stampede_prevention",
"explanation": "No matching observation found",
"invariant": "Cache stampede prevention MUST be implemented (locks, PER, or jitter)",
"verdict": "MISSING"
}
],
"conflicts": [],
"deprecated_usages": [],
"drifts": [],
"project": "cachewrap",
"scan_id": "scan-1770783885982",
"strict": false,
"summary": {
"acks": 0,
"authority_conflicts": 0,
"blocks": 0,
"claims_conflict": 0,
"claims_missing": 20,
"claims_pass": 0,
"claims_total": 20,
"claims_unclaimed": 26,
"deprecated_usages": 0,
"drifts": 0,
"files_scanned": 6,
"flags": 0,
"observations_extracted": 26,
"observations_recorded": 0,
"passes": 0
}
}