Foresight.Fitness.CorpusPurity (Foresight v0.1.0)

Copy Markdown View Source

Fitness check: recall/reflect logic must not hardcode eval-corpus or project literals.

Foresight's ranking quality was once inflated by branching on specific corpus phrases ("helios-diary", "industrial-strength", "next-week", …) so that the eval's own documents scored highly — a metric gamed from the inside. Track B excised that, from both the production storage AND the FakeStorage test double that "proves" recall behaviour without a database. This check fails closed if any of those literals reappear in either place, so the contamination cannot silently regrow into a green build.

Generic revision vocabulary (status:latest, superseded, corrected) is allowed — the ban targets domain proper-nouns and corpus content phrases only.

The check is non-vacuous by construction: scanned_files/0 must be non-empty, and the accompanying test asserts it. (An earlier version resolved its repo root incorrectly and silently scanned zero files — passing on emptiness. Never again.)

Summary

Types

violation()

@type violation() :: %{file: String.t(), literals: [String.t()]}

Functions

banned_literals()

@spec banned_literals() :: [String.t()]

scanned_files()

@spec scanned_files() :: [String.t()]

violations()

@spec violations() :: [violation()]

violations_for_sources(sources)

@spec violations_for_sources([{String.t(), String.t()}]) :: [violation()]