diff --git a/app/WORK.md b/app/WORK.md index 924c1b4c..897c95e0 100644 --- a/app/WORK.md +++ b/app/WORK.md @@ -14,7 +14,7 @@ All work under app/. Existing applications remain running and unchanged. | F5 | Isolated authenticated web preview tooling | run 30 + ae352bb | 6 proxy fixtures incl auth/bytes/origin/idle sockets pass | main 160ab45, ancestry verified | http://127.0.0.1:8096/ | | P1 | Pipeline list/detail/source/version browser | run34 / flutter/p1-pipelines | UIReview found whole-word tab-label scaling defect; visit3 export waits on duplicated inline screenshot data | held for exact export recovery then review-directed fix | pending | | C1 | Chat session browser and management | 35 →36 →42 / flutter/f4-chat | original export42 repaired; Review resumed | pending review/landing | pending | -| N1 | Connection settings/preferences | run37 / flutter/n1-settings | original export repaired; Review resumed | pending review/landing | pending | +| N1 | Connection settings/preferences | run37 /abd696b + manager first-frame fix |39 reviewed tests pass; first-frame delayed-store regression reproduced then fixed;40 focused/415 integrated tests pass, clean analyze | merged main, ancestry verified | not registered; preview unchanged | | R1 | Run list/detail/live timeline | controller43 + list48 + detail46 +35a8aab | manager checked retained candidate and real browser captures | merged main; ancestry verified | built into8096 preview | | D1 | Recorded changes/diff viewer | run39 / flutter/d1-diff-viewer | visual-review audit now export-waiting; inline-payload correction staged | held for exact export recovery | pending | | R2a | Human-decision native confirm | run47 / commit42b21b8 | manager inspected source + reran 7 exact-confirm/refusal/native tests + analyze, pass | main3e6f950, ancestry verified | reusable component only; wiring/browser pending | @@ -79,6 +79,15 @@ override, server edit or shell-write bypass was used by the manager. Allowed pipeline models: Luna or DeepSeek V4.1 Flash; current runs use Luna. ## Latest integration check +Settings37 landed after manager source/evidence check and39 focused tests. A +separate small manager correction starts the already-connected client's ping +before preference loading rather than rendering false build/time unavailability +on the first frame. New delayed-store regression failed on the original and +passes with fix; also checks one ping only and stale pong ignored on disconnect. +Integrated main now415 tests pass; analysis clean. No new browser capture for +the first-frame correction; shell registration still needs native-host framing +and shared-client wiring, so Settings is not yet claimed delivered in preview. + After Runs landing, integrated main:375 Flutter tests pass; analysis and normal web build pass. Manager reran browser probe against that normal bundle:18 PNGs, deep link/back/forward/drop/reconnect pass,5 subscriptions/5 lists/7 detail reads. diff --git a/app/lib/features/settings/settings_controller.dart b/app/lib/features/settings/settings_controller.dart index bbbebdd5..8d8bc715 100644 --- a/app/lib/features/settings/settings_controller.dart +++ b/app/lib/features/settings/settings_controller.dart @@ -30,6 +30,9 @@ class SettingsController extends ChangeNotifier { _connection = client.state { _lastKind = _connection.kind; _subscription = client.states.listen(_onConnectionState); + // Details belong to the current socket, not to the preferences read. + // Mark them pending before the first frame when opening Settings live. + if (_connection.kind == transport.ConnectionKind.connected) _requestPing(); } final transport.PipelinesClient client; diff --git a/app/test/features/settings/settings_initial_connection_test.dart b/app/test/features/settings/settings_initial_connection_test.dart new file mode 100644 index 00000000..5b9ceff8 --- /dev/null +++ b/app/test/features/settings/settings_initial_connection_test.dart @@ -0,0 +1,63 @@ +import 'dart:async'; + +import 'package:flutter_test/flutter_test.dart'; +import 'package:pipelines_app/core/transport/pipelines_client.dart'; +import 'package:pipelines_app/features/settings/settings_controller.dart'; +import 'package:pipelines_app/features/settings/settings_store.dart'; + +import 'fake_channel.dart'; + +class _DelayedStore extends MemorySettingsStore { + final loaded = Completer(); + + @override + Future load() => loaded.future; +} + +void main() { + test( + 'connected first frame loads details before preferences finish', + () async { + final factory = FakeChannelFactory(); + final client = PipelinesClient(channelFactory: factory.call); + addTearDown(client.dispose); + final connected = client.connect(Uri.parse('ws://fixture.test/connect')); + await settle(); + factory.last.markReady(); + await connected; + final store = _DelayedStore(); + final pong = Completer>(); + var pings = 0; + final controller = SettingsController( + client: client, + store: store, + ping: () { + pings++; + return pong.future; + }, + ); + addTearDown(controller.dispose); + + expect(controller.connectionLines, [ + 'Connected', + 'Loading server details…', + ]); + final initializing = controller.initialize(); + expect(controller.pingInFlight, isTrue); + expect(pings, 1); + store.loaded.complete(const SettingsValues()); + await initializing; + expect(pings, 1); + + await client.disconnect(); + await settle(); + pong.complete({ + 'type': 'pong', + 'build': {'version': 'stale'}, + }); + await settle(); + expect(controller.connectionLines, ['Not connected']); + expect(controller.buildVersion, isEmpty); + }, + ); +}