From PR #16's own adversarial review (graded in gadfly-reports):
- Empty/empty-result fallback: emit now scrapes the prose when the structured
block is absent, unterminated, malformed, OR parses to zero usable findings
(e.g. an empty [] emitted alongside real prose) — the safety net is no longer
defeated by a contradictory empty block. (extractStructuredFindingsOrScrape)
- Unterminated fence no longer swallows the comment: extract + strip share
findingsSpan, which only recognizes a TERMINATED block; an unterminated fence
is left in place.
- confidence is now consumed: normalized (normalizeConfidence) and emitted to
the telemetry store (reportPayload.confidence), not write-only.
- Canonical raw_severity everywhere: heuristic findings derive a canonical word
from the verdict (verdict.severity) instead of the full verdict phrase.
- normalizeSeverity table made consistent ("minor"/"low" -> small).
- Exact info-string match (isFindingsOpen) instead of substring; shared
fenceInfo predicate removes the duplicated open/close fence logic.
- Dedupe structured findings by file:line; never emit an empty title (fall back
to detail, then the location); validate the parsed line number.
- Skip the prose scan when findings already carry detail; refresh stale
emit.go doc comments.
Tests added for the empty-[] fallback, unterminated-fence strip, confidence
normalization, and verdict.severity. All green, gofmt clean, vet quiet.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Each lens now appends a fenced ```gadfly-findings JSON array of its findings
({file, line, severity, confidence, title}) after the prose review. The binary
parses it exactly instead of scraping prose with a path:line regex, so telemetry
carries PER-FINDING severity (not just the lens-level verdict) and downstream
consolidation gets a clean contract to cluster on.
- system-prompt.txt + recheck prompt: ask for / regenerate the block.
- findings.go: extractStructuredFindings + stripFindingsBlock, with severity
normalization and prose-paragraph detail enrichment.
- emit.go: prefer the structured block; gracefully fall back to the heuristic
scrape when a model doesn't emit a parseable one (provider-agnostic, robust).
- consolidate.go: strip the block from the rendered comment (tooling-only).
This is the enabling refactor for consensus consolidation + inline reviews.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>