From 9a12794487dd8eb4cc913fb5d670e29a98c14810 Mon Sep 17 00:00:00 2001 From: Strycher Date: Sat, 22 Aug 2026 01:39:46 -0400 Subject: [PATCH] fix(#589): late replies go to the app log, not the user's screen #528 surfaced unmatched and late replies in the UI because they were previously destroyed in silence. Once #529 widened the window, late arrivals stopped being the exception and the on-screen output became noise during ordinary use. Owner's call: log it, keep it off the screen. Removed: the CLI screen's late-response history entry and its renderer branch, the settings screen's snackbar, and the four l10n strings that only those two used. Also removed the settings screen's silent late-apply. A field changing value seconds after the fact with no explanation is the same problem as the snackbar, only quieter, and applying while saying nothing would be worse than either showing or not showing. One line to re-enable if that turns out to be wanted. Kept: the service still detects every unmatched reply and writes it to the app log via appLogger, now including the payload as well as the repeater, the originating command when known, and how late it arrived. That is the diagnostics channel and is what keeps this from being a silent drop. onUnmatchedResponse and UnmatchedRepeaterResponse stay on the service. They are the seam the no-silent-drop guarantee is tested through; the #528 and #532 tests exercise them directly and pass unchanged, which is the evidence the service contract did not move. 807 tests pass, analyze clean, format clean. --- lib/l10n/app_en.arb | 14 ----- lib/l10n/app_localizations.dart | 24 ------- lib/l10n/app_localizations_bg.dart | 17 ----- lib/l10n/app_localizations_de.dart | 17 ----- lib/l10n/app_localizations_en.dart | 17 ----- lib/l10n/app_localizations_es.dart | 17 ----- lib/l10n/app_localizations_fr.dart | 17 ----- lib/l10n/app_localizations_hu.dart | 17 ----- lib/l10n/app_localizations_it.dart | 17 ----- lib/l10n/app_localizations_ja.dart | 17 ----- lib/l10n/app_localizations_ko.dart | 17 ----- lib/l10n/app_localizations_nl.dart | 17 ----- lib/l10n/app_localizations_pl.dart | 17 ----- lib/l10n/app_localizations_pt.dart | 17 ----- lib/l10n/app_localizations_ru.dart | 17 ----- lib/l10n/app_localizations_sk.dart | 17 ----- lib/l10n/app_localizations_sl.dart | 17 ----- lib/l10n/app_localizations_sv.dart | 17 ----- lib/l10n/app_localizations_uk.dart | 17 ----- lib/l10n/app_localizations_zh.dart | 17 ----- lib/screens/repeater_cli_screen.dart | 73 +++------------------- lib/screens/repeater_settings_screen.dart | 24 ------- lib/services/repeater_command_service.dart | 18 ++++-- 23 files changed, 23 insertions(+), 436 deletions(-) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 7b714f5f..bd639249 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -1606,20 +1606,6 @@ } } }, - "repeater_cliLateResponse": "Late response to \"{command}\" (arrived {seconds}s after timeout)", - "@repeater_cliLateResponse": { - "placeholders": { - "command": { - "type": "String" - }, - "seconds": { - "type": "String" - } - } - }, - "repeater_cliUnmatchedResponse": "Unrequested response from repeater", - "repeater_lateResponseDiscarded": "A late response arrived but was not applied, because you have unsaved changes.", - "repeater_lateResponseReceived": "A late response arrived after the command timed out. See the CLI screen.", "repeater_cliQuickGetName": "Get Name", "repeater_cliQuickGetRadio": "Get Radio", "repeater_cliQuickGetTx": "Get TX", diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 944bccf6..28c37107 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -5180,30 +5180,6 @@ abstract class AppLocalizations { /// **'Command timed out after {seconds} seconds'** String repeater_cliCommandTimeout(String seconds); - /// No description provided for @repeater_cliLateResponse. - /// - /// In en, this message translates to: - /// **'Late response to \"{command}\" (arrived {seconds}s after timeout)'** - String repeater_cliLateResponse(String command, String seconds); - - /// No description provided for @repeater_cliUnmatchedResponse. - /// - /// In en, this message translates to: - /// **'Unrequested response from repeater'** - String get repeater_cliUnmatchedResponse; - - /// No description provided for @repeater_lateResponseDiscarded. - /// - /// In en, this message translates to: - /// **'A late response arrived but was not applied, because you have unsaved changes.'** - String get repeater_lateResponseDiscarded; - - /// No description provided for @repeater_lateResponseReceived. - /// - /// In en, this message translates to: - /// **'A late response arrived after the command timed out. See the CLI screen.'** - String get repeater_lateResponseReceived; - /// No description provided for @repeater_cliQuickGetName. /// /// In en, this message translates to: diff --git a/lib/l10n/app_localizations_bg.dart b/lib/l10n/app_localizations_bg.dart index 38fa6e8f..504792ac 100644 --- a/lib/l10n/app_localizations_bg.dart +++ b/lib/l10n/app_localizations_bg.dart @@ -2942,23 +2942,6 @@ class AppLocalizationsBg extends AppLocalizations { return 'Command timed out after $seconds seconds'; } - @override - String repeater_cliLateResponse(String command, String seconds) { - return 'Late response to \"$command\" (arrived ${seconds}s after timeout)'; - } - - @override - String get repeater_cliUnmatchedResponse => - 'Unrequested response from repeater'; - - @override - String get repeater_lateResponseDiscarded => - 'A late response arrived but was not applied, because you have unsaved changes.'; - - @override - String get repeater_lateResponseReceived => - 'A late response arrived after the command timed out. See the CLI screen.'; - @override String get repeater_cliQuickGetName => 'Получи име'; diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart index 0deceb78..03c6cc96 100644 --- a/lib/l10n/app_localizations_de.dart +++ b/lib/l10n/app_localizations_de.dart @@ -2945,23 +2945,6 @@ class AppLocalizationsDe extends AppLocalizations { return 'Command timed out after $seconds seconds'; } - @override - String repeater_cliLateResponse(String command, String seconds) { - return 'Late response to \"$command\" (arrived ${seconds}s after timeout)'; - } - - @override - String get repeater_cliUnmatchedResponse => - 'Unrequested response from repeater'; - - @override - String get repeater_lateResponseDiscarded => - 'A late response arrived but was not applied, because you have unsaved changes.'; - - @override - String get repeater_lateResponseReceived => - 'A late response arrived after the command timed out. See the CLI screen.'; - @override String get repeater_cliQuickGetName => 'Name erhalten'; diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index cbc29c29..001e8c13 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -2886,23 +2886,6 @@ class AppLocalizationsEn extends AppLocalizations { return 'Command timed out after $seconds seconds'; } - @override - String repeater_cliLateResponse(String command, String seconds) { - return 'Late response to \"$command\" (arrived ${seconds}s after timeout)'; - } - - @override - String get repeater_cliUnmatchedResponse => - 'Unrequested response from repeater'; - - @override - String get repeater_lateResponseDiscarded => - 'A late response arrived but was not applied, because you have unsaved changes.'; - - @override - String get repeater_lateResponseReceived => - 'A late response arrived after the command timed out. See the CLI screen.'; - @override String get repeater_cliQuickGetName => 'Get Name'; diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart index 15ed94be..4541d3cd 100644 --- a/lib/l10n/app_localizations_es.dart +++ b/lib/l10n/app_localizations_es.dart @@ -2936,23 +2936,6 @@ class AppLocalizationsEs extends AppLocalizations { return 'Command timed out after $seconds seconds'; } - @override - String repeater_cliLateResponse(String command, String seconds) { - return 'Late response to \"$command\" (arrived ${seconds}s after timeout)'; - } - - @override - String get repeater_cliUnmatchedResponse => - 'Unrequested response from repeater'; - - @override - String get repeater_lateResponseDiscarded => - 'A late response arrived but was not applied, because you have unsaved changes.'; - - @override - String get repeater_lateResponseReceived => - 'A late response arrived after the command timed out. See the CLI screen.'; - @override String get repeater_cliQuickGetName => 'Obtener Nombre'; diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart index f23e757f..c9d51931 100644 --- a/lib/l10n/app_localizations_fr.dart +++ b/lib/l10n/app_localizations_fr.dart @@ -2958,23 +2958,6 @@ class AppLocalizationsFr extends AppLocalizations { return 'Command timed out after $seconds seconds'; } - @override - String repeater_cliLateResponse(String command, String seconds) { - return 'Late response to \"$command\" (arrived ${seconds}s after timeout)'; - } - - @override - String get repeater_cliUnmatchedResponse => - 'Unrequested response from repeater'; - - @override - String get repeater_lateResponseDiscarded => - 'A late response arrived but was not applied, because you have unsaved changes.'; - - @override - String get repeater_lateResponseReceived => - 'A late response arrived after the command timed out. See the CLI screen.'; - @override String get repeater_cliQuickGetName => 'Obtenir le nom'; diff --git a/lib/l10n/app_localizations_hu.dart b/lib/l10n/app_localizations_hu.dart index 89d01845..14d76076 100644 --- a/lib/l10n/app_localizations_hu.dart +++ b/lib/l10n/app_localizations_hu.dart @@ -2949,23 +2949,6 @@ class AppLocalizationsHu extends AppLocalizations { return 'Command timed out after $seconds seconds'; } - @override - String repeater_cliLateResponse(String command, String seconds) { - return 'Late response to \"$command\" (arrived ${seconds}s after timeout)'; - } - - @override - String get repeater_cliUnmatchedResponse => - 'Unrequested response from repeater'; - - @override - String get repeater_lateResponseDiscarded => - 'A late response arrived but was not applied, because you have unsaved changes.'; - - @override - String get repeater_lateResponseReceived => - 'A late response arrived after the command timed out. See the CLI screen.'; - @override String get repeater_cliQuickGetName => 'Kapcsold össze a nevet'; diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart index 2be1a8a0..f78808eb 100644 --- a/lib/l10n/app_localizations_it.dart +++ b/lib/l10n/app_localizations_it.dart @@ -2942,23 +2942,6 @@ class AppLocalizationsIt extends AppLocalizations { return 'Command timed out after $seconds seconds'; } - @override - String repeater_cliLateResponse(String command, String seconds) { - return 'Late response to \"$command\" (arrived ${seconds}s after timeout)'; - } - - @override - String get repeater_cliUnmatchedResponse => - 'Unrequested response from repeater'; - - @override - String get repeater_lateResponseDiscarded => - 'A late response arrived but was not applied, because you have unsaved changes.'; - - @override - String get repeater_lateResponseReceived => - 'A late response arrived after the command timed out. See the CLI screen.'; - @override String get repeater_cliQuickGetName => 'Ottieni Nome'; diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart index 8f47415e..3bba046f 100644 --- a/lib/l10n/app_localizations_ja.dart +++ b/lib/l10n/app_localizations_ja.dart @@ -2822,23 +2822,6 @@ class AppLocalizationsJa extends AppLocalizations { return 'Command timed out after $seconds seconds'; } - @override - String repeater_cliLateResponse(String command, String seconds) { - return 'Late response to \"$command\" (arrived ${seconds}s after timeout)'; - } - - @override - String get repeater_cliUnmatchedResponse => - 'Unrequested response from repeater'; - - @override - String get repeater_lateResponseDiscarded => - 'A late response arrived but was not applied, because you have unsaved changes.'; - - @override - String get repeater_lateResponseReceived => - 'A late response arrived after the command timed out. See the CLI screen.'; - @override String get repeater_cliQuickGetName => '名前を取得する'; diff --git a/lib/l10n/app_localizations_ko.dart b/lib/l10n/app_localizations_ko.dart index 48e5c438..1a1e29c8 100644 --- a/lib/l10n/app_localizations_ko.dart +++ b/lib/l10n/app_localizations_ko.dart @@ -2820,23 +2820,6 @@ class AppLocalizationsKo extends AppLocalizations { return 'Command timed out after $seconds seconds'; } - @override - String repeater_cliLateResponse(String command, String seconds) { - return 'Late response to \"$command\" (arrived ${seconds}s after timeout)'; - } - - @override - String get repeater_cliUnmatchedResponse => - 'Unrequested response from repeater'; - - @override - String get repeater_lateResponseDiscarded => - 'A late response arrived but was not applied, because you have unsaved changes.'; - - @override - String get repeater_lateResponseReceived => - 'A late response arrived after the command timed out. See the CLI screen.'; - @override String get repeater_cliQuickGetName => '이름을 알려주세요'; diff --git a/lib/l10n/app_localizations_nl.dart b/lib/l10n/app_localizations_nl.dart index b6e8f411..f88ceac4 100644 --- a/lib/l10n/app_localizations_nl.dart +++ b/lib/l10n/app_localizations_nl.dart @@ -2922,23 +2922,6 @@ class AppLocalizationsNl extends AppLocalizations { return 'Command timed out after $seconds seconds'; } - @override - String repeater_cliLateResponse(String command, String seconds) { - return 'Late response to \"$command\" (arrived ${seconds}s after timeout)'; - } - - @override - String get repeater_cliUnmatchedResponse => - 'Unrequested response from repeater'; - - @override - String get repeater_lateResponseDiscarded => - 'A late response arrived but was not applied, because you have unsaved changes.'; - - @override - String get repeater_lateResponseReceived => - 'A late response arrived after the command timed out. See the CLI screen.'; - @override String get repeater_cliQuickGetName => 'Naam opvragen'; diff --git a/lib/l10n/app_localizations_pl.dart b/lib/l10n/app_localizations_pl.dart index 72787bc0..1d348dba 100644 --- a/lib/l10n/app_localizations_pl.dart +++ b/lib/l10n/app_localizations_pl.dart @@ -2950,23 +2950,6 @@ class AppLocalizationsPl extends AppLocalizations { return 'Command timed out after $seconds seconds'; } - @override - String repeater_cliLateResponse(String command, String seconds) { - return 'Late response to \"$command\" (arrived ${seconds}s after timeout)'; - } - - @override - String get repeater_cliUnmatchedResponse => - 'Unrequested response from repeater'; - - @override - String get repeater_lateResponseDiscarded => - 'A late response arrived but was not applied, because you have unsaved changes.'; - - @override - String get repeater_lateResponseReceived => - 'A late response arrived after the command timed out. See the CLI screen.'; - @override String get repeater_cliQuickGetName => 'Pobierz nazwę'; diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart index 9ee389fa..38f706e6 100644 --- a/lib/l10n/app_localizations_pt.dart +++ b/lib/l10n/app_localizations_pt.dart @@ -2934,23 +2934,6 @@ class AppLocalizationsPt extends AppLocalizations { return 'Command timed out after $seconds seconds'; } - @override - String repeater_cliLateResponse(String command, String seconds) { - return 'Late response to \"$command\" (arrived ${seconds}s after timeout)'; - } - - @override - String get repeater_cliUnmatchedResponse => - 'Unrequested response from repeater'; - - @override - String get repeater_lateResponseDiscarded => - 'A late response arrived but was not applied, because you have unsaved changes.'; - - @override - String get repeater_lateResponseReceived => - 'A late response arrived after the command timed out. See the CLI screen.'; - @override String get repeater_cliQuickGetName => 'Obter Nome'; diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart index be632971..8f42e3ca 100644 --- a/lib/l10n/app_localizations_ru.dart +++ b/lib/l10n/app_localizations_ru.dart @@ -2940,23 +2940,6 @@ class AppLocalizationsRu extends AppLocalizations { return 'Command timed out after $seconds seconds'; } - @override - String repeater_cliLateResponse(String command, String seconds) { - return 'Late response to \"$command\" (arrived ${seconds}s after timeout)'; - } - - @override - String get repeater_cliUnmatchedResponse => - 'Unrequested response from repeater'; - - @override - String get repeater_lateResponseDiscarded => - 'A late response arrived but was not applied, because you have unsaved changes.'; - - @override - String get repeater_lateResponseReceived => - 'A late response arrived after the command timed out. See the CLI screen.'; - @override String get repeater_cliQuickGetName => 'Получить имя'; diff --git a/lib/l10n/app_localizations_sk.dart b/lib/l10n/app_localizations_sk.dart index 4900c0b0..414894e4 100644 --- a/lib/l10n/app_localizations_sk.dart +++ b/lib/l10n/app_localizations_sk.dart @@ -2921,23 +2921,6 @@ class AppLocalizationsSk extends AppLocalizations { return 'Command timed out after $seconds seconds'; } - @override - String repeater_cliLateResponse(String command, String seconds) { - return 'Late response to \"$command\" (arrived ${seconds}s after timeout)'; - } - - @override - String get repeater_cliUnmatchedResponse => - 'Unrequested response from repeater'; - - @override - String get repeater_lateResponseDiscarded => - 'A late response arrived but was not applied, because you have unsaved changes.'; - - @override - String get repeater_lateResponseReceived => - 'A late response arrived after the command timed out. See the CLI screen.'; - @override String get repeater_cliQuickGetName => 'Zísť meno'; diff --git a/lib/l10n/app_localizations_sl.dart b/lib/l10n/app_localizations_sl.dart index bcc442a4..559fa3f4 100644 --- a/lib/l10n/app_localizations_sl.dart +++ b/lib/l10n/app_localizations_sl.dart @@ -2920,23 +2920,6 @@ class AppLocalizationsSl extends AppLocalizations { return 'Command timed out after $seconds seconds'; } - @override - String repeater_cliLateResponse(String command, String seconds) { - return 'Late response to \"$command\" (arrived ${seconds}s after timeout)'; - } - - @override - String get repeater_cliUnmatchedResponse => - 'Unrequested response from repeater'; - - @override - String get repeater_lateResponseDiscarded => - 'A late response arrived but was not applied, because you have unsaved changes.'; - - @override - String get repeater_lateResponseReceived => - 'A late response arrived after the command timed out. See the CLI screen.'; - @override String get repeater_cliQuickGetName => 'Pridobi ime'; diff --git a/lib/l10n/app_localizations_sv.dart b/lib/l10n/app_localizations_sv.dart index bb318db1..a0e1a3e4 100644 --- a/lib/l10n/app_localizations_sv.dart +++ b/lib/l10n/app_localizations_sv.dart @@ -2906,23 +2906,6 @@ class AppLocalizationsSv extends AppLocalizations { return 'Command timed out after $seconds seconds'; } - @override - String repeater_cliLateResponse(String command, String seconds) { - return 'Late response to \"$command\" (arrived ${seconds}s after timeout)'; - } - - @override - String get repeater_cliUnmatchedResponse => - 'Unrequested response from repeater'; - - @override - String get repeater_lateResponseDiscarded => - 'A late response arrived but was not applied, because you have unsaved changes.'; - - @override - String get repeater_lateResponseReceived => - 'A late response arrived after the command timed out. See the CLI screen.'; - @override String get repeater_cliQuickGetName => 'Hämta namn'; diff --git a/lib/l10n/app_localizations_uk.dart b/lib/l10n/app_localizations_uk.dart index 267b72ea..3b7ab782 100644 --- a/lib/l10n/app_localizations_uk.dart +++ b/lib/l10n/app_localizations_uk.dart @@ -2938,23 +2938,6 @@ class AppLocalizationsUk extends AppLocalizations { return 'Command timed out after $seconds seconds'; } - @override - String repeater_cliLateResponse(String command, String seconds) { - return 'Late response to \"$command\" (arrived ${seconds}s after timeout)'; - } - - @override - String get repeater_cliUnmatchedResponse => - 'Unrequested response from repeater'; - - @override - String get repeater_lateResponseDiscarded => - 'A late response arrived but was not applied, because you have unsaved changes.'; - - @override - String get repeater_lateResponseReceived => - 'A late response arrived after the command timed out. See the CLI screen.'; - @override String get repeater_cliQuickGetName => 'Отримати ім\'я'; diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index 6c2db174..ddfeb996 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -2774,23 +2774,6 @@ class AppLocalizationsZh extends AppLocalizations { return 'Command timed out after $seconds seconds'; } - @override - String repeater_cliLateResponse(String command, String seconds) { - return 'Late response to \"$command\" (arrived ${seconds}s after timeout)'; - } - - @override - String get repeater_cliUnmatchedResponse => - 'Unrequested response from repeater'; - - @override - String get repeater_lateResponseDiscarded => - 'A late response arrived but was not applied, because you have unsaved changes.'; - - @override - String get repeater_lateResponseReceived => - 'A late response arrived after the command timed out. See the CLI screen.'; - @override String get repeater_cliQuickGetName => '获取名称'; diff --git a/lib/screens/repeater_cli_screen.dart b/lib/screens/repeater_cli_screen.dart index 46039d5b..33e84324 100644 --- a/lib/screens/repeater_cli_screen.dart +++ b/lib/screens/repeater_cli_screen.dart @@ -52,31 +52,9 @@ class _RepeaterCliScreenState extends State { super.initState(); final connector = Provider.of(context, listen: false); _commandService = RepeaterCommandService(connector); - _commandService!.onUnmatchedResponse = _handleUnmatchedResponse; _setupMessageListener(); } - /// A reply the command future never received, because its window had already - /// closed. It is still the repeater's real answer, so it goes into the - /// history instead of being dropped (#528). - void _handleUnmatchedResponse(UnmatchedRepeaterResponse unmatched) { - if (!mounted) return; - setState(() { - _commandHistory.add({ - 'type': 'late', - 'text': unmatched.response, - 'command': unmatched.command ?? '', - 'seconds': unmatched.sinceTimeout == null - ? '' - : (unmatched.sinceTimeout!.inMilliseconds / 1000).toStringAsFixed( - 1, - ), - 'timestamp': DateTime.now().toString(), - }); - }); - _scrollToBottom(); - } - @override void dispose() { _frameSubscription?.cancel(); @@ -125,9 +103,9 @@ class _RepeaterCliScreenState extends State { if (parsed == null) return; if (!_matchesRepeaterPrefix(parsed.senderPrefix)) return; - // The service routes this either to the waiting command's future, which - // _sendCommand appends to history, or to onUnmatchedResponse when the - // window has already closed. Both paths reach the transcript (#528). + // Goes to the waiting command's future, which _sendCommand appends to the + // transcript. A reply whose window already closed is logged by the service + // to the app log and deliberately not shown here (#589). _commandService?.handleResponse(widget.repeater, parsed.text); } @@ -213,15 +191,6 @@ class _RepeaterCliScreenState extends State { _scrollToBottom(); } - String _lateResponseLabel(Map entry) { - final command = entry['command'] ?? ''; - final seconds = entry['seconds'] ?? ''; - if (command.isEmpty || seconds.isEmpty) { - return context.l10n.repeater_cliUnmatchedResponse; - } - return context.l10n.repeater_cliLateResponse(command, seconds); - } - void _scrollToBottom() { Future.delayed(const Duration(milliseconds: 100), () { if (_scrollController.hasClients) { @@ -488,25 +457,15 @@ class _RepeaterCliScreenState extends State { itemBuilder: (context, index) { final entry = _commandHistory[index]; final isCommand = entry['type'] == 'command'; - final isLate = entry['type'] == 'late'; final scheme = Theme.of(context).colorScheme; - final Color badgeColor; - final Color badgeIconColor; - final IconData badgeIcon; - if (isCommand) { - badgeColor = scheme.primaryContainer; - badgeIconColor = scheme.onPrimaryContainer; - badgeIcon = Icons.chevron_right; - } else if (isLate) { - badgeColor = scheme.tertiaryContainer; - badgeIconColor = scheme.onTertiaryContainer; - badgeIcon = Icons.history; - } else { - badgeColor = scheme.secondaryContainer; - badgeIconColor = scheme.onSecondaryContainer; - badgeIcon = Icons.arrow_back; - } + final badgeColor = isCommand + ? scheme.primaryContainer + : scheme.secondaryContainer; + final badgeIconColor = isCommand + ? scheme.onPrimaryContainer + : scheme.onSecondaryContainer; + final badgeIcon = isCommand ? Icons.chevron_right : Icons.arrow_back; return Padding( padding: const EdgeInsets.only(bottom: 12), @@ -526,18 +485,6 @@ class _RepeaterCliScreenState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (isLate) - Padding( - padding: const EdgeInsets.only(bottom: 2), - child: Text( - _lateResponseLabel(entry), - style: TextStyle( - fontSize: 11, - fontStyle: FontStyle.italic, - color: scheme.tertiary, - ), - ), - ), SelectableText( entry['text']!, style: TextStyle( diff --git a/lib/screens/repeater_settings_screen.dart b/lib/screens/repeater_settings_screen.dart index 4e675103..8e5c8922 100644 --- a/lib/screens/repeater_settings_screen.dart +++ b/lib/screens/repeater_settings_screen.dart @@ -183,34 +183,10 @@ class _RepeaterSettingsScreenState extends State { super.initState(); final connector = Provider.of(context, listen: false); _commandService = RepeaterCommandService(connector); - _commandService!.onUnmatchedResponse = _handleUnmatchedResponse; _setupMessageListener(); _loadSettings(); } - /// A repeater reply whose command had already timed out. This screen has no - /// transcript to append it to, so it is applied like any other response and - /// the user is told it arrived late rather than the reply being dropped - /// (#528). - void _handleUnmatchedResponse(UnmatchedRepeaterResponse unmatched) { - if (!mounted) return; - // A late reply is stale by definition. Applying it over edits the user - // made while waiting would silently discard their input, so it only lands - // when nothing is unsaved (Gemini review). - final applied = - !_hasChanges && - unmatched.command != null && - _handleGetResponse(unmatched.command!, unmatched.response); - showDismissibleSnackBar( - context, - content: Text( - applied - ? context.l10n.repeater_lateResponseReceived - : context.l10n.repeater_lateResponseDiscarded, - ), - ); - } - @override void dispose() { _frameSubscription?.cancel(); diff --git a/lib/services/repeater_command_service.dart b/lib/services/repeater_command_service.dart index e133d5e9..12d4cad4 100644 --- a/lib/services/repeater_command_service.dart +++ b/lib/services/repeater_command_service.dart @@ -77,9 +77,16 @@ class RepeaterCommandService { /// its window can still be presented with the request it answers. static const Duration lateReplyRetention = Duration(minutes: 2); - /// Invoked when a reply cannot be handed to a waiting command. Consumers - /// must surface this to the user: the reply is a real answer from the - /// repeater and dropping it silently loses it for good (#528). + /// Invoked when a reply cannot be handed to a waiting command. + /// + /// Every such reply is already written to the app log by + /// [_surfaceUnmatchedResponse], which is the diagnostics channel and is what + /// keeps this from being a silent drop (#528). + /// + /// This sink exists for tests and for any future diagnostics view. **No + /// screen wires it.** Late arrivals became ordinary noise once #529 widened + /// the window, and the owner asked for them off the UI: log them, do not put + /// them in front of users (#589). void Function(UnmatchedRepeaterResponse)? onUnmatchedResponse; RepeaterCommandService(this._connector); @@ -245,13 +252,14 @@ class RepeaterCommandService { if (expired != null) { appLogger.warn( 'Late reply to "${expired.command}" from $repeaterKey arrived ' - '${sinceTimeout!.inMilliseconds}ms after its window closed', + '${sinceTimeout!.inMilliseconds}ms after its window closed: ' + '$responsePayload', tag: 'RepeaterCommand', ); } else { appLogger.warn( 'Reply from $repeaterKey matched no pending or recently expired ' - 'command (prefix: ${prefix ?? 'none'})', + 'command (prefix: ${prefix ?? 'none'}): $responsePayload', tag: 'RepeaterCommand', ); }