d02d5ea11d
Root causes found in release web captures (1280x800 and 560x900): - Follow mode undid small wheel/trackpad ticks at the end: each tick is its own scroll, re-judged as following within 32 px and jumped back. A user scroll toward older rows now releases the end however small; the jump control appears once streamed content moves the end beyond the threshold. - The end-of-scroll jump ran inside the position's activity switch, so a touch or scrollbar drag released near the end recursed without end (stack overflow during the gesture). The jump now runs after the notification. - Horizontally scrolling code blocks and tables claimed diagonal trackpad gestures whole. HorizontalScrollView gives mostly vertical gestures to the enclosing list; sideways and Shift + wheel still scroll the block. - The wheel over the floating chat bar, composer and jump control moved nothing. VerticalWheelForwarder scrolls the transcript from them unless something under the pointer claims the event. Adds widget tests per content kind and scroll mode, follow/touch/Load older tests, a capture-kit check (tool/capture/examples/chat-wheel-scroll.json) with eval/expect steps, wheel dx/repeat, --params and eval: targets, a transcript scroll probe and fixture options, and fixes the kit ignoring a script's size. Notes in notes/chat-wheel-scroll.md.
190 lines
5.9 KiB
Dart
190 lines
5.9 KiB
Dart
// Extra fixture data for the interaction bench (tool/perf/interaction_bench.mjs)
|
|
// over the full-app probe (tool/search_selection_probe_entry.dart). Every
|
|
// option defaults to off, so other captures see the fixture unchanged.
|
|
//
|
|
// `?hits=N` N more `release` run hits in Search;
|
|
// `?chats=N` N chat sessions in the chat list, each opening a short
|
|
// markdown transcript;
|
|
// `?graph=1` run 7 carries its pinned graph (plan -> build);
|
|
// `?quota=claude|opencode` (with `?chats=N`) pushes a usage frame with
|
|
// that harness's account quota after a chat subscribes.
|
|
// `?msgs=`, `?rich=1`, `?older=1`, `?live=N` vary the chat transcripts for
|
|
// scroll captures (tool/perf/chat_scroll_fixture.dart).
|
|
import 'package:pipelines_app/core/api_gateway.dart';
|
|
|
|
import 'chat_scroll_fixture.dart';
|
|
|
|
Map<String, String> _params = const {};
|
|
|
|
/// Reads the options from the page URL's query, before the app rewrites it.
|
|
void configurePerfFixture(Map<String, String> params) {
|
|
_params = params;
|
|
configureChatScrollFixture(params);
|
|
}
|
|
|
|
int get _hits => int.tryParse(_params['hits'] ?? '') ?? 0;
|
|
int get _chats => int.tryParse(_params['chats'] ?? '') ?? 0;
|
|
bool get perfRunGraph => _params['graph'] == '1';
|
|
|
|
/// Whether a chat scroll option (tool/perf/chat_scroll_fixture.dart) shapes
|
|
/// the transcripts instead of the bench's short markdown history.
|
|
bool get _scrollVariety => ['msgs', 'rich', 'older'].any(_params.containsKey);
|
|
|
|
/// Unsolicited envelopes that follow a reply: the `?quota=` usage frame.
|
|
List<JsonMap> perfChatFollowUps(JsonMap request) {
|
|
final quota = _params['quota'];
|
|
if (_chats == 0 || quota == null || request['type'] != 'chat_subscribe') {
|
|
return const [];
|
|
}
|
|
final now = DateTime.now();
|
|
int at(Duration offset) => now.add(offset).millisecondsSinceEpoch;
|
|
final account = quota == 'opencode'
|
|
? {'harness': 'OpenCode', 'unsupported': true}
|
|
: {
|
|
'harness': 'Claude Code',
|
|
'source': 'rate_limit_event',
|
|
'plan': 'max',
|
|
'as_of': at(const Duration(minutes: -4)),
|
|
'windows': [
|
|
{
|
|
'id': 'five_hour',
|
|
'label': '5-hour',
|
|
'used_percent': 42,
|
|
'resets_at': at(
|
|
const Duration(hours: 2, minutes: 14, seconds: 30),
|
|
),
|
|
},
|
|
{
|
|
'id': 'seven_day',
|
|
'label': 'Weekly',
|
|
'used_percent': 93,
|
|
'resets_at': at(const Duration(days: 3, hours: 5)),
|
|
},
|
|
],
|
|
};
|
|
return [
|
|
{
|
|
'type': 'chat_event',
|
|
'chat_event': {
|
|
'session_id': (request['chat_subscribe'] as Map?)?['session_id'],
|
|
'kind': 'usage',
|
|
'usage': {
|
|
'scope': 'session',
|
|
'total_tokens': 132408,
|
|
'context_tokens': 42000,
|
|
'context_window': 200000,
|
|
'account': account,
|
|
},
|
|
},
|
|
},
|
|
];
|
|
}
|
|
|
|
/// Run 7's pinned graph for `?graph=1`.
|
|
JsonMap perfRunGraphFixture() => {
|
|
'name': 'Release train',
|
|
'stages': [
|
|
{
|
|
'key': 'plan',
|
|
'type': 'model',
|
|
'edges': {'success': 'build', 'error': '#'},
|
|
},
|
|
{
|
|
'key': 'build',
|
|
'type': 'model',
|
|
'edges': {'success': 'plan', 'error': '#failure'},
|
|
},
|
|
],
|
|
};
|
|
|
|
/// Filler run hits for a query that `release` text matches.
|
|
List<JsonMap> perfSearchHits(String query, String kind) {
|
|
if (_hits == 0 || (kind.isNotEmpty && kind != 'run')) return const [];
|
|
if (query.isNotEmpty && !'release filler run'.contains(query)) {
|
|
return const [];
|
|
}
|
|
return [
|
|
for (var i = 0; i < _hits; i++)
|
|
{
|
|
'kind': 'run',
|
|
'target': 'run:${1000 + i}',
|
|
'score': 1,
|
|
'recency': '2026-10-18T08:42:00Z',
|
|
'run': {
|
|
'id': 1000 + i,
|
|
'pipeline_name': 'Release filler $i',
|
|
'status': i % 3 == 0 ? 'failed' : 'succeeded',
|
|
'workspace': '/srv/probe/release',
|
|
'created_at': '2026-10-18T08:12:00Z',
|
|
'finished_at': '2026-10-18T08:42:00Z',
|
|
},
|
|
},
|
|
];
|
|
}
|
|
|
|
String _answer(int i) =>
|
|
'## Answer $i\n\nSome **bold** text with `code`.\n\n'
|
|
'```dart\n${List.generate(8, (l) => 'final v$l = $i * $l;').join('\n')}'
|
|
'\n```\n\n- one\n- two\n';
|
|
|
|
/// Chat replies for `?chats=N`, or null to fall through to the fixture.
|
|
JsonMap? perfChatReply(JsonMap request) {
|
|
if (_chats == 0) return null;
|
|
final id = request['id'];
|
|
switch ('${request['type']}') {
|
|
case 'chat_sessions':
|
|
return {
|
|
'id': id,
|
|
'type': 'chat_sessions',
|
|
'chat_sessions': [
|
|
for (var i = 0; i < _chats; i++)
|
|
{
|
|
'id': 'perf-chat-$i',
|
|
'title': 'Fixture chat ${i + 1}',
|
|
'directory': '/workspace/demo',
|
|
},
|
|
],
|
|
};
|
|
case 'chat_subscribe':
|
|
return {'id': id, 'type': 'chat_subscribed'};
|
|
case 'chat_shells':
|
|
return {'id': id, 'type': 'chat_shells', 'chat_shells': const []};
|
|
case 'chat_messages':
|
|
final query = request['chat_query'];
|
|
final session = query is Map ? '${query['session_id'] ?? ''}' : '';
|
|
if (_scrollVariety) {
|
|
return {
|
|
'id': id,
|
|
'type': 'chat_messages',
|
|
'chat_history': chatScrollHistory(
|
|
session,
|
|
int.tryParse(session.replaceFirst('perf-chat-', '')) ?? 0,
|
|
query is Map ? '${query['cursor'] ?? ''}' : '',
|
|
),
|
|
};
|
|
}
|
|
return {
|
|
'id': id,
|
|
'type': 'chat_messages',
|
|
'chat_history': {
|
|
'messages': [
|
|
for (var i = 0; i < 20; i++)
|
|
{
|
|
'id': 'perf-m$i',
|
|
'role': i.isEven ? 'user' : 'assistant',
|
|
'parts': [
|
|
{
|
|
'type': 'text',
|
|
'text': i.isEven ? 'Question $i' : _answer(i),
|
|
},
|
|
],
|
|
},
|
|
],
|
|
'next_cursor': '',
|
|
'has_more': false,
|
|
},
|
|
};
|
|
}
|
|
return null;
|
|
}
|