Complete prompt presets, body-priority panes and clearer chat and stage layouts

This commit is contained in:
2026-10-25 23:11:06 +00:00
parent de1b62791f
commit 121ace1cee
31 changed files with 990 additions and 396 deletions
@@ -13,13 +13,11 @@ import 'chat_create_dialog_frame.dart';
import 'chat_create_fields.dart'; import 'chat_create_fields.dart';
import 'chat_prompt_chooser.dart'; import 'chat_prompt_chooser.dart';
/// The instructions field's helper and the model note, verbatim from the web. /// The instructions field's helper and the creation-time model behavior.
const String chatCreateInstructionsHelper = const String chatCreateInstructionsHelper =
"Preloaded as this chat's session instructions. The agent still reads the " "Preloaded as this chat's session instructions. The agent still reads the "
"repository's AGENTS.md and skills."; "repository's AGENTS.md and skills.";
const String chatCreateModelNote = const String chatCreateModelNote = "New chats start with the server's default model.";
"This server has no request for choosing a chat's model, so a new chat "
"uses the server's default.";
class ChatDraft { class ChatDraft {
const ChatDraft({ const ChatDraft({
@@ -83,9 +81,7 @@ class _CreateChatDialogState extends State<CreateChatDialog> {
SharedPreferencesChatCreatePromptStore( SharedPreferencesChatCreatePromptStore(
serverId: serverStorageScope(serverIdentity(widget.repository.gateway)), serverId: serverStorageScope(serverIdentity(widget.repository.gateway)),
); );
final _instructions = TextEditingController( final _instructions = TextEditingController();
text: chatDefaultSessionInstructions,
);
final _name = TextEditingController(); final _name = TextEditingController();
/// The name follows the folder and harness until the operator edits it. /// The name follows the folder and harness until the operator edits it.
@@ -97,6 +93,7 @@ class _CreateChatDialogState extends State<CreateChatDialog> {
/// A user's choice or edit wins over any pending saved-prompt read. /// A user's choice or edit wins over any pending saved-prompt read.
bool _promptTouched = false; bool _promptTouched = false;
String _promptChoice = ChatPromptChooser.custom; String _promptChoice = ChatPromptChooser.custom;
String _customPrompt = '';
ChatCreatePrompt? _savedPrompt; ChatCreatePrompt? _savedPrompt;
int _recall = 0; int _recall = 0;
List<String> _directories = const []; List<String> _directories = const [];
@@ -159,6 +156,7 @@ class _CreateChatDialogState extends State<CreateChatDialog> {
} }
bool get _catalogReady => !_loading && _catalogError == null; bool get _catalogReady => !_loading && _catalogError == null;
bool get _promptReady => !_sendPrompt || _instructions.text.trim().isNotEmpty;
/// A folder or harness pick: the default name follows it, and the prompt /// A folder or harness pick: the default name follows it, and the prompt
/// choice last made there comes back. /// choice last made there comes back.
@@ -169,21 +167,35 @@ class _CreateChatDialogState extends State<CreateChatDialog> {
_name.text = defaultChatName(directory, chatBackendLabel(backend)); _name.text = defaultChatName(directory, chatBackendLabel(backend));
} }
final recall = ++_recall; final recall = ++_recall;
setState(() {
_savedPrompt = null;
if (_promptChoice == ChatPromptChooser.lastUsed) {
_promptChoice = ChatPromptChooser.custom;
_customPrompt = _instructions.text;
}
});
final saved = await _prompts.read(backend, directory); final saved = await _prompts.read(backend, directory);
if (!mounted || recall != _recall) return; if (!mounted || recall != _recall) return;
if (_promptTouched) return;
setState(() { setState(() {
// Prompt text can be recalled, but sending it always requires an
// explicit choice in this new-chat dialog.
_sendPrompt = false;
_instructions.text = saved?.text ?? chatDefaultSessionInstructions;
_savedPrompt = saved; _savedPrompt = saved;
_promptChoice = ChatPromptChooser.custom; if (!_promptTouched) {
_sendPrompt = false;
_instructions.clear();
_promptChoice = ChatPromptChooser.custom;
}
}); });
} }
void _selectPrompt(String choice) { void _selectPrompt(String choice) {
if (!mounted ||
_submitting ||
(choice == ChatPromptChooser.lastUsed && _savedPrompt == null)) {
return;
}
setState(() { setState(() {
if (_promptChoice == ChatPromptChooser.custom) {
_customPrompt = _instructions.text;
}
_promptTouched = true; _promptTouched = true;
_promptChoice = choice; _promptChoice = choice;
if (choice == ChatPromptChooser.careful) { if (choice == ChatPromptChooser.careful) {
@@ -193,6 +205,7 @@ class _CreateChatDialogState extends State<CreateChatDialog> {
_instructions.text = _savedPrompt!.text; _instructions.text = _savedPrompt!.text;
_sendPrompt = true; _sendPrompt = true;
} else { } else {
_instructions.text = _customPrompt;
_sendPrompt = true; _sendPrompt = true;
} }
}); });
@@ -200,8 +213,14 @@ class _CreateChatDialogState extends State<CreateChatDialog> {
Future<void> _submit() async { Future<void> _submit() async {
if (!_catalogReady || _submitting) return; if (!_catalogReady || _submitting) return;
if (!_promptReady) {
setState(() => _formError = 'Enter a prompt or choose a pre-filled one.');
return;
}
final directory = _directory ?? chatHomeDirectory; final directory = _directory ?? chatHomeDirectory;
final backend = _backend ?? ''; final backend = _backend ?? '';
final sendPrompt = _sendPrompt;
final promptText = _instructions.text;
setState(() { setState(() {
_submitting = true; _submitting = true;
_formError = null; _formError = null;
@@ -215,17 +234,20 @@ class _CreateChatDialogState extends State<CreateChatDialog> {
: name, : name,
directory: directory, directory: directory,
backend: backend, backend: backend,
instructions: _sendPrompt ? _instructions.text : '', instructions: sendPrompt ? promptText : '',
), ),
widget.operationId, widget.operationId,
); );
// Next time in this folder with this harness, the same choice. // Only an actually sent prompt becomes Last used. Starting a promptless
unawaited( // chat must not erase a saved preset (or wait for its pending read).
_prompts.write(backend, directory, ( if (sendPrompt) {
send: _sendPrompt, unawaited(
text: _instructions.text, _prompts.write(backend, directory, (
)), send: sendPrompt,
); text: promptText,
)),
);
}
if (!mounted) return; if (!mounted) return;
Navigator.pop(context, session); Navigator.pop(context, session);
} catch (error) { } catch (error) {
@@ -298,10 +320,12 @@ class _CreateChatDialogState extends State<CreateChatDialog> {
controller: _instructions, controller: _instructions,
minLines: 2, minLines: 2,
maxLines: 4, maxLines: 4,
onChanged: (_) { placeholder: 'Write your custom prompt',
onChanged: (value) {
setState(() { setState(() {
_promptTouched = true; _promptTouched = true;
_promptChoice = ChatPromptChooser.custom; _promptChoice = ChatPromptChooser.custom;
_customPrompt = value;
}); });
}, },
) )
@@ -311,10 +335,14 @@ class _CreateChatDialogState extends State<CreateChatDialog> {
controller: _instructions, controller: _instructions,
minLines: 2, minLines: 2,
maxLines: 4, maxLines: 4,
onChanged: (_) { decoration: const InputDecoration(
hintText: 'Write your custom prompt',
),
onChanged: (value) {
setState(() { setState(() {
_promptTouched = true; _promptTouched = true;
_promptChoice = ChatPromptChooser.custom; _promptChoice = ChatPromptChooser.custom;
_customPrompt = value;
}); });
}, },
), ),
@@ -347,7 +375,7 @@ class _CreateChatDialogState extends State<CreateChatDialog> {
return ChatCreateDialogFrame( return ChatCreateDialogFrame(
content: content, content: content,
canSubmit: _catalogReady, canSubmit: _catalogReady && _promptReady,
submitting: _submitting, submitting: _submitting,
onCancel: () => Navigator.pop(context), onCancel: () => Navigator.pop(context),
onSubmit: _submit, onSubmit: _submit,
@@ -156,7 +156,7 @@ class _CupertinoSessionRow extends StatelessWidget {
final meta = chatSessionMetaLines(session); final meta = chatSessionMetaLines(session);
final recency = relativeChatSessionTime(session['updated_at']); final recency = relativeChatSessionTime(session['updated_at']);
final status = chatSessionRowStatus(session, unseen: unseen); final status = chatSessionRowStatus(session, unseen: unseen);
final statusStyle = TextStyle( final statusStyle = theme.textTheme.tabLabelTextStyle.copyWith(
color: status == 'Closed' ? secondary : theme.primaryColor, color: status == 'Closed' ? secondary : theme.primaryColor,
); );
return Semantics( return Semantics(
@@ -166,28 +166,14 @@ class _CupertinoSessionRow extends StatelessWidget {
backgroundColor: selected backgroundColor: selected
? CupertinoColors.tertiarySystemFill.resolveFrom(context) ? CupertinoColors.tertiarySystemFill.resolveFrom(context)
: null, : null,
leading: Icon(
sessionCupertinoIcon(session),
color: selected ? theme.primaryColor : null,
),
// As on the web: the title with the unread/closed word trailing, then // As on the web: the title with the unread/closed word trailing, then
// the muted `recency · directory · model` line. // the muted `recency · directory · model` line.
title: ChatSessionRowContent( title: ChatSessionRowContent(
title: chatSessionTitle(session), leading: Icon(
status: status, sessionCupertinoIcon(session),
recency: recency.isEmpty ? null : recency, color: selected ? theme.primaryColor : null,
meta: meta,
titleStyle: theme.textTheme.textStyle.copyWith(
fontWeight: FontWeight.w600,
), ),
metaStyle: TextStyle(color: secondary), actions: [
statusStyle: statusStyle,
),
subtitle: null,
onTap: () => onOpen(session),
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: [
SessionStarButton( SessionStarButton(
key: Key('chat-star-$id'), key: Key('chat-star-$id'),
session: session, session: session,
@@ -200,7 +186,20 @@ class _CupertinoSessionRow extends StatelessWidget {
onSelected: _select, onSelected: _select,
), ),
], ],
title: chatSessionTitle(session),
status: status,
recency: recency.isEmpty ? null : recency,
meta: meta,
titleStyle: theme.textTheme.textStyle.copyWith(
fontWeight: FontWeight.w600,
),
metaStyle: theme.textTheme.tabLabelTextStyle.copyWith(
color: secondary,
),
statusStyle: statusStyle,
), ),
subtitle: null,
onTap: () => onOpen(session),
), ),
); );
} }
@@ -161,33 +161,21 @@ class _MaterialSessionRow extends StatelessWidget {
final meta = chatSessionMetaLines(session); final meta = chatSessionMetaLines(session);
final recency = relativeChatSessionTime(session['updated_at']); final recency = relativeChatSessionTime(session['updated_at']);
final status = chatSessionRowStatus(session, unseen: unseen); final status = chatSessionRowStatus(session, unseen: unseen);
final statusStyle = TextStyle( final statusStyle =
color: status == 'Closed' ? secondary : theme.colorScheme.primary, theme.textTheme.labelSmall?.copyWith(
); color: status == 'Closed' ? secondary : theme.colorScheme.primary,
) ??
TextStyle(color: theme.colorScheme.primary);
return ListTile( return ListTile(
key: Key('chat-row-$id'), key: Key('chat-row-$id'),
selected: selected, selected: selected,
selectedTileColor: theme.colorScheme.secondaryContainer, selectedTileColor: theme.colorScheme.secondaryContainer,
selectedColor: theme.colorScheme.onSecondaryContainer, selectedColor: theme.colorScheme.onSecondaryContainer,
leading: Icon(sessionMaterialIcon(session)),
// As on the web: the title with the unread/closed word trailing, then // As on the web: the title with the unread/closed word trailing, then
// the muted `recency · directory · model` line. // the muted `recency · directory · model` line.
title: ChatSessionRowContent( title: ChatSessionRowContent(
title: chatSessionTitle(session), leading: Icon(sessionMaterialIcon(session)),
status: status, actions: [
recency: recency.isEmpty ? null : recency,
meta: meta,
titleStyle:
theme.textTheme.titleSmall ??
const TextStyle(fontWeight: FontWeight.w600),
metaStyle: TextStyle(color: secondary),
statusStyle: statusStyle,
),
subtitle: null,
onTap: () => onOpen(session),
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: [
SessionStarButton( SessionStarButton(
key: Key('chat-star-$id'), key: Key('chat-star-$id'),
session: session, session: session,
@@ -197,10 +185,23 @@ class _MaterialSessionRow extends StatelessWidget {
key: Key('chat-actions-$id'), key: Key('chat-actions-$id'),
session: session, session: session,
duplicateTitles: duplicateTitles, duplicateTitles: duplicateTitles,
onSelected: (action) => _select(action), onSelected: _select,
), ),
], ],
title: chatSessionTitle(session),
status: status,
recency: recency.isEmpty ? null : recency,
meta: meta,
titleStyle:
theme.textTheme.titleSmall ??
const TextStyle(fontWeight: FontWeight.w600),
metaStyle:
theme.textTheme.bodySmall?.copyWith(color: secondary) ??
TextStyle(color: secondary),
statusStyle: statusStyle,
), ),
subtitle: null,
onTap: () => onOpen(session),
); );
} }
@@ -13,6 +13,8 @@ class ChatSessionRowContent extends StatelessWidget {
required this.titleStyle, required this.titleStyle,
required this.metaStyle, required this.metaStyle,
required this.statusStyle, required this.statusStyle,
this.leading,
this.actions = const [],
}); });
final String title; final String title;
@@ -22,6 +24,8 @@ class ChatSessionRowContent extends StatelessWidget {
final TextStyle titleStyle; final TextStyle titleStyle;
final TextStyle metaStyle; final TextStyle metaStyle;
final TextStyle statusStyle; final TextStyle statusStyle;
final Widget? leading;
final List<Widget> actions;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -35,13 +39,25 @@ class ChatSessionRowContent extends StatelessWidget {
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: titleStyle, style: titleStyle,
), ),
if (status != null) ...[ if (status != null || leading != null) ...[
const SizedBox(height: 2), const SizedBox(height: 2),
Align( Wrap(
alignment: AlignmentDirectional.centerStart, crossAxisAlignment: WrapCrossAlignment.center,
child: _StatusLabel(status: status!, style: statusStyle), spacing: 8,
children: [
?leading,
if (status != null)
_StatusLabel(status: status!, style: statusStyle),
],
), ),
], ],
for (final line in meta)
Text(
line,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: metaStyle,
),
if (recency != null && recency!.isNotEmpty) ...[ if (recency != null && recency!.isNotEmpty) ...[
const SizedBox(height: 3), const SizedBox(height: 3),
Align( Align(
@@ -54,12 +70,10 @@ class ChatSessionRowContent extends StatelessWidget {
), ),
), ),
], ],
for (final line in meta) if (actions.isNotEmpty)
Text( Align(
line, alignment: AlignmentDirectional.centerEnd,
maxLines: 2, child: Wrap(alignment: WrapAlignment.end, children: actions),
overflow: TextOverflow.ellipsis,
style: metaStyle,
), ),
], ],
); );
@@ -77,7 +91,7 @@ class _StatusLabel extends StatelessWidget {
if (status != 'New') { if (status != 'New') {
return Text( return Text(
status, status,
maxLines: 2, maxLines: 1,
style: style.copyWith(fontWeight: FontWeight.w600), style: style.copyWith(fontWeight: FontWeight.w600),
); );
} }
@@ -89,7 +103,7 @@ class _StatusLabel extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 7, vertical: 1), padding: const EdgeInsets.symmetric(horizontal: 7, vertical: 1),
child: Text( child: Text(
status, status,
maxLines: 2, maxLines: 1,
style: style.copyWith( style: style.copyWith(
color: Colors.white, color: Colors.white,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
@@ -17,6 +17,7 @@ import '../pipeline_query.dart';
import '../pipelines_controller.dart'; import '../pipelines_controller.dart';
import 'pipeline_controls.dart'; import 'pipeline_controls.dart';
import 'pipeline_filter_page.dart'; import 'pipeline_filter_page.dart';
import 'pipeline_scope_control.dart';
/// The list's horizontal rhythm, matching the web's toolbar and row inset /// The list's horizontal rhythm, matching the web's toolbar and row inset
/// (`var(--space-s)`: 12px). The detail pane keeps its own content padding. /// (`var(--space-s)`: 12px). The detail pane keeps its own content padding.
@@ -72,23 +73,10 @@ class PipelineListPanel extends StatelessWidget {
schedule: value ? ScheduleFilter.scheduled : ScheduleFilter.any, schedule: value ? ScheduleFilter.scheduled : ScheduleFilter.any,
), ),
); );
final control = useCupertinoControls(context) final control = PipelineScopeControl(
? CupertinoSlidingSegmentedControl<bool>( scheduled: scheduled,
key: const Key('pipeline-scope'), onSelected: pick,
groupValue: scheduled, );
onValueChanged: (value) => pick(value ?? false),
children: const {false: Text('All'), true: Text('Scheduled')},
)
: SegmentedButton<bool>(
key: const Key('pipeline-scope'),
showSelectedIcon: false,
segments: const [
ButtonSegment(value: false, label: Text('All')),
ButtonSegment(value: true, label: Text('Scheduled')),
],
selected: {scheduled},
onSelectionChanged: (value) => pick(value.single),
);
return Padding( return Padding(
padding: const EdgeInsets.fromLTRB( padding: const EdgeInsets.fromLTRB(
kPipelineListInset, kPipelineListInset,
@@ -313,7 +301,12 @@ class PipelineListPanel extends StatelessWidget {
], ],
) )
: controller.runsLoaded : controller.runsLoaded
? Text('no runs recorded', style: style) ? Text(
'no runs recorded',
style: style,
maxLines: 2,
overflow: TextOverflow.ellipsis,
)
: const SizedBox.shrink(); : const SizedBox.shrink();
return _measured( return _measured(
Column( Column(
@@ -322,7 +315,14 @@ class PipelineListPanel extends StatelessWidget {
Row( Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Expanded(child: Text(what, style: style)), Expanded(
child: Text(
what,
style: style,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
if (shape != null) ...[ if (shape != null) ...[
const SizedBox(width: 8), const SizedBox(width: 8),
// The miniature keeps to its corner and scales down when narrow. // The miniature keeps to its corner and scales down when narrow.
@@ -0,0 +1,119 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'pipeline_controls.dart';
/// Uses a native picker when the segmented labels cannot fit at the user's
/// text scale. The decision is content-measured, not a fixed pane width.
class PipelineScopeControl extends StatelessWidget {
const PipelineScopeControl({
super.key,
required this.scheduled,
required this.onSelected,
});
final bool scheduled;
final ValueChanged<bool> onSelected;
static const labels = {false: 'All', true: 'Scheduled'};
@override
Widget build(BuildContext context) {
final cupertino = useCupertinoControls(context);
final style = cupertino
? CupertinoTheme.of(context).textTheme.textStyle
: Theme.of(context).textTheme.labelLarge;
var requiredWidth = kMinInteractiveDimension * labels.length;
for (final label in labels.values) {
final painter = TextPainter(
text: TextSpan(text: label, style: style),
textDirection: Directionality.of(context),
textScaler: MediaQuery.textScalerOf(context),
)..layout();
requiredWidth += painter.width;
painter.dispose();
}
return LayoutBuilder(
builder: (context, constraints) {
if (constraints.maxWidth >= requiredWidth) {
return cupertino
? CupertinoSlidingSegmentedControl<bool>(
key: const Key('pipeline-scope'),
groupValue: scheduled,
onValueChanged: (value) => onSelected(value ?? false),
children: {
for (final entry in labels.entries)
entry.key: Text(entry.value),
},
)
: SegmentedButton<bool>(
key: const Key('pipeline-scope'),
showSelectedIcon: false,
segments: [
for (final entry in labels.entries)
ButtonSegment(value: entry.key, label: Text(entry.value)),
],
selected: {scheduled},
onSelectionChanged: (value) => onSelected(value.single),
);
}
if (!cupertino) {
return DropdownButton<bool>(
key: const Key('pipeline-scope'),
value: scheduled,
isExpanded: true,
items: [
for (final entry in labels.entries)
DropdownMenuItem(
value: entry.key,
child: Text(
entry.value,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
onChanged: (value) {
if (value != null) onSelected(value);
},
);
}
return CupertinoButton(
key: const Key('pipeline-scope'),
padding: EdgeInsets.zero,
onPressed: () => showCupertinoModalPopup<void>(
context: context,
builder: (sheetContext) => CupertinoActionSheet(
title: const Text('Pipeline scope'),
actions: [
for (final entry in labels.entries)
CupertinoActionSheetAction(
onPressed: () {
Navigator.of(sheetContext).pop();
if (context.mounted) onSelected(entry.key);
},
child: Text(entry.value),
),
],
cancelButton: CupertinoActionSheetAction(
onPressed: () => Navigator.of(sheetContext).pop(),
child: const Text('Cancel'),
),
),
),
child: Row(
children: [
Expanded(
child: Text(
labels[scheduled]!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
const Icon(CupertinoIcons.chevron_down),
],
),
);
},
);
}
}
+10 -5
View File
@@ -141,11 +141,16 @@ class _RunVisitPaneState extends State<RunVisitPane> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Semantics(
widget.visit.stage, container: true,
key: const Key('run-visit-title'), header: true,
style: style.stageTitle, identifier: 'run-stage-heading',
softWrap: true, child: Text(
widget.visit.stage,
key: const Key('run-visit-title'),
style: style.stageTitle,
softWrap: true,
),
), ),
const SizedBox(height: 4), const SizedBox(height: 4),
Wrap( Wrap(
+40 -18
View File
@@ -249,24 +249,46 @@ class RunListRow extends StatelessWidget {
color: secondary, color: secondary,
fontSize: (base.fontSize ?? 14) - 1, fontSize: (base.fontSize ?? 14) - 1,
); );
Widget line(String? start, String? end, TextStyle style, {Key? key}) => Row( Widget line(String? start, String? end, TextStyle style, {Key? key}) =>
key: key, LayoutBuilder(
crossAxisAlignment: CrossAxisAlignment.start, key: key,
children: [ builder: (context, constraints) {
Expanded( Widget text(String value) => Text(
child: Text( value,
start ?? '', style: style,
style: style, maxLines: 1,
maxLines: 1, overflow: TextOverflow.ellipsis,
overflow: TextOverflow.ellipsis, );
), if (end == null) return text(start ?? '');
), final measure = TextPainter(
if (end != null) ...[ text: TextSpan(text: end, style: style),
const SizedBox(width: 12), textDirection: Directionality.of(context),
Text(end, style: style), textScaler: MediaQuery.textScalerOf(context),
], )..layout();
], final fits = measure.width + 12 < constraints.maxWidth;
); measure.dispose();
if (!fits) {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
text(start ?? ''),
Align(
alignment: AlignmentDirectional.centerEnd,
child: text(end),
),
],
);
}
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: text(start ?? '')),
const SizedBox(width: 12),
text(end),
],
);
},
);
final scheduled = run['scheduled'] == true; final scheduled = run['scheduled'] == true;
final body = Row( final body = Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
+15 -11
View File
@@ -189,17 +189,21 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
: Column( : Column(
children: [ children: [
Expanded(child: _destinationStack(contents, index)), Expanded(child: _destinationStack(contents, index)),
CupertinoTabBar( // Match CupertinoTabScaffold's native tab-label policy;
currentIndex: index, // content elsewhere still follows the user's scaler.
onTap: (value) => MediaQuery.withNoTextScaling(
_select(AppDestination.values[value]), child: CupertinoTabBar(
items: _items((destination) { currentIndex: index,
final item = destinationDetails(destination); onTap: (value) =>
return BottomNavigationBarItem( _select(AppDestination.values[value]),
icon: _icon(destination, item.cupertinoIcon), items: _items((destination) {
label: item.label, final item = destinationDetails(destination);
); return BottomNavigationBarItem(
}), icon: _icon(destination, item.cupertinoIcon),
label: item.label,
);
}),
),
), ),
], ],
), ),
+49 -27
View File
@@ -1,3 +1,5 @@
import 'dart:math' as math;
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -6,13 +8,16 @@ import '../ui/adaptive/host.dart';
/// At least this wide, a destination keeps its list beside the open item /// At least this wide, a destination keeps its list beside the open item
/// (with the destination rail) instead of pushing the item as its own page. /// (with the destination rail) instead of pushing the item as its own page.
const double kListDetailMinWidth = 600; const double kListDetailMinWidth = 600;
const double _bodyWindowTarget = 0.6;
const double _bodyWindowMinimum = 0.5;
const double _bodyAvailableMaximum = 0.75;
/// Whether the window at [context] shows list and detail side by side. /// Whether the window at [context] shows list and detail side by side.
bool showsListBesideDetail(BuildContext context) => bool showsListBesideDetail(BuildContext context) =>
MediaQuery.sizeOf(context).width >= kListDetailMinWidth; MediaQuery.sizeOf(context).width >= kListDetailMinWidth;
/// Equal flexible panes, shared by Pipelines, Runs and Chat. No destination /// One body-priority policy for all destinations, derived from the full window
/// supplies a pixel width, minimum/maximum pane width or split ratio. /// and actual available space after navigation. No fixed pixel pane widths.
class ListDetailPanes extends StatelessWidget { class ListDetailPanes extends StatelessWidget {
const ListDetailPanes({super.key, required this.list, required this.detail}); const ListDetailPanes({super.key, required this.list, required this.detail});
@@ -27,33 +32,50 @@ class ListDetailPanes extends StatelessWidget {
color: CupertinoColors.separator.resolveFrom(context), color: CupertinoColors.separator.resolveFrom(context),
) )
: const VerticalDivider(width: 1); : const VerticalDivider(width: 1);
return Row( return LayoutBuilder(
crossAxisAlignment: CrossAxisAlignment.stretch, builder: (context, constraints) {
children: [ final window = MediaQuery.sizeOf(context).width;
Expanded( // Target 60% of the full window. Keep at least half for the body while
child: SizedBox.expand( // leaving a flexible share for native list controls on tighter windows.
key: const ValueKey('list-detail-list'), final requestedMinimum = window * _bodyWindowMinimum;
child: Semantics( final minimum = constraints.maxWidth > requestedMinimum
container: true, ? requestedMinimum
explicitChildNodes: true, : constraints.maxWidth * _bodyWindowMinimum;
identifier: 'list-detail-list', final maximum = math.max(
child: list, minimum,
constraints.maxWidth * _bodyAvailableMaximum,
);
final bodyWidth = (window * _bodyWindowTarget).clamp(minimum, maximum);
return Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: SizedBox.expand(
key: const ValueKey('list-detail-list'),
child: Semantics(
container: true,
explicitChildNodes: true,
identifier: 'list-detail-list',
child: list,
),
),
), ),
), divider,
), SizedBox(
divider, width: bodyWidth,
Expanded( child: SizedBox.expand(
child: SizedBox.expand( key: const ValueKey('list-detail-body'),
key: const ValueKey('list-detail-body'), child: Semantics(
child: Semantics( container: true,
container: true, explicitChildNodes: true,
explicitChildNodes: true, identifier: 'list-detail-body',
identifier: 'list-detail-body', child: detail,
child: detail, ),
),
), ),
), ],
), );
], },
); );
} }
} }
+7 -4
View File
@@ -3,13 +3,16 @@
| Item | Source | Verification | Landing | Deployment | | Item | Source | Verification | Landing | Deployment |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| Tasks badge above Send + live modal | Manager implementation complete | 1,936 full tests; clean analysis; Material/Cupertino browser pass | Main, manager commit | Not published | | Tasks badge above Send + live modal | Manager implementation complete | 1,936 full tests; clean analysis; Material/Cupertino browser pass | Main, manager commit | Not published |
| Body-priority shared split (target ~60% window, minimum 50%) | Manager, next | Pending | Pending | Not published | | Body-priority shared split (target ~60% window, minimum 50%) | Manager | Full suite + browser pass | Main | Not published |
| Optional-by-default custom/preset create prompt | Run 187 partial; direct Luna completion in same worktree | Default-off candidate passes; actual chooser/race guard in progress | Candidate only | Not published | | Optional-by-default custom/preset create prompt | Run 187 + direct completion/integration | Full suite + both-host browser pass | Main | Not published |
| Structured multiline chat rows | Run 188 + direct Luna candidate | Further style/narrow fixes required; no browser capture | Candidate only | Not published | | Structured multiline chat rows | Run 188 + direct completion/integration | Full suite + narrow both-host browser pass | Main | Not published |
| Prominent run-stage detail hierarchy | Run 189 no-op; direct Luna commit ca6a0516 | 13 focused tests; targeted analysis; browser probe needs repair | Candidate only | Not published | | Prominent run-stage detail hierarchy | Direct completion after run 189 no-op | Full suite + repeated deep-link browser pass | Main | Not published |
Prior Enter/shared equal-pane release is separately published as APK Prior Enter/shared equal-pane release is separately published as APK
0.1.29882706; see `shared-panes-enter-release.md`. It does not contain these new 0.1.29882706; see `shared-panes-enter-release.md`. It does not contain these new
follow-ups. Independent workers use separate worktrees; no pipeline definitions follow-ups. Independent workers use separate worktrees; no pipeline definitions
were created or modified. Manager will inspect changes and actual landing, were created or modified. Manager will inspect changes and actual landing,
resolve compatible overlaps, and run an integrated gate before claiming delivery. resolve compatible overlaps, and run an integrated gate before claiming delivery.
The integrated gate now passes: see `ui-followups-verified.md` (1,960 tests,
clean analysis, production web build and isolated browser captures). No public
deployment or phone installation of the follow-ups has occurred.
+48
View File
@@ -0,0 +1,48 @@
# Prompt, list and stage UI follow-ups
## Delivered source
- New-chat prompts default off on every opening. Opting in exposes a native
Custom / Careful coding / Last used picker (Last used only when recorded).
Presets stay editable; switching back restores the custom draft. An enabled
blank prompt cannot submit. Off omits instructions and preserves Last used.
Late saved reads cannot replace explicit choices or edits.
- All three destinations share a window-relative split: body targets 60% of
the full window, with 50% minimum in the supported side-by-side layouts.
Navigation is accounted for; no fixed list/body pixel widths. Phone layouts
still use page navigation. Narrow pipeline scope uses native pickers; run facts
wrap when needed. Cupertino tab-label scaling matches CupertinoTabScaffold.
- Chat rows separate title, state, backend, model, directory and recency. Metadata
uses secondary native typography, recency aligns trailing, actions stay at the
trailing edge and wrap without shrinking touch targets. Selected fill remains.
- Recorded stage identity is a prominent accessible native heading. Visit and run
coordinates are separate and subordinate; recorded facts and diagnostic follow.
Repeated/deep-linked visit selection, artifacts, changes and search are retained.
## Verification
- Full Flutter suite: **1,960 passed**, `build/ui-followups-full-tests.log`.
- `flutter analyze`: no issues. Production web build passed to
`build/ui-followups-web`, separate from public `build/web`.
- Shared-pane regression matrix: 24 cases across Material/Cupertino, light/dark,
640/840/1280 widths and 1x/2x text; selection, star/menu, narrow navigation and
resizing checked. Native compact pipeline scope interaction tests pass.
- Real isolated browser probes passed and captures inspected:
`build/body-priority-material` (640, light) and
`build/body-priority-cupertino` (840, dark), with all three tabs retaining the
same body-priority geometry and changing selected rows.
- `tool/ui_followups_probe.mjs` passed on both hosts using production app entry:
actual default-off create payload, editable preset/custom selector, custom
payload, and two repeated stage deep links. Captures in
`build/ui-followups-{material,cupertino}`. Fixture creates affect loopback only.
- Earlier pipeline UI-review stages skipped these actual UI changes; that skip
was not accepted as rendered evidence. Manager completed direct checks above.
- No phone test, APK build/publication or public website deployment for this batch.
Existing public release remains 0.1.29882706. Unrelated dirty work preserved.
## Integration
Preserved and merged candidates `661dfc66` (including `f1e2270e`), `ca6a0516`
and `bd256ad1` (including `9c9888c0`). Manager completed race handling, custom
draft restoration, narrow row fixes, shared sizing and regression expectations.
Background-task modal was separately committed as `a485ccec`.
@@ -17,217 +17,258 @@ void main() {
for (final cupertino in [false, true]) { for (final cupertino in [false, true]) {
for (final brightness in Brightness.values) { for (final brightness in Brightness.values) {
for (final width in [640.0, 840.0, 1280.0]) { for (final width in [640.0, 840.0, 1280.0]) {
testWidgets('shared equal panes and selected rows: $cupertino ' for (final scale in [1.0, 2.0]) {
'$brightness at $width', (tester) async { testWidgets('shared body-priority panes and selected rows: $cupertino '
SharedPreferences.setMockInitialValues({}); '$brightness at $width @${scale}x', (tester) async {
tester.view.physicalSize = Size(width, 900); SharedPreferences.setMockInitialValues({});
tester.view.devicePixelRatio = 1; tester.view.physicalSize = Size(width, 900);
addTearDown(tester.view.reset); tester.view.devicePixelRatio = 1;
final fixture = PipelineFixture(); addTearDown(tester.view.reset);
final gateway = FakeGateway( tester.platformDispatcher.textScaleFactorTestValue = scale;
(type, fields) => switch (type) { addTearDown(
'list_pipelines' => pipelineListReply(fixture.summaries), tester.platformDispatcher.clearTextScaleFactorTestValue,
'get_pipeline' => pipelineDetailReply( );
fixture.detailFor( final fixture = PipelineFixture();
fields['pipeline_id'] as int, final gateway = FakeGateway(
fields['version'] as int, (type, fields) => switch (type) {
)!, 'list_pipelines' => pipelineListReply(fixture.summaries),
), 'get_pipeline' => pipelineDetailReply(
'list_runs' => { fixture.detailFor(
'runs': [ fields['pipeline_id'] as int,
for (final id in [1, 2]) fields['version'] as int,
{'id': id, 'title': 'Run item $id', 'status': 'succeeded'}, )!,
], ),
}, 'list_runs' => {
'get_run' => { 'runs': [
'run_detail': { for (final id in [1, 2])
'id': fields['run_id'], {
'title': 'Run item ${fields['run_id']}', 'id': id,
'status': 'succeeded', 'title': 'Run item $id',
'input': {'prompt': 'Recorded input'}, 'status': 'succeeded',
},
],
}, },
}, 'get_run' => {
'chat_sessions' => { 'run_detail': {
'chat_sessions': [ 'id': fields['run_id'],
{ 'title': 'Run item ${fields['run_id']}',
'id': 'a', 'status': 'succeeded',
'title': 'Chat item a', 'input': {'prompt': 'Recorded input'},
'backend': 'claude',
'model': 'claude-opus',
'mode': 'auto',
'mode_name': 'Auto',
}, },
{ },
'id': 'b', 'chat_sessions' => {
'title': 'Chat item b', 'chat_sessions': [
'backend': 'claude', {
'model': 'claude-opus', 'id': 'a',
'mode': 'auto', 'title': 'Chat item a',
'mode_name': 'Auto', 'backend': 'claude',
}, 'model': 'claude-opus',
], 'mode': 'auto',
'mode_name': 'Auto',
},
{
'id': 'b',
'title': 'Chat item b',
'backend': 'claude',
'model': 'claude-opus',
'mode': 'auto',
'mode_name': 'Auto',
},
],
},
'chat_messages' => {
'chat_history': {'messages': []},
},
_ => {},
}, },
'chat_messages' => { );
'chat_history': {'messages': []}, final shell = AdaptiveShell(
cupertino: cupertino,
destinationBodies: {
AppDestination.pipelines: (_) =>
PipelinesScreen(gateway: gateway, embedded: true),
AppDestination.runs: (_) => RunsScreen(gateway: gateway),
AppDestination.chat: (_) => ChatScreen(gateway: gateway),
}, },
_ => {}, );
}, await tester.pumpWidget(
); cupertino
final shell = AdaptiveShell( ? CupertinoApp(
cupertino: cupertino, theme: CupertinoThemeData(brightness: brightness),
destinationBodies: { home: shell,
AppDestination.pipelines: (_) => )
PipelinesScreen(gateway: gateway, embedded: true), : MaterialApp(
AppDestination.runs: (_) => RunsScreen(gateway: gateway), theme: brightness == Brightness.dark
AppDestination.chat: (_) => ChatScreen(gateway: gateway), ? appDarkTheme()
}, : appLightTheme(),
); home: shell,
await tester.pumpWidget( ),
cupertino );
? CupertinoApp( await tester.pumpAndSettle();
theme: CupertinoThemeData(brightness: brightness), final paneWidths = <double>[];
home: shell, final bodyWidths = <double>[];
) for (final destination in ['Pipelines', 'Runs', 'Chat']) {
: MaterialApp( if (destination != 'Pipelines') {
theme: brightness == Brightness.dark await tester.tap(find.text(destination).first);
? appDarkTheme() await tester.pumpAndSettle();
: appLightTheme(), expect(
home: shell, tester.takeException(),
), isNull,
); reason: '$destination list',
await tester.pumpAndSettle(); );
final paneWidths = <double>[]; }
for (final destination in ['Pipelines', 'Runs', 'Chat']) { final list = find.byKey(const ValueKey('list-detail-list'));
if (destination != 'Pipelines') { final detail = find.byKey(const ValueKey('list-detail-body'));
await tester.tap(find.text(destination).first); expect(list, findsOneWidget);
await tester.pumpAndSettle(); expect(detail, findsOneWidget);
expect( final before = tester.getSize(list).width;
tester.takeException(), final bodyBefore = tester.getSize(detail).width;
isNull, paneWidths.add(before);
reason: '$destination list', bodyWidths.add(bodyBefore);
); expect(bodyBefore, greaterThanOrEqualTo(width * 0.5));
} expect(bodyBefore, lessThanOrEqualTo(width * 0.6));
final list = find.byKey(const ValueKey('list-detail-list')); expect(bodyBefore, greaterThan(before));
final detail = find.byKey(const ValueKey('list-detail-body')); final rowKeys = switch (destination) {
expect(list, findsOneWidget); 'Pipelines' => ['pipeline-row-1', 'pipeline-row-2'],
expect(detail, findsOneWidget); 'Runs' => ['run-row-1', 'run-row-2'],
final before = tester.getSize(list).width; _ => ['chat-row-a', 'chat-row-b'],
paneWidths.add(before); };
expect(before, closeTo(tester.getSize(detail).width, 0.01)); for (final key in rowKeys) {
final rowKeys = switch (destination) { final target = find.byKey(ValueKey(key));
'Pipelines' => ['pipeline-row-1', 'pipeline-row-2'], // In a narrow Cupertino list the row center can be a star/menu
'Runs' => ['run-row-1', 'run-row-2'], // control. Open the chat through its title, not a trailing action.
_ => ['chat-row-a', 'chat-row-b'], final opener = destination == 'Chat'
};
for (final key in rowKeys) {
final target = find.byKey(ValueKey(key));
// In a narrow Cupertino list the row center can be a star/menu
// control. Open the chat through its title, not a trailing action.
await tester.tap(
destination == 'Chat'
? find.descendant( ? find.descendant(
of: target, of: target,
matching: find.text('Chat item ${key.split('-').last}'), matching: find.text('Chat item ${key.split('-').last}'),
) )
: target, : target;
); await tester.ensureVisible(opener);
await tester.tap(opener);
await tester.pumpAndSettle();
expect(
tester.takeException(),
isNull,
reason: '$destination after opening $key',
);
expect(tester.getSize(list).width, closeTo(before, 0.01));
expect(tester.getSize(detail).width, closeTo(bodyBefore, 0.01));
expect(
tester.state<NavigatorState>(find.byType(Navigator)).canPop(),
isFalse,
);
for (final rowKey in rowKeys) {
final row = find.byKey(ValueKey(rowKey));
expect(
row,
findsOneWidget,
reason: 'the list must remain visible',
);
final selected = rowKey == key;
expect(
tester.getSemantics(row).flagsCollection.isSelected ==
Tristate.isTrue,
selected,
reason: '$destination: $rowKey after opening $key',
);
final context = tester.element(row);
if (cupertino) {
final color = destination == 'Runs'
? tester.widget<CupertinoButton>(row).color
: tester.widget<CupertinoListTile>(row).backgroundColor;
expect(
color,
selected
? CupertinoColors.tertiarySystemFill.resolveFrom(
context,
)
: isNull,
);
} else if (destination == 'Runs') {
final id = rowKey.split('-').last;
expect(
tester
.widget<Material>(
find.byKey(ValueKey('run-row-surface-$id')),
)
.color,
selected
? Theme.of(context).colorScheme.secondaryContainer
: Colors.transparent,
);
} else {
final tile = tester.widget<ListTile>(row);
expect(tile.selected, selected);
expect(
tile.selectedTileColor,
Theme.of(context).colorScheme.secondaryContainer,
);
}
}
}
if (destination == 'Chat') {
final star = find.byKey(const Key('chat-star-b'));
await tester.ensureVisible(star);
await tester.tap(star);
await tester.pumpAndSettle();
expect(
gateway
.callsOf('chat_star')
.last
.fields['chat_query']['session_id'],
'b',
);
final actions = find.byKey(const Key('chat-actions-b'));
await tester.ensureVisible(actions);
await tester.tap(actions);
await tester.pumpAndSettle();
expect(find.text('Rename…'), findsOneWidget);
await tester.binding.handlePopRoute();
await tester.pumpAndSettle();
}
// A phone still uses stock page navigation; returning to a wide
// window must keep the selected item without clearing its route.
tester.view.physicalSize = const Size(390, 900);
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect( expect(
tester.takeException(), tester.state<NavigatorState>(find.byType(Navigator)).canPop(),
isNull, isTrue,
reason: '$destination after opening $key', reason: '$destination should push its selected item on a phone',
); );
expect(tester.getSize(list).width, closeTo(before, 0.01)); expect(
expect(tester.getSize(detail).width, closeTo(before, 0.01)); find.byKey(const ValueKey('list-detail-list')),
findsNothing,
);
tester.view.physicalSize = Size(width, 900);
await tester.pumpAndSettle();
expect( expect(
tester.state<NavigatorState>(find.byType(Navigator)).canPop(), tester.state<NavigatorState>(find.byType(Navigator)).canPop(),
isFalse, isFalse,
); );
for (final rowKey in rowKeys) { expect(tester.getSize(list).width, closeTo(before, 0.01));
final row = find.byKey(ValueKey(rowKey)); expect(
expect( tester
row, .getSemantics(find.byKey(ValueKey(rowKeys.last)))
findsOneWidget, .flagsCollection
reason: 'the list must remain visible', .isSelected,
); Tristate.isTrue,
final selected = rowKey == key; );
expect(
tester.getSemantics(row).flagsCollection.isSelected ==
Tristate.isTrue,
selected,
reason: '$destination: $rowKey after opening $key',
);
final context = tester.element(row);
if (cupertino) {
final color = destination == 'Runs'
? tester.widget<CupertinoButton>(row).color
: tester.widget<CupertinoListTile>(row).backgroundColor;
expect(
color,
selected
? CupertinoColors.tertiarySystemFill.resolveFrom(
context,
)
: isNull,
);
} else if (destination == 'Runs') {
final id = rowKey.split('-').last;
expect(
tester
.widget<Material>(
find.byKey(ValueKey('run-row-surface-$id')),
)
.color,
selected
? Theme.of(context).colorScheme.secondaryContainer
: Colors.transparent,
);
} else {
final tile = tester.widget<ListTile>(row);
expect(tile.selected, selected);
expect(
tile.selectedTileColor,
Theme.of(context).colorScheme.secondaryContainer,
);
}
}
} }
// A phone still uses stock page navigation; returning to a wide
// window must keep the selected item without clearing its route.
tester.view.physicalSize = const Size(390, 900);
await tester.pumpAndSettle();
expect( expect(
tester.state<NavigatorState>(find.byType(Navigator)).canPop(), paneWidths,
isTrue, everyElement(closeTo(paneWidths.first, 0.01)),
reason: '$destination should push its selected item on a phone', reason: 'Pipelines, Runs and Chat must use identical pane widths',
); );
expect(tester.takeException(), isNull);
expect( expect(
find.byKey(const ValueKey('list-detail-list')), bodyWidths,
findsNothing, everyElement(closeTo(bodyWidths.first, 0.01)),
reason:
'Every destination must share the body-priority sizing policy',
); );
tester.view.physicalSize = Size(width, 900); await tester.pumpWidget(const SizedBox.shrink());
await tester.pumpAndSettle(); });
expect( }
tester.state<NavigatorState>(find.byType(Navigator)).canPop(),
isFalse,
);
expect(tester.getSize(list).width, closeTo(before, 0.01));
expect(
tester
.getSemantics(find.byKey(ValueKey(rowKeys.last)))
.flagsCollection
.isSelected,
Tristate.isTrue,
);
}
expect(
paneWidths,
everyElement(closeTo(paneWidths.first, 0.01)),
reason: 'Pipelines, Runs and Chat must use identical pane widths',
);
expect(tester.takeException(), isNull);
await tester.pumpWidget(const SizedBox.shrink());
});
} }
} }
} }
+4 -3
View File
@@ -3,6 +3,7 @@ import 'dart:convert';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import '../features/runs/ui/run_detail_finders.dart';
import '../native_back.dart'; import '../native_back.dart';
import 'package:pipelines_app/application/app_route.dart'; import 'package:pipelines_app/application/app_route.dart';
import 'package:pipelines_app/application/app_router.dart'; import 'package:pipelines_app/application/app_router.dart';
@@ -335,8 +336,8 @@ void main() {
// The query reached the detail: visit 0 is the earlier plan visit (seq 1), // The query reached the detail: visit 0 is the earlier plan visit (seq 1),
// not the latest one the pane would show without a visit. // not the latest one the pane would show without a visit.
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget); expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
expect(find.text('plan · visit 1'), findsOneWidget); expectVisitHeading(tester, 'plan', 1);
expect(find.text('plan · visit 5'), findsNothing); expect(find.text('Visit 5'), findsNothing);
expect(provider.value.uri.toString(), '/runs/77/stage/plan?visit=0'); expect(provider.value.uri.toString(), '/runs/77/stage/plan?visit=0');
// A history entry the app itself writes is parsed back as a query, so // A history entry the app itself writes is parsed back as a query, so
@@ -350,7 +351,7 @@ void main() {
await tester.pump(); await tester.pump();
await tester.pump(const Duration(milliseconds: 400)); await tester.pump(const Duration(milliseconds: 400));
await tester.pump(const Duration(milliseconds: 400)); await tester.pump(const Duration(milliseconds: 400));
expect(find.text('plan · visit 5'), findsOneWidget); expectVisitHeading(tester, 'plan', 5);
expect(provider.value.uri.path, '/runs/77/stage/plan'); expect(provider.value.uri.path, '/runs/77/stage/plan');
expect(provider.value.uri.query, 'visit=1'); expect(provider.value.uri.query, 'visit=1');
}); });
+3 -14
View File
@@ -3,6 +3,7 @@ import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import '../features/runs/ui/run_detail_finders.dart';
import '../native_back.dart'; import '../native_back.dart';
import 'package:pipelines_app/application/app_route.dart'; import 'package:pipelines_app/application/app_route.dart';
import 'package:pipelines_app/application/app_router.dart'; import 'package:pipelines_app/application/app_router.dart';
@@ -496,13 +497,7 @@ void main() {
expect(provider.value.uri.path, '/runs/7'); expect(provider.value.uri.path, '/runs/7');
expect(find.byType(SearchScreen), findsNothing); expect(find.byType(SearchScreen), findsNothing);
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget); expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
expect( expectVisitHeading(tester, 'build', 2);
find.descendant(
of: find.byKey(const Key('run-visit-pane')),
matching: find.text('build · visit 2'),
),
findsOneWidget,
);
// Leave the visit page (it covers the shell), then a retired field hit // Leave the visit page (it covers the shell), then a retired field hit
// opens the plain Summary with no visit. // opens the plain Summary with no visit.
@@ -613,13 +608,7 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget); expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
expect( expectVisitHeading(tester, 'build', 2);
find.descendant(
of: find.byKey(const Key('run-visit-pane')),
matching: find.text('build · visit 2'),
),
findsOneWidget,
);
await tester.pumpWidget(const SizedBox.shrink()); await tester.pumpWidget(const SizedBox.shrink());
await tester.pump(); await tester.pump();
@@ -57,8 +57,7 @@ void main() {
); );
expect( expect(
find.text( find.text(
"This server has no request for choosing a chat's model, so a new " "New chats start with the server's default model.",
"chat uses the server's default.",
), ),
findsOneWidget, findsOneWidget,
); );
@@ -150,17 +149,28 @@ void main() {
findsOneWidget, findsOneWidget,
); );
expect(find.text('Chat harness: OpenCode'), findsOneWidget); expect(find.text('Chat harness: OpenCode'), findsOneWidget);
await tester.ensureVisible(
find.byKey(const Key('chat-create-prompt-choice')),
);
await tester.tap(find.byKey(const Key('chat-create-prompt-choice')));
await tester.pumpAndSettle();
await tester.tap(find.text('Careful coding'));
await tester.pumpAndSettle();
expect( expect(
find.textContaining('Act as a careful coding agent.'), find.textContaining('Act as a careful coding agent.'),
findsOneWidget, findsOneWidget,
); );
await tester.ensureVisible(find.byKey(const Key('chat-create-backend')));
await tester.tap(find.byKey(const Key('chat-create-backend'))); await tester.tap(find.byKey(const Key('chat-create-backend')));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
await tester.tap(find.text('Codex')); await tester.tap(find.text('Codex'));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.text('Chat harness: Codex'), findsOneWidget); expect(find.text('Chat harness: Codex'), findsOneWidget);
await tester.ensureVisible(
find.byKey(const Key('chat-create-server-directory')),
);
await tester.tap(find.byKey(const Key('chat-create-server-directory'))); await tester.tap(find.byKey(const Key('chat-create-server-directory')));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.text('/archive'), findsOneWidget); expect(find.text('/archive'), findsOneWidget);
@@ -68,6 +68,7 @@ Future<ChatDraft?> _create(
find.byKey(const Key('chat-create-instructions')), find.byKey(const Key('chat-create-instructions')),
prompt, prompt,
); );
await tester.pump();
} }
await tester.ensureVisible(find.byKey(const Key('chat-create-confirm'))); await tester.ensureVisible(find.byKey(const Key('chat-create-confirm')));
await tester.tap(find.byKey(const Key('chat-create-confirm'))); await tester.tap(find.byKey(const Key('chat-create-confirm')));
@@ -95,6 +96,11 @@ void main() {
await tester.pumpWidget(const SizedBox()); await tester.pumpWidget(const SizedBox());
final second = await _create(tester, prompts); final second = await _create(tester, prompts);
expect(second!.instructions, isEmpty); expect(second!.instructions, isEmpty);
expect(
prompts.saved.values.single.text,
'Review only.',
reason: 'A promptless chat must not erase the Last used preset',
);
}); });
testWidgets('a chat starts without a prompt even after a prior choice', ( testWidgets('a chat starts without a prompt even after a prior choice', (
@@ -103,11 +109,11 @@ void main() {
final prompts = _MemoryPrompts(); final prompts = _MemoryPrompts();
final draft = await _create(tester, prompts); final draft = await _create(tester, prompts);
expect(draft!.instructions, isEmpty); expect(draft!.instructions, isEmpty);
expect(prompts.saved.values.single.send, isFalse); expect(prompts.saved, isEmpty);
await tester.pumpWidget(const SizedBox()); await tester.pumpWidget(const SizedBox());
await _create(tester, prompts); await _create(tester, prompts);
expect(prompts.saved.values.single.send, isFalse); expect(prompts.saved, isEmpty);
}); });
testWidgets('the prompt menu selects a preset and permits custom edits', ( testWidgets('the prompt menu selects a preset and permits custom edits', (
@@ -182,6 +188,62 @@ void main() {
); );
}); });
testWidgets(
'custom starts empty and survives switching to a preset and back',
(tester) async {
await _open(tester, _MemoryPrompts());
await tester.tap(find.byKey(const Key('chat-create-send-prompt')));
await tester.pumpAndSettle();
final field = find.byKey(const Key('chat-create-instructions'));
String text() => tester.widget<TextField>(field).controller!.text;
expect(text(), isEmpty);
expect(
tester
.widget<FilledButton>(find.byKey(const Key('chat-create-confirm')))
.onPressed,
isNull,
);
await tester.enterText(field, 'My custom draft');
await tester.pump();
await _pickPrompt(tester, 'Careful coding');
expect(text(), chatDefaultSessionInstructions);
await _pickPrompt(tester, 'Custom');
expect(text(), 'My custom draft');
expect(
tester
.widget<FilledButton>(find.byKey(const Key('chat-create-confirm')))
.onPressed,
isNotNull,
);
},
);
testWidgets('late saved data preserves opt-in and still offers Last used', (
tester,
) async {
final prompts = _DelayedPrompts();
await _open(tester, prompts, settle: false);
await tester.pump(const Duration(milliseconds: 1));
await tester.tap(find.byKey(const Key('chat-create-send-prompt')));
await tester.pump();
prompts.result.complete((send: true, text: 'Saved preset'));
await tester.pumpAndSettle();
expect(
tester
.widget<Switch>(find.byKey(const Key('chat-create-send-prompt')))
.value,
isTrue,
);
await _pickPrompt(tester, 'Last used prompt');
expect(
tester
.widget<TextField>(find.byKey(const Key('chat-create-instructions')))
.controller!
.text,
'Saved preset',
);
});
testWidgets('Cupertino prompt chooser has native preset and custom choices', ( testWidgets('Cupertino prompt chooser has native preset and custom choices', (
tester, tester,
) async { ) async {
@@ -213,6 +275,15 @@ void main() {
}); });
} }
Future<void> _pickPrompt(WidgetTester tester, String label) async {
final chooser = find.byKey(const Key('chat-create-prompt-choice'));
await tester.ensureVisible(chooser);
await tester.tap(chooser);
await tester.pumpAndSettle();
await tester.tap(find.text(label).last);
await tester.pumpAndSettle();
}
Future<void> _open( Future<void> _open(
WidgetTester tester, WidgetTester tester,
ChatCreatePromptStore prompts, { ChatCreatePromptStore prompts, {
@@ -185,14 +185,17 @@ void main() {
greaterThan(tester.getCenter(find.text('Starred chat')).dx), greaterThan(tester.getCenter(find.text('Starred chat')).dx),
); );
// The meta line keeps `CupertinoListTile`'s native 12pt subtitle style; it // Metadata and state use native caption roles, not title-sized text.
// must not be rendered at the title's body size. The colour-only style the
// row passes merges with the tile's own `DefaultTextStyle`.
final titleStyle = _styleOf(tester, 'Starred chat'); final titleStyle = _styleOf(tester, 'Starred chat');
final metaStyle = _styleOf(tester, '5 min ago'); final metaStyle = _styleOf(tester, '5 min ago');
expect(metaStyle.fontSize, lessThan(titleStyle.fontSize!)); expect(metaStyle.fontSize, lessThan(titleStyle.fontSize!));
expect(metaStyle.fontSize, 12.0); expect(
expect(_styleOf(tester, 'New').fontSize, titleStyle.fontSize); metaStyle.fontSize,
CupertinoTheme.of(
tester.element(find.text('5 min ago')),
).textTheme.tabLabelTextStyle.fontSize,
);
expect(_styleOf(tester, 'New').fontSize, metaStyle.fontSize);
// Each session is still its own native tile with its own actions, so the // Each session is still its own native tile with its own actions, so the
// inset group draws the separator between them. // inset group draws the separator between them.
@@ -34,6 +34,7 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('chat-create-send-prompt'))); await tester.tap(find.byKey(const Key('chat-create-send-prompt')));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
await _chooseCareful(tester);
await tester.tap(find.byKey(const Key('chat-create-confirm'))); await tester.tap(find.byKey(const Key('chat-create-confirm')));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
@@ -196,6 +197,7 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('chat-create-send-prompt'))); await tester.tap(find.byKey(const Key('chat-create-send-prompt')));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
await _chooseCareful(tester);
await tester.tap(find.byKey(const Key('chat-create-confirm'))); await tester.tap(find.byKey(const Key('chat-create-confirm')));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
@@ -231,3 +233,12 @@ void main() {
expect(find.byKey(const Key('chat-row-error-s2')), findsNothing); expect(find.byKey(const Key('chat-row-error-s2')), findsNothing);
}); });
} }
Future<void> _chooseCareful(WidgetTester tester) async {
final chooser = find.byKey(const Key('chat-create-prompt-choice'));
await tester.ensureVisible(chooser);
await tester.tap(chooser);
await tester.pumpAndSettle();
await tester.tap(find.text('Careful coding').last);
await tester.pumpAndSettle();
}
@@ -62,6 +62,7 @@ void main() {
testWidgets( testWidgets(
'material list keeps closed starred rows once and groups directories once', 'material list keeps closed starred rows once and groups directories once',
(tester) async { (tester) async {
_inventoryViewport(tester);
final gateway = FakeChatGateway() final gateway = FakeChatGateway()
..sessionsReply = {'chat_sessions': sampleSessions()}; ..sessionsReply = {'chat_sessions': sampleSessions()};
await pumpMaterialChat(tester, gateway); await pumpMaterialChat(tester, gateway);
@@ -101,6 +102,7 @@ void main() {
testWidgets( testWidgets(
'Cupertino app renders standard controls, groups and renames without Material', 'Cupertino app renders standard controls, groups and renames without Material',
(tester) async { (tester) async {
_inventoryViewport(tester);
final gateway = FakeChatGateway() final gateway = FakeChatGateway()
..sessionsReply = {'chat_sessions': sampleSessions()}; ..sessionsReply = {'chat_sessions': sampleSessions()};
await pumpCupertinoChat(tester, gateway); await pumpCupertinoChat(tester, gateway);
@@ -203,6 +205,7 @@ void main() {
testWidgets('closed chats start folded away behind their heading', ( testWidgets('closed chats start folded away behind their heading', (
tester, tester,
) async { ) async {
_inventoryViewport(tester);
final gateway = FakeChatGateway() final gateway = FakeChatGateway()
..sessionsReply = {'chat_sessions': sampleSessions()}; ..sessionsReply = {'chat_sessions': sampleSessions()};
await pumpMaterialChat(tester, gateway); await pumpMaterialChat(tester, gateway);
@@ -213,3 +216,10 @@ void main() {
expect(find.byKey(const Key('chat-row-s4')), findsOneWidget); expect(find.byKey(const Key('chat-row-s4')), findsOneWidget);
}); });
} }
void _inventoryViewport(WidgetTester tester) {
// This test inventories every row; separate layout tests cover small screens.
tester.view.physicalSize = const Size(800, 1600);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
}
@@ -4,7 +4,13 @@ import 'package:flutter_test/flutter_test.dart';
/// Closed chats start folded away; opens that section when it is shown. /// Closed chats start folded away; opens that section when it is shown.
Future<void> expandClosedChats(WidgetTester tester) async { Future<void> expandClosedChats(WidgetTester tester) async {
final section = find.byKey(const ValueKey('chat-section-Closed')); final section = find.byKey(const ValueKey('chat-section-Closed'));
if (section.evaluate().isEmpty) return; if (section.evaluate().isEmpty) {
await tester.scrollUntilVisible(
section,
200,
scrollable: find.byType(Scrollable).first,
);
}
final heading = find.descendant(of: section, matching: find.text('Closed')); final heading = find.descendant(of: section, matching: find.text('Closed'));
await tester.ensureVisible(heading.first); await tester.ensureVisible(heading.first);
await tester.tap(heading.first); await tester.tap(heading.first);
@@ -0,0 +1,44 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/pipelines/widgets/pipeline_scope_control.dart';
void main() {
for (final cupertino in [false, true]) {
for (final width in [120.0, 500.0]) {
testWidgets(
'native scope remains usable at $width, Cupertino=$cupertino',
(tester) async {
var scheduled = false;
final control = StatefulBuilder(
builder: (context, setState) => Center(
child: SizedBox(
width: width,
child: PipelineScopeControl(
scheduled: scheduled,
onSelected: (value) => setState(() => scheduled = value),
),
),
),
);
await tester.pumpWidget(
cupertino
? CupertinoApp(home: CupertinoPageScaffold(child: control))
: MaterialApp(home: Scaffold(body: control)),
);
await tester.pumpAndSettle();
if (width == 120) {
await tester.tap(find.byKey(const Key('pipeline-scope')));
await tester.pumpAndSettle();
await tester.tap(find.text('Scheduled').last);
} else {
await tester.tap(find.text('Scheduled'));
}
await tester.pumpAndSettle();
expect(scheduled, isTrue);
expect(tester.takeException(), isNull);
},
);
}
}
}
@@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'run_detail_finders.dart';
import 'package:pipelines_app/features/runs/ui/run_graph_preview.dart'; import 'package:pipelines_app/features/runs/ui/run_graph_preview.dart';
import 'package:pipelines_app/core/api_gateway.dart'; import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/graph/widgets/run_graph_view.dart'; import 'package:pipelines_app/features/graph/widgets/run_graph_view.dart';
@@ -136,8 +137,8 @@ void main() {
await pumpDeepLink(tester, platform, stage: 'plan', visit: 0); await pumpDeepLink(tester, platform, stage: 'plan', visit: 0);
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget); expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
expect(find.text('plan · visit 1'), findsOneWidget); expectVisitHeading(tester, 'plan', 1);
expect(find.text('plan · visit 5'), findsNothing); expect(find.text('Visit 5'), findsNothing);
// The visit is its own page over the Timeline tab. // The visit is its own page over the Timeline tab.
expect( expect(
find.byKey( find.byKey(
@@ -180,7 +181,7 @@ void main() {
await pumpDeepLink(tester, RunDetailTestPlatform.material, stage: 'plan'); await pumpDeepLink(tester, RunDetailTestPlatform.material, stage: 'plan');
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget); expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
expect(find.text('plan · visit 5'), findsOneWidget); expectVisitHeading(tester, 'plan', 5);
}); });
testWidgets('a Graph click opens the same latest visit as the stage route', ( testWidgets('a Graph click opens the same latest visit as the stage route', (
@@ -194,7 +195,7 @@ void main() {
// The web client's graph click takes the last visit in sequence order, not // 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. // the last row in reply order, so both entry points agree.
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget); expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
expect(find.text('plan · visit 5'), findsOneWidget); expectVisitHeading(tester, 'plan', 5);
}); });
testWidgets('an out-of-range visit is clamped to the stage last visit', ( testWidgets('an out-of-range visit is clamped to the stage last visit', (
@@ -208,7 +209,7 @@ void main() {
); );
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget); expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
expect(find.text('plan · visit 5'), findsOneWidget); expectVisitHeading(tester, 'plan', 5);
}); });
testWidgets('a declared but unvisited stage selects its graph node', ( testWidgets('a declared but unvisited stage selects its graph node', (
@@ -258,7 +259,7 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget); expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
expect(find.text('plan · visit 5'), findsOneWidget); expectVisitHeading(tester, 'plan', 5);
}); });
testWidgets('a route change applies its visit and a plain route closes it', ( testWidgets('a route change applies its visit and a plain route closes it', (
@@ -296,11 +297,11 @@ void main() {
), ),
); );
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.text('plan · visit 1'), findsOneWidget); expectVisitHeading(tester, 'plan', 1);
rebuild(() => visit = 1); rebuild(() => visit = 1);
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.text('plan · visit 5'), findsOneWidget); expectVisitHeading(tester, 'plan', 5);
rebuild(() => stage = null); rebuild(() => stage = null);
await tester.pumpAndSettle(); await tester.pumpAndSettle();
@@ -1,6 +1,22 @@
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/runs/ui/run_detail_view.dart'; import 'package:pipelines_app/features/runs/ui/run_detail_view.dart';
/// Wide screens deliberately repeat the selected title in the visible list. /// Wide screens deliberately repeat the selected title in the visible list.
Finder runDetailText(String text) => Finder runDetailText(String text) =>
find.descendant(of: find.byType(RunDetailView), matching: find.text(text)); find.descendant(of: find.byType(RunDetailView), matching: find.text(text));
/// Stage identity and visit coordinates are separate rendered fields now.
void expectVisitHeading(WidgetTester tester, String stage, num sequence) {
final pane = find.byKey(const Key('run-visit-pane'));
expect(pane, findsOneWidget);
final title = find.descendant(
of: pane,
matching: find.byKey(const Key('run-visit-title')),
);
expect(tester.widget<Text>(title).data, stage);
expect(
find.descendant(of: pane, matching: find.text('Visit $sequence')),
findsOneWidget,
);
}
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'run_detail_finders.dart';
import 'package:pipelines_app/features/graph/widgets/graph_stage_node.dart'; import 'package:pipelines_app/features/graph/widgets/graph_stage_node.dart';
import 'package:pipelines_app/features/graph/widgets/run_graph_canvas.dart'; import 'package:pipelines_app/features/graph/widgets/run_graph_canvas.dart';
import 'package:pipelines_app/features/graph/widgets/run_graph_view.dart'; import 'package:pipelines_app/features/graph/widgets/run_graph_view.dart';
@@ -65,7 +66,7 @@ void main() {
findsNothing, findsNothing,
); );
expect(find.byKey(const Key('run-visit-title')), findsOneWidget); expect(find.byKey(const Key('run-visit-title')), findsOneWidget);
expect(find.text('plan · visit 1'), findsOneWidget); expectVisitHeading(tester, 'plan', 1);
expect(find.byKey(const Key('run-visit-facts-grid')), findsOneWidget); expect(find.byKey(const Key('run-visit-facts-grid')), findsOneWidget);
expect(find.textContaining('audit · visit'), findsNothing); expect(find.textContaining('audit · visit'), findsNothing);
}); });
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'run_detail_finders.dart';
import 'package:pipelines_app/features/artifacts/ui/artifact_gallery_page.dart'; import 'package:pipelines_app/features/artifacts/ui/artifact_gallery_page.dart';
import 'package:pipelines_app/features/graph/widgets/stage_definition_view.dart'; import 'package:pipelines_app/features/graph/widgets/stage_definition_view.dart';
import 'package:pipelines_app/features/runs/ui/run_detail_visit_facts.dart'; import 'package:pipelines_app/features/runs/ui/run_detail_visit_facts.dart';
@@ -182,7 +183,7 @@ void main() {
}); });
await openVisit(tester, platform, run: run, sequence: 2); await openVisit(tester, platform, run: run, sequence: 2);
expect(find.text('plan · visit 2'), findsOneWidget); expectVisitHeading(tester, 'plan', 2);
await openVisitTab(tester, RunVisitSection.artifacts); await openVisitTab(tester, RunVisitSection.artifacts);
expect(find.text('plan-2.csv'), findsOneWidget); expect(find.text('plan-2.csv'), findsOneWidget);
expect(find.text('public/shared.csv'), findsNothing); expect(find.text('public/shared.csv'), findsNothing);
@@ -1,6 +1,7 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'run_detail_finders.dart';
import 'package:pipelines_app/core/api_gateway.dart'; import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/runs/data/runs_repository.dart'; import 'package:pipelines_app/features/runs/data/runs_repository.dart';
import 'package:pipelines_app/features/runs/ui/run_detail_view.dart'; import 'package:pipelines_app/features/runs/ui/run_detail_view.dart';
@@ -112,7 +113,7 @@ void main() {
); );
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget); expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
expect(find.text('build · visit 2'), findsOneWidget); expectVisitHeading(tester, 'build', 2);
}); });
} }
@@ -66,7 +66,13 @@ void main() {
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget); expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
// The body keeps the landed viewer's own identity for that visit. // The body keeps the landed viewer's own identity for that visit.
expect(find.text('plan'), findsOneWidget); expect(
find.descendant(
of: find.byType(ChangesViewer),
matching: find.text('plan'),
),
findsOneWidget,
);
expect(find.text('Visit 1 · completed'), findsOneWidget); expect(find.text('Visit 1 · completed'), findsOneWidget);
expect(find.text('lib/plan.dart'), findsOneWidget); expect(find.text('lib/plan.dart'), findsOneWidget);
expect(find.text('lib/build.dart'), findsNothing); expect(find.text('lib/build.dart'), findsNothing);
+8 -6
View File
@@ -16,8 +16,8 @@ const output = resolve(process.argv[3] ?? `build/list-detail-${platform}`);
await mkdir(output, { recursive: true }); await mkdir(output, { recursive: true });
const root = resolve(process.argv[2]); const root = resolve(process.argv[2]);
const runs = await startFixture({ root, chatMessages: [], chatSessions: [ const runs = await startFixture({ root, chatMessages: [], chatSessions: [
{ id: 'ses_probechat', title: 'First fixture chat', backend: 'claude', model: 'claude-opus', mode: 'auto', mode_name: 'Auto' }, { id: 'ses_probechat', title: 'First fixture chat', backend: 'claude', model: 'claude-opus', directory:'/srv/probe', updated_at:Date.now()-180000, mode: 'auto', mode_name: 'Auto' },
{ id: 'ses_secondchat', title: 'Second fixture chat', backend: 'claude', model: 'claude-opus', mode: 'auto', mode_name: 'Auto' }, { id: 'ses_secondchat', title: 'Second fixture chat', backend: 'claude', model: 'claude-opus', directory:'/srv/probe', updated_at:Date.now()-180000, mode: 'auto', mode_name: 'Auto' },
] }); ] });
const pipelines = await startWiringFixture({ root }); const pipelines = await startWiringFixture({ root });
const profile = await mkdtemp(join(tmpdir(), 'list-detail-consistency-')); const profile = await mkdtemp(join(tmpdir(), 'list-detail-consistency-'));
@@ -59,23 +59,25 @@ try {
await enableSemantics(c); await enableSemantics(c);
assert.ok(await waitFor(async () => (await geometry()).list,30000)); assert.ok(await waitFor(async () => (await geometry()).list,30000));
const before = await geometry(); const before = await geometry();
assert.ok(Math.abs(before.list.width-before.body.width)<1, 'equal panes before selection'); assert.ok(before.body.width>=width*0.5-1 && before.body.width<=width*0.6+1, 'body gets at least half the full window, targeting sixty percent');
assert.ok(before.body.width>before.list.width,'body takes priority over list');
assert.deepEqual(await selected(titles), []); assert.deepEqual(await selected(titles), []);
for (let i=0;i<titles.length;i++) { for (let i=0;i<titles.length;i++) {
await open(titles[i]); await open(titles[i]);
assert.ok(await waitFor(async () => (await selected(titles)).some(name => name.includes(titles[i])),12000), `${destination} selected ${titles[i]}`); assert.ok(await waitFor(async () => (await selected(titles)).some(name => name.includes(titles[i])),12000), `${destination} selected ${titles[i]}`);
assert.equal((await selected(titles)).length,1,'only the active row is selected'); assert.equal((await selected(titles)).length,1,'only the active row is selected');
const bounds = await geometry(); const bounds = await geometry();
assert.ok(Math.abs(bounds.list.width-bounds.body.width)<1,'equal flexible panes'); assert.equal(bounds.body.width,before.body.width,'body width is stable during selection');
assert.equal(bounds.list.width,before.list.width,'selection does not resize panes'); assert.equal(bounds.list.width,before.list.width,'selection does not resize panes');
log.panes.push({destination,title:titles[i],...bounds}); log.panes.push({destination,title:titles[i],...bounds});
await sleep(300); await sleep(300);
await capture(c,output,log,`${destination}-selected-${i+1}`); await capture(c,output,log,`${destination}-selected-${i+1}`);
} }
log.checks.push(`${destination}: list remains visible, selection moves, panes remain equal`); log.checks.push(`${destination}: list remains visible, selection moves, body gets 50–60% of full window`);
} }
assert.ok(log.panes.every(p => Math.abs(p.list.width-log.panes[0].list.width)<1),'identical pane widths across destinations'); assert.ok(log.panes.every(p => Math.abs(p.list.width-log.panes[0].list.width)<1),'identical pane widths across destinations');
log.checks.push('all three destinations have identical pane widths'); assert.ok(log.panes.every(p => Math.abs(p.body.width-log.panes[0].body.width)<1),'identical body widths across destinations');
log.checks.push('all three destinations share the same body-priority pane widths');
console.log(JSON.stringify(log,null,2)); console.log(JSON.stringify(log,null,2));
} catch (error) { } catch (error) {
if(c) { if(c) {
+21 -1
View File
@@ -327,6 +327,8 @@ export async function startFixture({ root, runs = RUNS, runDetail, files = {}, c
let chatSubscribed = 0; let chatSubscribed = 0;
let chatHistory = 0; let chatHistory = 0;
const chatPrompts = []; const chatPrompts = [];
const chatCreateRequests = [];
const createdChats = [];
const shellOutputRequests = []; const shellOutputRequests = [];
const fileReads = []; const fileReads = [];
let chatRunning = false; let chatRunning = false;
@@ -421,6 +423,7 @@ export async function startFixture({ root, runs = RUNS, runDetail, files = {}, c
chatSubscribed, chatSubscribed,
chatHistory, chatHistory,
chatPrompts, chatPrompts,
chatCreateRequests,
shellOutputRequests, shellOutputRequests,
chatRunning, chatRunning,
chatInterrupts, chatInterrupts,
@@ -552,7 +555,24 @@ export async function startFixture({ root, runs = RUNS, runDetail, files = {}, c
} }
if (request.type === 'chat_sessions') { if (request.type === 'chat_sessions') {
client.send({ id: request.id, type: 'chat_sessions', client.send({ id: request.id, type: 'chat_sessions',
chat_sessions: chatSessions ?? [CHAT_SESSION] }); chat_sessions: [...(chatSessions ?? [CHAT_SESSION]), ...createdChats] });
return;
}
if (request.type === 'chat_directories') {
client.send({ id: request.id, type: 'chat_directories', chat_directories: ['/home/fixture', '/srv/probe'] });
return;
}
if (request.type === 'chat_backends') {
client.send({ id: request.id, type: 'chat_backends', chat_backends: ['opencode', 'claude'] });
return;
}
if (request.type === 'chat_create') {
const body = request.chat_create ?? {};
chatCreateRequests.push(body);
const session = { id: 'fixture_created_' + chatCreateRequests.length,
title: body.title, directory: body.directory, backend: body.backend };
createdChats.push(session);
client.send({ id: request.id, type: 'chat_create', chat_session: session });
return; return;
} }
if (request.type === 'chat_subscribe') { if (request.type === 'chat_subscribe') {
+95
View File
@@ -0,0 +1,95 @@
// Production app UI, isolated create-prompt and recorded-stage fixtures only.
import assert from 'node:assert/strict';
import { mkdir, mkdtemp, writeFile } from 'node:fs/promises';
import { once } from 'node:events';
import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
import { startFixture } from './runs_probe_server.mjs';
import { launchChrome, waitForPort, waitForPage, connect, sleep } from './pipelines_probe_cdp_lib.mjs';
import { axNodes, enableSemantics, waitFor, capture, click, clickAt } from './pipelines_probe_cdp_input.mjs';
const platform = process.env.PROBE_PLATFORM ?? 'material';
const output = resolve(process.argv[3] ?? `build/ui-followups-${platform}`);
await mkdir(output,{recursive:true});
const stage = 'verify_release';
const runDetail = { id:1,title:'Recorded release',status:'failed',graph:{stages:[{key:stage,type:'model'}]},steps:[
{stage,sequence:1,status:'completed',outcome:'success',provider:'openai',model:'fixture-model',
started_at:'2026-10-25T12:00:00Z',finished_at:'2026-10-25T12:02:05Z',output:{result:'First visit'}},
{stage,sequence:2,status:'failed',outcome:'error',diagnostic:'Recorded verification failure',
started_at:'2026-10-25T12:03:00Z',finished_at:'2026-10-25T12:03:10Z',output:{result:'Second visit'}},
]};
const fixture=await startFixture({root:resolve(process.argv[2]),runDetail,chatMessages:[]});
const profile=await mkdtemp(join(tmpdir(),'ui-followups-'));
const chrome=launchChrome('/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',profile,'about:blank');
const log={platform,checks:[],captures:[]};
let c;
const names=async()=>(await axNodes(c)).flatMap(n=>[n.name?.value??'',n.value?.value??'']);
async function point(node) {
assert.ok(node,'expected accessible control');
const {model}=await c.send('DOM.getBoxModel',{backendNodeId:node.backendDOMNodeId});
const [x1,y1,,,x3,y3]=model.content;await clickAt(c,(x1+x3)/2,(y1+y3)/2);
}
async function navigate(path) {
await c.send('Page.navigate',{url:fixture.url+path});
assert.ok(await waitFor(()=>c.evaluate("Boolean(document.querySelector('flt-semantics-placeholder'))"),30000));
await enableSemantics(c);
}
async function createButton() {
return waitFor(async () => {
const button=(await axNodes(c)).filter(n=>n.role?.value==='button'&&n.name?.value==='New chat'&&n.backendDOMNodeId).at(-1);
return button && !button.properties?.some(p=>p.name==='disabled'&&p.value?.value===true) ? button : null;
},10000);
}
async function promptSwitch() {
return (await axNodes(c)).find(n=>['switch','checkbox'].includes(n.role?.value)&&n.backendDOMNodeId);
}
try {
c=await connect((await waitForPage(await waitForPort(join(profile,'DevToolsActivePort')))).webSocketDebuggerUrl);
await c.send('Page.enable');
if(platform==='material') await c.send('Emulation.setUserAgentOverride',{
userAgent:'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36',platform:'Win32',
});
await c.send('Emulation.setDeviceMetricsOverride',{width:1280,height:1000,deviceScaleFactor:1,mobile:false});
await navigate('/chat');
await click(c,'New chat');
let toggle=await waitFor(promptSwitch,15000);assert.ok(toggle);
assert.equal(String(toggle.properties.find(p=>p.name==='checked')?.value?.value),'false','prompt is off by default');
await capture(c,output,log,'01-prompt-off');
await point(await createButton());
assert.ok(await waitFor(()=>c.evaluate("location.pathname.includes('fixture_created_1')"),10000));
let state=await(await fetch(fixture.url+'/fixture/state')).json();
assert.equal(state.chatCreateRequests.length,1);
assert.equal(Object.hasOwn(state.chatCreateRequests[0],'instructions'),false);
log.checks.push('default-off chat creation omits instructions');
await navigate('/chat');await click(c,'New chat');
await point(await waitFor(promptSwitch,10000));
await sleep(300);
await click(c,'Custom');await click(c,'Careful coding');await sleep(300);
await capture(c,output,log,'02-preset-editable');
await click(c,'Careful coding');await click(c,'Custom');await sleep(200);
const editor=(await axNodes(c)).filter(n=>n.role?.value==='textbox'&&n.backendDOMNodeId).at(-1);
await point(editor);await c.send('Input.insertText',{text:'Custom prompt from the isolated fixture.'});
await sleep(200);await point(await createButton());
assert.ok(await waitFor(()=>c.evaluate("location.pathname.includes('fixture_created_2')"),10000));
state=await(await fetch(fixture.url+'/fixture/state')).json();
assert.equal(state.chatCreateRequests[1].instructions,'Custom prompt from the isolated fixture.');
log.checks.push('real preset/custom picker and exact custom create payload');
for(const [index,sequence] of [[0,1],[1,2]]) {
await navigate(`/runs/1/stage/${stage}?visit=${index}`);
assert.ok(await waitFor(()=>c.evaluate("Boolean(document.querySelector('[flt-semantics-identifier=run-stage-heading]'))"),15000));
assert.ok((await names()).includes(stage));
assert.ok((await names()).includes('Visit '+sequence));
if(index===1) assert.ok((await names()).some(name=>name.includes('Recorded verification failure')));
await capture(c,output,log,`03-stage-visit-${sequence}`);
}
log.checks.push('prominent stage heading and correct separate coordinates for repeated deep-linked visits');
console.log(JSON.stringify(log,null,2));
} catch(error) {
if(c){await capture(c,output,log,'failure');await writeFile(join(output,'failure-ax.json'),JSON.stringify(await axNodes(c),null,2));}
throw error;
} finally {
await writeFile(join(output,'result.json'),JSON.stringify(log,null,2));
c?.close();const exited=once(chrome,'exit');chrome.kill();await exited;await fixture.close();
}