---
id: w3/m8/t008
title: Test coverage — filter→LogQL mapping, cardinality guard, fallbacks
worker: worker3
status: todo
estimate: 30m
depends_on: [w3/m8/t006]
---

## Objective

Standing closing task. Meaningful tests: table-driven filter→LogQL mapping (each honored filter, combinations, escaping — extend m5's injection tests to the new filters), rejected-filter validation errors name the filter, `path` never becomes a label (a regression here is a cardinality incident), `unknown`-level fallback behavior, discovery scoping (service A's request never returns service B's values — fake-Loki fixture), and fallback-mode behavior as documented. Never tautological.

## Acceptance criteria

- [ ] Cardinality-guard and discovery-scoping cases have explicit tests; `go test ./...` green in `lego/backend`.
