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>
This commit is contained in:
2026-12-03 12:52:16 +00:00
parent c4de1de27b
commit 87016ef5dc
47 changed files with 2674 additions and 129 deletions
@@ -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);
});
}