diff --git a/app/notes/detail-bodies-fixes.md b/app/notes/detail-bodies-fixes.md new file mode 100644 index 00000000..aa12a6d5 --- /dev/null +++ b/app/notes/detail-bodies-fixes.md @@ -0,0 +1,170 @@ +# Run, stage and pipeline detail bodies (style review round 2: B, C, E) + +These are fixes from the second style review +(`/tmp/app-style-review-r2/report-summary.md`): + +- P1-2: Cupertino summary pages were a patchwork of grouped bands. +- P2-2: run detail chrome. +- P2-3: the pipeline Summary read as a document. + +The shell, the floating destination bar, templates, settings, chat, +`segmented_bar*.dart` and `sticky_section.dart` were out of scope and are +untouched. + +## One approach: flat on the page, both hosts + +The run detail, the stage (visit) page and the pipeline detail now use the +flat list style on both hosts, as Material already did. The Cupertino page +stays the theme's page colour (`AppColors.background`: white, or `#141416` in +dark mode). Content sits directly on it: + +- facts as a grid; +- sections under quiet headings; +- rows as `AppListRow` with inset dividers. + +There is no `CupertinoListSection.insetGrouped` left in these bodies, so no +group can be nested inside another. Settings and Templates keep their grouped +background. They are lists of settings and choices, not detail documents. + +- `SectionHeadingStyle` (`lib/ui/layout/section_heading.dart`): + - On Cupertino, the background and body are now the theme's + `scaffoldBackgroundColor`, not `systemGroupedBackground`. Pinned sticky + headings (Input/Output, the artifact groups) used to be grey bands, or + black bands in dark mode. They now blend into the page, as on Material. + `sticky_section.dart` itself is unchanged. + - New `header` flag: it marks the title (only) as a heading for semantics. +- `FactsGrid` (`lib/ui/layout/facts_grid.dart`, new) is shared by the run and + pipeline Summaries: + - two facts per line below 600 wide, three from 600; + - a long (over 28 characters), `wide` or monospace value takes a whole line; + - the `Wrap` is wrapped in a full-width `SizedBox`, so a single fact sits at + x=16 instead of a half-width card centred on the page; + - no card of its own; + - optional `cupertino` override. +- Run Summary (`run_detail_tab_bodies.dart`): + - the facts are a `FactsGrid`, keeping `run-detail-summary-facts` and the + `run-detail-summary-` cell keys; + - the Cupertino Input/Output field tabs no longer wrap the body in an inset + group; + - the old `_summaryFacts` was removed. +- Timeline (`run_detail_timeline.dart`): + - rows are `AppListRow` with the status avatar (as in the runs list); + - the title is the visit, the time is the duration, and the line is the + outcome chip then `→ target`; + - inset dividers between rows, on a flat list on both hosts; + - the "Timeline" group header and the `CupertinoListTile`/`ListTile` are + gone; + - the keys `run-timeline-visit-` and `run-detail-tab-body-timeline` + are kept. +- Stage Session (`run_detail_visit_session.dart`): the Cupertino inset group + is gone, and the body is the same padded flat list as on Material. +- `ArtifactDocumentSection`: the Cupertino "Turn documents" inset group (the + group nested in the Session group) is now the same flat titled rows as on + Material, with the heading in the quiet section style. +- `ArtifactVisitList`: the grid/list switch's pinned bar was `StickyBar`, a + grouped-background band. It is now a local `PinnedHeaderSliver` on the + heading/page colour. +- The standalone `ArtifactGalleryPage` no longer forces the grouped + background on Cupertino. + +## Run detail chrome (P2-2) + +- No graph: `RunGraphPreview` now shows `runGraphMissing` as one muted line + (key `run-graph-preview-missing`). There is no 200px outlined box, and + nothing to tap or open. +- Wide (pane tabs at the top, pane at least 600 wide): + - `RunDetailWideChrome` (new, `run_detail_wide_chrome.dart`) puts the tabs + and the header (status kicker, Cancel/Retry, notices, decision banner) in + one floating row under the bar; + - the tabs lead, in line with the title pill, and take at most 60% of the + row; the header follows as a glass piece (key `run-detail-header`); + - before, this was title pill, then the status strip, then the tabs strip: + about 200px before content; + - narrower panes and phone pages keep the header strip under the bar, with + the tabs at the bottom. +- The Pipeline fact is dropped from the Summary when the run has a pipeline + name. That name is already in the bar's subtitle, and the title opens the + pipeline. `detailSummaryRows` itself is unchanged. +- Decision banner: the tinted, bordered card inside the grey header strip is + now a flat line of the strip. It keeps the teal glyph, the title over the + meta line, and Decide. The key `run-decision-banner` is kept. + +## Pipeline Summary (P2-3) + +- Facts: the five label/value rows are now a `FactsGrid` (key + `pipeline-summary-facts`, cells `pipeline-summary-`). + - The content hash takes a whole line (`wide`). It keeps the host font, + because the pipeline detail's no-monospace choice is untouched (P2-6 is + still a pending decision). + - Blank values are omitted instead of drawn empty. +- Schedules (`schedule_pipeline_list_body.dart`): + - The heading is a quiet `SectionHeading` ("Schedules (n)"), with Add as its + only trailing action: an icon button whose tooltip/semantics is "Add + schedule" (key `schedule-pipeline-add` kept). + - The inline Refresh is removed, with `scheduleRefreshKey`/`Label`. The + section reloads after every accepted mutation and has Retry on failure. + Note that the pipeline bar has no Refresh. The review assumed it did. + - The standing paragraph is gone. Its sentence is appended to the empty + state. +- Versions: + - `AppListRow` rows under a quiet "Versions" heading. The title is `vN`, the + time is the created date, and the line is `N stages`, plus `latest` when + it is the latest version. + - The shown version is the selected row (fill and selected semantics). This + replaces the check icon. + - "View latest vN" is a row too. + - Keys `pipeline-version-` and `pipeline-latest-version` are kept. + +## Tests + +- New: + - `test/features/runs/ui/run_detail_flat_bodies_test.dart`, both hosts: + - no `CupertinoListSection` on Summary or Timeline; + - the stage Session has Turn documents but no group (no nested groups); + - beside a list (`PageTabsEdge.top`, 720 wide) the header sits to the + right of the tabs and overlaps them vertically (one row); + - Cupertino heading scrim equals the page colour in light and dark. + - `test/features/pipelines/pipeline_summary_flat_test.dart`, both hosts: + - facts grid with short facts side by side; + - no Refresh, Add is an icon in the heading; + - no grouped section or `ListTile`; + - the version row is a selected `AppListRow`. +- `run_detail_summary_fields_test`: + - new single-fact case: the grid spans 900, the fact is at x=16 and left of + centre, and there is no group (the centred-card regression); + - the recorded-rows case now expects no Pipeline fact (it is in the bar). +- `run_detail_tabs_test` "missing graph": now expects one line on Summary, + with no preview, `RunGraphView` or frame, and under 60px tall. +- Updated for intentional changes: + - `run_timeline_row_test`: target and duration split; `AppListRow`, no + section; + - `pipelines_adaptive_test`: Cupertino version rows instead of + `CupertinoListTile`; + - `schedule_pipeline_section_test`: the empty text gained the note. + +## Evidence + +Captures are in `/tmp/r3-b-evidence/`. They were taken with the reviewer's +driver (`/tmp/r3-b-scripts/shoot.mjs`, a copy of +`/tmp/app-style-review-r2/shoot.mjs` pointing at this worktree's +`pipelines_wiring_probe_server.mjs`). The spec is +`/tmp/r3-b-scripts/mkspec.py`. + +- Runs: a web build of `tool/app_host_probe_entry.dart` over the wave2-e runs + fixture. +- Pipelines: the same build over `pipelines_wiring_probe_server`. +- Names: + - `{m,c}-{run1,run5,stage,pdetail}-{560,1200}-{light,dark}`; + - `{m,c}-{run1-timeline,stage-session,stage-artifacts}-560-{light,dark}`. + +There was no device run: Android and iOS are unverified. + +## Not done / notes + +- In the stage Session, the turn documents start at x=32 to 36: the list's + 16 padding plus the section's own 16. Material already rendered it this way + before this change, and it was left alone. +- Summary bodies are still uncapped on wide windows. That is batch K, which + is not in this scope. +- The 1200 Timeline/Session interactions were not captured. Only the 560 + tab clicks were scripted. diff --git a/app/test/features/pipelines/pipeline_summary_flat_test.dart b/app/test/features/pipelines/pipeline_summary_flat_test.dart new file mode 100644 index 00000000..f58a8383 --- /dev/null +++ b/app/test/features/pipelines/pipeline_summary_flat_test.dart @@ -0,0 +1,75 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:pipelines_app/features/pipelines/screen.dart'; +import 'package:pipelines_app/features/pipelines/widgets/pipeline_summary_view.dart'; +import 'package:pipelines_app/features/schedules/ui/pipeline/schedule_pipeline_wording.dart'; +import 'package:pipelines_app/ui/layout/app_list_row.dart'; + +import 'fixtures.dart'; + +/// The pipeline Summary is flat on both hosts: facts in the shared grid, +/// Schedules with Add as its heading's only action (no body Refresh), and +/// versions as the shared list row. +void main() { + for (final cupertino in [false, true]) { + testWidgets('pipeline Summary is a facts grid with flat sections ' + '(${cupertino ? 'cupertino' : 'material'})', (tester) async { + final gateway = FakeGateway((type, fields) { + return switch (type) { + 'list_pipelines' => pipelineListReply([ + pipelineSummary(id: 1, name: 'Alpha review', version: 3), + ]), + 'list_runs' => runListReply([]), + 'get_pipeline' => pipelineDetailReply( + pipelineDetail( + id: 1, + name: 'Alpha review', + version: 3, + latestVersion: 3, + versions: [versionSummary(2), versionSummary(3)], + ), + ), + 'list_schedules' => {'type': 'schedules', 'schedules': []}, + _ => errorReply('unexpected $type'), + }; + }); + tester.view.physicalSize = const Size(1100, 900); + tester.view.devicePixelRatio = 1; + addTearDown(tester.view.resetPhysicalSize); + addTearDown(tester.view.resetDevicePixelRatio); + final screen = PipelinesScreen(gateway: gateway); + await tester.pumpWidget( + cupertino + ? CupertinoApp(home: CupertinoPageScaffold(child: screen)) + : MaterialApp(home: screen), + ); + await tester.pumpAndSettle(); + await tester.tap(find.byKey(const Key('pipeline-row-1'))); + await tester.pumpAndSettle(); + + expect(find.byKey(pipelineSummaryFactsKey), findsOneWidget); + // Short facts share a line instead of one label/value row each. + final latest = tester.getRect( + find.byKey(const ValueKey('pipeline-summary-latest-version')), + ); + final versionCreated = tester.getRect( + find.byKey(const ValueKey('pipeline-summary-version-created')), + ); + expect(versionCreated.top, moreOrLessEquals(latest.top)); + expect(versionCreated.left, greaterThan(latest.right)); + + expect(find.text('Refresh'), findsNothing); + expect(find.text(scheduleAddLabel), findsNothing); + expect(find.byKey(scheduleAddKey), findsOneWidget); + expect(find.byType(CupertinoListSection), findsNothing); + expect(find.byType(ListTile), findsNothing); + final row = tester.widget( + find.byKey(const Key('pipeline-version-3')), + ); + expect(row.selected, isTrue); + expect(row.cupertino, cupertino); + expect(tester.takeException(), isNull); + }); + } +} diff --git a/app/test/features/pipelines/pipelines_adaptive_test.dart b/app/test/features/pipelines/pipelines_adaptive_test.dart index ddb8bfe6..8bf67e6d 100644 --- a/app/test/features/pipelines/pipelines_adaptive_test.dart +++ b/app/test/features/pipelines/pipelines_adaptive_test.dart @@ -141,7 +141,14 @@ void main() { ), findsOneWidget, ); - expect(find.byType(CupertinoListTile), findsWidgets); + // Versions are the shared row in its Cupertino form, flat on the page. + expect( + tester + .widget(find.byKey(const Key('pipeline-version-1'))) + .cupertino, + isTrue, + ); + expect(find.byType(CupertinoListSection), findsNothing); await tester.tap(find.byKey(const Key('pipeline-version-1'))); await tester.pumpAndSettle(); diff --git a/app/test/features/runs/ui/run_detail_flat_bodies_test.dart b/app/test/features/runs/ui/run_detail_flat_bodies_test.dart new file mode 100644 index 00000000..6bb26ec5 --- /dev/null +++ b/app/test/features/runs/ui/run_detail_flat_bodies_test.dart @@ -0,0 +1,91 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:pipelines_app/features/runs/data/runs_repository.dart'; +import 'package:pipelines_app/features/runs/ui/run_detail_tab.dart'; +import 'package:pipelines_app/features/runs/ui/run_detail_view.dart'; +import 'package:pipelines_app/features/runs/ui/run_detail_visit_sections.dart'; +import 'package:pipelines_app/features/runs/ui/runs_controller.dart'; +import 'package:pipelines_app/ui/adaptive/floating_bar_layout.dart'; +import 'package:pipelines_app/ui/layout/section_heading.dart'; + +import 'run_detail_graph_support.dart'; +import 'run_detail_visit_support.dart'; + +/// The run and stage detail bodies are flat on the page on both hosts: no +/// Cupertino inset group (so none nested in another), pinned headings on the +/// page colour, and beside a list one row of tabs and header. +void main() { + for (final platform in RunDetailTestPlatform.values) { + testWidgets('${platform.name} Summary and Timeline draw no grouped ' + 'card', (tester) async { + await pumpRunDetail(tester, platform); + expect(find.byType(CupertinoListSection), findsNothing); + await openRunDetailTab(tester, RunDetailTab.timeline); + expect(find.byType(CupertinoListSection), findsNothing); + expect(tester.takeException(), isNull); + }); + + testWidgets('${platform.name} the stage Session nests no group in a ' + 'group', (tester) async { + await openVisit(tester, platform); + await openVisitTab(tester, RunVisitSection.session); + expect(find.text('Turn documents'), findsOneWidget); + expect(find.byType(CupertinoListSection), findsNothing); + }); + + testWidgets('${platform.name} beside a list the tabs and the header ' + 'share one row', (tester) async { + tester.view.physicalSize = const Size(720, 900); + tester.view.devicePixelRatio = 1; + addTearDown(tester.view.reset); + final gateway = RunDetailFakeGateway(graphRunFixture()); + final controller = RunsController(RunsRepository(gateway)); + addTearDown(controller.dispose); + await controller.select(51); + final view = PageTabsEdge( + edge: FloatingBarEdge.top, + child: RunDetailView( + controller: controller, + gateway: gateway, + onBack: () {}, + ), + ); + await tester.pumpWidget( + platform == RunDetailTestPlatform.material + ? MaterialApp(home: Scaffold(body: view)) + : CupertinoApp(home: CupertinoPageScaffold(child: view)), + ); + await tester.pumpAndSettle(); + + final tabs = tester.getRect(find.byKey(const Key('run-detail-tabs'))); + final header = tester.getRect(find.byKey(const Key('run-detail-header'))); + // Side by side, not stacked: the header starts after the tabs and + // overlaps them vertically. + expect(header.left, greaterThanOrEqualTo(tabs.right - 12)); + expect(header.top, lessThan(tabs.bottom)); + expect(header.bottom, greaterThan(tabs.top)); + expect(tester.takeException(), isNull); + }); + } + + testWidgets('Cupertino pinned headings take the page colour', (tester) async { + for (final brightness in Brightness.values) { + late SectionHeadingStyle style; + late Color page; + await tester.pumpWidget( + CupertinoApp( + theme: CupertinoThemeData(brightness: brightness), + home: Builder( + builder: (context) { + style = SectionHeadingStyle.of(context); + page = CupertinoTheme.of(context).scaffoldBackgroundColor; + return const SizedBox.shrink(); + }, + ), + ), + ); + expect(style.background, page, reason: '$brightness'); + } + }); +} diff --git a/app/test/features/runs/ui/run_detail_summary_fields_test.dart b/app/test/features/runs/ui/run_detail_summary_fields_test.dart index e4888493..b1c1dc5a 100644 --- a/app/test/features/runs/ui/run_detail_summary_fields_test.dart +++ b/app/test/features/runs/ui/run_detail_summary_fields_test.dart @@ -1,3 +1,4 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -132,10 +133,12 @@ void main() { size: const Size(900, 1600), ); - for (final label in recordedLabels) { + // The bar's subtitle names the pipeline, so no Pipeline fact repeats it. + for (final label in recordedLabels.where((l) => l != 'Pipeline')) { expect(find.text(label), findsOneWidget, reason: label); } - expect(find.text('id 3 · v2'), findsOneWidget); + expect(find.text('Pipeline'), findsNothing); + expect(find.text('id 3 · v2'), findsNothing); expect(find.text('review'), findsOneWidget); expect(find.text('/srv/workspaces/run-51'), findsOneWidget); expect(find.text('abc123def456'), findsOneWidget); @@ -199,6 +202,28 @@ void main() { expect(hash.width, greaterThan(300)); }); + testWidgets('${platform.name} a single fact starts at the leading edge, ' + 'with no grouped card', (tester) async { + await pumpRunDetail( + tester, + platform, + run: absentRunFixture()..['current_stage'] = 'review', + size: const Size(900, 1600), + ); + final grid = tester.getRect( + find.byKey(const Key('run-detail-summary-facts')), + ); + final stage = tester.getRect( + find.byKey(const ValueKey('run-detail-summary-stage')), + ); + // The grid spans the Summary, and its one fact is at the start of the + // line rather than a half-width block centred on the page. + expect(grid.width, moreOrLessEquals(900)); + expect(stage.left, moreOrLessEquals(16)); + expect(stage.center.dx, lessThan(450)); + expect(find.byType(CupertinoListSection), findsNothing); + }); + testWidgets('${platform.name} summary sections state their exact empty ' 'wording', (tester) async { await pumpRunDetail( diff --git a/app/test/features/runs/ui/run_detail_tabs_test.dart b/app/test/features/runs/ui/run_detail_tabs_test.dart index 454840e5..ba1517a3 100644 --- a/app/test/features/runs/ui/run_detail_tabs_test.dart +++ b/app/test/features/runs/ui/run_detail_tabs_test.dart @@ -121,10 +121,23 @@ void main() { tester, ) async { await pumpRunDetail(tester, platform, run: graphRunFixture(graph: false)); - await openRunDetailTab(tester, RunDetailTab.graph); + await openRunDetailTab(tester, RunDetailTab.summary); + // One muted line on the Summary: no framed, tappable empty preview. expect(find.text(runGraphMissing), findsOneWidget); + expect(find.byKey(runGraphPreviewMissingKey), findsOneWidget); + expect(find.byKey(runGraphPreviewKey), findsNothing); + expect(find.byType(RunGraphView), findsNothing); expect(find.byType(InteractiveViewer), findsNothing); + final line = tester.getSize(find.byKey(runGraphPreviewMissingKey)); + expect(line.height, lessThan(60)); + expect( + find.descendant( + of: find.byKey(runGraphPreviewMissingKey), + matching: find.byType(DecoratedBox), + ), + findsNothing, + ); }); testWidgets('${platform.name} Graph stays bounded at 320 with 2x text', ( diff --git a/app/test/features/runs/ui/run_timeline_row_test.dart b/app/test/features/runs/ui/run_timeline_row_test.dart index d5bca773..3d3df9bf 100644 --- a/app/test/features/runs/ui/run_timeline_row_test.dart +++ b/app/test/features/runs/ui/run_timeline_row_test.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/features/runs/ui/run_detail_content.dart'; import 'package:pipelines_app/features/runs/ui/run_detail_timeline.dart'; +import 'package:pipelines_app/ui/layout/app_list_row.dart'; import 'package:pipelines_app/ui/status/run_status_icon.dart'; final _steps = [ @@ -52,8 +53,13 @@ void main() { expect(find.text('success'), findsOneWidget); expect(find.text('error'), findsOneWidget); - expect(find.text('→ build · 2m 5s'), findsOneWidget); + // The target is the line; the duration is the row's time. + expect(find.text('→ build'), findsOneWidget); + expect(find.text('2m 5s'), findsOneWidget); expect(find.text('→ #failure'), findsOneWidget); + // The shared flat row, with no grouped card on either host. + expect(find.byType(AppListRow), findsNWidgets(3)); + expect(find.byType(CupertinoListSection), findsNothing); }); } } diff --git a/app/test/features/schedules/ui/pipeline/schedule_pipeline_section_test.dart b/app/test/features/schedules/ui/pipeline/schedule_pipeline_section_test.dart index b6cad9b2..adb8fdf6 100644 --- a/app/test/features/schedules/ui/pipeline/schedule_pipeline_section_test.dart +++ b/app/test/features/schedules/ui/pipeline/schedule_pipeline_section_test.dart @@ -112,10 +112,7 @@ void main() { await pumpScheduleSection(tester, gateway: gateway, version: 3); expect(find.text('Schedules (0)'), findsOneWidget); - expect( - find.text('No schedules yet. Add one for each topic or recurring task.'), - findsOneWidget, - ); + expect(find.textContaining(scheduleSectionEmpty), findsOneWidget); await tester.tap(find.byKey(scheduleAddKey)); await tester.pumpAndSettle(); @@ -329,10 +326,7 @@ void main() { expect(gateway.callsOf('delete_schedule'), hasLength(1)); expect(find.text('Research batteries'), findsNothing); - expect( - find.text('No schedules yet. Add one for each topic or recurring task.'), - findsOneWidget, - ); + expect(find.textContaining(scheduleSectionEmpty), findsOneWidget); expect(gateway.calls.map((call) => call.type), [ 'list_schedules', 'delete_schedule',