# Testing

## Unit Tests

```sh
make test
```

Tests use `miniredis` for Redis Streams; Docker is not required for CI.

## Coverage

| Area | Package / file |
| --- | --- |
| HTTP health + debug APIs | `internal/http/` |
| Config | `internal/config/` |
| Contracts + validation | `internal/contracts/` |
| Filesystem artifact reader | `internal/store/` |
| Delta impact analyzer | `internal/service/commitintel/analyzer_test.go` |
| ProcessGraphDeltaReady | `internal/service/commitintel/service_test.go` |
| Redis client | `internal/redis/client_test.go` |
| Redis consumer | `internal/redis/consumer_test.go` |
| Redis publisher | `internal/redis/publisher_test.go` |
| Pipeline + consumer round-trip | `internal/service/commitintel/pipeline_integration_test.go` |

## Local E2E (with Code Parser)

1. Start Redis: `docker compose up -d redis` in this repo (or shared stack).
2. Set the same `ARTIFACT_STORE_PATH` on Code Parser (6002) and Commit Intel (6003).
3. Run both services (`make dev` or PM2).
4. Trigger a commit diff in Code Parser → `graph.delta.ready`.
5. Verify Commit Intel:
   - `redis-cli XREAD STREAMS commit.analysis.ready 0`
   - `curl http://localhost:6003/analysis-jobs/{job_id}`
   - `curl http://localhost:6003/analysis/{analysis_id}`

Job and analysis IDs are deterministic from repo + commit SHAs (see `internal/service/commitintel/ids.go`).
