3ee5d0e407
Split the export model/classification from the session wording, add the no-session, selected-repair and missing-evidence coverage, and update the parity matrix and R4 note. The visit probe now passes the scheme name its fixture reads, asserts the painted theme before capture and re-captures the export states.
252 lines
7.2 KiB
Dart
252 lines
7.2 KiB
Dart
// Standalone fixture entry for real-browser recorded-visit pane evidence.
|
|
//
|
|
// Build and probe (from app/):
|
|
// flutter build web --target tool/run_detail_visit_probe.dart \
|
|
// --output build/probe-run-detail-visit
|
|
// PROBE_VARIANT=material OPENCODE_ARTIFACT_DIR=DIR \
|
|
// node tool/run_detail_visit_probe.mjs
|
|
//
|
|
// Server-shaped fixtures only: a fake gateway answers the same get_run envelope
|
|
// the app consumes. No server or operator run is touched.
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:pipelines_app/core/api_gateway.dart';
|
|
import 'package:pipelines_app/features/runs/data/runs_repository.dart';
|
|
import 'package:pipelines_app/features/runs/ui/run_detail_view.dart';
|
|
import 'package:pipelines_app/features/runs/ui/runs_controller.dart';
|
|
|
|
class _FakeGateway implements ApiGateway {
|
|
_FakeGateway(this.detail);
|
|
|
|
final JsonMap detail;
|
|
|
|
@override
|
|
Stream<JsonMap> get frames => const Stream<JsonMap>.empty();
|
|
|
|
@override
|
|
Future<JsonMap> call(String type, [JsonMap fields = const {}]) {
|
|
if (type != 'get_run') throw UnsupportedError(type);
|
|
return Future.value({'run_detail': detail});
|
|
}
|
|
}
|
|
|
|
/// plan -> build, with a rich first visit, a sparse second visit, a third visit
|
|
/// whose complete export carries a recorded failed repair, and a fourth whose
|
|
/// export is partial with a diagnostic.
|
|
JsonMap _graph() => <String, dynamic>{
|
|
'name': 'Release verification',
|
|
'stages': <dynamic>[
|
|
<String, dynamic>{
|
|
'key': 'plan',
|
|
'type': 'model',
|
|
'prompt': 'Draft the plan.',
|
|
'output': 'A plan.',
|
|
'edges': <String, String?>{'success': 'build', 'error': '#'},
|
|
},
|
|
<String, dynamic>{
|
|
'key': 'build',
|
|
'type': 'model',
|
|
'prompt': 'Build the candidate.',
|
|
'edges': <String, String?>{'success': '#success', 'error': '#'},
|
|
},
|
|
],
|
|
};
|
|
|
|
JsonMap _run() => <String, dynamic>{
|
|
'id': 512,
|
|
'title': 'Release verification',
|
|
'name': 'release',
|
|
'pipeline_id': 7,
|
|
'version': 3,
|
|
'status': 'succeeded',
|
|
'executing': false,
|
|
'input': <String, dynamic>{'prompt': 'Verify the candidate release.'},
|
|
'output': <String, dynamic>{'result': 'verified'},
|
|
'graph': _graph(),
|
|
'steps': <dynamic>[
|
|
<String, dynamic>{
|
|
'stage': 'plan',
|
|
'sequence': 1,
|
|
'status': 'completed',
|
|
'outcome': 'success',
|
|
'target': 'build',
|
|
'provider': 'anthropic',
|
|
'model': 'claude-x',
|
|
'started_at': '2026-10-22T00:00:00Z',
|
|
'finished_at': '2026-10-22T00:02:05Z',
|
|
'diagnostic': 'Plan checked.',
|
|
'verdict': <String, dynamic>{
|
|
'option': 'approve',
|
|
'reason': 'Looks good.',
|
|
},
|
|
'input': <String, dynamic>{'markdown': 'Draft the plan.\n'},
|
|
'output': <String, dynamic>{'result': 'ok'},
|
|
'session_id': 'sess-1',
|
|
'session_export': <String, dynamic>{
|
|
'html': 'session.html',
|
|
'status': 'complete',
|
|
'messages': 3,
|
|
'html_bytes': 1234,
|
|
},
|
|
'artifacts': <dynamic>[
|
|
<String, dynamic>{
|
|
'name': 'plan.csv',
|
|
'url': 'https://example.test/artifacts/plan.csv',
|
|
'content_type': 'text/csv',
|
|
'size_bytes': 42,
|
|
},
|
|
<String, dynamic>{
|
|
'name': 'session.html',
|
|
'url': 'https://example.test/artifacts/session.html',
|
|
'content_type': 'text/html',
|
|
'size_bytes': 100,
|
|
},
|
|
],
|
|
},
|
|
<String, dynamic>{
|
|
'stage': 'build',
|
|
'sequence': 2,
|
|
'status': 'completed',
|
|
'outcome': 'success',
|
|
'target': '#success',
|
|
'diagnostic': 'Built.',
|
|
},
|
|
<String, dynamic>{
|
|
'stage': 'audit',
|
|
'sequence': 3,
|
|
'status': 'completed',
|
|
'outcome': 'success',
|
|
'target': '#success',
|
|
'diagnostic': 'Audited.',
|
|
'session_id': 'sess-2',
|
|
'session_export': <String, dynamic>{
|
|
'html': 'session.html',
|
|
'status': 'complete',
|
|
'messages': 3,
|
|
'html_bytes': 500,
|
|
},
|
|
'session_export_repairs': <dynamic>[
|
|
<String, dynamic>{
|
|
'html': 'session-repair-1.html',
|
|
'status': 'failed',
|
|
'messages': 0,
|
|
'diagnostic': 'The repair read failed.',
|
|
},
|
|
],
|
|
'artifacts': <dynamic>[
|
|
<String, dynamic>{
|
|
'name': 'session.html',
|
|
'url': 'https://example.test/artifacts/session.html',
|
|
'content_type': 'text/html',
|
|
'size_bytes': 100,
|
|
},
|
|
<String, dynamic>{
|
|
'name': 'session-repair-1.html',
|
|
'url': 'https://example.test/artifacts/session-repair-1.html',
|
|
'content_type': 'text/html',
|
|
'size_bytes': 100,
|
|
},
|
|
],
|
|
},
|
|
<String, dynamic>{
|
|
'stage': 'partial',
|
|
'sequence': 4,
|
|
'status': 'completed',
|
|
'outcome': 'success',
|
|
'target': '#success',
|
|
'diagnostic': 'Partial export recorded.',
|
|
'session_id': 'sess-3',
|
|
'session_export': <String, dynamic>{
|
|
'html': 'session.html',
|
|
'status': 'failed',
|
|
'messages': 2,
|
|
'diagnostic': 'The native read was refused.',
|
|
},
|
|
'artifacts': <dynamic>[
|
|
<String, dynamic>{
|
|
'name': 'session.html',
|
|
'url': 'https://example.test/artifacts/session.html',
|
|
'content_type': 'text/html',
|
|
'size_bytes': 100,
|
|
},
|
|
],
|
|
},
|
|
],
|
|
};
|
|
|
|
void main() {
|
|
final params = Uri.base.queryParameters;
|
|
final cupertino = params['platform'] == 'cupertino';
|
|
final dark = params['theme'] == 'dark';
|
|
final scale = double.tryParse(params['scale'] ?? '') ?? 1;
|
|
runApp(
|
|
_ProbeBody(cupertino: cupertino, dark: dark, scale: scale, run: _run()),
|
|
);
|
|
}
|
|
|
|
class _ProbeBody extends StatefulWidget {
|
|
const _ProbeBody({
|
|
required this.cupertino,
|
|
required this.dark,
|
|
required this.scale,
|
|
required this.run,
|
|
});
|
|
|
|
final bool cupertino;
|
|
final bool dark;
|
|
final double scale;
|
|
final JsonMap run;
|
|
|
|
@override
|
|
State<_ProbeBody> createState() => _ProbeBodyState();
|
|
}
|
|
|
|
class _ProbeBodyState extends State<_ProbeBody> {
|
|
late final _FakeGateway _gateway = _FakeGateway(widget.run);
|
|
late final RunsController _controller = RunsController(
|
|
RunsRepository(_gateway),
|
|
);
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_controller.select(512);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_controller.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final detail = RunDetailView(
|
|
controller: _controller,
|
|
gateway: _gateway,
|
|
onBack: () {},
|
|
);
|
|
final theme = widget.dark ? Brightness.dark : Brightness.light;
|
|
Widget scaled(BuildContext context, Widget? app) => MediaQuery(
|
|
data: MediaQuery.of(
|
|
context,
|
|
).copyWith(textScaler: TextScaler.linear(widget.scale)),
|
|
child: app!,
|
|
);
|
|
if (widget.cupertino) {
|
|
return CupertinoApp(
|
|
title: 'Visit pane fixture',
|
|
theme: CupertinoThemeData(brightness: theme),
|
|
builder: scaled,
|
|
home: CupertinoPageScaffold(child: SafeArea(child: detail)),
|
|
);
|
|
}
|
|
return MaterialApp(
|
|
title: 'Visit pane fixture',
|
|
theme: ThemeData(brightness: theme, platform: TargetPlatform.android),
|
|
builder: scaled,
|
|
home: Scaffold(body: SafeArea(child: detail)),
|
|
);
|
|
}
|
|
}
|