Merge branch 'worktree-agent-add3194df2bcbd3c5'
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -111,7 +111,7 @@ String? noPatchReasonMessage(String? reason) => switch (reason) {
|
||||
'budget' =>
|
||||
'The workspace snapshot ran out of text budget, so no diff text was '
|
||||
'recorded.',
|
||||
'lines' => 'The change is over 5,000 lines, so no diff text was recorded.',
|
||||
'lines' => 'The change is over 20,000 lines, so no diff text was recorded.',
|
||||
'evidence_size' =>
|
||||
"This visit's recorded changes reached their size limit, so this patch "
|
||||
'was dropped.',
|
||||
@@ -121,6 +121,15 @@ String? noPatchReasonMessage(String? reason) => switch (reason) {
|
||||
'baseline' =>
|
||||
"The file's content at stage start couldn't be recovered from Git, so no "
|
||||
'diff was recorded.',
|
||||
'symlink' => 'Symbolic link; only the change to its target was recorded.',
|
||||
'protected' =>
|
||||
'A protected file (secrets, credentials or a database); its content is '
|
||||
'never read, only that it changed.',
|
||||
'generated' =>
|
||||
'A lockfile, minified or generated file; it is listed without a diff.',
|
||||
'large' =>
|
||||
'This file is too large to hash, so it was compared by size and '
|
||||
'modification time only.',
|
||||
_ => null,
|
||||
};
|
||||
|
||||
|
||||
@@ -36,8 +36,10 @@ class FileChange {
|
||||
final bool truncated;
|
||||
|
||||
/// Why the server recorded no (complete) patch: `binary`, `file_size`,
|
||||
/// `budget`, `lines`, `evidence_size`, `git_status` or `baseline`. Null from
|
||||
/// an older server or when a patch was recorded.
|
||||
/// `budget`, `lines`, `evidence_size`, `git_status`, `baseline`, `symlink`,
|
||||
/// `protected` (content never read), `generated` (lockfile/minified) or
|
||||
/// `large` (compared by size and mtime only). Null from an older server or
|
||||
/// when a patch was recorded; an unknown value gets the generic wording.
|
||||
final String? noPatchReason;
|
||||
final String? beforeMode;
|
||||
final String? afterMode;
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
// The `check` stage type: a model-free stage that runs shell commands and
|
||||
// routes `pass`/`fail` (plus `error`). Its `delivery` config marks the landing
|
||||
// gate, which runs the commands in a fresh worktree and fast-forwards main on
|
||||
// pass. Pure data only; an older graph simply has no check stages.
|
||||
|
||||
/// The stage type word the server uses for a check stage.
|
||||
const String checkStageType = 'check';
|
||||
|
||||
/// Whether [stage] (a graph stage declaration) is a check stage.
|
||||
bool isCheckStage(dynamic stage) =>
|
||||
stage is Map && '${stage['type'] ?? ''}'.trim() == checkStageType;
|
||||
|
||||
/// Whether a check [stage] is the delivery (landing) gate.
|
||||
///
|
||||
/// Configs are strings on the wire (`"true"`); a JSON boolean is accepted too.
|
||||
bool isDeliveryGate(dynamic stage) {
|
||||
if (!isCheckStage(stage)) return false;
|
||||
final configs = (stage as Map)['configs'];
|
||||
if (configs is! Map) return false;
|
||||
final value = configs['delivery'];
|
||||
return value == true || '${value ?? ''}'.trim().toLowerCase() == 'true';
|
||||
}
|
||||
|
||||
/// The check stage's commands, one per non-blank line of `blocks.commands`
|
||||
/// (a list of strings is read item by item), in declared order.
|
||||
List<String> checkCommands(dynamic stage) {
|
||||
if (stage is! Map) return const <String>[];
|
||||
final blocks = stage['blocks'];
|
||||
if (blocks is! Map) return const <String>[];
|
||||
final raw = blocks['commands'];
|
||||
final lines = raw is List
|
||||
? [for (final item in raw) '${item ?? ''}']
|
||||
: '${raw ?? ''}'.split('\n');
|
||||
return [
|
||||
for (final line in lines)
|
||||
if (line.trim().isNotEmpty) line.trimRight(),
|
||||
];
|
||||
}
|
||||
|
||||
/// The short kind a graph node shows under its name: `Check` or
|
||||
/// `Delivery gate`, or null for every other stage type.
|
||||
String? checkStageCaption({required String type, required bool delivery}) {
|
||||
if (type.trim() != checkStageType) return null;
|
||||
return delivery ? 'Delivery gate' : 'Check';
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'check_stage.dart';
|
||||
import 'graph_protocol.dart';
|
||||
|
||||
/// The graph definition: nodes and edges declared by a pipeline, never the
|
||||
@@ -70,11 +71,27 @@ class GraphEdge {
|
||||
/// One graph definition node: a declared stage, or a terminal the definition
|
||||
/// routes to.
|
||||
class GraphNode {
|
||||
const GraphNode({required this.key, required this.terminal, this.stageIndex});
|
||||
const GraphNode({
|
||||
required this.key,
|
||||
required this.terminal,
|
||||
this.stageIndex,
|
||||
this.type = '',
|
||||
this.delivery = false,
|
||||
});
|
||||
|
||||
final String key;
|
||||
final bool terminal;
|
||||
|
||||
/// The stage's declared `type` exactly as recorded (blank reads `model`);
|
||||
/// empty for a terminal.
|
||||
final String type;
|
||||
|
||||
/// Whether this is a check stage marked as the delivery gate.
|
||||
final bool delivery;
|
||||
|
||||
/// `Check` or `Delivery gate` for a check stage, otherwise null.
|
||||
String? get kindCaption => checkStageCaption(type: type, delivery: delivery);
|
||||
|
||||
/// The node's stage declaration index, or null for a terminal.
|
||||
final int? stageIndex;
|
||||
|
||||
@@ -142,7 +159,15 @@ List<GraphNode> graphNodes(dynamic graph) {
|
||||
for (var index = 0; index < stages.length; index += 1) {
|
||||
final key = _stageKey(stages[index]);
|
||||
if (key.isEmpty || !seen.add(key)) continue;
|
||||
nodes.add(GraphNode(key: key, terminal: false, stageIndex: index));
|
||||
nodes.add(
|
||||
GraphNode(
|
||||
key: key,
|
||||
terminal: false,
|
||||
stageIndex: index,
|
||||
type: '${stages[index]['type'] ?? ''}',
|
||||
delivery: isDeliveryGate(stages[index]),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (graphEdges(graph).any((edge) => edge.isTerminal)) {
|
||||
nodes.add(const GraphNode(key: failureEnd, terminal: true));
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'check_stage.dart';
|
||||
import 'graph_definition.dart';
|
||||
import 'graph_protocol.dart';
|
||||
|
||||
@@ -9,13 +10,22 @@ import 'graph_protocol.dart';
|
||||
/// reads run visits, so a definition can be inspected without claiming that a
|
||||
/// stage executed.
|
||||
class StageDefinitionField {
|
||||
const StageDefinitionField(this.label, this.value, {this.block = false});
|
||||
const StageDefinitionField(
|
||||
this.label,
|
||||
this.value, {
|
||||
this.block = false,
|
||||
this.monospace = false,
|
||||
});
|
||||
|
||||
final String label;
|
||||
final String value;
|
||||
|
||||
/// Multi-line content (prompt, output, outcomes, tools, memory, routes).
|
||||
final bool block;
|
||||
|
||||
/// Literal code (a check stage's commands): always shown verbatim in a
|
||||
/// monospace block, never rendered as markdown.
|
||||
final bool monospace;
|
||||
}
|
||||
|
||||
/// The one stage declaration [key] names, or null when this version does not
|
||||
@@ -58,6 +68,12 @@ String stageConfigLabel(String key) {
|
||||
return 'Budget (tokens)';
|
||||
case 'harness':
|
||||
return 'Harness';
|
||||
case 'command_timeout':
|
||||
return 'Command timeout';
|
||||
case 'keep_going':
|
||||
return 'Keep going';
|
||||
case 'delivery':
|
||||
return 'Delivery gate';
|
||||
default:
|
||||
return key;
|
||||
}
|
||||
@@ -69,10 +85,27 @@ String stageConfigLabel(String key) {
|
||||
/// interpreted here; the pane keeps the stage's raw JSON so they stay visible.
|
||||
List<StageDefinitionField> stageDefinitionFields(dynamic stage) {
|
||||
if (stage is! Map) return const <StageDefinitionField>[];
|
||||
final type = effectiveStageType(stage['type']);
|
||||
final fields = <StageDefinitionField>[
|
||||
StageDefinitionField('Type', effectiveStageType(stage['type'])),
|
||||
StageDefinitionField(
|
||||
'Type',
|
||||
isDeliveryGate(stage) ? '$type (delivery gate)' : type,
|
||||
),
|
||||
];
|
||||
|
||||
// A check stage runs commands where a model stage has its prompt.
|
||||
final commands = checkCommands(stage);
|
||||
if (isCheckStage(stage) && commands.isNotEmpty) {
|
||||
fields.add(
|
||||
StageDefinitionField(
|
||||
'Commands',
|
||||
commands.join('\n'),
|
||||
block: true,
|
||||
monospace: true,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final prompt = _text(stage['prompt']);
|
||||
if (prompt.trim().isNotEmpty) {
|
||||
fields.add(StageDefinitionField('Prompt', prompt, block: true));
|
||||
|
||||
@@ -45,10 +45,7 @@ class GraphStageNode extends StatelessWidget {
|
||||
return status != null && status.trim().isNotEmpty ? status : null;
|
||||
}
|
||||
|
||||
String get _label {
|
||||
final status = _status;
|
||||
return status == null ? node.label : '${node.label}\n$status';
|
||||
}
|
||||
String get _label => graphNodeSemanticsLabel(node, _status);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -112,11 +109,13 @@ class GraphStageNode extends StatelessWidget {
|
||||
graphStatusState(status),
|
||||
Theme.of(context).colorScheme,
|
||||
);
|
||||
final caption = node.kindCaption;
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(_breakable(node.label), softWrap: true),
|
||||
if (caption != null) _kind(context, caption),
|
||||
if (status != null)
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -144,6 +143,29 @@ class GraphStageNode extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
/// A check stage's kind under its name: the check icon (a gate icon for the
|
||||
/// delivery gate) and `Check`/`Delivery gate` in the muted label role.
|
||||
Widget _kind(BuildContext context, String caption) {
|
||||
final theme = Theme.of(context);
|
||||
final color = theme.colorScheme.onSurfaceVariant;
|
||||
final style = (theme.textTheme.labelSmall ?? const TextStyle()).copyWith(
|
||||
color: color,
|
||||
);
|
||||
return Row(
|
||||
key: ValueKey('graph-node-kind-${node.key}'),
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
checkStageIcon(delivery: node.delivery),
|
||||
size: (style.fontSize ?? 11) * 1.4,
|
||||
color: color,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Flexible(child: Text(caption, style: style, softWrap: true)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// The web node uses `overflow-wrap: anywhere`; Flutter text does not break a
|
||||
/// long unbroken key, so the same invisible break opportunities are added.
|
||||
/// The visible text and the semantics label stay unchanged.
|
||||
@@ -265,6 +287,18 @@ class StageActivityHaloPainter extends CustomPainter {
|
||||
oldDelegate.color != color || oldDelegate.progress != progress;
|
||||
}
|
||||
|
||||
/// The icon for a check stage; the delivery gate gets the landing icon.
|
||||
IconData checkStageIcon({required bool delivery}) =>
|
||||
delivery ? Icons.verified_outlined : Icons.fact_check_outlined;
|
||||
|
||||
/// A node's accessible name: its label, a check stage's kind, then the run's
|
||||
/// recorded status when there is one.
|
||||
String graphNodeSemanticsLabel(GraphNode node, String? status) => [
|
||||
node.label,
|
||||
?node.kindCaption,
|
||||
if (status != null && status.trim().isNotEmpty) status,
|
||||
].join('\n');
|
||||
|
||||
/// The run state a recorded step status colours as: done is green, an error or
|
||||
/// a block is red, running is blue, waiting teal, anything else grey.
|
||||
String graphStatusState(String status) {
|
||||
|
||||
@@ -341,7 +341,7 @@ class RunGraphNode extends StatelessWidget {
|
||||
}
|
||||
return Semantics(
|
||||
container: true,
|
||||
label: status == null ? node.label : '${node.label}\n$status',
|
||||
label: graphNodeSemanticsLabel(node, status),
|
||||
child: ExcludeSemantics(
|
||||
child: IgnorePointer(
|
||||
child: GraphStageNode(
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/segmented_bar.dart';
|
||||
import '../../../ui/text/markdown_source_view.dart';
|
||||
import '../../../ui/text/monospace.dart';
|
||||
import '../../chat/ui/transcript/chat_markdown_view.dart';
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
@@ -190,8 +191,15 @@ class _StageDefinitionFieldView extends StatelessWidget {
|
||||
children: [
|
||||
Text(field.label, style: style.label),
|
||||
const SizedBox(height: 4),
|
||||
// Commands are literal code: verbatim and monospace in either mode.
|
||||
if (field.monospace)
|
||||
_SelectableDefinitionText(
|
||||
key: ValueKey('stage-definition-${field.label}'),
|
||||
value: field.value,
|
||||
style: style.value.copyWith(fontFamily: appMonospaceFamily),
|
||||
)
|
||||
// An authored text block (a prompt) is markdown: rendered or raw.
|
||||
if (field.block && raw)
|
||||
else if (field.block && raw)
|
||||
_SelectableDefinitionText(value: field.value, style: style.value)
|
||||
else if (field.block)
|
||||
ChatMarkdownView(text: field.value)
|
||||
@@ -215,7 +223,11 @@ class _StageDefinitionFieldView extends StatelessWidget {
|
||||
/// fallback font with taller metrics and double-space only that block. It is
|
||||
/// the host's own line metrics, not a font override or a fixed height.
|
||||
class _SelectableDefinitionText extends StatelessWidget {
|
||||
const _SelectableDefinitionText({required this.value, required this.style});
|
||||
const _SelectableDefinitionText({
|
||||
super.key,
|
||||
required this.value,
|
||||
required this.style,
|
||||
});
|
||||
|
||||
final String value;
|
||||
final TextStyle style;
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
// A check stage visit's recorded output: the per-command results the server
|
||||
// ran for a `check` stage, read without widget imports.
|
||||
//
|
||||
// Only an output map carrying a `checks` list is a check output; older
|
||||
// servers never send one, so every other step keeps its ordinary rendering.
|
||||
|
||||
/// How one command ended. [unknown] keeps a status this client does not know
|
||||
/// (its raw word stays in [CheckCommandResult.statusWord]).
|
||||
enum CheckCommandStatus { passed, failed, timedOut, notRun, unknown }
|
||||
|
||||
CheckCommandStatus checkCommandStatus(String word) =>
|
||||
switch (word.trim().toLowerCase()) {
|
||||
'passed' => CheckCommandStatus.passed,
|
||||
'failed' => CheckCommandStatus.failed,
|
||||
'timed_out' => CheckCommandStatus.timedOut,
|
||||
'not_run' => CheckCommandStatus.notRun,
|
||||
_ => CheckCommandStatus.unknown,
|
||||
};
|
||||
|
||||
/// The status as the row reads it; an unknown status shows its raw word.
|
||||
String checkStatusLabel(CheckCommandResult check) => switch (check.status) {
|
||||
CheckCommandStatus.passed => 'Passed',
|
||||
CheckCommandStatus.failed => 'Failed',
|
||||
CheckCommandStatus.timedOut => 'Timed out',
|
||||
CheckCommandStatus.notRun => 'Not run',
|
||||
CheckCommandStatus.unknown =>
|
||||
check.statusWord.isEmpty ? 'Unknown status' : check.statusWord,
|
||||
};
|
||||
|
||||
/// One command's recorded result.
|
||||
class CheckCommandResult {
|
||||
const CheckCommandResult({
|
||||
required this.command,
|
||||
required this.statusWord,
|
||||
this.exitCode,
|
||||
this.durationMs,
|
||||
this.output = '',
|
||||
this.truncated = false,
|
||||
});
|
||||
|
||||
final String command;
|
||||
|
||||
/// The server's status word verbatim.
|
||||
final String statusWord;
|
||||
|
||||
/// Null when not recorded (a command that never ran has none).
|
||||
final int? exitCode;
|
||||
final int? durationMs;
|
||||
final String output;
|
||||
|
||||
/// Whether the server cut [output] at its capture limit.
|
||||
final bool truncated;
|
||||
|
||||
CheckCommandStatus get status => checkCommandStatus(statusWord);
|
||||
|
||||
/// `exit 1 · 51s`, leaving out whichever fact was not recorded.
|
||||
String get meta => [
|
||||
if (exitCode != null) 'exit $exitCode',
|
||||
if (durationMs != null) formatCheckDuration(durationMs!),
|
||||
].join(' · ');
|
||||
}
|
||||
|
||||
/// A check visit's whole recorded output.
|
||||
class CheckStepOutput {
|
||||
const CheckStepOutput({
|
||||
required this.checks,
|
||||
this.summary,
|
||||
this.markdown,
|
||||
this.delivery = false,
|
||||
});
|
||||
|
||||
final List<CheckCommandResult> checks;
|
||||
|
||||
/// The server's one-line summary (`1 of 2 checks failed: go test ./...`).
|
||||
final String? summary;
|
||||
|
||||
/// The handoff document the next stage reads.
|
||||
final String? markdown;
|
||||
|
||||
/// Whether this visit was the delivery gate.
|
||||
final bool delivery;
|
||||
}
|
||||
|
||||
/// The check output recorded in [output], or null when it is not one.
|
||||
CheckStepOutput? checkStepOutput(dynamic output) {
|
||||
if (output is! Map) return null;
|
||||
final checks = output['checks'];
|
||||
if (checks is! List) return null;
|
||||
return CheckStepOutput(
|
||||
checks: [
|
||||
for (final item in checks)
|
||||
if (item is Map) _check(item),
|
||||
],
|
||||
summary: _text(output['summary']),
|
||||
markdown: _text(output['markdown']),
|
||||
delivery: output['delivery'] == true,
|
||||
);
|
||||
}
|
||||
|
||||
CheckCommandResult _check(Map item) => CheckCommandResult(
|
||||
command: '${item['command'] ?? ''}',
|
||||
statusWord: '${item['status'] ?? ''}'.trim(),
|
||||
exitCode: _int(item['exit_code']),
|
||||
durationMs: _int(item['duration_ms']),
|
||||
output: item['output'] is String ? item['output'] as String : '',
|
||||
truncated: item['truncated'] == true,
|
||||
);
|
||||
|
||||
/// A command duration: `850ms`, `2.1s`, `51s`, `3m 05s`.
|
||||
String formatCheckDuration(int ms) {
|
||||
if (ms < 1000) return '${ms}ms';
|
||||
if (ms < 10000) {
|
||||
final tenths = (ms / 100).round();
|
||||
return tenths % 10 == 0 ? '${tenths ~/ 10}s' : '${tenths / 10}s';
|
||||
}
|
||||
final seconds = (ms / 1000).round();
|
||||
if (seconds < 60) return '${seconds}s';
|
||||
final minutes = seconds ~/ 60;
|
||||
final rest = (seconds % 60).toString().padLeft(2, '0');
|
||||
if (minutes < 60) return '${minutes}m ${rest}s';
|
||||
return '${minutes ~/ 60}h ${(minutes % 60).toString().padLeft(2, '0')}m';
|
||||
}
|
||||
|
||||
int? _int(dynamic value) {
|
||||
if (value is num) return value.toInt();
|
||||
if (value is String) return int.tryParse(value.trim());
|
||||
return null;
|
||||
}
|
||||
|
||||
String? _text(dynamic value) {
|
||||
if (value is! String) return null;
|
||||
return value.trim().isEmpty ? null : value;
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/status/run_status_icon.dart';
|
||||
import '../../../ui/text/monospace.dart';
|
||||
import '../../chat/ui/transcript/chat_markdown_view.dart';
|
||||
import '../domain/check_step_output.dart';
|
||||
|
||||
/// The note under a command whose recorded output the server cut short.
|
||||
const String checkOutputTruncated =
|
||||
'The server truncated this output at its capture limit.';
|
||||
|
||||
/// The body of a command that recorded no output.
|
||||
const String checkOutputEmpty = 'No output recorded.';
|
||||
|
||||
/// A check visit's Output: its summary, a delivery-gate marker, one
|
||||
/// expandable row per command and the handoff document the next stage reads.
|
||||
class RunCheckOutputView extends StatelessWidget {
|
||||
const RunCheckOutputView({super.key, required this.output});
|
||||
|
||||
final CheckStepOutput output;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final summary = output.summary;
|
||||
final markdown = output.markdown;
|
||||
return Column(
|
||||
key: const Key('run-check-output'),
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
if (output.delivery)
|
||||
Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: Chip(
|
||||
key: const Key('run-check-delivery'),
|
||||
avatar: const Icon(Icons.verified_outlined),
|
||||
label: const Text('Delivery gate'),
|
||||
),
|
||||
),
|
||||
if (summary != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||
child: SelectableText(summary, style: theme.textTheme.bodyLarge),
|
||||
),
|
||||
if (output.checks.isEmpty)
|
||||
const Text('No commands were recorded.')
|
||||
else
|
||||
for (final (index, check) in output.checks.indexed)
|
||||
RunCheckCommandRow(
|
||||
key: ValueKey('run-check-command-$index'),
|
||||
check: check,
|
||||
),
|
||||
if (markdown != null) ...[
|
||||
const SizedBox(height: 12),
|
||||
Text('Handoff', style: theme.textTheme.titleSmall),
|
||||
const SizedBox(height: 4),
|
||||
ChatMarkdownView(text: markdown),
|
||||
],
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// One command: a status icon, the command, its status, exit code and
|
||||
/// duration; expanding it shows the recorded output as selectable monospace.
|
||||
class RunCheckCommandRow extends StatelessWidget {
|
||||
const RunCheckCommandRow({super.key, required this.check});
|
||||
|
||||
final CheckCommandResult check;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final mono = (theme.textTheme.bodyMedium ?? const TextStyle()).copyWith(
|
||||
fontFamily: appMonospaceFamily,
|
||||
);
|
||||
final color = runStatusColor(_state(check.status), theme.colorScheme);
|
||||
final meta = check.meta;
|
||||
return ExpansionTile(
|
||||
tilePadding: EdgeInsets.zero,
|
||||
childrenPadding: const EdgeInsets.only(bottom: 12),
|
||||
expandedCrossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
leading: Icon(
|
||||
_icon(check.status),
|
||||
color: color,
|
||||
semanticLabel: checkStatusLabel(check),
|
||||
),
|
||||
title: Text(
|
||||
check.command.isEmpty ? '(no command)' : check.command,
|
||||
style: mono,
|
||||
),
|
||||
subtitle: Text(
|
||||
[checkStatusLabel(check), if (meta.isNotEmpty) meta].join(' · '),
|
||||
),
|
||||
children: [
|
||||
if (check.output.isEmpty)
|
||||
const Text(checkOutputEmpty)
|
||||
else
|
||||
DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: SelectableText(check.output, style: mono),
|
||||
),
|
||||
),
|
||||
if (check.truncated)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: Text(
|
||||
checkOutputTruncated,
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
static String _state(CheckCommandStatus status) => switch (status) {
|
||||
CheckCommandStatus.passed => 'succeeded',
|
||||
CheckCommandStatus.failed || CheckCommandStatus.timedOut => 'failed',
|
||||
CheckCommandStatus.notRun || CheckCommandStatus.unknown => 'unknown',
|
||||
};
|
||||
|
||||
static IconData _icon(CheckCommandStatus status) => switch (status) {
|
||||
CheckCommandStatus.passed => Icons.check_circle_outline,
|
||||
CheckCommandStatus.failed => Icons.cancel_outlined,
|
||||
CheckCommandStatus.timedOut => Icons.timer_off_outlined,
|
||||
CheckCommandStatus.notRun => Icons.remove_circle_outline,
|
||||
CheckCommandStatus.unknown => Icons.help_outline,
|
||||
};
|
||||
}
|
||||
@@ -133,6 +133,22 @@ String? detailVisitSkills(JsonMap step) {
|
||||
return (option: option, reason: reason);
|
||||
}
|
||||
|
||||
/// How many times the server sent its one "missing `# outcome`" repair
|
||||
/// follow-up for this visit (`control.outcome_repairs`); 0 when not recorded,
|
||||
/// which older servers and unrepaired visits both mean.
|
||||
int detailVisitOutcomeRepairs(JsonMap step) {
|
||||
final control = step['control'];
|
||||
if (control is! Map) return 0;
|
||||
final value = control['outcome_repairs'];
|
||||
if (value is num) return value.toInt();
|
||||
return int.tryParse('${value ?? ''}'.trim()) ?? 0;
|
||||
}
|
||||
|
||||
/// The note a repaired visit shows under its facts.
|
||||
String outcomeRepairNote(int repairs) => repairs == 1
|
||||
? 'Outcome repaired by follow-up'
|
||||
: 'Outcome repaired by follow-up ($repairs times)';
|
||||
|
||||
/// The visit's diagnostic exactly as recorded, or null when it is blank.
|
||||
String? detailVisitDiagnostic(JsonMap step) => _text(step['diagnostic']);
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ class RunVisitFactsView extends StatelessWidget {
|
||||
final facts = detailVisitFacts(step);
|
||||
final verdict = detailVisitVerdict(step);
|
||||
final diagnostic = detailVisitDiagnostic(step);
|
||||
final repairs = detailVisitOutcomeRepairs(step);
|
||||
return Padding(
|
||||
key: const Key('run-visit-facts'),
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 8, 16, 12),
|
||||
@@ -28,6 +29,23 @@ class RunVisitFactsView extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_FactGrid(facts: facts, style: style),
|
||||
if (repairs > 0) ...[
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
key: const Key('run-visit-outcome-repaired'),
|
||||
children: [
|
||||
Icon(
|
||||
Icons.build_circle_outlined,
|
||||
size: 16,
|
||||
color: style.muted.color,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Flexible(
|
||||
child: Text(outcomeRepairNote(repairs), style: style.muted),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
if (verdict != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text('Verdict', style: style.heading),
|
||||
@@ -57,10 +75,14 @@ class _FactGrid extends StatelessWidget {
|
||||
static String _stateOf(VisitFact fact) {
|
||||
final value = fact.value.trim().toLowerCase();
|
||||
if (fact.label == 'Outcome') {
|
||||
if (value == 'error' || value == 'failed' || value == 'blocked') {
|
||||
if (value == 'error' ||
|
||||
value == 'failed' ||
|
||||
value == 'fail' ||
|
||||
value == 'blocked') {
|
||||
return 'failed';
|
||||
}
|
||||
if (value == 'success') return 'succeeded';
|
||||
// A check stage routes `pass`/`fail`.
|
||||
if (value == 'success' || value == 'pass') return 'succeeded';
|
||||
return 'running';
|
||||
}
|
||||
return graphStatusState(fact.value);
|
||||
|
||||
@@ -4,6 +4,8 @@ import 'package:flutter/services.dart';
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../ui/adaptive/floating_destination_bar.dart';
|
||||
import '../../changes/changes.dart';
|
||||
import '../domain/check_step_output.dart';
|
||||
import 'run_check_output_view.dart';
|
||||
import 'run_detail_tab_bodies.dart';
|
||||
import 'run_field_body.dart';
|
||||
import '../../../ui/layout/sticky_section.dart';
|
||||
@@ -216,6 +218,9 @@ class _VisitSummaryState extends State<_VisitSummary> {
|
||||
);
|
||||
final open = !_closed.contains(name);
|
||||
const padding = EdgeInsets.fromLTRB(16, 0, 16, 16);
|
||||
// A check visit's Output is its command results, not a field map.
|
||||
final check = name == 'Output' ? checkStepOutput(value) : null;
|
||||
final sliver = lazy && check == null;
|
||||
return StickySection(
|
||||
key: ValueKey('run-visit-section-$name'),
|
||||
title: name,
|
||||
@@ -224,13 +229,15 @@ class _VisitSummaryState extends State<_VisitSummary> {
|
||||
if (!_closed.remove(name)) _closed.add(name);
|
||||
}),
|
||||
trailing: [copy],
|
||||
body: lazy
|
||||
body: sliver
|
||||
? null
|
||||
: Padding(
|
||||
padding: padding,
|
||||
child: RunFieldBody(value: value, empty: empty),
|
||||
child: check != null
|
||||
? RunCheckOutputView(output: check)
|
||||
: RunFieldBody(value: value, empty: empty),
|
||||
),
|
||||
sliverBody: lazy
|
||||
sliverBody: sliver
|
||||
? SliverPadding(
|
||||
padding: padding,
|
||||
sliver: RunFieldSliver(value: value, empty: empty),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../domain/check_step_output.dart';
|
||||
import 'run_detail_visit_export.dart';
|
||||
import 'run_detail_visit_recorded.dart';
|
||||
|
||||
@@ -18,6 +19,10 @@ const String visitSessionNoIdentity =
|
||||
'Runtime error: this model stage has no recorded session identity.';
|
||||
const String visitSessionNone = 'This visit has no harness session.';
|
||||
|
||||
/// A check stage runs commands, never a model, so it has no session at all.
|
||||
const String visitSessionCheck =
|
||||
'A check stage runs commands without a model; it has no harness session.';
|
||||
|
||||
/// An export that exists but cannot be resolved through the configured server.
|
||||
const String visitSessionEndpointMissing =
|
||||
'Set the server URL in Settings to open the session.';
|
||||
@@ -94,6 +99,7 @@ String _noSessionMessage(JsonMap step) {
|
||||
if (status == 'canceled' || status == 'interrupted') {
|
||||
return visitSessionStopped;
|
||||
}
|
||||
if (checkStepOutput(step['output']) != null) return visitSessionCheck;
|
||||
final model =
|
||||
recordedText(step['provider']) != null ||
|
||||
recordedText(step['model']) != null;
|
||||
|
||||
@@ -13,7 +13,7 @@ const _expected = {
|
||||
'budget':
|
||||
'The workspace snapshot ran out of text budget, so no diff text was '
|
||||
'recorded.',
|
||||
'lines': 'The change is over 5,000 lines, so no diff text was recorded.',
|
||||
'lines': 'The change is over 20,000 lines, so no diff text was recorded.',
|
||||
'evidence_size':
|
||||
"This visit's recorded changes reached their size limit, so this patch "
|
||||
'was dropped.',
|
||||
@@ -24,6 +24,15 @@ const _expected = {
|
||||
"The file's content at stage start couldn't be recovered from Git, so no "
|
||||
'diff was recorded.',
|
||||
'binary': 'Binary file; only its metadata was recorded.',
|
||||
'symlink': 'Symbolic link; only the change to its target was recorded.',
|
||||
'protected':
|
||||
'A protected file (secrets, credentials or a database); its content is '
|
||||
'never read, only that it changed.',
|
||||
'generated':
|
||||
'A lockfile, minified or generated file; it is listed without a diff.',
|
||||
'large':
|
||||
'This file is too large to hash, so it was compared by size and '
|
||||
'modification time only.',
|
||||
};
|
||||
|
||||
FileChange _noPatch(Object? reason, {bool binary = false}) =>
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:pipelines_app/features/graph/domain/check_stage.dart';
|
||||
import 'package:pipelines_app/features/graph/domain/graph_definition.dart';
|
||||
import 'package:pipelines_app/features/graph/domain/stage_definition.dart';
|
||||
|
||||
Map<String, dynamic> _verify({Map<String, dynamic>? configs}) => {
|
||||
'key': 'verify',
|
||||
'type': 'check',
|
||||
'configs':
|
||||
configs ??
|
||||
{
|
||||
'command_timeout': '15m',
|
||||
'timeout': '1h',
|
||||
'keep_going': 'true',
|
||||
'delivery': 'true',
|
||||
},
|
||||
'edges': {'pass': 'review', 'fail': 'implement', 'error': '#failure'},
|
||||
'blocks': {'commands': 'go vet ./...\n\ngo test ./...\n'},
|
||||
'prompt': '',
|
||||
'output': '',
|
||||
};
|
||||
|
||||
void main() {
|
||||
test('a check stage reads its commands, one per non-blank line', () {
|
||||
expect(isCheckStage(_verify()), isTrue);
|
||||
expect(checkCommands(_verify()), ['go vet ./...', 'go test ./...']);
|
||||
expect(isCheckStage({'type': 'model'}), isFalse);
|
||||
expect(isCheckStage({'key': 'x'}), isFalse);
|
||||
});
|
||||
|
||||
test('the delivery config marks the gate, and only on a check stage', () {
|
||||
expect(isDeliveryGate(_verify()), isTrue);
|
||||
expect(isDeliveryGate(_verify(configs: {'delivery': 'false'})), isFalse);
|
||||
expect(isDeliveryGate(_verify(configs: {})), isFalse);
|
||||
expect(
|
||||
isDeliveryGate({
|
||||
'type': 'model',
|
||||
'configs': {'delivery': 'true'},
|
||||
}),
|
||||
isFalse,
|
||||
);
|
||||
});
|
||||
|
||||
test('graph nodes carry the stage type and the gate caption', () {
|
||||
final nodes = graphNodes({
|
||||
'stages': [
|
||||
_verify(),
|
||||
{
|
||||
..._verify(configs: {}),
|
||||
'key': 'lint',
|
||||
},
|
||||
{
|
||||
'key': 'review',
|
||||
'edges': {'success': '#'},
|
||||
},
|
||||
],
|
||||
});
|
||||
final byKey = {for (final node in nodes) node.key: node};
|
||||
expect(byKey['verify']!.kindCaption, 'Delivery gate');
|
||||
expect(byKey['lint']!.kindCaption, 'Check');
|
||||
expect(byKey['review']!.kindCaption, isNull);
|
||||
expect(byKey['#success']!.kindCaption, isNull);
|
||||
});
|
||||
|
||||
test('a check definition lists its commands in place of a prompt', () {
|
||||
final fields = stageDefinitionFields(_verify());
|
||||
final byLabel = {for (final field in fields) field.label: field};
|
||||
expect(byLabel['Type']!.value, 'check (delivery gate)');
|
||||
final commands = byLabel['Commands']!;
|
||||
expect(commands.value, 'go vet ./...\ngo test ./...');
|
||||
expect(commands.monospace, isTrue);
|
||||
expect(byLabel.containsKey('Prompt'), isFalse);
|
||||
expect(byLabel['Command timeout']!.value, '15m');
|
||||
expect(byLabel['Keep going']!.value, 'true');
|
||||
expect(byLabel['Delivery gate']!.value, 'true');
|
||||
expect(byLabel['Outcomes']!.value, contains('pass → review'));
|
||||
expect(byLabel['Outcomes']!.value, contains('fail → implement'));
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:pipelines_app/features/graph/domain/graph_definition.dart';
|
||||
import 'package:pipelines_app/features/graph/widgets/graph_stage_node.dart';
|
||||
import 'package:pipelines_app/features/graph/widgets/stage_definition_view.dart';
|
||||
import 'package:pipelines_app/ui/text/monospace.dart';
|
||||
|
||||
Map<String, dynamic> _graph() => {
|
||||
'stages': [
|
||||
{
|
||||
'key': 'verify',
|
||||
'type': 'check',
|
||||
'configs': {'delivery': 'true'},
|
||||
'edges': {'pass': '#', 'fail': 'fix'},
|
||||
'blocks': {'commands': 'go vet ./...\ngo test ./...'},
|
||||
},
|
||||
{
|
||||
'key': 'fix',
|
||||
'type': 'model',
|
||||
'prompt': 'Fix it.',
|
||||
'edges': {'success': 'verify'},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
Widget _host(Widget child) => MaterialApp(
|
||||
home: Scaffold(body: Center(child: child)),
|
||||
);
|
||||
|
||||
void main() {
|
||||
testWidgets('a check node shows its kind under its name', (tester) async {
|
||||
final nodes = {for (final node in graphNodes(_graph())) node.key: node};
|
||||
await tester.pumpWidget(
|
||||
_host(
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
GraphStageNode(node: nodes['verify']!, onSelected: (_) {}),
|
||||
GraphStageNode(node: nodes['fix']!, onSelected: (_) {}),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(find.byKey(const ValueKey('graph-node-kind-verify')), findsOne);
|
||||
expect(find.byKey(const ValueKey('graph-node-kind-fix')), findsNothing);
|
||||
expect(find.text('Delivery gate'), findsOne);
|
||||
expect(find.byIcon(Icons.verified_outlined), findsOne);
|
||||
expect(find.bySemanticsLabel('verify\nDelivery gate'), findsOne);
|
||||
expect(find.bySemanticsLabel('fix'), findsOne);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
testWidgets('a check definition lists its commands in monospace', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: StageDefinitionView(
|
||||
graph: _graph(),
|
||||
stageKey: 'verify',
|
||||
pipelineId: 1,
|
||||
pipelineName: 'Demo',
|
||||
version: 3,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
final commands = tester.widget<SelectableText>(
|
||||
find.descendant(
|
||||
of: find.byKey(const ValueKey('stage-definition-Commands')),
|
||||
matching: find.byType(SelectableText),
|
||||
),
|
||||
);
|
||||
expect(commands.data, 'go vet ./...\ngo test ./...');
|
||||
expect(commands.style?.fontFamily, appMonospaceFamily);
|
||||
expect(find.text('check (delivery gate)'), findsOne);
|
||||
expect(find.text('Prompt'), findsNothing);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:pipelines_app/features/runs/domain/check_step_output.dart';
|
||||
|
||||
void main() {
|
||||
test('a check output reads each command result', () {
|
||||
final output = checkStepOutput({
|
||||
'markdown': '# outcome\n\nfail\n',
|
||||
'summary': '1 of 2 checks failed: go test ./...',
|
||||
'delivery': true,
|
||||
'checks': [
|
||||
{
|
||||
'command': 'go vet ./...',
|
||||
'status': 'passed',
|
||||
'exit_code': 0,
|
||||
'duration_ms': 2100,
|
||||
'output': '',
|
||||
'truncated': false,
|
||||
},
|
||||
{
|
||||
'command': 'go test ./...',
|
||||
'status': 'failed',
|
||||
'exit_code': 1,
|
||||
'duration_ms': 51000,
|
||||
'output': '--- FAIL',
|
||||
'truncated': true,
|
||||
},
|
||||
{'command': 'make lint', 'status': 'not_run'},
|
||||
'not a map',
|
||||
],
|
||||
})!;
|
||||
expect(output.delivery, isTrue);
|
||||
expect(output.summary, '1 of 2 checks failed: go test ./...');
|
||||
expect(output.markdown, startsWith('# outcome'));
|
||||
expect(output.checks, hasLength(3));
|
||||
final [vet, test, lint] = output.checks;
|
||||
expect(vet.status, CheckCommandStatus.passed);
|
||||
expect(vet.meta, 'exit 0 · 2.1s');
|
||||
expect(test.status, CheckCommandStatus.failed);
|
||||
expect(test.meta, 'exit 1 · 51s');
|
||||
expect(test.truncated, isTrue);
|
||||
expect(lint.status, CheckCommandStatus.notRun);
|
||||
expect(lint.meta, '');
|
||||
expect(checkStatusLabel(lint), 'Not run');
|
||||
});
|
||||
|
||||
test('statuses this client does not know keep their own word', () {
|
||||
final output = checkStepOutput({
|
||||
'checks': [
|
||||
{'command': 'x', 'status': 'skipped_by_policy'},
|
||||
{'command': 'y'},
|
||||
{'command': 'z', 'status': 'timed_out'},
|
||||
],
|
||||
})!;
|
||||
expect(output.checks[0].status, CheckCommandStatus.unknown);
|
||||
expect(checkStatusLabel(output.checks[0]), 'skipped_by_policy');
|
||||
expect(checkStatusLabel(output.checks[1]), 'Unknown status');
|
||||
expect(checkStatusLabel(output.checks[2]), 'Timed out');
|
||||
expect(output.delivery, isFalse);
|
||||
});
|
||||
|
||||
test('outputs without a checks list are not check outputs', () {
|
||||
expect(checkStepOutput(null), isNull);
|
||||
expect(checkStepOutput('text'), isNull);
|
||||
expect(checkStepOutput({'markdown': '# outcome'}), isNull);
|
||||
expect(checkStepOutput({'checks': 'go test'}), isNull);
|
||||
});
|
||||
|
||||
test('durations read compactly', () {
|
||||
expect(formatCheckDuration(850), '850ms');
|
||||
expect(formatCheckDuration(2000), '2s');
|
||||
expect(formatCheckDuration(2100), '2.1s');
|
||||
expect(formatCheckDuration(51000), '51s');
|
||||
expect(formatCheckDuration(185000), '3m 05s');
|
||||
expect(formatCheckDuration(3720000), '1h 02m');
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_check_output_view.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_detail_visit_facts.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_detail_visit_sections.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_detail_visit_session_state.dart';
|
||||
import 'package:pipelines_app/ui/text/monospace.dart';
|
||||
|
||||
import 'run_detail_graph_support.dart';
|
||||
import 'run_detail_visit_support.dart';
|
||||
|
||||
/// verify (a delivery check) -> review, with one failed check visit.
|
||||
JsonMap _checkRun({int repairs = 0}) => <String, dynamic>{
|
||||
'id': 78,
|
||||
'title': 'Check run',
|
||||
'name': 'release',
|
||||
'pipeline_id': 7,
|
||||
'version': 4,
|
||||
'status': 'succeeded',
|
||||
'graph': <String, dynamic>{
|
||||
'stages': <dynamic>[
|
||||
<String, dynamic>{
|
||||
'key': 'verify',
|
||||
'type': 'check',
|
||||
'configs': <String, dynamic>{'delivery': 'true'},
|
||||
'edges': <String, String?>{'pass': '#', 'fail': 'verify'},
|
||||
'blocks': <String, dynamic>{'commands': 'go vet ./...\ngo test ./...'},
|
||||
},
|
||||
],
|
||||
},
|
||||
'steps': <dynamic>[
|
||||
<String, dynamic>{
|
||||
'stage': 'verify',
|
||||
'sequence': 1,
|
||||
'status': 'completed',
|
||||
'outcome': 'fail',
|
||||
'target': 'verify',
|
||||
'started_at': '2026-10-22T00:00:00Z',
|
||||
'finished_at': '2026-10-22T00:01:00Z',
|
||||
if (repairs > 0)
|
||||
'control': <String, dynamic>{'visit': 1, 'outcome_repairs': repairs},
|
||||
'output': <String, dynamic>{
|
||||
'markdown': '# outcome\n\nfail\n\n# handoff\n\nFix the test.',
|
||||
'summary': '1 of 2 checks failed: go test ./...',
|
||||
'delivery': true,
|
||||
'checks': <dynamic>[
|
||||
<String, dynamic>{
|
||||
'command': 'go vet ./...',
|
||||
'status': 'passed',
|
||||
'exit_code': 0,
|
||||
'duration_ms': 2100,
|
||||
'output': 'vet ok',
|
||||
'truncated': false,
|
||||
},
|
||||
<String, dynamic>{
|
||||
'command': 'go test ./...',
|
||||
'status': 'failed',
|
||||
'exit_code': 1,
|
||||
'duration_ms': 51000,
|
||||
'output': '--- FAIL: TestX',
|
||||
'truncated': true,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
void main() {
|
||||
const platform = RunDetailTestPlatform.material;
|
||||
|
||||
testWidgets('a check visit shows one row per command with its output', (
|
||||
tester,
|
||||
) async {
|
||||
await openVisit(tester, platform, run: _checkRun());
|
||||
|
||||
expect(find.byKey(const Key('run-check-output')), findsOneWidget);
|
||||
expect(find.byKey(const Key('run-check-delivery')), findsOneWidget);
|
||||
expect(find.text('1 of 2 checks failed: go test ./...'), findsOneWidget);
|
||||
expect(find.text('go vet ./...'), findsOneWidget);
|
||||
expect(find.text('Passed · exit 0 · 2.1s'), findsOneWidget);
|
||||
expect(find.text('Failed · exit 1 · 51s'), findsOneWidget);
|
||||
// The raw checks list is never shown as a `key=value` field dump.
|
||||
expect(find.text('checks'), findsNothing);
|
||||
|
||||
// Output is collapsed until the row is expanded; then it is selectable
|
||||
// monospace with the truncation note.
|
||||
expect(find.text('--- FAIL: TestX'), findsNothing);
|
||||
final row = find.byKey(const ValueKey('run-check-command-1'));
|
||||
await tester.ensureVisible(row);
|
||||
await tester.tap(find.text('go test ./...'));
|
||||
await tester.pumpAndSettle();
|
||||
final output = tester.widget<SelectableText>(
|
||||
find.widgetWithText(SelectableText, '--- FAIL: TestX'),
|
||||
);
|
||||
expect(output.style?.fontFamily, appMonospaceFamily);
|
||||
expect(find.text(checkOutputTruncated), findsOneWidget);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
|
||||
testWidgets('a check visit has no model row and an honest session note', (
|
||||
tester,
|
||||
) async {
|
||||
await openVisit(tester, platform, run: _checkRun());
|
||||
expect(find.text('Provider/model'), findsNothing);
|
||||
expect(find.text('fail'), findsWidgets);
|
||||
await openVisitTab(tester, RunVisitSection.session);
|
||||
expect(find.text(visitSessionCheck), findsOneWidget);
|
||||
expect(find.text(visitSessionNoIdentity), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('a repaired outcome is noted on the visit', (tester) async {
|
||||
await openVisit(tester, platform, run: _checkRun(repairs: 1));
|
||||
expect(find.byKey(const Key('run-visit-outcome-repaired')), findsOne);
|
||||
expect(find.text('Outcome repaired by follow-up'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('an unrepaired visit shows no repair note', (tester) async {
|
||||
await openVisit(tester, platform, run: _checkRun());
|
||||
expect(find.byKey(const Key('run-visit-outcome-repaired')), findsNothing);
|
||||
});
|
||||
|
||||
test('outcome repairs read from control, absent meaning none', () {
|
||||
expect(detailVisitOutcomeRepairs({}), 0);
|
||||
expect(detailVisitOutcomeRepairs({'control': 'x'}), 0);
|
||||
expect(
|
||||
detailVisitOutcomeRepairs({
|
||||
'control': {'visit': 2},
|
||||
}),
|
||||
0,
|
||||
);
|
||||
expect(
|
||||
detailVisitOutcomeRepairs({
|
||||
'control': {'outcome_repairs': 2},
|
||||
}),
|
||||
2,
|
||||
);
|
||||
expect(outcomeRepairNote(2), 'Outcome repaired by follow-up (2 times)');
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user