From b024038114ec4c8ba88765d1afd23bb908641b13 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Thu, 3 Dec 2026 14:21:22 +0000 Subject: [PATCH] Capture fixture: run card graph maps, pipeline graph under graph=1 Co-Authored-By: Claude Opus 5.5 --- .../shown/chat_shown_run_map_view.dart | 2 +- app/tool/perf/chat_shown_run_map_fixture.dart | 137 ++++++++++++++++++ app/tool/perf/chat_shown_tools_fixture.dart | 27 +++- app/tool/search_selection_probe_entry.dart | 1 + 4 files changed, 162 insertions(+), 5 deletions(-) create mode 100644 app/tool/perf/chat_shown_run_map_fixture.dart diff --git a/app/lib/features/chat/ui/transcript/shown/chat_shown_run_map_view.dart b/app/lib/features/chat/ui/transcript/shown/chat_shown_run_map_view.dart index 4b65605e..468b8442 100644 --- a/app/lib/features/chat/ui/transcript/shown/chat_shown_run_map_view.dart +++ b/app/lib/features/chat/ui/transcript/shown/chat_shown_run_map_view.dart @@ -5,7 +5,7 @@ import '../../../domain/chat_shown_run.dart'; /// The mini-map's height: enough for one row of stages and the ends below it /// at a glance, small enough to keep the card compact. -const double chatShownRunMapHeight = 136; +const double chatShownRunMapHeight = 160; /// A `show_run` card's graph: a still mini-map of the run's pipeline drawn by /// the run graph itself (visited stages with their status, the live stage's diff --git a/app/tool/perf/chat_shown_run_map_fixture.dart b/app/tool/perf/chat_shown_run_map_fixture.dart new file mode 100644 index 00000000..44b61b59 --- /dev/null +++ b/app/tool/perf/chat_shown_run_map_fixture.dart @@ -0,0 +1,137 @@ +// The graph maps the `shown=2` run cards carry (ChatShownRunMap): a release +// running its second review after one round of changes, a feature that failed +// its tests, and a docs run that succeeded. +import 'package:pipelines_app/core/api_gateway.dart'; + +JsonMap _stage( + String key, + Map edges, { + int visits = 0, + String status = '', + int seconds = 0, + int? runningSince, + bool fallbackError = false, +}) => { + 'key': key, + 'type': 'model', + 'edges': edges, + if (fallbackError) 'fallback_error': true, + if (visits > 0) 'visits': visits, + if (status.isNotEmpty) 'status': status, + if (seconds > 0) 'seconds': seconds, + 'running_since': ?runningSince, +}; + +JsonMap _visit( + int sequence, + String stage, + String status, [ + String outcome = '', + String target = '', +]) => { + 'sequence': sequence, + 'stage': stage, + 'status': status, + 'outcome': outcome, + 'target': target, +}; + +/// plan → implement → review, review sending changes back to implement. +JsonMap releaseRunningMap(int reviewSince) => { + 'stages': [ + _stage( + 'plan', + {'success': 'implement'}, + visits: 1, + status: 'completed', + seconds: 84, + ), + _stage( + 'implement', + {'success': 'review'}, + visits: 2, + status: 'completed', + seconds: 431, + fallbackError: true, + ), + _stage( + 'review', + {'success': 'publish', 'changes': 'implement'}, + visits: 2, + status: 'running', + seconds: 95, + runningSince: reviewSince, + ), + _stage('publish', {'success': '#'}), + ], + 'visits': [ + _visit(1, 'plan', 'completed', 'success', 'implement'), + _visit(3, 'review', 'completed', 'changes', 'implement'), + _visit(4, 'implement', 'completed', 'success', 'review'), + _visit(5, 'review', 'running'), + ], +}; + +/// plan → implement → test, the tests failing into the failure end. +JsonMap featureFailedMap() => { + 'stages': [ + _stage( + 'plan', + {'success': 'implement'}, + visits: 1, + status: 'completed', + seconds: 62, + ), + _stage( + 'implement', + {'success': 'test'}, + visits: 1, + status: 'completed', + seconds: 318, + ), + _stage( + 'test', + {'success': '#', 'tests_failed': '#failure'}, + visits: 1, + status: 'failed', + seconds: 190, + ), + ], + 'visits': [ + _visit(1, 'plan', 'completed', 'success', 'implement'), + _visit(2, 'implement', 'completed', 'success', 'test'), + _visit(3, 'test', 'failed', 'tests_failed', '#failure'), + ], +}; + +/// draft → check → publish, all passed. +JsonMap docsSucceededMap() => { + 'stages': [ + _stage( + 'draft', + {'success': 'check'}, + visits: 1, + status: 'completed', + seconds: 141, + ), + _stage( + 'check', + {'success': 'publish', 'fix': 'draft'}, + visits: 1, + status: 'completed', + seconds: 22, + ), + _stage( + 'publish', + {'success': '#'}, + visits: 1, + status: 'completed', + seconds: 9, + ), + ], + 'visits': [ + _visit(1, 'draft', 'completed', 'success', 'check'), + _visit(2, 'check', 'completed', 'success', 'publish'), + _visit(3, 'publish', 'completed', 'success', '#'), + ], +}; diff --git a/app/tool/perf/chat_shown_tools_fixture.dart b/app/tool/perf/chat_shown_tools_fixture.dart index 1c59c5ee..e7f244cc 100644 --- a/app/tool/perf/chat_shown_tools_fixture.dart +++ b/app/tool/perf/chat_shown_tools_fixture.dart @@ -1,11 +1,13 @@ // `?shown=2` (with `?chats=N×tamps=1&files=1`): the subscribe reply // carries the newer shown entries instead of the `shown=1` set, after the -// bench transcript's last answer: a dark-aware and a light-only HTML view, a -// run card running and one finished, a file changed since it was shown, an -// image that no longer exists, a web image the server fetched, and a diff of -// a revision limited to some paths. +// bench transcript's last answer: a dark-aware and a light-only HTML view, +// run cards running, failed and succeeded (each with its graph map), a file +// changed since it was shown, an image that no longer exists, a web image the +// server fetched, and a diff of a revision limited to some paths. import 'package:pipelines_app/core/api_gateway.dart'; +import 'chat_shown_run_map_fixture.dart'; + int _at(int minute, int second) => DateTime.utc(2026, 11, 5, 9, minute, second).millisecondsSinceEpoch; @@ -70,6 +72,7 @@ JsonMap chatShownToolsFixture(Object? sessionId) => { 'status': 'running', 'current_stage': 'review', 'started_at': _now - 754000, + 'map': releaseRunningMap(_now - 40000), }, }, { @@ -84,6 +87,22 @@ JsonMap chatShownToolsFixture(Object? sessionId) => { 'outcome': 'tests_failed', 'started_at': _at(1, 0), 'finished_at': _at(9, 30), + 'map': featureFailedMap(), + }, + }, + { + 'id': 'shown-run-ok', + 'kind': 'run', + 'created_at': _at(19, 27), + 'run': { + 'id': 5, + 'pipeline': 'Docs', + 'title': 'Refresh the install guide', + 'status': 'succeeded', + 'outcome': 'success', + 'started_at': _at(10, 0), + 'finished_at': _at(12, 52), + 'map': docsSucceededMap(), }, }, { diff --git a/app/tool/search_selection_probe_entry.dart b/app/tool/search_selection_probe_entry.dart index 0b3add4b..4cbaa584 100644 --- a/app/tool/search_selection_probe_entry.dart +++ b/app/tool/search_selection_probe_entry.dart @@ -343,6 +343,7 @@ JsonMap probePipelineDetail(int id, int requestedVersion) { 'version_created_at': '2026-10-18T16:05:00', 'content_hash': 'sha256:probe-$id-v$version', 'source': _releaseSource, + if (perfRunGraph) 'graph': perfRunGraphFixture(), 'versions': [ for (var v = 1; v <= latest; v++) {