The integration test for parsing real NEEDLE worker logs was already created in bead bd-6q2 at src/parser.real-logs.integration.test.ts. All 19 tests pass, covering: - Worker extraction (worker_id) - Bead extraction (bead_id) - Timestamp extraction (ISO to NeedleEvent) - Event information (event_type, data, session_id, sequence) - Multiple event types (worker lifecycle, bead lifecycle) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1.3 KiB
1.3 KiB
BD-129: Integration Test for Real NEEDLE Worker Logs
Task
Create a vitest integration test that reads actual NEEDLE log files from ~/.needle/logs/ and verifies the parser correctly extracts worker, bead, timestamp and event information from production logs.
Finding
The integration test already exists in src/parser.real-logs.integration.test.ts, created in bead bd-6q2.
Existing Test Coverage
The file contains 467 lines with 19 comprehensive tests:
- Log directory sanity checks - verifies .jsonl files exist and are valid JSONL
- NeedleEvent shape assertions - validates canonical format parsing, session_id preservation, monotonically increasing sequence numbers, nested data fields, and bead_id preservation
- Worker lifecycle events - tests worker.started, worker.idle, worker.state_transition, worker.stopped
- Bead lifecycle events - tests bead.claim.*, bead.completed, bead.released
- Adapter round-trip - verifies consistency between parseNeedleEvent and parseLogLine
- Cross-file consistency - tests multiple log files, worker_id consistency, event type variety
All 19 tests pass successfully.
Test Results
Test Files 1 passed (1)
Tests 19 passed (19)
Conclusion
Task already completed in previous bead. No changes needed.