Skip to content

Keep the newest log entries when trimming an oversized diagnostic report - #47

Open
ps2 wants to merge 2 commits into
next-devfrom
fix/report-keep-newest-log
Open

ps2 wants to merge 2 commits into
next-devfrom
fix/report-keep-newest-log

Conversation

@ps2

@ps2 ps2 commented Nov 10, 2026 •

Copy link
Copy Markdown

Send to the Loop Developers caps the diagnostic report at the server's 10 MB per-file limit by keeping its first bytes. The device log is in the middle of the report, oldest entries first, so a busy log (Tandem history streaming plus G7, for example) pushed out the most recent entries along with every section after the log: watch, status extension, loop data, the glucose/carb/dose stores and notifications. A report about something that just happened ended days earlier.

When the report is over the limit, it now keeps the first 1 MB (build details and device state) and fills the rest from the end of the report, with a [… older entries removed to fit the size limit …] marker between. Both cuts fall on line breaks, so the text stays valid UTF-8. Reports under the limit are unchanged. Share a Diagnostic Report is unaffected; it has no cap.

The diagnostic report's cap is also raised from 10 MB to 20 MB, matching the ingest server's new per-file limit (ps2/loop-analytics b78e6f9, now deployed). Screenshots stay at 10 MB.

Testing

  • LoopWorkspace scheme builds for iOS Simulator.
  • LoopSupport has no test target, so I compiled fitted(_:toBytes:headBytes:) standalone: short input passes through unchanged; multi-byte input over the limit keeps its head and newest lines and stays valid UTF-8; a 15 MB input comes out at 9,999,972 bytes, keeping both its first and last sections, in 9 ms.

dev has the same code; I can open a matching PR there if wanted.

ps2 added 2 commits November 10, 2026 14:08
The report was cut to the server's 10 MB limit by keeping its first bytes, which
dropped the most recent device log entries and every section after the log. Keep
the first 1 MB (build details and device state) and fill the rest from the end,
cutting at line breaks.
The issue server now accepts attachments up to 20 MiB. Screenshots keep the 10 MB limit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant