Files
pipelines/app/test/features/runs/domain/run_findings_test.dart
T
alan ebe79ebed0 App: findings ledger tab, retry extra visits and exhaustion decisions
Run detail gains a Findings tab (open-count badge) listing the server's
findings ledger with status and minimum-severity filters and expandable
event history; visit grants show as an Extra visits summary fact. The
resume retry prompt can grant 1-5 extra visits to the exhausted stage or a
chosen graph stage (never sent on restart), suggested when the run failed
on a visit limit. A loop-exhaustion decision waiting on a model stage is
now decidable from its recorded options, with readable labels, targets and
the visit count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 12:45:51 +00:00

66 lines
2.1 KiB
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/runs/domain/run_findings.dart';
import 'run_findings_fixture.dart';
void main() {
test('parses the recorded ledger and skips malformed items', () {
final findings = runFindings(findingsRun());
expect(findings.map((f) => f.id), ['F1', 'F2', 'F3']);
final fixed = findings[1];
expect(fixed.severity, FindingSeverity.minor);
expect(fixed.origin, 'pre-existing');
expect(fixed.location, '');
expect(fixed.reason, 'Corrected');
expect(fixed.updatedBy, 'implement');
expect(fixed.updatedSequence, 5);
expect(fixed.events.single.stage, 'implement');
expect(fixed.events.single.sequence, 5);
expect(findings.first.events, isEmpty);
expect(findings.first.raisedSequence, 4);
});
test('older servers without findings show nothing', () {
expect(runFindings({'id': 1}), isEmpty);
expect(runFindings({'findings': []}), isEmpty);
expect(runFindings(null), isEmpty);
});
test('filters by status and minimum severity', () {
final findings = runFindings(findingsRun());
expect(openFindingCount(findings), 1);
expect(defaultFindingStatus(findings), 'open');
expect(defaultFindingStatus(findings.skip(1)), isNull);
ids(List<RunFinding> list) => list.map((f) => f.id).toList();
expect(ids(filterFindings(findings)), ['F1', 'F2', 'F3']);
expect(ids(filterFindings(findings, status: 'fixed')), ['F2']);
expect(ids(filterFindings(findings, minSeverity: FindingSeverity.minor)), [
'F1',
'F2',
]);
expect(
ids(filterFindings(findings, minSeverity: FindingSeverity.critical)),
['F1'],
);
expect(
filterFindings(
findings,
status: 'fixed',
minSeverity: FindingSeverity.important,
),
isEmpty,
);
});
test('visit grants summarise as stage +n', () {
expect(
visitGrantsSummary({
'visit_grants': {'review': 1, 'implement': 2, 'idle': 0},
}),
'review +1, implement +2',
);
expect(visitGrantsSummary({'visit_grants': {}}), isNull);
expect(visitGrantsSummary({}), isNull);
});
}