Files
pipelines/app/test/features/runs/domain/run_exhausted_decision_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

71 lines
1.9 KiB
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/runs/actions/decision_wording.dart';
import 'package:pipelines_app/features/runs/domain/run_decisions.dart';
import 'run_exhausted_decision_fixture.dart';
void main() {
test('an exhaustion decision on a model stage uses the recorded options', () {
final decision = pendingDecision(exhaustedDecisionRun())!;
expect(decision.stageKey, 'review');
expect(decision.instructions, 'Review used all its visits.');
expect(decision.options.map((o) => o.key), ['accept', 'continue', 'abort']);
expect(decision.options.map((o) => o.displayLabel), [
'Accept as is',
'One more round',
'Abort',
]);
expect(decision.options.map((o) => o.target), [
'SUCCESS',
'implement',
'FAILURE',
]);
expect(decision.exhausted?.visit, 3);
expect(decision.exhausted?.maxVisits, 3);
expect(
decisionExhaustedText(decision),
'review reached its visit limit: visit 3 of 3',
);
});
test('unknown option keys keep their recorded wording', () {
final decision = pendingDecision(
exhaustedDecisionRun(
output: {
'options': ['accept', 'extend'],
'exhausted': {'stage': 'review'},
},
),
)!;
expect(decision.options.map((o) => o.displayLabel), [
'Accept as is',
'extend',
]);
expect(decision.options.last.target, '');
expect(decisionExhaustedText(decision), 'review reached its visit limit');
});
test('a model stage waiting without an exhaustion record is no decision', () {
expect(
pendingDecision(
exhaustedDecisionRun(
output: {
'options': ['accept'],
},
),
),
isNull,
);
expect(
pendingDecision(
exhaustedDecisionRun(
output: {
'exhausted': {'stage': 'review'},
},
),
),
isNull,
);
});
}