// 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 // PROBE_VARIANT=material 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/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 get frames => const Stream.empty(); @override Future 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() => { 'name': 'Release verification', 'stages': [ { 'key': 'plan', 'type': 'model', 'edges': {'success': 'build', 'error': '#'}, 'fallback_error': true, }, { 'key': 'build', 'type': 'model', 'edges': {'success': 'audit', 'error': '#'}, }, { 'key': 'audit', 'type': 'model', 'edges': {'success': '#success', 'error': '#failure'}, }, ], }; JsonMap _run({required bool graph}) => { 'id': 488, 'title': 'Release verification', 'name': 'release', 'status': 'succeeded', 'executing': false, 'input': {'prompt': 'Verify the candidate release.'}, 'output': {'result': 'verified'}, 'steps': [ { 'stage': 'plan', 'sequence': 1, 'status': 'completed', 'outcome': 'success', 'target': 'build', }, { 'stage': 'build', 'sequence': 2, 'status': 'completed', 'outcome': 'success', 'target': 'audit', }, ], if (graph) 'graph': _graph(), }; void main() { final params = Uri.base.queryParameters; final cupertino = params['platform'] == 'cupertino'; final dark = params['theme'] == 'dark'; final scale = double.tryParse(params['scale'] ?? '') ?? 1; final run = _run(graph: params['case'] != 'missing'); 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(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!, ); if (widget.cupertino) { return CupertinoApp( title: 'Run graph fixture', theme: CupertinoThemeData(brightness: theme), builder: scaled, home: CupertinoPageScaffold(child: SafeArea(child: detail)), ); } return MaterialApp( title: 'Run graph fixture', theme: ThemeData(brightness: theme, platform: TargetPlatform.android), builder: scaled, home: Scaffold(body: SafeArea(child: detail)), ); } }