MingaAdversarial.Findings (minga_adversarial v0.1.0)

Copy Markdown View Source

Parses the model's reply into findings the diagnostics SDK can publish.

The model is asked for a strict JSON array of {"line", "concern"}, but models sometimes wrap their output in prose or fenced JSON blocks. This parser is deliberately tolerant (it extracts the outermost JSON array and drops anything malformed) and never raises. A bad reply yields [], which is treated as "no findings" (and clears stale ones).

Line numbers arrive 1-based and are converted to the 0-based lines the diagnostics pipeline uses.

Summary

Types

finding()

@type finding() :: %{line: non_neg_integer(), concern: String.t()}

Functions

parse(text)

@spec parse(String.t()) :: [finding()]