Files
pipelines/app/tool/run_detail_graph_probe.dart
alan b60ad6d98f Remove alternate hosts from tooling probes
Keep the probe suite on the Material composition so browser fixtures and capture drivers no longer render or select Cupertino hosts. Record the final residual legacy arguments and implementation checks for the delivery gate.
2026-11-11 21:38:30 +00:00

145 lines
4.0 KiB
Dart

// Standalone fixture entry for real-browser run-detail Graph evidence.
//
// Build and probe (from app/):
// flutter build web --target tool/run_detail_graph_probe.dart \
// --output build/probe-run-detail-graph
// OPENCODE_ARTIFACT_DIR=DIR \
// node tool/run_detail_graph_probe.mjs
//
// Server-shaped fixtures only: a fake gateway answers the same get_run envelope
// the app consumes. The run's own pinned graph and recorded steps drive the
// Graph tab; no server or operator run is touched.
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 -> audit, with plan and build recorded and audit unvisited.
JsonMap _graph() => <String, dynamic>{
'name': 'Release verification',
'stages': <dynamic>[
<String, dynamic>{
'key': 'plan',
'type': 'model',
'edges': <String, String?>{'success': 'build', 'error': '#'},
'fallback_error': true,
},
<String, dynamic>{
'key': 'build',
'type': 'model',
'edges': <String, String?>{'success': 'audit', 'error': '#'},
},
<String, dynamic>{
'key': 'audit',
'type': 'model',
'edges': <String, String?>{'success': '#success', 'error': '#failure'},
},
],
};
JsonMap _run({required bool graph}) => <String, dynamic>{
'id': 488,
'title': 'Release verification',
'name': 'release',
'status': 'succeeded',
'executing': false,
'input': <String, dynamic>{'prompt': 'Verify the candidate release.'},
'output': <String, dynamic>{'result': 'verified'},
'steps': <dynamic>[
<String, dynamic>{
'stage': 'plan',
'sequence': 1,
'status': 'completed',
'outcome': 'success',
'target': 'build',
},
<String, dynamic>{
'stage': 'build',
'sequence': 2,
'status': 'completed',
'outcome': 'success',
'target': 'audit',
},
],
if (graph) 'graph': _graph(),
};
void main() {
final params = Uri.base.queryParameters;
final dark = params['theme'] == 'dark';
final scale = double.tryParse(params['scale'] ?? '') ?? 1;
final run = _run(graph: params['case'] != 'missing');
runApp(_ProbeBody(dark: dark, scale: scale, run: run));
}
class _ProbeBody extends StatefulWidget {
const _ProbeBody({
required this.dark,
required this.scale,
required this.run,
});
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(488);
}
@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!,
);
return MaterialApp(
title: 'Run graph fixture',
theme: ThemeData(brightness: theme, platform: TargetPlatform.android),
builder: scaled,
home: Scaffold(body: SafeArea(child: detail)),
);
}
}