π Description
In src/streams/sseEmitter.ts the subscriber fan-out wraps each callback in a try/catch and swallows the error so one bad listener doesn't break the others. While the isolation is correct, the catch is silent β there is no log or metric when a subscriber throws, so a persistently failing listener is invisible.
π‘ Why it matters: Silent error isolation hides bugs; a misbehaving SSE listener could be failing every event with zero signal to operators.
π§© Requirements and context
- Emit a structured log (with stream id + error) when a subscriber callback throws.
- Add a
prom-client counter (e.g. fluxora_sse_subscriber_errors_total) for thrown subscriber callbacks.
- Keep the existing isolation behavior (other subscribers still receive the event).
- Add a test that registers a throwing subscriber and asserts the log/metric fires while other subscribers still run.
Non-functional requirements
- Must be secure, tested, and documented.
- Should be efficient and easy to review.
π οΈ Suggested execution
1. Fork the repo and create a branch
git checkout -b feat/sse-subscriber-error-observability
2. Implement changes
- Write/modify the relevant source:
src/streams/sseEmitter.ts, src/metrics/index.ts
- Write comprehensive tests:
tests/routes/streams-sse.test.ts
- Add documentation: metric name in observability docs
- Include TSDoc doc comments
- Validate security assumptions: error logs carry no PII
3. Test and commit
- Cover edge cases: one throwing + multiple healthy subscribers
- Include test output and security notes in the PR description.
Example commit message
feat(sse): log and meter throwing SSE subscriber callbacks
β
Acceptance criteria
π Security notes
Ensure SSE payloads (which may contain stream data) are not logged in full.
π Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
π Description
In
src/streams/sseEmitter.tsthe subscriber fan-out wraps each callback in a try/catch and swallows the error so one bad listener doesn't break the others. While the isolation is correct, the catch is silent β there is no log or metric when a subscriber throws, so a persistently failing listener is invisible.π§© Requirements and context
prom-clientcounter (e.g.fluxora_sse_subscriber_errors_total) for thrown subscriber callbacks.Non-functional requirements
π οΈ Suggested execution
1. Fork the repo and create a branch
2. Implement changes
src/streams/sseEmitter.ts,src/metrics/index.tstests/routes/streams-sse.test.ts3. Test and commit
npm testExample commit message
β Acceptance criteria
π Security notes
Ensure SSE payloads (which may contain stream data) are not logged in full.
π Guidelines