Skip to content

Propagate correlation_id and stream_id through all stream lifecycle route logs #242

@greatest0fallt1me

Description

@greatest0fallt1me

Description

Several routes import getCorrelationContext from app/lib/logger.ts but never use it (e.g. start, pause, settle import it yet log nothing structured), so logs lack the correlation_id/stream_id propagation the project's logging story promises. Wire structured, correlated logging through every lifecycle route. This is a backend observability task.

Requirements and Context

  • Emit structured logger.info/warn/error entries on each lifecycle action with correlation_id, stream_id, action, and resulting status.
  • Remove the unused getCorrelationContext imports or actually consume them; ensure correlation-middleware.ts context is in scope.
  • Redact secrets/PII per app/lib/privacy.ts and the README secret-redaction policy.
  • 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 task/correlated-lifecycle-logging
  2. Implement changes
    • app/api/streams/[id]/{start,pause,stop,settle,withdraw}/route.ts
    • Reuse app/lib/logger.ts and app/lib/correlation-middleware.ts
  3. Test and commit
    • npm test -- app/lib/logger.test.ts app/lib/correlation-middleware.test.ts
    • Cover edge cases: correlation_id present in logs, redaction of recipient PII
    • Include test output and notes in the PR

Example commit message

task: propagate correlation and stream ids in lifecycle logs

Acceptance Criteria

  • Every lifecycle action logs correlation_id + stream_id
  • No unused logger imports remain
  • PII/secrets redacted in logged fields
  • Coverage ≥ 90% for logger/correlation libs

Guidelines

  • Minimum 90% test coverage including redaction
  • Clear documentation and inline comments
  • Timeframe: 96 hours

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programbackendBackend service workdocumentationDocumentationenhancementNew feature or improvement

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions