Skip to content

Truncate or omit step summary when approaching GitHub's 1 MiB limit#68

Merged
Tyrrrz merged 15 commits intoprimefrom
copilot/improve-ux-large-step-summaries
Mar 28, 2026
Merged

Truncate or omit step summary when approaching GitHub's 1 MiB limit#68
Tyrrrz merged 15 commits intoprimefrom
copilot/improve-ux-large-step-summaries

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 27, 2026

  • Add size-checking and truncation logic in CreateSummaryAsync
  • Extract file path via cast: summaryWriter as StreamWriterBaseStreamContentionTolerantWriteFileStream.FilePath or FileStream.Name
  • Add FilePath auto-property to ContentionTolerantWriteFileStream
  • Add FileExtensions.WriteAllZeroes extension (C# 14) without buffer allocation
  • Inline BuildSummaryTruncatedWarning and BuildSummaryOmittedWarning at call sites
  • Rename truncation tests to reviewer-requested format
  • Add File.ReadAllBytes(path, int offset) extension method using stream seeking
  • Create TempFile utility class; use it in truncation tests instead of try/finally
  • Update StreamWriter comment in tests to "so that the file path is exposed internally"
  • Add MTP truncation tests
  • Add GitHubAnnotationKind enum in its own file (GitHubAnnotationKind.cs)
  • Use string.IsNullOrWhiteSpace checks
  • Rename availableBytesavailableSize
  • Convert CreateErrorAnnotationAsync and CreateWarningAnnotationAsync to async arrow methods
  • Use kind.ToString().ToLowerInvariant() instead of switch expression
  • Simplify TryTruncateSummary → inlined truncation at UTF-8 byte boundary in CreateSummaryAsync
  • Move SummaryFileSizeLimit constant to GitHubEnvironment
  • Move CreateAnnotationAsync above the methods that call it
  • Fix inner FileStream disposal in MTP and VsTest truncation tests
  • Use .ContainAll() for multi-string assertions in truncation tests
  • Add blank line before await summaryWriter.FlushAsync() in MTP tests
  • Use File.Open(...) instead of new FileStream(...) in all four truncation tests
  • Use generic wording in truncation/omission warning messages (no more VSTest-specific parameter names)
  • Use Math.Min for available-size clamping instead of ternary
  • Fix File.ReadAllBytes extension to use FileShare.ReadWrite (prevents Windows file locking error when the summary file is still held open by the writer)
  • All 39 tests pass
Original prompt

Hi. Create a PR that would improve UX when producing very large step summaries and hitting the 1mb github limit.

#67 (comment)

Suggestion: watch the size of the step summary file (identified by an env var). When we get close to the limit, truncate the summary. The truncated summary should still be legible. If it can't be legible, don't write it at all. Report a step warning that the summary didn't fit and suggest either excluding passed/skipped tests (if enabled) or splitting the test step into sub-steps (if multiple summaries are written to the same file: can validate by checking if it's not empty before we write to it).

Create PR.


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

@Tyrrrz Tyrrrz added the bug Something isn't working label Mar 27, 2026
Copilot AI changed the title [WIP] Improve user experience for large step summaries Truncate or omit step summary when approaching GitHub's 1 MiB limit Mar 27, 2026
Copilot AI requested a review from Tyrrrz March 27, 2026 17:16
Copy link
Copy Markdown
Owner

@Tyrrrz Tyrrrz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot AI requested a review from Tyrrrz March 27, 2026 17:36
Copy link
Copy Markdown
Owner

@Tyrrrz Tyrrrz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot AI requested a review from Tyrrrz March 27, 2026 19:01
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 28, 2026

Codecov Report

❌ Patch coverage is 83.07692% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.42%. Comparing base (d79a0a0) to head (0855cae).
⚠️ Report is 1 commits behind head on prime.

Files with missing lines Patch % Lines
GitHubActionsTestLogger/GitHub/GitHubWorkflow.cs 84.12% 4 Missing and 6 partials ⚠️
...tLogger/Utils/ContentionTolerantWriteFileStream.cs 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            prime      #68      +/-   ##
==========================================
- Coverage   84.44%   84.42%   -0.03%     
==========================================
  Files          23       23              
  Lines         733      796      +63     
  Branches       86       97      +11     
==========================================
+ Hits          619      672      +53     
- Misses         60       64       +4     
- Partials       54       60       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Owner

@Tyrrrz Tyrrrz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

…onKind, simplify TryTruncateSummary, MTP tests

Agent-Logs-Url: https://github.com/Tyrrrz/GitHubActionsTestLogger/sessions/5e671f3d-6979-487c-8f65-bc095c213334

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
This was referenced Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants