Files
pipelines/app/lib/features/runs/ui/run_check_output_view.dart
T
alan 87016ef5dc Engine: check stages, harness-agnostic delivery, read-only enforcement, complete captures
- New `type=check` stage: the server runs a `commands` block (sh -c, per
  command_timeout, workspace env) and routes on pass/fail; per-command status,
  exit code, duration and bounded output are recorded and the failing output is
  the handoff. With delivery=true it is the landing gate (commit leftovers,
  merge moved main, checks in a fresh candidate worktree, fast-forward main).
  Parser/registry, lint (silent guards), format docs, CLI inspect, app graph and
  run detail rendering.
- delivery=true is accepted on every harness (and on check stages).
- permissions.shell on claude stages maps to Bash(cmd) / Bash(prefix:*) rules
  instead of a bare Bash allow; stages without edit that change the workspace
  fail the visit with the changed files listed (allow_workspace_changes=true
  opts out; artifacts, public and harness state dirs are ignored).
- File-change capture: symlinks compared by target, untouched protected files no
  longer make captures partial, untracked caches/dependency/build output left
  out, lockfiles listed without patch, huge files compared by metadata, raised
  patch/line limits. Outcome repair follow-ups are logged and counted on the
  step (control.outcome_repairs).

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

137 lines
4.7 KiB
Dart

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,
};
}