fix: address code review feedback (batch 2)

1. Add logger to writeCacheFile (version-cache.ts)
   - Now logs warnings when file write fails
   - Helps debugging in production environments

2. Sanitize logging in parseGroupResult (communities.ts)
   - Changed from info to debug level
   - Removed full node/groupNode dumps (sensitive data)
   - Now only logs nodeTag and groupId

3. Add input validation in parseNewsletterCreateResponse (newsletter.ts)
   - Validates response structure before destructuring
   - Adds fallback values for parseInt (prevents NaN)
   - Adds null checks for optional fields

4. Add health-status.ts module
   - getHealthStatus(): Full health check with circuit breakers, cache, memory
   - isHealthy(): Simple boolean for liveness probes
   - getSimpleHealthStatus(): Returns 'ok', 'degraded', or 'error'
   - Useful for k8s probes and monitoring dashboards
This commit is contained in:
Claude
2026-01-24 20:04:53 +00:00
parent 22eda03eb2
commit d132e1cfd8
5 changed files with 243 additions and 15 deletions
+3
View File
@@ -42,5 +42,8 @@ export * from './unified-session'
// Version management
export * from './version-cache'
// Health monitoring
export * from './health-status'
// Event streaming
export * from './baileys-event-stream'