Skip to content

Report emitted line count in truncated patch previews - #58408

Merged
pelikhan merged 2 commits into
mainfrom
copilot/fix-generate-patch-preview-line-count
Sep 4, 2026
Merged

Report emitted line count in truncated patch previews#58408
pelikhan merged 2 commits into
mainfrom
copilot/fix-generate-patch-preview-line-count

Conversation

Copilot AI commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

generatePatchPreview() reported the pre-truncation line count when the 2,000-character cap shortened a patch, producing misleading summaries such as “435 of 435 lines.”

  • Preview summary

    • Derive the shown-line count from the final emitted preview after both truncation limits.
    const shownLines = preview.split("\n").length;
  • Regression coverage

    • Verify character-truncated previews report their actual line count.
    • Keep line-cap coverage isolated from the character cap.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix line count reporting in generatePatchPreview Report emitted line count in truncated patch previews Sep 4, 2026
Copilot AI requested a review from pelikhan September 4, 2026 06:44
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Category: bug | Risk: low | Score: 40 (impact 22 + urgency 10 + quality 8) | Action: defer | Batch: none

Generated by 🔧 PR Triage Agent · copilot · mai10 · 22.2 AIC · ⌖ 2.85 AIC · ⊞ 15.1K ·

1 similar comment
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Category: bug | Risk: low | Score: 40 (impact 22 + urgency 10 + quality 8) | Action: defer | Batch: none

Generated by 🔧 PR Triage Agent · copilot · mai10 · 22.2 AIC · ⌖ 2.85 AIC · ⊞ 15.1K ·

@pelikhan
pelikhan marked this pull request as ready for review September 4, 2026 13:36
Copilot AI balanced review requested due to automatic review settings September 4, 2026 13:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The fix and regression coverage are complete with no unresolved issues.

Pull request overview

Corrects truncated patch previews to report the number of lines actually emitted.

Changes:

  • Counts lines after applying both truncation limits.
  • Adds regression coverage for character and line truncation.
File summaries
File Description
actions/setup/js/create_pull_request_helpers.test.cjs Tests both truncation paths independently.
actions/setup/js/create_pull_request_helpers.cjs Reports the final preview line count.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@pelikhan
pelikhan merged commit 0a2901e into main Sep 4, 2026
14 checks passed
@pelikhan
pelikhan deleted the copilot/fix-generate-patch-preview-line-count branch September 4, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

generatePatchPreview() reports the pre-truncation line count when only the 2000-character cap trips

3 participants