FABRIC/notes/bd-129.md
jedarden eda03a80b6 docs(bd-129): note integration test already exists
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>
2026-05-01 07:58:13 -04:00

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:

  1. Log directory sanity checks - verifies .jsonl files exist and are valid JSONL
  2. NeedleEvent shape assertions - validates canonical format parsing, session_id preservation, monotonically increasing sequence numbers, nested data fields, and bead_id preservation
  3. Worker lifecycle events - tests worker.started, worker.idle, worker.state_transition, worker.stopped
  4. Bead lifecycle events - tests bead.claim.*, bead.completed, bead.released
  5. Adapter round-trip - verifies consistency between parseNeedleEvent and parseLogLine
  6. 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.