From 27a6e901a3942e52e696f9746a8b5e62151946d6 Mon Sep 17 00:00:00 2001 From: YuYu1015 Date: Tue, 18 Aug 2026 17:20:08 +0800 Subject: [PATCH] feat(log): widen the dump budget to fit a debug session MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New(zh-Hant): 診斷回報上限放寬,可附上更完整的日誌 New(en-US): the diagnostics report now carries a much longer log tail --- lib/core/diagnostics/debug_dump.dart | 2 +- lib/core/diagnostics/haste_api.dart | 5 +++-- lib/shared/diagnostics/dump_action.dart | 5 +++-- test/core/diagnostics/debug_dump_test.dart | 5 +++-- test/core/logging/log_benign_assert_test.dart | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/core/diagnostics/debug_dump.dart b/lib/core/diagnostics/debug_dump.dart index 06f547980..a6b9fedd2 100644 --- a/lib/core/diagnostics/debug_dump.dart +++ b/lib/core/diagnostics/debug_dump.dart @@ -7,7 +7,7 @@ library; /// a chat window will show without collapsing. The diagnostics are the part /// that cannot be trimmed (every row answers a question somebody asks), so the /// log takes whatever is left. -const int dumpLimit = 4000; +const int dumpLimit = 39995; const String _diagnosticsHeading = '=== 除錯資訊 ==='; const String _logHeading = '=== 日誌紀錄 ==='; diff --git a/lib/core/diagnostics/haste_api.dart b/lib/core/diagnostics/haste_api.dart index 278547372..499202f88 100644 --- a/lib/core/diagnostics/haste_api.dart +++ b/lib/core/diagnostics/haste_api.dart @@ -7,8 +7,9 @@ import 'package:dpip/core/diagnostics/dump_uploader.dart'; /// Posts a dump and returns the URL to read it at. /// /// A paste rather than an attachment because of where these end up: a bug -/// report in Discord or an issue, where 4000 characters of log pasted inline -/// buries everything around it and an attached file is not read at all. +/// report in Discord or an issue, where tens of thousands of characters of log +/// pasted inline buries everything around it and an attached file is not read +/// at all. class HasteApi implements DumpUploader { const HasteApi(this._client); diff --git a/lib/shared/diagnostics/dump_action.dart b/lib/shared/diagnostics/dump_action.dart index 0fb0eaee1..ffa99d323 100644 --- a/lib/shared/diagnostics/dump_action.dart +++ b/lib/shared/diagnostics/dump_action.dart @@ -22,8 +22,9 @@ import 'package:talker_flutter/talker_flutter.dart'; /// /// The two halves answer different questions and a report needs both: the /// diagnostics say what this build and this device are, the log says what they -/// just did. Pasting 4000 characters into a chat buries the conversation they -/// are part of, so they go to a paste and only the link comes back. +/// just did. Pasting tens of thousands of characters into a chat buries the +/// conversation they are part of, so they go to a paste and only the link +/// comes back. /// /// Returns true when a link was produced. Failures are reported to the user /// here and logged; the caller only has to stop showing its spinner. diff --git a/test/core/diagnostics/debug_dump_test.dart b/test/core/diagnostics/debug_dump_test.dart index 7d2bad71b..d94354c59 100644 --- a/test/core/diagnostics/debug_dump_test.dart +++ b/test/core/diagnostics/debug_dump_test.dart @@ -54,10 +54,11 @@ void main() { test('diagnostics are never cut to make room', () { // A partial diagnostic reads as a complete one and is answered as if it // were, which is worse than carrying no log at all. - final big = 'Version: 26w34b\n${'x' * 5000}'; + // Sized past the limit so the log must be dropped for the diagnostics to fit. + final big = 'Version: 26w34b\n${'x' * (dumpLimit + 1000)}'; final out = buildDump(diagnostics: big, logLines: lines(50)); expect(out, contains('Version: 26w34b')); - expect(out, contains('x' * 5000)); + expect(out, contains('x' * (dumpLimit + 1000))); expect(out, isNot(contains('line 0'))); }); diff --git a/test/core/logging/log_benign_assert_test.dart b/test/core/logging/log_benign_assert_test.dart index 5f6a2478c..0c61464d6 100644 --- a/test/core/logging/log_benign_assert_test.dart +++ b/test/core/logging/log_benign_assert_test.dart @@ -2,7 +2,7 @@ /// into the log that sheet belongs to — a debug assert from talker_flutter, /// which paints that sheet as a coloured box with bare `ListTile`s inside it. /// Nothing this app can fix, and nothing a user is affected by, but it filled -/// the terminal, the log page and the 4000-character dump budget. +/// the terminal, the log page and the dump budget. /// /// The tests here pin the two halves of the compromise: it is said once, so it /// is on the record, and it is said only once, so it cannot flood. A real error