podcast manager
Session Memory#
IMPORTANT: Keep this file actively updated with conversation summaries, decisions, and progress. Jonathan values having records of our discussions and the evolution of ideas.
Style Guide Reference#
See @docs/style-guide.org for coding patterns, conventions, and architectural guidance.
Recent Work - Error Handling Refactor (COMPLETED ✅)#
Summary#
Successfully refactored from multiple AbortControllers to single connection-level controller with clean error hierarchy and proper timeout handling.
Key Achievements#
- Clean Error Hierarchy - HTTP status code-based system with proper differentiation
- Single AbortController Architecture - Connection-level controller passes signals down
- Robust Timeout Handling - Custom
timeoutSignal()with proper cleanup - Signal Composition - Custom
combineSignals()preserves abort reasons
Working Error Scenarios#
- ✅ 3-second timeout →
408 Request Timeout: operation timed out - ✅ Socket disconnect →
499 Client Closed Request: operation was aborted - ✅ Invalid JSON →
400 Bad Request: validation failed - ✅ No spurious errors when operations complete before socket close
Files Modified#
src/common/errors.ts- HTTP error hierarchy with status codessrc/common/aborts.ts-timeoutSignal()andcombineSignals()utilitiessrc/common/socket.ts- Signal-basedtakeSocket()with reason preservationsrc/server/socket/handler.ts- Single controller pattern with proper error handling
Key Technical Insights#
AbortSignal.timeout()incorrectly throwsAbortErrorinstead ofTimeoutErrorin Deno/browsersAbortSignal.any()doesn't preserve individual signal reasons - need customcombineSignals()takeSocket()must reject withsignal.reason(not create new error) to preserve error types- Timeout cleanup critical when using
AbortSignal.any()to prevent lingering timers
Current State#
Project has clean, unified signal-passing architecture with proper error differentiation and timeout handling. Ready for next features.