Sub-Phase 1.4: Failure Hardening
Handle all failure scenarios gracefully.
Objective
Must handle:
- Ethos down, Talent up
- Talent unauthorized, Ethos up
- Both unavailable
- Wallet exists in neither
Rules:
- Never fabricate defaults
- Never hide absence
- Never throw on valid input
Analysis Result
The implementation from Sub-Phases 1.1-1.3 ALREADY SATISFIES Phase 1.4 requirements.
No code changes are required. This document formally verifies compliance.
Scenario Verification
Scenario 1: Ethos down, Talent up
| Component | Behavior | Status |
|---|---|---|
fetchEthosProfile | HTTP failure → { availability: 'error' } | ✅ |
Promise.allSettled | Does not block Talent call | ✅ |
| Output | { availability: { ethos: 'error', talent: 'available' }, talent: {...} } | ✅ |
Scenario 2: Talent unauthorized (401), Ethos up
| Component | Behavior | Status |
|---|---|---|
fetchTalentScore | 401 response → { availability: 'error' } | ✅ |
Promise.allSettled | Does not block Ethos call | ✅ |
| Output | { availability: { ethos: 'available', talent: 'error' }, ethos: {...} } | ✅ |
Scenario 3: Both unavailable
| Component | Behavior | Status |
|---|---|---|
fetchEthosProfile | Returns { availability: 'error' } independently | ✅ |
fetchTalentScore | Returns { availability: 'error' } independently | ✅ |
| Output | { availability: { ethos: 'error', talent: 'error' } } | ✅ |
Scenario 4: Wallet exists in neither
| Component | Behavior | Status |
|---|---|---|
| Ethos | Empty array → { availability: 'not_found' } | ✅ |
| Talent | Returns points: 0 → { availability: 'available' } | ✅ |
| Output | { availability: { ethos: 'not_found', talent: 'available' }, talent: {...} } | ✅ |
Rule Compliance
| Rule | Status | Evidence |
|---|---|---|
| Never fabricate defaults | ✅ | Meta fields use null when unknown |
| Never hide absence | ✅ | Availability always explicit |
| Never throw on valid input | ✅ | Try/catch in repositories, Promise.allSettled in use case |
Output Examples
Ethos Error, Talent Available
{
"identity": { "address": "0xabc..." },
"availability": { "ethos": "error", "talent": "available" },
"talent": {
"data": { "builderScore": 85 },
"signals": { "verifiedBuilder": true },
"meta": { "lastUpdatedAt": "2024-01-15T10:30:00Z" }
}
}
Both Error
{
"identity": { "address": "0xabc..." },
"availability": { "ethos": "error", "talent": "error" }
}
Exit Checklist
Failure Scenarios
- Ethos down, Talent up → handled
- Talent unauthorized (401), Ethos up → handled
- Both unavailable → handled
- Wallet exists in neither → handled
Rule Compliance
- Never fabricate defaults → uses
nullfor unknown values - Never hide absence → availability always explicit
- Never throw on valid input → try/catch + Promise.allSettled
Architecture
- Repositories return result objects, never throw
- Use case handles all failure states gracefully
- Parallel execution with independent failure handling