# `Insider.Lab.PrivacyCorpus`
[🔗](https://github.com/hiivemarkets/insider/blob/v0.1.0/tools/insider_lab/lib/insider_lab/privacy_corpus.ex#L1)

Runs a caller-supplied synthetic privacy corpus through the exact Logger and
Telemetry ingress code paths and reports which field names survive.

Every item is handed to the real collector handlers
(`Insider.Collector.Logger.Handler.log/2` and
`Insider.Collector.Telemetry.Handler.handle_event/4`) with the Logger
settings derived from the selected `Insider.Collector.IngressProfile` and the
caller's exact `Insider.Collector.Telemetry.Policy`. No allowlist is
reimplemented here. The report lists retained field paths, suppression
counts, and the item/field coordinates of every declared canary token that
appears in projected output, plus each item's source, disposition, and
handler-classified event kind, the caller's policy id and fingerprint, and
fixed settings, bounds, and limitation names. It never contains the value
of a retained field.

The corpus content and the review of every retained field are human work.
A report with no canary hits is bounded evidence about the supplied items
only; it does not prove application coverage or authorize observation.

# `reason`

```elixir
@type reason() ::
  :invalid_options
  | :invalid_corpus
  | :corpus_limit_exceeded
  | :canary_token_unused
  | :telemetry_policy_required
  | :telemetry_policy_atom_missing
  | :invalid_telemetry_policy
  | :privacy_corpus_failed
  | {:invalid_item, non_neg_integer()}
  | {:item_limit_exceeded, non_neg_integer()}
```

# `run`

```elixir
@spec run(map(), keyword()) :: {:ok, map()} | {:error, reason()}
```

Projects every corpus item through the selected ingress profile.

`corpus` is a map with the `insider.privacy-corpus/v1` shape: `"schema"`,
`"canary_tokens"`, `"items"`, and optionally a `"telemetry_policy"` wire
object. Options are `environment:` (any `IngressProfile` environment) and an
optional `telemetry_policy:` struct, which may not be combined with an
embedded wire policy.

# `telemetry_policy`

```elixir
@spec telemetry_policy(term()) ::
  {:ok, Insider.Collector.Telemetry.Policy.t()}
  | {:error, :invalid_telemetry_policy | :telemetry_policy_atom_missing}
```

Builds a Telemetry policy from its JSON wire shape.

Event-name segments, projection sources, and correlation sources resolve only
to atoms that already exist in this VM; a missing atom fails closed.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
