Problem Statement
The stream processing worker (xstreamroll-processing/) has excellent unit tests for individual components (StreamSession, SessionRegistry, EventFilter, LifecycleManager, Metrics, Logger) but no integration test covering the full pipeline: poll → filter → session → publish. The worker orchestration in worker.ts is completely untested.
Evidence
xstreamroll-processing/__tests__/ contains 7 test files, all unit tests. No test exercises the full flow from API polling to session creation to event publishing. The worker.ts file has no test file at all.
Impact
A regression in the polling loop, session routing, or event filtering would only be caught in manual testing or production. The worker's startup, shutdown, and error recovery behaviors are untested. The graceful shutdown coordinator's integration with the session drain is untested end-to-end.
Proposed Solution
Create an integration test that:
- Mocks the API server (using
nock or a simple HTTP server)
- Starts the worker with the mock API URL
- Mocks
/streams/pending to return test events
- Mocks
/streams/processed to capture published events
- Verifies that events flow through the pipeline correctly
- Tests capacity back-pressure (return "capacity" when full)
- Tests event filtering (blocked events not published)
- Tests graceful shutdown (worker stops gracefully)
Technical Requirements
- Must mock HTTP endpoints (not call real API)
- Must test with realistic timing (poll interval configurable in test)
- Must verify processed events match expected output
- Must test error recovery (API down, returns)
Acceptance Criteria
File Map
xstreamroll-processing/__tests__/integration/worker.integration.test.ts — new file
xstreamroll-processing/__tests__/integration/pipeline.integration.test.ts — new file
xstreamroll-processing/package.json — add nock dev dependency
Dependencies
- Related: REPO-042 (fix shutdown hook)
Testing Strategy
- Integration: Full pipeline test with mock HTTP server
- Test concurrent event processing
- Test worker startup with malformed API responses
- Test shutdown during active processing
Security Considerations
No security impact. Verify mock server doesn't expose real ports.
Definition of Done
Labels: testing, high impact
Priority: High
Difficulty: Advanced
Estimated Effort: 2d
Milestone: v1.0-alpha
Labels: testing,high impact
Priority: High | Difficulty: Advanced | Estimated Effort: 2d
Backlog ID: REPO-013
Problem Statement
The stream processing worker (
xstreamroll-processing/) has excellent unit tests for individual components (StreamSession, SessionRegistry, EventFilter, LifecycleManager, Metrics, Logger) but no integration test covering the full pipeline: poll → filter → session → publish. The worker orchestration inworker.tsis completely untested.Evidence
xstreamroll-processing/__tests__/contains 7 test files, all unit tests. No test exercises the full flow from API polling to session creation to event publishing. Theworker.tsfile has no test file at all.Impact
A regression in the polling loop, session routing, or event filtering would only be caught in manual testing or production. The worker's startup, shutdown, and error recovery behaviors are untested. The graceful shutdown coordinator's integration with the session drain is untested end-to-end.
Proposed Solution
Create an integration test that:
nockor a simple HTTP server)/streams/pendingto return test events/streams/processedto capture published eventsTechnical Requirements
Acceptance Criteria
File Map
xstreamroll-processing/__tests__/integration/worker.integration.test.ts— new filexstreamroll-processing/__tests__/integration/pipeline.integration.test.ts— new filexstreamroll-processing/package.json— addnockdev dependencyDependencies
Testing Strategy
Security Considerations
No security impact. Verify mock server doesn't expose real ports.
Definition of Done
Labels: testing, high impact
Priority: High
Difficulty: Advanced
Estimated Effort: 2d
Milestone: v1.0-alpha
Labels: testing,high impact
Priority: High | Difficulty: Advanced | Estimated Effort: 2d
Backlog ID: REPO-013