Merge branch 'main' into worktree-agent-abb9404cc062f4b30

# Conflicts:
#	app/lib/ui/theme/app_design.dart
This commit is contained in:
2026-12-04 00:15:07 +00:00
306 changed files with 13454 additions and 5708 deletions
+17
View File
@@ -35,6 +35,23 @@ void main() {
errorAdviceKind(TimeoutException('request timed out after 30000ms')),
ErrorAdviceKind.timeout,
);
expect(
errorAdviceKind(
const ProtocolError('chat is not configured on this server'),
),
ErrorAdviceKind.noHarness,
);
expect(
errorAdviceKind(
'HARNESS TRANSPORT: harness unreachable: cannot run the selected '
'OpenCode CLI',
),
ErrorAdviceKind.noHarness,
);
expect(
errorAdviceSentence(ErrorAdviceKind.noHarness),
contains('pipelines harness setup'),
);
expect(errorAdviceKind('pipeline 4 has no stage review'), isNull);
final advice = errorAdvice(StateError('Connection closed'));
expect(advice?.detail, 'Connection closed');
@@ -106,7 +106,10 @@ void main() {
AppDesign.standard,
AppDesign.terminal,
AppDesign.paper,
AppDesign.notebook,
AppDesign.compact,
AppDesign.retroCrt,
AppDesign.retroCrtAmber,
]) {
design.value = other;
for (var f = 0; f < 20; f++) {
+128
View File
@@ -0,0 +1,128 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/chat/conversation/chat_draft_store.dart';
import 'package:pipelines_app/features/chat/conversation/chat_thread_view.dart';
import 'package:pipelines_app/features/chat/ui/transcript/notebook/notebook_cell_frame.dart';
import 'package:pipelines_app/ui/theme/app_design.dart';
import 'package:pipelines_app/ui/theme/app_design_tokens.dart';
import '../../features/chat/conversation/chat_composer_bar_fixtures.dart';
ThemeData _theme(Brightness brightness, {String? font}) =>
brightness == Brightness.dark
? AppDesign.notebook.dark(fontFamily: font)
: AppDesign.notebook.light(fontFamily: font);
Widget _thread(ComposerBarGateway gateway, AppDesign design) => MaterialApp(
theme: design.light(),
home: Scaffold(
body: ChatThreadView(
gateway: gateway,
sessionId: 's',
session: const {'id': 's', 'directory': '/Users/ada/repos/tank'},
syncToken: 0,
onBack: () {},
drafts: MemoryChatDraftStore(),
),
),
);
void main() {
test('Notebook is listed with a stable id, a label and one line', () {
expect(AppDesign.fromId('notebook'), AppDesign.notebook);
expect(AppDesign.notebook.label, 'Notebook');
expect(AppDesign.notebook.description, isNot(contains('\n')));
expect(AppDesign.notebook.usesInterfaceFont, isTrue);
});
test('Notebook tokens: cells transcript, cell composer, washed row, '
'4-6px corners, hairlines, flat', () {
for (final brightness in Brightness.values) {
final theme = _theme(brightness);
final tokens = theme.extension<AppDesignTokens>()!;
expect(tokens.design, AppDesign.notebook);
expect(tokens.transcript, TranscriptStyle.cells);
expect(tokens.terminal, isFalse);
expect(tokens.composer, ComposerStyle.cell);
expect(tokens.selectedRow, SelectedRowStyle.washed);
expect(tokens.radius, inInclusiveRange(4, 6));
expect(tokens.flat, isTrue);
expect(tokens.frame, theme.colorScheme.outlineVariant);
expect(tokens.ansi, isNotNull);
// Reading text keeps the interface sans.
expect(tokens.reading.family, isNull);
}
});
test('Notebook pages: white by day, neutral charcoal by night, cells a '
'step off the page', () {
final light = _theme(Brightness.light);
expect(light.scaffoldBackgroundColor, const Color(0xFFFFFFFF));
final dark = _theme(Brightness.dark);
expect(
dark.scaffoldBackgroundColor.computeLuminance(),
inExclusiveRange(0.005, 0.03),
);
for (final theme in [light, dark]) {
final scheme = theme.colorScheme;
expect(scheme.surfaceContainerLow, isNot(scheme.surface));
expect(scheme.onSurface, isNot(scheme.onSurfaceVariant));
}
});
test('Notebook keeps the interface font and caches its themes', () {
expect(
_theme(Brightness.light, font: 'Inter').textTheme.bodyLarge?.fontFamily,
'Inter',
);
expect(identical(_theme(Brightness.dark), _theme(Brightness.dark)), isTrue);
expect(
AppDesign.notebook.build(Brightness.light),
_theme(Brightness.light),
);
});
testWidgets('Notebook: the composer is an In [ ]: input cell whose frame '
'takes the accent on focus', (tester) async {
final gateway = ComposerBarGateway();
addTearDown(gateway.close);
await tester.pumpWidget(_thread(gateway, AppDesign.notebook));
await tester.pumpAndSettle();
expect(find.byKey(const Key('chat-composer-pill')), findsNothing);
expect(find.byKey(const Key('chat-composer-underline')), findsNothing);
final cell = find.byKey(const Key('chat-composer-cell'));
expect(cell, findsOneWidget);
expect(
find.descendant(of: cell, matching: find.text('In [ ]:')),
findsOneWidget,
);
for (final key in [
'chat-composer-attach',
'chat-composer-field',
'chat-composer-primary',
]) {
expect(
find.descendant(of: cell, matching: find.byKey(Key(key))),
findsOneWidget,
);
}
final scheme = Theme.of(tester.element(cell)).colorScheme;
Color frame() {
final paint = tester.widget<CustomPaint>(
find
.descendant(
of: find.byKey(const Key('chat-composer-cell-frame')),
matching: find.byType(CustomPaint),
)
.first,
);
return (paint.painter! as NotebookCellPainter).border;
}
expect(frame(), scheme.outlineVariant);
await tester.tap(find.byKey(const Key('chat-composer-field')));
await tester.pumpAndSettle();
expect(frame(), scheme.primary);
});
}
@@ -1,118 +0,0 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/chat/domain/chat_transcript.dart';
import 'package:pipelines_app/features/chat/ui/transcript/chat_message_view.dart';
import 'package:pipelines_app/ui/theme/app_design.dart';
final _rows = transcriptRows([
for (var i = 0; i < 6; i++) ...[
{
'id': 'u$i',
'role': 'user',
'parts': [
{'type': 'text', 'text': 'Step $i'},
],
},
{
'id': 'a$i',
'role': 'assistant',
'parts': [
{
'type': 'tool',
'id': 't$i',
'name': 'Bash',
'state': {
'status': 'completed',
'input': {'command': 'go test'},
},
},
{'type': 'text', 'text': 'Fixed `x`.\n\n- one\n\n```go\nreturn 1\n```'},
],
},
],
]);
/// A live design switch between Retro CRT (whose text roles, tooltip and
/// snack bar styles carry a glow shadow) and every other design animates
/// the theme without an error in any frame.
void main() {
testWidgets('switching to and from Retro CRT lerps every frame cleanly', (
tester,
) async {
debugDefaultTargetPlatformOverride = TargetPlatform.linux;
final design = ValueNotifier(AppDesign.retroCrt);
await tester.pumpWidget(
ValueListenableBuilder<AppDesign>(
valueListenable: design,
builder: (_, d, _) => MaterialApp(
theme: d.dark(),
darkTheme: d.dark(),
home: Scaffold(
floatingActionButton: FloatingActionButton.extended(
onPressed: () {},
icon: const Icon(Icons.add),
label: const Text('New run'),
),
body: Row(
children: [
NavigationRail(
destinations: const [
NavigationRailDestination(
icon: Icon(Icons.add),
label: Text('a'),
),
NavigationRailDestination(
icon: Icon(Icons.add),
label: Text('b'),
),
],
selectedIndex: 0,
),
Expanded(
child: ListView(
children: [
IconButton(onPressed: () {}, icon: const Icon(Icons.add)),
IconButton.filled(
onPressed: () {},
icon: const Icon(Icons.add),
),
Checkbox(value: true, onChanged: (_) {}),
Switch(value: true, onChanged: (_) {}),
const ListTile(title: Text('t'), subtitle: Text('s')),
const TextField(),
Chip(label: const Text('c'), onDeleted: () {}),
SegmentedButton<int>(
segments: const [
ButtonSegment(value: 1, label: Text('one')),
ButtonSegment(value: 2, label: Text('two')),
],
selected: const {1},
),
for (final row in _rows) ChatMessageView(row: row),
],
),
),
],
),
),
),
),
);
await tester.pumpAndSettle();
for (var round = 0; round < 2; round++) {
for (final other in [
for (final d in AppDesign.values) ...[d, AppDesign.retroCrt],
AppDesign.retroCrtAmber,
]) {
design.value = other;
for (var f = 0; f < 20; f++) {
await tester.pump(const Duration(milliseconds: 16));
final e = tester.takeException();
if (e != null) fail('to ${other.id} frame $f: $e');
}
}
}
debugDefaultTargetPlatformOverride = null;
});
}