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>
This commit is contained in:
@@ -53,6 +53,9 @@ class RunDecisionNotice extends StatelessWidget {
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
if (decisionExhaustedText(pending) case final text
|
||||
when text.isNotEmpty)
|
||||
Text(text, style: metaStyle),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../pipelines/pipeline_format.dart';
|
||||
import '../domain/run_deletion.dart' show formatByteSize, runSizeBytes;
|
||||
import '../domain/run_findings.dart' show visitGrantsSummary;
|
||||
import '../domain/run_tokens.dart';
|
||||
import 'run_detail_visit_facts.dart';
|
||||
|
||||
@@ -70,6 +71,7 @@ List<DetailSummaryRow> detailSummaryRows(JsonMap run, {DateTime? now}) {
|
||||
}
|
||||
final retryOf = _number(run['retry_of'])?.toInt() ?? 0;
|
||||
if (retryOf > 0) add('Retry of', 'run $retryOf');
|
||||
add('Extra visits', visitGrantsSummary(run));
|
||||
// A diagnostic is a recorded document: its own whitespace is preserved, but a
|
||||
// blank one is not a row.
|
||||
final diagnostic = '${run['diagnostic'] ?? ''}';
|
||||
|
||||
@@ -5,7 +5,8 @@ import 'package:flutter/material.dart';
|
||||
///
|
||||
/// The stable keys match the web client's `RUN_DETAIL_TABS`; the visible labels
|
||||
/// are the same words. `renderedRunDetailTabs` decides which keys the strip
|
||||
/// draws, so Input and Output stay addressable without being tabs.
|
||||
/// draws, so Input and Output stay addressable without being tabs. Findings
|
||||
/// is appended only for a run whose server recorded a findings ledger.
|
||||
enum RunDetailTab {
|
||||
summary('Summary', Icons.summarize_outlined),
|
||||
graph('Graph', Icons.account_tree_outlined),
|
||||
@@ -13,7 +14,8 @@ enum RunDetailTab {
|
||||
output('Output', Icons.output),
|
||||
timeline('Timeline', Icons.timeline),
|
||||
artifacts('Artifacts', Icons.inventory_2_outlined),
|
||||
changes('Changes', Icons.difference_outlined);
|
||||
changes('Changes', Icons.difference_outlined),
|
||||
findings('Findings', Icons.fact_check_outlined);
|
||||
|
||||
const RunDetailTab(this.label, this.icon);
|
||||
|
||||
|
||||
@@ -41,6 +41,25 @@ class RunArtifactsCount extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
/// The run's open findings as a badge on the Findings tab; nothing when none
|
||||
/// are open.
|
||||
class RunOpenFindingsCount extends StatelessWidget {
|
||||
const RunOpenFindingsCount({super.key, required this.count, this.child});
|
||||
|
||||
final int count;
|
||||
final Widget? child;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (count <= 0) return child ?? const SizedBox.shrink();
|
||||
return Badge(
|
||||
key: const ValueKey('run-detail-findings-count'),
|
||||
label: Text('$count'),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// The run detail's tabs on a phone: the app's floating glass tab bar, full
|
||||
/// width at the bottom of the page (a wide layout puts `RunDetailTopTabs`
|
||||
/// under the run header instead).
|
||||
@@ -59,6 +78,7 @@ class RunDetailTabStrip extends StatelessWidget {
|
||||
this.tabs = renderedRunDetailTabs,
|
||||
this.edge = FloatingBarEdge.bottom,
|
||||
this.artifactCount,
|
||||
this.openFindingCount,
|
||||
this.disabled = const {},
|
||||
this.disabledReasons = const {},
|
||||
});
|
||||
@@ -77,6 +97,9 @@ class RunDetailTabStrip extends StatelessWidget {
|
||||
/// no badge.
|
||||
final int? artifactCount;
|
||||
|
||||
/// The run's open findings, badged on the Findings tab when above zero.
|
||||
final int? openFindingCount;
|
||||
|
||||
/// Tabs shown greyed out that take no taps.
|
||||
final Set<RunDetailTab> disabled;
|
||||
|
||||
@@ -99,6 +122,11 @@ class RunDetailTabStrip extends StatelessWidget {
|
||||
key: ValueKey('run-detail-tab-${tab.name}'),
|
||||
icon: tab == RunDetailTab.artifacts && count != null
|
||||
? RunArtifactsCount(count: count, child: Icon(tab.icon))
|
||||
: tab == RunDetailTab.findings
|
||||
? RunOpenFindingsCount(
|
||||
count: openFindingCount ?? 0,
|
||||
child: Icon(tab.icon),
|
||||
)
|
||||
: Icon(tab.icon),
|
||||
label: tab.label,
|
||||
enabled: !disabled.contains(tab),
|
||||
|
||||
@@ -27,6 +27,8 @@ import 'run_detail_top_tabs.dart';
|
||||
import 'run_detail_timeline.dart';
|
||||
import 'run_detail_visit.dart';
|
||||
import 'run_detail_wide_chrome.dart';
|
||||
import 'run_findings_tab.dart';
|
||||
import '../domain/run_findings.dart';
|
||||
import 'run_detail_visit_facts.dart';
|
||||
import 'run_search_selection.dart';
|
||||
|
||||
@@ -398,6 +400,7 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
|
||||
List<RunDetailTab> _tabsFor(JsonMap run) => [
|
||||
for (final tab in renderedRunDetailTabs)
|
||||
if (tab != RunDetailTab.changes || showRunChangesAction(run)) tab,
|
||||
if (runFindings(run).isNotEmpty) RunDetailTab.findings,
|
||||
];
|
||||
|
||||
/// Artifacts stays in place but disabled while the run recorded none.
|
||||
@@ -414,10 +417,13 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
|
||||
final tabs = _tabsFor(widget.run);
|
||||
final disabled = _disabledTabs(widget.run);
|
||||
final artifactCount = runArtifactCount(widget.run);
|
||||
final findings = runFindings(widget.run);
|
||||
final openFindings = openFindingCount(findings);
|
||||
// A tab the run no longer offers (or cannot open) falls back to Summary.
|
||||
final shown =
|
||||
(tabs.contains(_tab) && !disabled.contains(_tab)) ||
|
||||
!renderedRunDetailTabs.contains(_tab)
|
||||
(!renderedRunDetailTabs.contains(_tab) &&
|
||||
_tab != RunDetailTab.findings)
|
||||
? _tab
|
||||
: RunDetailTab.summary;
|
||||
final edge = PageTabsEdge.of(context);
|
||||
@@ -458,6 +464,7 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
|
||||
selected: shown,
|
||||
onSelected: select,
|
||||
artifactCount: artifactCount,
|
||||
openFindingCount: openFindings,
|
||||
disabled: disabled,
|
||||
disabledReasons: reasons,
|
||||
),
|
||||
@@ -471,6 +478,7 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
|
||||
selected: shown,
|
||||
onSelected: select,
|
||||
artifactCount: artifactCount,
|
||||
openFindingCount: openFindings,
|
||||
disabled: disabled,
|
||||
disabledReasons: reasons,
|
||||
);
|
||||
@@ -568,6 +576,11 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
|
||||
);
|
||||
// Its summary heads the tab, so the tab starts below a pane's top tabs.
|
||||
return BelowTopBar(child: viewer);
|
||||
case RunDetailTab.findings:
|
||||
return RunFindingsTab(
|
||||
key: ValueKey('run-detail-findings-${widget.run['id']}'),
|
||||
findings: runFindings(widget.run),
|
||||
);
|
||||
case RunDetailTab.timeline:
|
||||
final visits = detailTimeline(widget.run['steps']);
|
||||
final index = _selectedVisit;
|
||||
|
||||
@@ -18,6 +18,7 @@ class RunDetailTopTabs extends StatelessWidget {
|
||||
required this.selected,
|
||||
required this.onSelected,
|
||||
this.artifactCount,
|
||||
this.openFindingCount,
|
||||
this.disabled = const {},
|
||||
this.disabledReasons = const {},
|
||||
});
|
||||
@@ -26,6 +27,7 @@ class RunDetailTopTabs extends StatelessWidget {
|
||||
final RunDetailTab selected;
|
||||
final ValueChanged<RunDetailTab> onSelected;
|
||||
final int? artifactCount;
|
||||
final int? openFindingCount;
|
||||
final Set<RunDetailTab> disabled;
|
||||
|
||||
/// Why a disabled tab cannot open, as its tooltip.
|
||||
@@ -67,6 +69,11 @@ class RunDetailTopTabs extends StatelessWidget {
|
||||
const SizedBox(width: 6),
|
||||
RunArtifactsCount(count: count),
|
||||
],
|
||||
if (tab == RunDetailTab.findings &&
|
||||
(openFindingCount ?? 0) > 0) ...[
|
||||
const SizedBox(width: 6),
|
||||
RunOpenFindingsCount(count: openFindingCount!),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
import '../../../ui/text/monospace.dart';
|
||||
import '../domain/run_findings.dart';
|
||||
|
||||
/// The Findings tab: the run's recorded findings ledger, filtered by status
|
||||
/// (open first when any are open) and by minimum severity. Each finding
|
||||
/// expands to show who raised it and its recorded status changes.
|
||||
class RunFindingsTab extends StatefulWidget {
|
||||
const RunFindingsTab({super.key, required this.findings});
|
||||
|
||||
final List<RunFinding> findings;
|
||||
|
||||
@override
|
||||
State<RunFindingsTab> createState() => _RunFindingsTabState();
|
||||
}
|
||||
|
||||
class _RunFindingsTabState extends State<RunFindingsTab> {
|
||||
late String? _status = defaultFindingStatus(widget.findings);
|
||||
FindingSeverity? _minSeverity;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final shown = filterFindings(
|
||||
widget.findings,
|
||||
status: _status,
|
||||
minSeverity: _minSeverity,
|
||||
);
|
||||
return ListView(
|
||||
key: const Key('run-detail-tab-body-findings'),
|
||||
padding: withBarClearance(context, const EdgeInsets.all(16)),
|
||||
children: [
|
||||
_filters(context),
|
||||
const SizedBox(height: 8),
|
||||
if (shown.isEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
child: Text(
|
||||
'No findings match these filters.',
|
||||
key: const Key('run-findings-empty'),
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
for (final finding in shown) RunFindingTile(finding: finding),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _filters(BuildContext context) {
|
||||
int count(String? status) =>
|
||||
filterFindings(widget.findings, status: status).length;
|
||||
return Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
for (final status in <String?>[null, ...findingStatuses])
|
||||
ChoiceChip(
|
||||
key: ValueKey('run-findings-status-${status ?? 'all'}'),
|
||||
label: Text('${_statusLabel(status)} (${count(status)})'),
|
||||
selected: _status == status,
|
||||
onSelected: (_) => setState(() => _status = status),
|
||||
),
|
||||
DropdownMenu<FindingSeverity?>(
|
||||
key: const Key('run-findings-severity'),
|
||||
label: const Text('Minimum severity'),
|
||||
initialSelection: _minSeverity,
|
||||
onSelected: (value) => setState(() => _minSeverity = value),
|
||||
dropdownMenuEntries: [
|
||||
const DropdownMenuEntry(value: null, label: 'All severities'),
|
||||
for (final severity in FindingSeverity.values)
|
||||
DropdownMenuEntry(value: severity, label: severity.name),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
String _statusLabel(String? status) => switch (status) {
|
||||
null => 'All',
|
||||
final text => '${text[0].toUpperCase()}${text.substring(1)}',
|
||||
};
|
||||
|
||||
/// One finding: severity, id and summary, with origin, location, status and
|
||||
/// the latest reason under it; expanding shows its recorded events.
|
||||
class RunFindingTile extends StatelessWidget {
|
||||
const RunFindingTile({super.key, required this.finding});
|
||||
|
||||
final RunFinding finding;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final meta = [
|
||||
if (finding.severityText.isNotEmpty) finding.severityText,
|
||||
if (finding.origin.isNotEmpty) finding.origin,
|
||||
if (finding.status.isNotEmpty) finding.status,
|
||||
].join(' · ');
|
||||
final history = [
|
||||
if (finding.raisedBy.isNotEmpty)
|
||||
'Raised by ${finding.raisedBy}${_visit(finding.raisedSequence)}',
|
||||
if (finding.updatedBy.isNotEmpty)
|
||||
'Updated by ${finding.updatedBy}${_visit(finding.updatedSequence)}',
|
||||
];
|
||||
return ExpansionTile(
|
||||
key: ValueKey('run-finding-${finding.id}'),
|
||||
tilePadding: EdgeInsets.zero,
|
||||
childrenPadding: const EdgeInsetsDirectional.only(start: 40, bottom: 8),
|
||||
expandedCrossAxisAlignment: CrossAxisAlignment.start,
|
||||
leading: Icon(
|
||||
_severityIcon(finding.severity),
|
||||
color: _severityColor(theme.colorScheme, finding.severity),
|
||||
),
|
||||
title: Text(
|
||||
[
|
||||
finding.id,
|
||||
finding.summary,
|
||||
].where((part) => part.isNotEmpty).join(' · '),
|
||||
),
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(meta),
|
||||
if (finding.location.isNotEmpty)
|
||||
SelectableText(
|
||||
finding.location,
|
||||
style: const TextStyle(fontFamily: appMonospaceFamily),
|
||||
),
|
||||
if (finding.reason.isNotEmpty) Text(finding.reason),
|
||||
],
|
||||
),
|
||||
children: [
|
||||
for (final line in history)
|
||||
Text(line, style: theme.textTheme.bodySmall),
|
||||
for (final event in finding.events)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: Text(
|
||||
[
|
||||
if (event.sequence != null) '#${event.sequence}',
|
||||
if (event.stage.isNotEmpty) event.stage,
|
||||
if (event.status.isNotEmpty) event.status,
|
||||
].join(' · ') +
|
||||
(event.reason.isEmpty ? '' : ': ${event.reason}'),
|
||||
style: theme.textTheme.bodySmall,
|
||||
),
|
||||
),
|
||||
if (history.isEmpty && finding.events.isEmpty)
|
||||
Text('No recorded history.', style: theme.textTheme.bodySmall),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
String _visit(int? sequence) => sequence == null ? '' : ' (visit #$sequence)';
|
||||
|
||||
IconData _severityIcon(FindingSeverity? severity) => switch (severity) {
|
||||
FindingSeverity.critical => Icons.error,
|
||||
FindingSeverity.important => Icons.warning_amber,
|
||||
FindingSeverity.minor => Icons.info_outline,
|
||||
FindingSeverity.nit || null => Icons.label_outline,
|
||||
};
|
||||
|
||||
Color _severityColor(ColorScheme scheme, FindingSeverity? severity) =>
|
||||
switch (severity) {
|
||||
FindingSeverity.critical => scheme.error,
|
||||
FindingSeverity.important => scheme.tertiary,
|
||||
FindingSeverity.minor => scheme.primary,
|
||||
FindingSeverity.nit || null => scheme.onSurfaceVariant,
|
||||
};
|
||||
Reference in New Issue
Block a user