Complete prompt presets, body-priority panes and clearer chat and stage layouts
This commit is contained in:
@@ -13,13 +13,11 @@ import 'chat_create_dialog_frame.dart';
|
||||
import 'chat_create_fields.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 =
|
||||
"Preloaded as this chat's session instructions. The agent still reads the "
|
||||
"repository's AGENTS.md and skills.";
|
||||
const String chatCreateModelNote =
|
||||
"This server has no request for choosing a chat's model, so a new chat "
|
||||
"uses the server's default.";
|
||||
const String chatCreateModelNote = "New chats start with the server's default model.";
|
||||
|
||||
class ChatDraft {
|
||||
const ChatDraft({
|
||||
@@ -83,9 +81,7 @@ class _CreateChatDialogState extends State<CreateChatDialog> {
|
||||
SharedPreferencesChatCreatePromptStore(
|
||||
serverId: serverStorageScope(serverIdentity(widget.repository.gateway)),
|
||||
);
|
||||
final _instructions = TextEditingController(
|
||||
text: chatDefaultSessionInstructions,
|
||||
);
|
||||
final _instructions = TextEditingController();
|
||||
final _name = TextEditingController();
|
||||
|
||||
/// 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.
|
||||
bool _promptTouched = false;
|
||||
String _promptChoice = ChatPromptChooser.custom;
|
||||
String _customPrompt = '';
|
||||
ChatCreatePrompt? _savedPrompt;
|
||||
int _recall = 0;
|
||||
List<String> _directories = const [];
|
||||
@@ -159,6 +156,7 @@ class _CreateChatDialogState extends State<CreateChatDialog> {
|
||||
}
|
||||
|
||||
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
|
||||
/// choice last made there comes back.
|
||||
@@ -169,21 +167,35 @@ class _CreateChatDialogState extends State<CreateChatDialog> {
|
||||
_name.text = defaultChatName(directory, chatBackendLabel(backend));
|
||||
}
|
||||
final recall = ++_recall;
|
||||
setState(() {
|
||||
_savedPrompt = null;
|
||||
if (_promptChoice == ChatPromptChooser.lastUsed) {
|
||||
_promptChoice = ChatPromptChooser.custom;
|
||||
_customPrompt = _instructions.text;
|
||||
}
|
||||
});
|
||||
final saved = await _prompts.read(backend, directory);
|
||||
if (!mounted || recall != _recall) return;
|
||||
if (_promptTouched) return;
|
||||
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;
|
||||
_promptChoice = ChatPromptChooser.custom;
|
||||
if (!_promptTouched) {
|
||||
_sendPrompt = false;
|
||||
_instructions.clear();
|
||||
_promptChoice = ChatPromptChooser.custom;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void _selectPrompt(String choice) {
|
||||
if (!mounted ||
|
||||
_submitting ||
|
||||
(choice == ChatPromptChooser.lastUsed && _savedPrompt == null)) {
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
if (_promptChoice == ChatPromptChooser.custom) {
|
||||
_customPrompt = _instructions.text;
|
||||
}
|
||||
_promptTouched = true;
|
||||
_promptChoice = choice;
|
||||
if (choice == ChatPromptChooser.careful) {
|
||||
@@ -193,6 +205,7 @@ class _CreateChatDialogState extends State<CreateChatDialog> {
|
||||
_instructions.text = _savedPrompt!.text;
|
||||
_sendPrompt = true;
|
||||
} else {
|
||||
_instructions.text = _customPrompt;
|
||||
_sendPrompt = true;
|
||||
}
|
||||
});
|
||||
@@ -200,8 +213,14 @@ class _CreateChatDialogState extends State<CreateChatDialog> {
|
||||
|
||||
Future<void> _submit() async {
|
||||
if (!_catalogReady || _submitting) return;
|
||||
if (!_promptReady) {
|
||||
setState(() => _formError = 'Enter a prompt or choose a pre-filled one.');
|
||||
return;
|
||||
}
|
||||
final directory = _directory ?? chatHomeDirectory;
|
||||
final backend = _backend ?? '';
|
||||
final sendPrompt = _sendPrompt;
|
||||
final promptText = _instructions.text;
|
||||
setState(() {
|
||||
_submitting = true;
|
||||
_formError = null;
|
||||
@@ -215,17 +234,20 @@ class _CreateChatDialogState extends State<CreateChatDialog> {
|
||||
: name,
|
||||
directory: directory,
|
||||
backend: backend,
|
||||
instructions: _sendPrompt ? _instructions.text : '',
|
||||
instructions: sendPrompt ? promptText : '',
|
||||
),
|
||||
widget.operationId,
|
||||
);
|
||||
// Next time in this folder with this harness, the same choice.
|
||||
unawaited(
|
||||
_prompts.write(backend, directory, (
|
||||
send: _sendPrompt,
|
||||
text: _instructions.text,
|
||||
)),
|
||||
);
|
||||
// Only an actually sent prompt becomes Last used. Starting a promptless
|
||||
// chat must not erase a saved preset (or wait for its pending read).
|
||||
if (sendPrompt) {
|
||||
unawaited(
|
||||
_prompts.write(backend, directory, (
|
||||
send: sendPrompt,
|
||||
text: promptText,
|
||||
)),
|
||||
);
|
||||
}
|
||||
if (!mounted) return;
|
||||
Navigator.pop(context, session);
|
||||
} catch (error) {
|
||||
@@ -298,10 +320,12 @@ class _CreateChatDialogState extends State<CreateChatDialog> {
|
||||
controller: _instructions,
|
||||
minLines: 2,
|
||||
maxLines: 4,
|
||||
onChanged: (_) {
|
||||
placeholder: 'Write your custom prompt',
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_promptTouched = true;
|
||||
_promptChoice = ChatPromptChooser.custom;
|
||||
_customPrompt = value;
|
||||
});
|
||||
},
|
||||
)
|
||||
@@ -311,10 +335,14 @@ class _CreateChatDialogState extends State<CreateChatDialog> {
|
||||
controller: _instructions,
|
||||
minLines: 2,
|
||||
maxLines: 4,
|
||||
onChanged: (_) {
|
||||
decoration: const InputDecoration(
|
||||
hintText: 'Write your custom prompt',
|
||||
),
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_promptTouched = true;
|
||||
_promptChoice = ChatPromptChooser.custom;
|
||||
_customPrompt = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
@@ -347,7 +375,7 @@ class _CreateChatDialogState extends State<CreateChatDialog> {
|
||||
|
||||
return ChatCreateDialogFrame(
|
||||
content: content,
|
||||
canSubmit: _catalogReady,
|
||||
canSubmit: _catalogReady && _promptReady,
|
||||
submitting: _submitting,
|
||||
onCancel: () => Navigator.pop(context),
|
||||
onSubmit: _submit,
|
||||
|
||||
@@ -156,7 +156,7 @@ class _CupertinoSessionRow extends StatelessWidget {
|
||||
final meta = chatSessionMetaLines(session);
|
||||
final recency = relativeChatSessionTime(session['updated_at']);
|
||||
final status = chatSessionRowStatus(session, unseen: unseen);
|
||||
final statusStyle = TextStyle(
|
||||
final statusStyle = theme.textTheme.tabLabelTextStyle.copyWith(
|
||||
color: status == 'Closed' ? secondary : theme.primaryColor,
|
||||
);
|
||||
return Semantics(
|
||||
@@ -166,28 +166,14 @@ class _CupertinoSessionRow extends StatelessWidget {
|
||||
backgroundColor: selected
|
||||
? CupertinoColors.tertiarySystemFill.resolveFrom(context)
|
||||
: null,
|
||||
leading: Icon(
|
||||
sessionCupertinoIcon(session),
|
||||
color: selected ? theme.primaryColor : null,
|
||||
),
|
||||
// As on the web: the title with the unread/closed word trailing, then
|
||||
// the muted `recency · directory · model` line.
|
||||
title: ChatSessionRowContent(
|
||||
title: chatSessionTitle(session),
|
||||
status: status,
|
||||
recency: recency.isEmpty ? null : recency,
|
||||
meta: meta,
|
||||
titleStyle: theme.textTheme.textStyle.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
leading: Icon(
|
||||
sessionCupertinoIcon(session),
|
||||
color: selected ? theme.primaryColor : null,
|
||||
),
|
||||
metaStyle: TextStyle(color: secondary),
|
||||
statusStyle: statusStyle,
|
||||
),
|
||||
subtitle: null,
|
||||
onTap: () => onOpen(session),
|
||||
trailing: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
actions: [
|
||||
SessionStarButton(
|
||||
key: Key('chat-star-$id'),
|
||||
session: session,
|
||||
@@ -200,7 +186,20 @@ class _CupertinoSessionRow extends StatelessWidget {
|
||||
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 recency = relativeChatSessionTime(session['updated_at']);
|
||||
final status = chatSessionRowStatus(session, unseen: unseen);
|
||||
final statusStyle = TextStyle(
|
||||
color: status == 'Closed' ? secondary : theme.colorScheme.primary,
|
||||
);
|
||||
final statusStyle =
|
||||
theme.textTheme.labelSmall?.copyWith(
|
||||
color: status == 'Closed' ? secondary : theme.colorScheme.primary,
|
||||
) ??
|
||||
TextStyle(color: theme.colorScheme.primary);
|
||||
return ListTile(
|
||||
key: Key('chat-row-$id'),
|
||||
selected: selected,
|
||||
selectedTileColor: theme.colorScheme.secondaryContainer,
|
||||
selectedColor: theme.colorScheme.onSecondaryContainer,
|
||||
leading: Icon(sessionMaterialIcon(session)),
|
||||
// As on the web: the title with the unread/closed word trailing, then
|
||||
// the muted `recency · directory · model` line.
|
||||
title: ChatSessionRowContent(
|
||||
title: chatSessionTitle(session),
|
||||
status: status,
|
||||
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: [
|
||||
leading: Icon(sessionMaterialIcon(session)),
|
||||
actions: [
|
||||
SessionStarButton(
|
||||
key: Key('chat-star-$id'),
|
||||
session: session,
|
||||
@@ -197,10 +185,23 @@ class _MaterialSessionRow extends StatelessWidget {
|
||||
key: Key('chat-actions-$id'),
|
||||
session: session,
|
||||
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.metaStyle,
|
||||
required this.statusStyle,
|
||||
this.leading,
|
||||
this.actions = const [],
|
||||
});
|
||||
|
||||
final String title;
|
||||
@@ -22,6 +24,8 @@ class ChatSessionRowContent extends StatelessWidget {
|
||||
final TextStyle titleStyle;
|
||||
final TextStyle metaStyle;
|
||||
final TextStyle statusStyle;
|
||||
final Widget? leading;
|
||||
final List<Widget> actions;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -35,13 +39,25 @@ class ChatSessionRowContent extends StatelessWidget {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: titleStyle,
|
||||
),
|
||||
if (status != null) ...[
|
||||
if (status != null || leading != null) ...[
|
||||
const SizedBox(height: 2),
|
||||
Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: _StatusLabel(status: status!, style: statusStyle),
|
||||
Wrap(
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
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) ...[
|
||||
const SizedBox(height: 3),
|
||||
Align(
|
||||
@@ -54,12 +70,10 @@ class ChatSessionRowContent extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
],
|
||||
for (final line in meta)
|
||||
Text(
|
||||
line,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: metaStyle,
|
||||
if (actions.isNotEmpty)
|
||||
Align(
|
||||
alignment: AlignmentDirectional.centerEnd,
|
||||
child: Wrap(alignment: WrapAlignment.end, children: actions),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -77,7 +91,7 @@ class _StatusLabel extends StatelessWidget {
|
||||
if (status != 'New') {
|
||||
return Text(
|
||||
status,
|
||||
maxLines: 2,
|
||||
maxLines: 1,
|
||||
style: style.copyWith(fontWeight: FontWeight.w600),
|
||||
);
|
||||
}
|
||||
@@ -89,7 +103,7 @@ class _StatusLabel extends StatelessWidget {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 7, vertical: 1),
|
||||
child: Text(
|
||||
status,
|
||||
maxLines: 2,
|
||||
maxLines: 1,
|
||||
style: style.copyWith(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w700,
|
||||
|
||||
@@ -17,6 +17,7 @@ import '../pipeline_query.dart';
|
||||
import '../pipelines_controller.dart';
|
||||
import 'pipeline_controls.dart';
|
||||
import 'pipeline_filter_page.dart';
|
||||
import 'pipeline_scope_control.dart';
|
||||
|
||||
/// 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.
|
||||
@@ -72,23 +73,10 @@ class PipelineListPanel extends StatelessWidget {
|
||||
schedule: value ? ScheduleFilter.scheduled : ScheduleFilter.any,
|
||||
),
|
||||
);
|
||||
final control = useCupertinoControls(context)
|
||||
? CupertinoSlidingSegmentedControl<bool>(
|
||||
key: const Key('pipeline-scope'),
|
||||
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),
|
||||
);
|
||||
final control = PipelineScopeControl(
|
||||
scheduled: scheduled,
|
||||
onSelected: pick,
|
||||
);
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
kPipelineListInset,
|
||||
@@ -313,7 +301,12 @@ class PipelineListPanel extends StatelessWidget {
|
||||
],
|
||||
)
|
||||
: controller.runsLoaded
|
||||
? Text('no runs recorded', style: style)
|
||||
? Text(
|
||||
'no runs recorded',
|
||||
style: style,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
)
|
||||
: const SizedBox.shrink();
|
||||
return _measured(
|
||||
Column(
|
||||
@@ -322,7 +315,14 @@ class PipelineListPanel extends StatelessWidget {
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(child: Text(what, style: style)),
|
||||
Expanded(
|
||||
child: Text(
|
||||
what,
|
||||
style: style,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
if (shape != null) ...[
|
||||
const SizedBox(width: 8),
|
||||
// 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),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -141,11 +141,16 @@ class _RunVisitPaneState extends State<RunVisitPane> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
widget.visit.stage,
|
||||
key: const Key('run-visit-title'),
|
||||
style: style.stageTitle,
|
||||
softWrap: true,
|
||||
Semantics(
|
||||
container: true,
|
||||
header: true,
|
||||
identifier: 'run-stage-heading',
|
||||
child: Text(
|
||||
widget.visit.stage,
|
||||
key: const Key('run-visit-title'),
|
||||
style: style.stageTitle,
|
||||
softWrap: true,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Wrap(
|
||||
|
||||
@@ -249,24 +249,46 @@ class RunListRow extends StatelessWidget {
|
||||
color: secondary,
|
||||
fontSize: (base.fontSize ?? 14) - 1,
|
||||
);
|
||||
Widget line(String? start, String? end, TextStyle style, {Key? key}) => Row(
|
||||
key: key,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
start ?? '',
|
||||
style: style,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
if (end != null) ...[
|
||||
const SizedBox(width: 12),
|
||||
Text(end, style: style),
|
||||
],
|
||||
],
|
||||
);
|
||||
Widget line(String? start, String? end, TextStyle style, {Key? key}) =>
|
||||
LayoutBuilder(
|
||||
key: key,
|
||||
builder: (context, constraints) {
|
||||
Widget text(String value) => Text(
|
||||
value,
|
||||
style: style,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
);
|
||||
if (end == null) return text(start ?? '');
|
||||
final measure = TextPainter(
|
||||
text: TextSpan(text: end, style: style),
|
||||
textDirection: Directionality.of(context),
|
||||
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 body = Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
||||
@@ -189,17 +189,21 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
|
||||
: Column(
|
||||
children: [
|
||||
Expanded(child: _destinationStack(contents, index)),
|
||||
CupertinoTabBar(
|
||||
currentIndex: index,
|
||||
onTap: (value) =>
|
||||
_select(AppDestination.values[value]),
|
||||
items: _items((destination) {
|
||||
final item = destinationDetails(destination);
|
||||
return BottomNavigationBarItem(
|
||||
icon: _icon(destination, item.cupertinoIcon),
|
||||
label: item.label,
|
||||
);
|
||||
}),
|
||||
// Match CupertinoTabScaffold's native tab-label policy;
|
||||
// content elsewhere still follows the user's scaler.
|
||||
MediaQuery.withNoTextScaling(
|
||||
child: CupertinoTabBar(
|
||||
currentIndex: index,
|
||||
onTap: (value) =>
|
||||
_select(AppDestination.values[value]),
|
||||
items: _items((destination) {
|
||||
final item = destinationDetails(destination);
|
||||
return BottomNavigationBarItem(
|
||||
icon: _icon(destination, item.cupertinoIcon),
|
||||
label: item.label,
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/cupertino.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
|
||||
/// (with the destination rail) instead of pushing the item as its own page.
|
||||
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.
|
||||
bool showsListBesideDetail(BuildContext context) =>
|
||||
MediaQuery.sizeOf(context).width >= kListDetailMinWidth;
|
||||
|
||||
/// Equal flexible panes, shared by Pipelines, Runs and Chat. No destination
|
||||
/// supplies a pixel width, minimum/maximum pane width or split ratio.
|
||||
/// One body-priority policy for all destinations, derived from the full window
|
||||
/// and actual available space after navigation. No fixed pixel pane widths.
|
||||
class ListDetailPanes extends StatelessWidget {
|
||||
const ListDetailPanes({super.key, required this.list, required this.detail});
|
||||
|
||||
@@ -27,33 +32,50 @@ class ListDetailPanes extends StatelessWidget {
|
||||
color: CupertinoColors.separator.resolveFrom(context),
|
||||
)
|
||||
: const VerticalDivider(width: 1);
|
||||
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,
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final window = MediaQuery.sizeOf(context).width;
|
||||
// Target 60% of the full window. Keep at least half for the body while
|
||||
// leaving a flexible share for native list controls on tighter windows.
|
||||
final requestedMinimum = window * _bodyWindowMinimum;
|
||||
final minimum = constraints.maxWidth > requestedMinimum
|
||||
? requestedMinimum
|
||||
: constraints.maxWidth * _bodyWindowMinimum;
|
||||
final maximum = math.max(
|
||||
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,
|
||||
Expanded(
|
||||
child: SizedBox.expand(
|
||||
key: const ValueKey('list-detail-body'),
|
||||
child: Semantics(
|
||||
container: true,
|
||||
explicitChildNodes: true,
|
||||
identifier: 'list-detail-body',
|
||||
child: detail,
|
||||
divider,
|
||||
SizedBox(
|
||||
width: bodyWidth,
|
||||
child: SizedBox.expand(
|
||||
key: const ValueKey('list-detail-body'),
|
||||
child: Semantics(
|
||||
container: true,
|
||||
explicitChildNodes: true,
|
||||
identifier: 'list-detail-body',
|
||||
child: detail,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,16 @@
|
||||
| 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 |
|
||||
| Body-priority shared split (target ~60% window, minimum 50%) | Manager, next | Pending | Pending | 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 |
|
||||
| Structured multiline chat rows | Run 188 + direct Luna candidate | Further style/narrow fixes required; no browser capture | Candidate only | 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 |
|
||||
| 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 + direct completion/integration | Full suite + both-host browser pass | Main | 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 | 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
|
||||
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
|
||||
were created or modified. Manager will inspect changes and actual landing,
|
||||
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.
|
||||
|
||||
@@ -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 brightness in Brightness.values) {
|
||||
for (final width in [640.0, 840.0, 1280.0]) {
|
||||
testWidgets('shared equal panes and selected rows: $cupertino '
|
||||
'$brightness at $width', (tester) async {
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
tester.view.physicalSize = Size(width, 900);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
final fixture = PipelineFixture();
|
||||
final gateway = FakeGateway(
|
||||
(type, fields) => switch (type) {
|
||||
'list_pipelines' => pipelineListReply(fixture.summaries),
|
||||
'get_pipeline' => pipelineDetailReply(
|
||||
fixture.detailFor(
|
||||
fields['pipeline_id'] as int,
|
||||
fields['version'] as int,
|
||||
)!,
|
||||
),
|
||||
'list_runs' => {
|
||||
'runs': [
|
||||
for (final id in [1, 2])
|
||||
{'id': id, 'title': 'Run item $id', 'status': 'succeeded'},
|
||||
],
|
||||
},
|
||||
'get_run' => {
|
||||
'run_detail': {
|
||||
'id': fields['run_id'],
|
||||
'title': 'Run item ${fields['run_id']}',
|
||||
'status': 'succeeded',
|
||||
'input': {'prompt': 'Recorded input'},
|
||||
for (final scale in [1.0, 2.0]) {
|
||||
testWidgets('shared body-priority panes and selected rows: $cupertino '
|
||||
'$brightness at $width @${scale}x', (tester) async {
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
tester.view.physicalSize = Size(width, 900);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
tester.platformDispatcher.textScaleFactorTestValue = scale;
|
||||
addTearDown(
|
||||
tester.platformDispatcher.clearTextScaleFactorTestValue,
|
||||
);
|
||||
final fixture = PipelineFixture();
|
||||
final gateway = FakeGateway(
|
||||
(type, fields) => switch (type) {
|
||||
'list_pipelines' => pipelineListReply(fixture.summaries),
|
||||
'get_pipeline' => pipelineDetailReply(
|
||||
fixture.detailFor(
|
||||
fields['pipeline_id'] as int,
|
||||
fields['version'] as int,
|
||||
)!,
|
||||
),
|
||||
'list_runs' => {
|
||||
'runs': [
|
||||
for (final id in [1, 2])
|
||||
{
|
||||
'id': id,
|
||||
'title': 'Run item $id',
|
||||
'status': 'succeeded',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
'chat_sessions' => {
|
||||
'chat_sessions': [
|
||||
{
|
||||
'id': 'a',
|
||||
'title': 'Chat item a',
|
||||
'backend': 'claude',
|
||||
'model': 'claude-opus',
|
||||
'mode': 'auto',
|
||||
'mode_name': 'Auto',
|
||||
'get_run' => {
|
||||
'run_detail': {
|
||||
'id': fields['run_id'],
|
||||
'title': 'Run item ${fields['run_id']}',
|
||||
'status': 'succeeded',
|
||||
'input': {'prompt': 'Recorded input'},
|
||||
},
|
||||
{
|
||||
'id': 'b',
|
||||
'title': 'Chat item b',
|
||||
'backend': 'claude',
|
||||
'model': 'claude-opus',
|
||||
'mode': 'auto',
|
||||
'mode_name': 'Auto',
|
||||
},
|
||||
],
|
||||
},
|
||||
'chat_sessions' => {
|
||||
'chat_sessions': [
|
||||
{
|
||||
'id': 'a',
|
||||
'title': 'Chat item a',
|
||||
'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),
|
||||
},
|
||||
_ => {},
|
||||
},
|
||||
);
|
||||
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
|
||||
? CupertinoApp(
|
||||
theme: CupertinoThemeData(brightness: brightness),
|
||||
home: shell,
|
||||
)
|
||||
: MaterialApp(
|
||||
theme: brightness == Brightness.dark
|
||||
? appDarkTheme()
|
||||
: appLightTheme(),
|
||||
home: shell,
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
final paneWidths = <double>[];
|
||||
for (final destination in ['Pipelines', 'Runs', 'Chat']) {
|
||||
if (destination != 'Pipelines') {
|
||||
await tester.tap(find.text(destination).first);
|
||||
await tester.pumpAndSettle();
|
||||
expect(
|
||||
tester.takeException(),
|
||||
isNull,
|
||||
reason: '$destination list',
|
||||
);
|
||||
}
|
||||
final list = find.byKey(const ValueKey('list-detail-list'));
|
||||
final detail = find.byKey(const ValueKey('list-detail-body'));
|
||||
expect(list, findsOneWidget);
|
||||
expect(detail, findsOneWidget);
|
||||
final before = tester.getSize(list).width;
|
||||
paneWidths.add(before);
|
||||
expect(before, closeTo(tester.getSize(detail).width, 0.01));
|
||||
final rowKeys = switch (destination) {
|
||||
'Pipelines' => ['pipeline-row-1', 'pipeline-row-2'],
|
||||
'Runs' => ['run-row-1', 'run-row-2'],
|
||||
_ => ['chat-row-a', 'chat-row-b'],
|
||||
};
|
||||
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'
|
||||
);
|
||||
await tester.pumpWidget(
|
||||
cupertino
|
||||
? CupertinoApp(
|
||||
theme: CupertinoThemeData(brightness: brightness),
|
||||
home: shell,
|
||||
)
|
||||
: MaterialApp(
|
||||
theme: brightness == Brightness.dark
|
||||
? appDarkTheme()
|
||||
: appLightTheme(),
|
||||
home: shell,
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
final paneWidths = <double>[];
|
||||
final bodyWidths = <double>[];
|
||||
for (final destination in ['Pipelines', 'Runs', 'Chat']) {
|
||||
if (destination != 'Pipelines') {
|
||||
await tester.tap(find.text(destination).first);
|
||||
await tester.pumpAndSettle();
|
||||
expect(
|
||||
tester.takeException(),
|
||||
isNull,
|
||||
reason: '$destination list',
|
||||
);
|
||||
}
|
||||
final list = find.byKey(const ValueKey('list-detail-list'));
|
||||
final detail = find.byKey(const ValueKey('list-detail-body'));
|
||||
expect(list, findsOneWidget);
|
||||
expect(detail, findsOneWidget);
|
||||
final before = tester.getSize(list).width;
|
||||
final bodyBefore = tester.getSize(detail).width;
|
||||
paneWidths.add(before);
|
||||
bodyWidths.add(bodyBefore);
|
||||
expect(bodyBefore, greaterThanOrEqualTo(width * 0.5));
|
||||
expect(bodyBefore, lessThanOrEqualTo(width * 0.6));
|
||||
expect(bodyBefore, greaterThan(before));
|
||||
final rowKeys = switch (destination) {
|
||||
'Pipelines' => ['pipeline-row-1', 'pipeline-row-2'],
|
||||
'Runs' => ['run-row-1', 'run-row-2'],
|
||||
_ => ['chat-row-a', 'chat-row-b'],
|
||||
};
|
||||
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.
|
||||
final opener = destination == 'Chat'
|
||||
? find.descendant(
|
||||
of: target,
|
||||
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();
|
||||
expect(
|
||||
tester.takeException(),
|
||||
isNull,
|
||||
reason: '$destination after opening $key',
|
||||
tester.state<NavigatorState>(find.byType(Navigator)).canPop(),
|
||||
isTrue,
|
||||
reason: '$destination should push its selected item on a phone',
|
||||
);
|
||||
expect(tester.getSize(list).width, closeTo(before, 0.01));
|
||||
expect(tester.getSize(detail).width, closeTo(before, 0.01));
|
||||
expect(
|
||||
find.byKey(const ValueKey('list-detail-list')),
|
||||
findsNothing,
|
||||
);
|
||||
tester.view.physicalSize = Size(width, 900);
|
||||
await tester.pumpAndSettle();
|
||||
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,
|
||||
);
|
||||
}
|
||||
}
|
||||
expect(tester.getSize(list).width, closeTo(before, 0.01));
|
||||
expect(
|
||||
tester
|
||||
.getSemantics(find.byKey(ValueKey(rowKeys.last)))
|
||||
.flagsCollection
|
||||
.isSelected,
|
||||
Tristate.isTrue,
|
||||
);
|
||||
}
|
||||
// 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(
|
||||
tester.state<NavigatorState>(find.byType(Navigator)).canPop(),
|
||||
isTrue,
|
||||
reason: '$destination should push its selected item on a phone',
|
||||
paneWidths,
|
||||
everyElement(closeTo(paneWidths.first, 0.01)),
|
||||
reason: 'Pipelines, Runs and Chat must use identical pane widths',
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
expect(
|
||||
find.byKey(const ValueKey('list-detail-list')),
|
||||
findsNothing,
|
||||
bodyWidths,
|
||||
everyElement(closeTo(bodyWidths.first, 0.01)),
|
||||
reason:
|
||||
'Every destination must share the body-priority sizing policy',
|
||||
);
|
||||
tester.view.physicalSize = Size(width, 900);
|
||||
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());
|
||||
});
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import '../features/runs/ui/run_detail_finders.dart';
|
||||
import '../native_back.dart';
|
||||
import 'package:pipelines_app/application/app_route.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),
|
||||
// not the latest one the pane would show without a visit.
|
||||
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
|
||||
expect(find.text('plan · visit 1'), findsOneWidget);
|
||||
expect(find.text('plan · visit 5'), findsNothing);
|
||||
expectVisitHeading(tester, 'plan', 1);
|
||||
expect(find.text('Visit 5'), findsNothing);
|
||||
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
|
||||
@@ -350,7 +351,7 @@ void main() {
|
||||
await tester.pump();
|
||||
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.query, 'visit=1');
|
||||
});
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import '../features/runs/ui/run_detail_finders.dart';
|
||||
import '../native_back.dart';
|
||||
import 'package:pipelines_app/application/app_route.dart';
|
||||
import 'package:pipelines_app/application/app_router.dart';
|
||||
@@ -496,13 +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);
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('run-visit-pane')),
|
||||
matching: find.text('build · visit 2'),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
expectVisitHeading(tester, 'build', 2);
|
||||
|
||||
// Leave the visit page (it covers the shell), then a retired field hit
|
||||
// opens the plain Summary with no visit.
|
||||
@@ -613,13 +608,7 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byKey(const Key('run-visit-pane')),
|
||||
matching: find.text('build · visit 2'),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
expectVisitHeading(tester, 'build', 2);
|
||||
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
await tester.pump();
|
||||
|
||||
@@ -57,8 +57,7 @@ void main() {
|
||||
);
|
||||
expect(
|
||||
find.text(
|
||||
"This server has no request for choosing a chat's model, so a new "
|
||||
"chat uses the server's default.",
|
||||
"New chats start with the server's default model.",
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
@@ -150,17 +149,28 @@ void main() {
|
||||
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(
|
||||
find.textContaining('Act as a careful coding agent.'),
|
||||
findsOneWidget,
|
||||
);
|
||||
|
||||
await tester.ensureVisible(find.byKey(const Key('chat-create-backend')));
|
||||
await tester.tap(find.byKey(const Key('chat-create-backend')));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Codex'));
|
||||
await tester.pumpAndSettle();
|
||||
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.pumpAndSettle();
|
||||
expect(find.text('/archive'), findsOneWidget);
|
||||
|
||||
@@ -68,6 +68,7 @@ Future<ChatDraft?> _create(
|
||||
find.byKey(const Key('chat-create-instructions')),
|
||||
prompt,
|
||||
);
|
||||
await tester.pump();
|
||||
}
|
||||
await tester.ensureVisible(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());
|
||||
final second = await _create(tester, prompts);
|
||||
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', (
|
||||
@@ -103,11 +109,11 @@ void main() {
|
||||
final prompts = _MemoryPrompts();
|
||||
final draft = await _create(tester, prompts);
|
||||
expect(draft!.instructions, isEmpty);
|
||||
expect(prompts.saved.values.single.send, isFalse);
|
||||
expect(prompts.saved, isEmpty);
|
||||
|
||||
await tester.pumpWidget(const SizedBox());
|
||||
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', (
|
||||
@@ -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', (
|
||||
tester,
|
||||
) 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(
|
||||
WidgetTester tester,
|
||||
ChatCreatePromptStore prompts, {
|
||||
|
||||
@@ -185,14 +185,17 @@ void main() {
|
||||
greaterThan(tester.getCenter(find.text('Starred chat')).dx),
|
||||
);
|
||||
|
||||
// The meta line keeps `CupertinoListTile`'s native 12pt subtitle style; it
|
||||
// must not be rendered at the title's body size. The colour-only style the
|
||||
// row passes merges with the tile's own `DefaultTextStyle`.
|
||||
// Metadata and state use native caption roles, not title-sized text.
|
||||
final titleStyle = _styleOf(tester, 'Starred chat');
|
||||
final metaStyle = _styleOf(tester, '5 min ago');
|
||||
expect(metaStyle.fontSize, lessThan(titleStyle.fontSize!));
|
||||
expect(metaStyle.fontSize, 12.0);
|
||||
expect(_styleOf(tester, 'New').fontSize, titleStyle.fontSize);
|
||||
expect(
|
||||
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
|
||||
// inset group draws the separator between them.
|
||||
|
||||
@@ -34,6 +34,7 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const Key('chat-create-send-prompt')));
|
||||
await tester.pumpAndSettle();
|
||||
await _chooseCareful(tester);
|
||||
await tester.tap(find.byKey(const Key('chat-create-confirm')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -196,6 +197,7 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const Key('chat-create-send-prompt')));
|
||||
await tester.pumpAndSettle();
|
||||
await _chooseCareful(tester);
|
||||
await tester.tap(find.byKey(const Key('chat-create-confirm')));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -231,3 +233,12 @@ void main() {
|
||||
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(
|
||||
'material list keeps closed starred rows once and groups directories once',
|
||||
(tester) async {
|
||||
_inventoryViewport(tester);
|
||||
final gateway = FakeChatGateway()
|
||||
..sessionsReply = {'chat_sessions': sampleSessions()};
|
||||
await pumpMaterialChat(tester, gateway);
|
||||
@@ -101,6 +102,7 @@ void main() {
|
||||
testWidgets(
|
||||
'Cupertino app renders standard controls, groups and renames without Material',
|
||||
(tester) async {
|
||||
_inventoryViewport(tester);
|
||||
final gateway = FakeChatGateway()
|
||||
..sessionsReply = {'chat_sessions': sampleSessions()};
|
||||
await pumpCupertinoChat(tester, gateway);
|
||||
@@ -203,6 +205,7 @@ void main() {
|
||||
testWidgets('closed chats start folded away behind their heading', (
|
||||
tester,
|
||||
) async {
|
||||
_inventoryViewport(tester);
|
||||
final gateway = FakeChatGateway()
|
||||
..sessionsReply = {'chat_sessions': sampleSessions()};
|
||||
await pumpMaterialChat(tester, gateway);
|
||||
@@ -213,3 +216,10 @@ void main() {
|
||||
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.
|
||||
Future<void> expandClosedChats(WidgetTester tester) async {
|
||||
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'));
|
||||
await tester.ensureVisible(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/material.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/core/api_gateway.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);
|
||||
|
||||
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
|
||||
expect(find.text('plan · visit 1'), findsOneWidget);
|
||||
expect(find.text('plan · visit 5'), findsNothing);
|
||||
expectVisitHeading(tester, 'plan', 1);
|
||||
expect(find.text('Visit 5'), findsNothing);
|
||||
// The visit is its own page over the Timeline tab.
|
||||
expect(
|
||||
find.byKey(
|
||||
@@ -180,7 +181,7 @@ void main() {
|
||||
await pumpDeepLink(tester, RunDetailTestPlatform.material, stage: 'plan');
|
||||
|
||||
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', (
|
||||
@@ -194,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);
|
||||
expect(find.text('plan · visit 5'), findsOneWidget);
|
||||
expectVisitHeading(tester, 'plan', 5);
|
||||
});
|
||||
|
||||
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.text('plan · visit 5'), findsOneWidget);
|
||||
expectVisitHeading(tester, 'plan', 5);
|
||||
});
|
||||
|
||||
testWidgets('a declared but unvisited stage selects its graph node', (
|
||||
@@ -258,7 +259,7 @@ void main() {
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
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', (
|
||||
@@ -296,11 +297,11 @@ void main() {
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('plan · visit 1'), findsOneWidget);
|
||||
expectVisitHeading(tester, 'plan', 1);
|
||||
|
||||
rebuild(() => visit = 1);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('plan · visit 5'), findsOneWidget);
|
||||
expectVisitHeading(tester, 'plan', 5);
|
||||
|
||||
rebuild(() => stage = null);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
@@ -1,6 +1,22 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/features/runs/ui/run_detail_view.dart';
|
||||
|
||||
/// Wide screens deliberately repeat the selected title in the visible list.
|
||||
Finder runDetailText(String 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_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/run_graph_canvas.dart';
|
||||
import 'package:pipelines_app/features/graph/widgets/run_graph_view.dart';
|
||||
@@ -65,7 +66,7 @@ void main() {
|
||||
findsNothing,
|
||||
);
|
||||
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.textContaining('audit · visit'), findsNothing);
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.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/graph/widgets/stage_definition_view.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);
|
||||
expect(find.text('plan · visit 2'), findsOneWidget);
|
||||
expectVisitHeading(tester, 'plan', 2);
|
||||
await openVisitTab(tester, RunVisitSection.artifacts);
|
||||
expect(find.text('plan-2.csv'), findsOneWidget);
|
||||
expect(find.text('public/shared.csv'), findsNothing);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.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/features/runs/data/runs_repository.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.text('build · visit 2'), findsOneWidget);
|
||||
expectVisitHeading(tester, 'build', 2);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,13 @@ void main() {
|
||||
|
||||
expect(find.byKey(const Key('run-visit-pane')), findsOneWidget);
|
||||
// The body keeps the landed viewer's own identity for that visit.
|
||||
expect(find.text('plan'), findsOneWidget);
|
||||
expect(
|
||||
find.descendant(
|
||||
of: find.byType(ChangesViewer),
|
||||
matching: find.text('plan'),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.text('Visit 1 · completed'), findsOneWidget);
|
||||
expect(find.text('lib/plan.dart'), findsOneWidget);
|
||||
expect(find.text('lib/build.dart'), findsNothing);
|
||||
|
||||
@@ -16,8 +16,8 @@ const output = resolve(process.argv[3] ?? `build/list-detail-${platform}`);
|
||||
await mkdir(output, { recursive: true });
|
||||
const root = resolve(process.argv[2]);
|
||||
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_secondchat', title: 'Second 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', directory:'/srv/probe', updated_at:Date.now()-180000, mode: 'auto', mode_name: 'Auto' },
|
||||
] });
|
||||
const pipelines = await startWiringFixture({ root });
|
||||
const profile = await mkdtemp(join(tmpdir(), 'list-detail-consistency-'));
|
||||
@@ -59,23 +59,25 @@ try {
|
||||
await enableSemantics(c);
|
||||
assert.ok(await waitFor(async () => (await geometry()).list,30000));
|
||||
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), []);
|
||||
for (let i=0;i<titles.length;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.equal((await selected(titles)).length,1,'only the active row is selected');
|
||||
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');
|
||||
log.panes.push({destination,title:titles[i],...bounds});
|
||||
await sleep(300);
|
||||
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');
|
||||
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));
|
||||
} catch (error) {
|
||||
if(c) {
|
||||
|
||||
@@ -327,6 +327,8 @@ export async function startFixture({ root, runs = RUNS, runDetail, files = {}, c
|
||||
let chatSubscribed = 0;
|
||||
let chatHistory = 0;
|
||||
const chatPrompts = [];
|
||||
const chatCreateRequests = [];
|
||||
const createdChats = [];
|
||||
const shellOutputRequests = [];
|
||||
const fileReads = [];
|
||||
let chatRunning = false;
|
||||
@@ -421,6 +423,7 @@ export async function startFixture({ root, runs = RUNS, runDetail, files = {}, c
|
||||
chatSubscribed,
|
||||
chatHistory,
|
||||
chatPrompts,
|
||||
chatCreateRequests,
|
||||
shellOutputRequests,
|
||||
chatRunning,
|
||||
chatInterrupts,
|
||||
@@ -552,7 +555,24 @@ export async function startFixture({ root, runs = RUNS, runDetail, files = {}, c
|
||||
}
|
||||
if (request.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;
|
||||
}
|
||||
if (request.type === 'chat_subscribe') {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
Reference in New Issue
Block a user