Merge branch 'main' into worktree-agent-aab11f4f1fe3dff6b

# Conflicts:
#	app/test/features/runs/ui/run_list_row_test.dart
This commit is contained in:
2026-10-31 12:36:49 +00:00
29 changed files with 266 additions and 225 deletions
+1 -1
View File
@@ -351,7 +351,7 @@ void main() {
await tester.pump();
await tester.pump(const Duration(milliseconds: 400));
await tester.pump(const Duration(milliseconds: 400));
expectVisitHeading(tester, 'plan', 5);
expectVisitHeading(tester, 'plan', 2);
expect(provider.value.uri.path, '/runs/77/stage/plan');
expect(provider.value.uri.query, 'visit=1');
});
+3 -3
View File
@@ -401,7 +401,7 @@ void main() {
await tester.pump();
await tester.pump();
expect(find.text('run #7 · Preserved run'), findsOneWidget);
expect(find.text('Run 7 · Preserved run'), findsOneWidget);
await tester.tap(find.byKey(const ValueKey('search.result.run:7')));
await tester.pump();
await tester.pump(const Duration(milliseconds: 400));
@@ -497,7 +497,7 @@ void main() {
expect(provider.value.uri.path, '/runs/7');
expect(find.byType(SearchScreen), findsNothing);
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
expectVisitHeading(tester, 'build', 2);
expectVisitHeading(tester, 'build', 1);
// Leave the visit page (it covers the shell), then a retired field hit
// opens the plain Summary with no visit.
@@ -608,7 +608,7 @@ void main() {
await tester.pumpAndSettle();
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
expectVisitHeading(tester, 'build', 2);
expectVisitHeading(tester, 'build', 1);
await tester.pumpWidget(const SizedBox.shrink());
await tester.pump();
@@ -125,11 +125,11 @@ void main() {
);
// The run-wide aggregate still counts the file this visit recorded.
expect(find.textContaining('1 file changed'), findsOneWidget);
expect(find.text('implementer'), findsOneWidget);
expect(find.text('implementer'), findsNothing);
expect(find.text('Visit 1 · completed'), findsOneWidget);
expect(
find.text(
'partial (1 files), 1 skipped, 2 omitted · Excluded protected files.',
'partial (1 file), 1 skipped, 2 omitted · Excluded protected files.',
),
findsOneWidget,
);
@@ -157,7 +157,7 @@ void main() {
await tester.pump();
expect(find.text('implementer'), findsNothing);
expect(find.text('reviewer'), findsOneWidget);
expect(find.text('reviewer'), findsNothing);
// The reviewer's first visit is Visit 1, not the run-wide step ordinal 2.
expect(find.text('Visit 1 · failed'), findsOneWidget);
expect(find.text('Visit 2 · failed'), findsNothing);
@@ -205,18 +205,18 @@ void main() {
await tester.tap(find.byKey(ChangesVisitPager.nextKey));
await tester.pump();
// The reviewer's first recorded visit is Visit 1 too.
expect(find.text('reviewer'), findsOneWidget);
expect(find.text('reviewer'), findsNothing);
expect(find.text('Visit 1 · completed'), findsOneWidget);
await tester.tap(find.byKey(ChangesVisitPager.nextKey));
await tester.pump();
expect(find.text('implementer'), findsOneWidget);
expect(find.text('implementer'), findsNothing);
expect(find.text('Visit 2 · completed'), findsOneWidget);
await tester.tap(find.byKey(ChangesVisitPager.nextKey));
await tester.pump();
// The resumed reviewer visit records control.visit 6.
expect(find.text('reviewer'), findsOneWidget);
expect(find.text('reviewer'), findsNothing);
expect(find.text('Visit 6 · completed'), findsOneWidget);
expect(find.text('Visit 3 · completed'), findsNothing);
expect(find.text('Visit 4 · completed'), findsNothing);
@@ -411,7 +411,7 @@ void main() {
expect(parsed.files.map((entry) => entry.path), ['x']);
expect(
fileChangesSummary(parsed),
'partial (1 files), 2 skipped, 1 omitted · Excluded protected files.',
'partial (1 file), 2 skipped, 1 omitted · Excluded protected files.',
);
});
@@ -43,7 +43,7 @@ void main() {
// change as the operator pages.
expect(find.text('3 files changed'), findsOneWidget);
expect(find.text('1 of 2'), findsOneWidget);
expect(find.text('implementer'), findsOneWidget);
expect(find.text('implementer'), findsNothing);
expect(find.text('Visit 1 · completed'), findsOneWidget);
expect(find.text('lib/a.dart'), findsOneWidget);
expect(find.text('lib/c.dart'), findsNothing);
@@ -52,7 +52,7 @@ void main() {
await tester.pump();
// The shown page keeps its own visit identity in the heading.
expect(find.text('reviewer'), findsOneWidget);
expect(find.text('reviewer'), findsNothing);
expect(find.text('Visit 1 · completed'), findsOneWidget);
expect(find.text('lib/c.dart'), findsOneWidget);
expect(find.text('lib/a.dart'), findsNothing);
@@ -62,7 +62,7 @@ void main() {
await tester.tap(find.byKey(ChangesVisitPager.previousKey));
await tester.pump();
expect(find.text('implementer'), findsOneWidget);
expect(find.text('implementer'), findsNothing);
expect(find.text('lib/a.dart'), findsOneWidget);
expect(find.text('lib/c.dart'), findsNothing);
expect(find.text('1 of 2'), findsOneWidget);
@@ -104,11 +104,11 @@ void main() {
// The disabled Next is inert; the page stays on the last visit.
await tester.tap(find.byKey(ChangesVisitPager.nextKey));
await tester.pump();
expect(find.text('reviewer'), findsOneWidget);
expect(find.text('reviewer'), findsNothing);
await tester.tap(find.byKey(ChangesVisitPager.previousKey));
await tester.pump();
expect(find.text('implementer'), findsOneWidget);
expect(find.text('implementer'), findsNothing);
expect(previous().onPressed, isNull);
});
@@ -133,7 +133,7 @@ void main() {
findsNothing,
);
// The single visit still keeps its identity heading.
expect(find.text('implementer'), findsOneWidget);
expect(find.text('implementer'), findsNothing);
expect(find.text('Visit 1 · completed'), findsOneWidget);
expect(find.text('lib/only.dart'), findsOneWidget);
});
@@ -154,12 +154,12 @@ void main() {
await tester.pumpWidget(materialHost(ChangesViewer(steps: first)));
await tester.tap(find.byKey(ChangesVisitPager.nextKey));
await tester.pump();
expect(find.text('reviewer'), findsOneWidget);
expect(find.text('reviewer'), findsNothing);
await tester.pumpWidget(materialHost(ChangesViewer(steps: second)));
await tester.pump();
expect(tester.takeException(), isNull);
expect(find.text('implementer'), findsOneWidget);
expect(find.text('implementer'), findsNothing);
expect(find.text('Visit 1 · completed'), findsOneWidget);
expect(find.byKey(ChangesVisitPager.previousKey), findsNothing);
});
@@ -187,7 +187,7 @@ void main() {
await tester.tap(find.byKey(ChangesVisitPager.nextKey));
await tester.pump();
expect(tester.takeException(), isNull);
expect(find.text('reviewer'), findsOneWidget);
expect(find.text('reviewer'), findsNothing);
expect(find.text('Visit 1 · completed'), findsOneWidget);
expect(find.text('lib/c.dart'), findsOneWidget);
});
@@ -210,7 +210,7 @@ void main() {
await tester.tap(find.byKey(ChangesVisitPager.nextKey));
await tester.pump();
expect(find.text('reviewer'), findsOneWidget);
expect(find.text('reviewer'), findsNothing);
expect(
tester
.widget<CupertinoButton>(find.byKey(ChangesVisitPager.nextKey))
@@ -54,61 +54,64 @@ TextStyle _styleOf(WidgetTester tester, String text) =>
tester.renderObject<RenderParagraph>(find.textContaining(text)).text.style!;
void main() {
test('relative recency uses the web wording and never invents a time', () {
final now = DateTime(2026, 10, 22, 12);
final from = now.subtract;
test(
'relative recency uses shared compact wording and never invents a time',
() {
final now = DateTime(2026, 10, 22, 12);
final from = now.subtract;
expect(relativeChatSessionTime(null, now: now), '');
expect(relativeChatSessionTime(0, now: now), '');
expect(
relativeChatSessionTime(now.millisecondsSinceEpoch, now: now),
'just now',
);
expect(
relativeChatSessionTime(
from(const Duration(minutes: 5)).millisecondsSinceEpoch,
now: now,
),
'5 min ago',
);
expect(
relativeChatSessionTime(
from(const Duration(hours: 3)).millisecondsSinceEpoch,
now: now,
),
'3 hr ago',
);
expect(
relativeChatSessionTime(
from(const Duration(hours: 25)).millisecondsSinceEpoch,
now: now,
),
'1 day ago',
);
expect(
relativeChatSessionTime(
from(const Duration(days: 3)).millisecondsSinceEpoch,
now: now,
),
'3 days ago',
);
expect(
relativeChatSessionTime(
DateTime(2026, 10, 1, 9).millisecondsSinceEpoch,
now: now,
),
'1 Oct',
);
// The web formats with `Intl.DateTimeFormat('en-GB', …)`, whose short
// September is `Sept`; its own test asserts `12 Sept`.
expect(
relativeChatSessionTime(
DateTime(2026, 9, 12, 9).millisecondsSinceEpoch,
now: now,
),
'12 Sept',
);
});
expect(relativeChatSessionTime(null, now: now), '');
expect(relativeChatSessionTime(0, now: now), '');
expect(
relativeChatSessionTime(now.millisecondsSinceEpoch, now: now),
'just now',
);
expect(
relativeChatSessionTime(
from(const Duration(minutes: 5)).millisecondsSinceEpoch,
now: now,
),
'5m',
);
expect(
relativeChatSessionTime(
from(const Duration(hours: 3)).millisecondsSinceEpoch,
now: now,
),
'3h',
);
expect(
relativeChatSessionTime(
from(const Duration(hours: 25)).millisecondsSinceEpoch,
now: now,
),
'1d',
);
expect(
relativeChatSessionTime(
from(const Duration(days: 3)).millisecondsSinceEpoch,
now: now,
),
'3d',
);
expect(
relativeChatSessionTime(
DateTime(2026, 10, 1, 9).millisecondsSinceEpoch,
now: now,
),
'1 Oct',
);
// The web formats with `Intl.DateTimeFormat('en-GB', …)`, whose short
// September is `Sept`; its own test asserts `12 Sept`.
expect(
relativeChatSessionTime(
DateTime(2026, 9, 12, 9).millisecondsSinceEpoch,
now: now,
),
'12 Sep',
);
},
);
test('the subtitle and status come only from the row', () {
expect(
@@ -173,7 +176,7 @@ void main() {
);
final title = tester.getRect(find.textContaining('Unread chat'));
final time = tester.getRect(find.text('5 min ago'));
final time = tester.getRect(find.text('5m'));
final subtitle = tester.getRect(find.text('model-a · /work'));
final avatar = tester.getRect(
find.descendant(
@@ -197,10 +200,10 @@ void main() {
expect(_styleOf(tester, 'Read chat').fontWeight, FontWeight.w600);
expect(find.byKey(const Key('chat-row-unread')), findsOneWidget);
final accent = CupertinoTheme.of(
tester.element(find.text('5 min ago')),
tester.element(find.text('5m')),
).primaryColor;
expect(_styleOf(tester, '5 min ago').color, accent);
expect(_styleOf(tester, '2 hr ago').color, isNot(accent));
expect(_styleOf(tester, '5m').color, accent);
expect(_styleOf(tester, '2h').color, isNot(accent));
// Starred shows a small star by the title; running a badge on the avatar.
expect(
@@ -265,7 +268,7 @@ void main() {
expect(subtitle.didExceedMaxLines, isTrue);
// The time and the Closed word stay inside their row.
for (final (row, word) in [('s1', '3 days ago'), ('c1', 'Closed')]) {
for (final (row, word) in [('s1', '3d'), ('c1', 'Closed')]) {
expect(
tester.getRect(find.textContaining(word)).right,
lessThanOrEqualTo(
@@ -76,7 +76,7 @@ void main() {
], isUnseen: (session) => session['id'] == 's1');
final title = tester.getRect(find.text('Unread chat'));
final time = tester.getRect(find.text('5 min ago'));
final time = tester.getRect(find.text('5m'));
expect(time.left, greaterThan(title.right));
expect(time.center.dy, closeTo(title.center.dy, 2));
expect(
@@ -90,13 +90,10 @@ void main() {
);
// Unread: bold title, accent time and a dot; the read row stays muted.
final scheme = Theme.of(tester.element(find.text('5 min ago'))).colorScheme;
final scheme = Theme.of(tester.element(find.text('5m'))).colorScheme;
expect(tester.widget<Text>(find.text('5m')).style?.color, scheme.primary);
expect(
tester.widget<Text>(find.text('5 min ago')).style?.color,
scheme.primary,
);
expect(
tester.widget<Text>(find.text('2 hr ago')).style?.color,
tester.widget<Text>(find.text('2h')).style?.color,
scheme.onSurfaceVariant,
);
expect(find.byKey(const Key('chat-row-unread')), findsOneWidget);
@@ -183,7 +180,7 @@ void main() {
);
expect(subtitle.maxLines, 1);
expect(subtitle.didExceedMaxLines, isTrue);
for (final (row, word) in [('s1', '3 days ago'), ('c1', 'Closed')]) {
for (final (row, word) in [('s1', '3d'), ('c1', 'Closed')]) {
expect(
tester.getRect(find.textContaining(word)).right,
lessThanOrEqualTo(
@@ -7,7 +7,7 @@ import 'fixtures.dart';
void main() {
group('formatting', () {
test('renders local timestamps, durations and ages', () {
test('renders local timestamps and bounded durations', () {
expect(formatLocalTimestamp('2026-10-17T21:26:00'), '17 Oct 21:26');
expect(formatLocalTimestamp(''), isNull);
expect(formatLocalTimestamp('not a time'), isNull);
@@ -15,15 +15,10 @@ void main() {
expect(formatDuration(45), '45s');
expect(formatDuration(125), '2m 5s');
expect(formatDuration(3720), '1h 2m');
expect(formatDuration(840000), '9d 17h');
expect(formatDuration(-4), '0s');
expect(stageCountText(1), '1 stage');
expect(stageCountText(2), '2 stages');
final now = DateTime(2026, 10, 17, 21, 30);
expect(formatRanAgo('2026-10-17T21:29:40', now), 'just now');
expect(formatRanAgo('2026-10-17T21:25:00', now), '5m ago');
expect(formatRanAgo('2026-10-17T19:30:00', now), '2h ago');
expect(formatRanAgo('2026-10-14T21:30:00', now), '3d ago');
expect(formatRanAgo('2026-10-17T22:00:00', now), 'just now');
});
test('maps the server status vocabulary and unknown values', () {
@@ -181,7 +181,7 @@ void main() {
await pumpDeepLink(tester, RunDetailTestPlatform.material, stage: 'plan');
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
expectVisitHeading(tester, 'plan', 5);
expectVisitHeading(tester, 'plan', 2);
});
testWidgets('a Graph click opens the same latest visit as the stage route', (
@@ -195,7 +195,7 @@ void main() {
// The web client's graph click takes the last visit in sequence order, not
// the last row in reply order, so both entry points agree.
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
expectVisitHeading(tester, 'plan', 5);
expectVisitHeading(tester, 'plan', 2);
});
testWidgets('an out-of-range visit is clamped to the stage last visit', (
@@ -209,7 +209,7 @@ void main() {
);
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
expectVisitHeading(tester, 'plan', 5);
expectVisitHeading(tester, 'plan', 2);
});
testWidgets('a declared but unvisited stage selects its graph node', (
@@ -259,7 +259,7 @@ void main() {
await tester.pumpAndSettle();
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
expectVisitHeading(tester, 'plan', 5);
expectVisitHeading(tester, 'plan', 2);
});
testWidgets('a route change applies its visit and a plain route closes it', (
@@ -301,7 +301,7 @@ void main() {
rebuild(() => visit = 1);
await tester.pumpAndSettle();
expectVisitHeading(tester, 'plan', 5);
expectVisitHeading(tester, 'plan', 2);
rebuild(() => stage = null);
await tester.pumpAndSettle();
@@ -14,8 +14,8 @@ Finder runDetailText(String text) => find.descendant(
);
/// The stage page's bar names the stage over its visit (and run): the title
/// is keyed `run-visit-title` and the subtitle starts `Visit <sequence>`.
void expectVisitHeading(WidgetTester tester, String stage, num sequence) {
/// is keyed `run-visit-title` and the subtitle starts `Visit <stage visit>`.
void expectVisitHeading(WidgetTester tester, String stage, num visit) {
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
final heading = find.byKey(const Key('run-visit-title'));
expect(
@@ -25,7 +25,7 @@ void expectVisitHeading(WidgetTester tester, String stage, num sequence) {
expect(
find.descendant(
of: heading,
matching: find.textContaining(RegExp('^Visit $sequence( ·|\$)')),
matching: find.textContaining(RegExp('^Visit $visit( ·|\$)')),
),
findsOneWidget,
);
@@ -100,7 +100,7 @@ void main() {
expect(find.byKey(const Key('run-visit-pane')), findsNothing);
expect(find.byType(RunTimelineList), findsOneWidget);
expect(find.text('plan · visit 1'), findsOneWidget);
expect(find.text('plan · Visit 1'), findsOneWidget);
});
testWidgets('${platform.name} visit pane at 320 with 2x dark text', (
@@ -201,17 +201,17 @@ void main() {
matching: find.byType(Scrollable),
);
await tester.scrollUntilVisible(
find.textContaining('build · visit 3'),
find.textContaining('build · Visit 1').last,
200,
scrollable: timelineScroll,
);
expect(find.textContaining('build · visit 3'), findsOneWidget);
expect(find.textContaining('build · Visit 1').last, findsOneWidget);
await tester.scrollUntilVisible(
find.textContaining('test · visit 4'),
find.textContaining('test · Visit 1').last,
200,
scrollable: timelineScroll,
);
expect(find.textContaining('test · visit 4'), findsOneWidget);
expect(find.textContaining('test · Visit 1').last, findsOneWidget);
final before = tester
.state<ScrollableState>(timelineScroll)
@@ -58,7 +58,7 @@ void main() {
);
Rect at(String text) => tester.getRect(find.text(text));
final title = at('Ship the release notes');
final age = at('12h ago');
final age = at('12h');
final subtitle = at('release · 2m 5s · 3 steps');
expect(age.center.dy, moreOrLessEquals(title.center.dy));
@@ -113,7 +113,7 @@ void main() {
);
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
expectVisitHeading(tester, 'build', 2);
expectVisitHeading(tester, 'build', 1);
});
}
@@ -65,13 +65,13 @@ void main() {
await _openVisitChanges(tester);
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
// The body keeps the landed viewer's own identity for that visit.
// The stage is already named in the page bar, so Changes does not repeat it.
expect(
find.descendant(
of: find.byType(ChangesViewer),
matching: find.text('plan'),
),
findsOneWidget,
findsNothing,
);
expect(find.text('Visit 1 · completed'), findsOneWidget);
expect(find.text('lib/plan.dart'), findsOneWidget);
@@ -33,7 +33,7 @@ void main() {
// Two lines per row: the name with its next run, then the timer
// and pinned pipeline version. The editor holds the rest.
expect(find.text('Research batteries'), findsOneWidget);
expect(find.text('22 Oct 09:00'), findsOneWidget);
expect(find.text('22 Oct'), findsOneWidget);
expect(
find.text('Every 24h · mon, wed · Pipeline 4 · v2'),
findsOneWidget,
@@ -90,24 +90,23 @@ void main() {
final version = searchRowView(versionHit(), 'release');
expect(version.title, 'pipeline 9 · v2');
expect(version.secondary, startsWith('content abc · '));
expect(version.secondary, 'content abc');
expect(version.recency, isNotNull);
final run = searchRowView(runHit(), 'release');
expect(run.title, 'run #11 · release');
expect(run.secondary, startsWith('succeeded · '));
expect(run.secondary.split(' · '), hasLength(2));
expect(run.title, 'Run 11 · release');
expect(run.secondary, 'succeeded');
final unnamed = searchRowView(runHit({'pipeline_name': ''}), '');
expect(unnamed.title, 'run #11');
expect(unnamed.title, 'Run 11');
final step = searchRowView(stepHit({'target': '#success'}), '');
expect(step.title, 'run #11 · builder visit 2');
expect(step.title, 'Run 11 · builder visit 2');
expect(step.secondary, 'success · → #success');
final artifact = searchRowView(artifactHit(), 'notes');
expect(artifact.title, 'notes.md');
expect(artifact.secondary, 'run #11 · step 4 · text/markdown · 2.0 KiB');
expect(artifact.secondary, 'Run 11 · step 4 · text/markdown · 2.0 KiB');
});
test('a field snippet marks the first case-insensitive query occurrence', () {
+36
View File
@@ -0,0 +1,36 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/ui/text/relative_time.dart';
void main() {
final now = DateTime(2026, 10, 22, 12);
test('formats compact past and future list-row times', () {
expect(formatRelativeTime(now, now: now), 'just now');
expect(
formatRelativeTime(now.subtract(const Duration(minutes: 5)), now: now),
'5m',
);
expect(
formatRelativeTime(now.subtract(const Duration(hours: 3)), now: now),
'3h',
);
expect(
formatRelativeTime(now.subtract(const Duration(days: 3)), now: now),
'3d',
);
expect(
formatRelativeTime(now.subtract(const Duration(days: 8)), now: now),
'14 Oct',
);
expect(
formatRelativeTime(now.add(const Duration(hours: 2)), now: now),
'in 2h',
);
});
test('parses timestamps and omits unusable values', () {
expect(formatRelativeTimestamp('2026-10-22T11:55:00', now: now), '5m');
expect(formatRelativeTimestamp('', now: now), isNull);
expect(formatRelativeTimestamp('not a time', now: now), isNull);
});
}