newViolationsComparedTo method
Violations in this report with no equivalent in baseline — the
"fail the PR build on new violations" workflow, comparing against a
baseline generated by an earlier run (e.g. loaded via
A11yReport.fromJson from a checked-in file).
Matches on rule + widget type + message rather than A11yViolation's exact value equality, deliberately ignoring A11yViolation.bounds: pixel bounds can shift between runs (different viewport, unrelated layout changes) without the underlying issue being new. This is a heuristic, not a guarantee — a rule whose message text changes incidentally between runs (e.g. a recomputed contrast ratio) will read as a removed-then-added violation rather than an update to the same one.
Implementation
List<A11yViolation> newViolationsComparedTo(A11yReport baseline) {
final baselineKeys = baseline.violations.map(_diffKey).toSet();
return [
for (final v in violations)
if (!baselineKeys.contains(_diffKey(v))) v,
];
}