---
id: w3/m5/t008
title: Test coverage — meaningful tests for the Loki path + fallback
worker: worker3
status: todo
estimate: 30m
depends_on: [w3/m5/t006]
---

## Objective

Standing closing task. Meaningful tests for what shipped: `LogQuery`→LogQL mapping (filters, limits, time bounds — table-driven against a fake Loki), Loki-down behavior (query error surfaced honestly; tail degrades per t003's decision), unset-fallback equivalence, and limit semantics unchanged (default 20 / cap 100). Assert real behavior and failure modes — never tautological.

## Acceptance criteria

- [ ] Failure modes covered: Loki unreachable, empty range, filter escaping (label injection via service names impossible).
- [ ] `go test ./...` green in `lego/backend`.
