- Add Layered() method to Go SDK for per-source-class consensus queries - Add LayeredQueryParams, LayeredResult, TierResolution types to Go SDK - Create conflict example demonstrating Skeptic and Layered endpoints - Update quickstart.md with sections 6 (conflict detection) and 7 (authority tiers) - Remove tracked Go binary and add data/ to .gitignore The new quickstart sections demonstrate Episteme's differentiating features: - Skeptic endpoint shows "Trust but Verify" conflict analysis - Layered endpoint shows per-tier resolution (Clinical vs Anecdotal) Note: Pre-existing large files flagged by pre-commit hook (technical debt from prior sessions) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2.0 KiB
2.0 KiB
inline-validation-handlers
AUDIT (2026-02-01)
Initial Assessment: "No structured validation library" flagged as MEDIUM priority debt.
Investigation: Thorough audit of all 12 handler files in crates/stemedb-api/src/handlers/.
Finding: False positive. The codebase already has well-structured validation:
Existing Validation Infrastructure
-
Centralized hex module (
crates/stemedb-api/src/hex.rs):decode_hash_32()- 32-byte hash validationdecode_hash_8()- 8-byte hash validationdecode_agent_id()- Ed25519 public key validationdecode_signature()- 64-byte signature validation- All functions validate length BEFORE decoding, with clear error messages
-
Handler-specific dto_to_ functions*:
dto_to_assertion()in assert.rsdto_to_vote()in vote.rsdto_to_epoch()in epoch.rs- Each encapsulates conversion + domain-specific validation
-
Consistent patterns across all handlers:
- Bounds checks:
if req.confidence < 0.0 || req.confidence > 1.0 - Empty checks:
if req.reason.trim().is_empty() - Relationship validation:
if supersedes.is_some() && supersession_type.is_none()
- Bounds checks:
Usage Count
| Handler | Uses hex module | Domain validation |
|---|---|---|
| assert.rs | ✅ 5 calls | ✅ confidence, signatures |
| vote.rs | ✅ 3 calls | ✅ weight |
| epoch.rs | ✅ 1 call | ✅ name, supersession |
| supersede.rs | ✅ 4 calls | ✅ reason |
| trace.rs | ✅ 1 call | ✅ timestamps |
| query.rs | ✅ 3 calls | ✅ epoch |
| audit.rs | ✅ 2 calls | - |
| meter.rs | ✅ 1 call | - |
| layered.rs | - (read-only) | - |
RESOLUTION
Status: CLOSED - No debt found
Reason: The inline validation is intentional and appropriate:
- Domain-specific rules are co-located with conversion logic
- Shared validation (hex decoding) is already centralized
- Adding a validation library would add complexity without benefit
- Error messages are consistent via
ApiError::InvalidRequest
No fixes applied.