feat(app): a timeline visit shows its own changes as a Changes section

This commit is contained in:
2026-10-23 17:27:46 +01:00
parent 5e5b48a393
commit 7d9b3da936
3 changed files with 26 additions and 52 deletions
@@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
import '../../../ui/adaptive/host.dart';
import 'run_changes_action.dart';
import 'run_detail_content.dart';
import 'run_detail_visit_facts.dart';
import 'run_detail_visit_sections.dart';
@@ -156,14 +155,7 @@ class _RunVisitPaneState extends State<RunVisitPane> {
spacing: 8,
runSpacing: 4,
crossAxisAlignment: WrapCrossAlignment.center,
children: [
close,
RunVisitChangesButton(
stage: widget.visit.stage,
sequence: widget.visit.sequence,
step: widget.step,
),
],
children: [close],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
import '../../../ui/adaptive/host.dart';
import '../../changes/changes.dart';
import 'run_detail_tab_bodies.dart';
import 'run_detail_tab_strip.dart';
import 'run_detail_visit_artifacts.dart';
@@ -11,12 +12,13 @@ import 'run_detail_visit_facts.dart';
import 'run_detail_visit_session.dart';
/// The visit pane's recorded sections, in the Android audit order the web
/// client follows: the turn's Input and Output, its Artifacts, its Session and
/// the authored Definition.
/// client follows: the turn's Input and Output, its Artifacts, the files this
/// visit changed, its Session and the authored Definition.
enum RunVisitSection {
input('Input'),
output('Output'),
artifacts('Artifacts'),
changes('Changes'),
session('Session'),
definition('Definition');
@@ -118,6 +120,20 @@ Widget runVisitSectionBody({
runSteps: runSteps,
configuredEndpoint: configuredEndpoint,
);
case RunVisitSection.changes:
// Only this visit's own capture; the run's final state is the run's
// Changes tab.
final viewer = ChangesViewer(
key: ValueKey('run-visit-changes-$visitIndex'),
steps: [step],
showSummary: false,
);
return cupertino
? Builder(
builder: (context) =>
Theme(data: hostTextTheme(context), child: viewer),
)
: viewer;
case RunVisitSection.session:
return RunVisitSession(
run: run,
@@ -1,8 +1,9 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/changes/changes.dart';
import 'package:pipelines_app/features/runs/ui/run_changes_action.dart';
import 'package:pipelines_app/features/runs/ui/run_detail_visit_sections.dart';
import '../../changes/fixtures.dart';
import 'run_detail_graph_support.dart';
@@ -26,10 +27,9 @@ JsonMap _capture(String path) => captureFixture(
files: <JsonMap>[fileChangeFixture(path: path, patch: multiHunkPatch)],
);
Future<void> _openVisitChanges(WidgetTester tester) async {
await tester.tap(find.byKey(runVisitChangesButtonKey));
await tester.pumpAndSettle();
}
/// A visit's own changes are a section of its pane, not a separate page.
Future<void> _openVisitChanges(WidgetTester tester) =>
openVisitTab(tester, RunVisitSection.changes);
void main() {
group('visitChangesTitle', () {
@@ -64,7 +64,7 @@ void main() {
await _openVisitChanges(tester);
expect(find.text('Changes · plan · visit 1'), findsOneWidget);
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
// The body keeps the landed viewer's own identity for that visit.
expect(find.text('plan'), findsOneWidget);
expect(find.text('Visit 1 · completed'), findsOneWidget);
@@ -83,7 +83,7 @@ void main() {
await _openVisitChanges(tester);
expect(find.text('Changes · plan · visit 1'), findsOneWidget);
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
expect(find.text(missingCaptureDetail), findsOneWidget);
// A missing capture is evidence, never an observed no-change.
expect(find.text('No changes observed'), findsNothing);
@@ -91,38 +91,4 @@ void main() {
expect(find.text('lib/build.dart'), findsNothing);
});
}
testWidgets('material: visit Changes returns to the opened pane', (
tester,
) async {
await openVisit(
tester,
RunDetailTestPlatform.material,
run: _run(planChanges: _capture('lib/plan.dart')),
);
await _openVisitChanges(tester);
await tester.tap(find.byTooltip('Back'));
await tester.pumpAndSettle();
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
expect(find.byKey(runVisitChangesButtonKey), findsOneWidget);
});
testWidgets('cupertino: visit Changes returns to the opened pane', (
tester,
) async {
await openVisit(
tester,
RunDetailTestPlatform.cupertino,
run: _run(planChanges: _capture('lib/plan.dart')),
);
await _openVisitChanges(tester);
await tester.tap(find.byType(CupertinoNavigationBarBackButton));
await tester.pumpAndSettle();
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
expect(find.byKey(runVisitChangesButtonKey), findsOneWidget);
});
}