chore(app): chat probes take platform/theme/tasks queries; note chat chrome fixes

This commit is contained in:
2026-10-31 03:14:35 +00:00
parent 481b1f6fff
commit 92095f8a4e
3 changed files with 155 additions and 11 deletions
+107
View File
@@ -0,0 +1,107 @@
# Chat chrome fixes (style review F5, F23, F29, F14, F24, F1-chat)
Findings from the whole-app style review (`/tmp/app-style-review/report.md`),
chat screens only (`lib/features/chat/**`). Shared primitives in
`lib/ui/adaptive/` are used, not changed.
## F5 — floating glass composer
- `ChatThreadView` no longer stacks the transcript above the composer in a
`Column`. The transcript fills the page inside `FloatingBarOverlay(bar:
ChatComposerBar, child: SegmentedBarOverlay(header, transcript))`: the header
floats over its top, the composer over its bottom, and history scrolls behind
both.
- The list pads its end by `MediaQuery.paddingOf(context).bottom + 8` (the
composer's measured height from the overlay), so at rest the last message sits
fully above the composer. The follow logic is unchanged: a taller composer
(multi-line draft, attachments, notices) changes the list's extent, and a
following view stays pinned to the end (`_onScrollMetrics`). Jump to latest
floats 16 above the composer.
- `ChatComposerBar._pill` is a `GlassPill` (rounded rectangle, radius 28), key
`chat-composer-pill`. The attachment strip, upload/attachment-error/command
report/queued/error notices now sit inside the glass above the field row; the
command palette (an opaque card/menu) still floats above the pill. Keyboard
insets, `SafeArea(top: false)`, Send/Stop, attach and every key are unchanged.
The space beside and above the pill passes taps through to the transcript.
## F23 — no "0 tasks"
`ChatBackgroundTasks` builds nothing when no task runs (also while the first
read is loading); with tasks it is a quiet neutral control (`onSurfaceVariant` /
`secondaryLabel`, a layers icon and "n task(s)") inside the composer pill,
before Send. A list that cannot be read still shows "Tasks" so its refusal stays
reachable. Key `chat-background-tasks-button` kept.
## F29 — reading width
`chat_reading_width.dart`: `kChatReadingWidth = 760`, `chatReadingInset(width)`.
The transcript `ListView` still spans the window (its margins scroll it) and
pads each side by the inset; the composer is centred and capped at the same
760, so the pill lines up with the rows (both keep the 16 margins).
## F14 — header controls
- No fixed 160/140 caps: the controls take their natural width while the bar
has room ("Ask for permission" whole at 560 and 1200 in Material). Under
pressure the mode keeps at most half the actions pill and the model ellipsises
first (`SegmentedBar` still caps the whole pill at the title's 25% share).
- A session without both `mode` and `mode_name` gets no mode control, and with
no model either there are no actions, so `SegmentedBar` draws no (empty)
actions pill.
- Neutral colours (`chat_bar_control_style.dart`): Material `TextButton` in
`onSurfaceVariant` (the bar's icon buttons' role), Cupertino content in
`CupertinoColors.label`.
## F24 / F1 — chat list
- The standalone Material list's "New chat" FAB is gone; the bar's +
(`chat-new-chat`) is the one create action. The hide/undo bar sits 8 from the
bottom on every host.
- The standalone list scrolls behind its bar: Material drops the top-only
`SafeArea` (the default `ListView` padding takes the bar height), Cupertino
keeps `SafeArea(top: false)` and the list pads its top by the media top. The
body is built under the scaffold (`Builder`) so it reads the scaffold's
padding, and a load-error notice is pushed below the bar while the list under
it drops the inset. Under the shell (`embedded`) nothing changes; the shell
owns that.
## Tests
New: `test/features/chat/conversation/chat_floating_chrome_test.dart` (both
hosts: composer is a `GlassPill` over a full-height transcript and the last
message rests above it, then scrolls behind; 1200 window caps pill and rows to
the centred 760 column while the list spans the window; 560 pill = width − 32;
no empty actions pill without model/mode; at 1200 neither control is truncated;
neutral colours), `test/features/chat/ui/sessions/chat_sessions_floating_bar_test.dart`
(both hosts: list reaches under the bar, first section starts below it; no FAB,
one New chat in the bar).
Updated: background-task tests (no control and never "0 tasks" for an empty
snapshot or after a session switch; the control sits inside the pill beside
Send in neutral colour; the owner-disposal test now has a task to open), the
three create-dialog tests tap `chat-new-chat` instead of the removed FAB, and
`expand_closed.dart` centres the Closed heading before tapping it (at the top
edge it is under the floating bar).
## Evidence
Headless Chrome (`/tmp/fix-b-scripts/shoot.mjs`, a copy of the review's
script) in `/tmp/fix-b-evidence/`:
- `cc-*`: `tool/chat_composer_probe_entry.dart`, which now also reads
`?platform=`, `?theme=`, `?long=1`, `?tasks=n`, `?mode=0`, `?model=0`:
560/1200 × light/dark × Material/Cupertino, scrolled behind the composer,
with tasks, without model/mode, and a three-line draft at 1200.
- `cs-*`: `tool/chat_sessions_probe_entry.dart` (now `?platform=` and
`?many=1`): 560/1200 × light/dark × Material/Cupertino, scrolled behind the
bar.
- `app-*`: the full web build over the runs fixture (thread 560/1200
light/dark, the command palette above the pill, the shell chat list).
## Not done / notes
- Cupertino dark glass is nearly invisible against black (review F17); that is
`GlassPill`'s fill, owned by another batch.
- The conversation header is not width-capped (it spans the pane like every
other segmented bar).
- No device run; Android/iOS keyboard behaviour is unverified on hardware
(the structure keeps the scaffold's inset handling and the composer's
`SafeArea`).
+32 -6
View File
@@ -27,12 +27,24 @@ class _ProbeGateway implements ApiGateway {
switch (type) {
case 'chat_subscribe':
return <String, dynamic>{};
case 'chat_shells':
// `?tasks=2` reports that many running background tasks.
return {
'chat_shells': [
for (var i = 0; i < _probeTasks; i++)
{
'id': 'probe-shell-$i',
'status': 'running',
'command': 'go test ./... #$i',
},
],
};
case 'chat_messages':
return {
'chat_history': {
'messages': [
// A long history scrolls behind the floating header.
if (_probeLong)
if (_probeLong || _query['long'] == '1')
for (var i = 0; i < 12; i++)
{
'id': 'probe-history-$i',
@@ -133,26 +145,40 @@ const _probeStyle = String.fromEnvironment(
defaultValue: 'material',
);
/// Browser overrides: `?platform=cupertino|material`, `?theme=dark|light`,
/// `?long=1`, `?tasks=<n>`, `?mode=0` (no permission mode recorded) and
/// `?model=0` (a backend without models).
Map<String, String> get _query => Uri.base.queryParameters;
int get _probeTasks => int.tryParse(_query['tasks'] ?? '') ?? 0;
void main() {
final gateway = _ProbeGateway();
final cupertino = (_query['platform'] ?? _probeStyle) == 'cupertino';
final dark = _query['theme'] == null ? cupertino : _query['theme'] == 'dark';
final thread = ChatThreadView(
gateway: gateway,
sessionId: 'probe-composer',
title: 'Composer fixture',
session: const {
session: {
'id': 'probe-composer',
'backend': 'opencode',
'backend': _query['model'] == '0' ? 'pi' : 'opencode',
'model': _probeModel,
'directory': '/Users/ada/repos/tank',
if (_query['mode'] != '0') ...{
'mode': 'default',
'mode_name': 'Ask for permission',
},
},
onBack: () {},
drafts: MemoryChatDraftStore(),
newOperationId: gateway.nextOperation,
);
if (_probeStyle == 'cupertino') {
if (cupertino) {
runApp(
CupertinoApp(
theme: const CupertinoThemeData(brightness: Brightness.dark),
theme: CupertinoThemeData(
brightness: dark ? Brightness.dark : Brightness.light,
),
home: CupertinoPageScaffold(child: _framed(SafeArea(child: thread))),
),
);
@@ -162,7 +188,7 @@ void main() {
MaterialApp(
theme: ThemeData(
platform: TargetPlatform.android,
brightness: Brightness.light,
brightness: dark ? Brightness.dark : Brightness.light,
),
home: Scaffold(body: _framed(SafeArea(child: thread))),
),
+16 -5
View File
@@ -132,11 +132,22 @@ const _probeStyle = String.fromEnvironment(
void main() {
final dark = Uri.base.queryParameters['dark'] == '1';
final unseen = Uri.base.queryParameters['unseen'] == '1';
final home = ChatSessionsScreen(
gateway: _FixtureGateway(bumpAfterFirstRead: unseen),
onOpen: (_) {},
);
if (_probeStyle == 'cupertino') {
final gateway = _FixtureGateway(bumpAfterFirstRead: unseen);
// `?many=1` adds enough chats to scroll the list behind the bar.
if (Uri.base.queryParameters['many'] == '1') {
gateway._sessions.addAll([
for (var i = 0; i < 24; i++)
{
'id': 'probe-many-$i',
'title': 'Fixture chat ${i + 1}',
'directory': '/workspace/demo',
},
]);
}
final home = ChatSessionsScreen(gateway: gateway, onOpen: (_) {});
// `?platform=cupertino` overrides the compile-time style.
final style = Uri.base.queryParameters['platform'] ?? _probeStyle;
if (style == 'cupertino') {
runApp(
CupertinoApp(
theme: CupertinoThemeData(