Cyclium.Findings.Config (Cyclium v0.1.5)

Copy Markdown

ETS-backed registry for per-expectation finding configuration.

Stores enrichment callbacks, escalation rules, and default TTL so that the findings write path and escalation sweep can look up config without requiring application env.

Registration

Called automatically during actor init for expectations that declare finding_enrichment, escalation_rules, or finding_ttl_seconds.

Fallback

When no per-expectation config is registered, Cyclium.Findings and Cyclium.Findings.FindingSweep falls back to application env for backwards compatibility.

Summary

Functions

Get the default TTL seconds for an actor + expectation.

Get the enrichment callback for an actor + expectation.

Idempotent ETS table creation.

Return all registered (actor_id, expectation_id, rules_by_class) tuples that have escalation rules configured.

Get finding config for an actor + expectation. Returns nil if not registered.

Register finding config for an actor + expectation.

Functions

default_ttl_for(actor_id, expectation_id)

Get the default TTL seconds for an actor + expectation.

Returns nil if not configured.

enrichment_for(actor_id, expectation_id)

Get the enrichment callback for an actor + expectation.

Falls back to Application.get_env(:cyclium, :finding_enrichment).

ensure_table()

Idempotent ETS table creation.

escalation_pairs()

Return all registered (actor_id, expectation_id, rules_by_class) tuples that have escalation rules configured.

Used by Cyclium.Findings.FindingSweep.sweep_escalations/0 to scope rules to the correct actor + expectation pair rather than merging them globally by class.

get(actor_id, expectation_id)

Get finding config for an actor + expectation. Returns nil if not registered.

register(actor_id, expectation_id, config)

Register finding config for an actor + expectation.

Config map may contain:

  • :enrichment — callback fun/2 or {mod, fun}
  • :escalation_rules — %{"class" => [%{after_minutes: n, escalate_to: severity}]}
  • :default_ttl_seconds — default TTL for findings without explicit ttl_seconds