Skip to content

[APIView] Fix excess whitespace in Copilot-generated comments (#15421)#15528

Open
helen229 wants to merge 2 commits intomainfrom
fix/15421-copilot-comment-whitespace
Open

[APIView] Fix excess whitespace in Copilot-generated comments (#15421)#15528
helen229 wants to merge 2 commits intomainfrom
fix/15421-copilot-comment-whitespace

Conversation

@helen229
Copy link
Copy Markdown
Member

@helen229 helen229 commented May 6, 2026

Fixes #15421

Problem

When CopilotJobProcessor converts AVC (APIView Copilot) job results into CommentItemModel rows, it builds the comment markdown with three consecutive AppendLine calls between sections and an extra AppendLine() before each guideline URL. The persisted comment text looks like:

Optional operation-specific parameters should be keyword-only.\r\n\r\n\r\n
Guidelines\r\n\r\n
https://...\r\n\r\n
https://...\r\n

In the rendered comment card that produces two blank lines between the body and the Guidelines heading, and a blank line between every guideline link, making the card unnecessarily tall and sparse.

Fix

In src/dotnet/APIView/APIViewWeb/HostedServices/CopilotJobProcessor.cs the comment text builder now:

  • Uses a single blank line (one AppendLine()) as the paragraph separator before the Suggestion and **Guidelines** sections.
  • Renders guideline links as a markdown bullet list (- https://…) so consecutive links are rendered compactly with no blank line between items.

No behavior changes outside of the rendered comment text.

Why existing comments on staging/prod won't visibly change

The fix runs at write time — it only affects the markdown that is persisted to Cosmos when a Copilot job result is converted into a CommentItemModel. Comments that were generated before this change (including the one shown in the issue) are already stored in the DB with the old whitespace and are rendered verbatim, so they will continue to look the same.

To verify the fix you have to look at a newly generated AI comment — i.e. trigger a fresh Copilot review on a revision after this change is deployed. If we want to clean up the historical comments as well, that has to be done as a separate one-off DB rewrite (out of scope for this PR / issue).

…ments

The conversion from AVC results to APIView CommentItemModel emitted three CRLFs (two blank lines) between the comment body and the Suggestion / Guidelines sections, and an extra blank line between each guideline link. In rendered markdown that produced large gaps inside the comment card.

Use a single blank line as a paragraph separator and render guideline links as a markdown bullet list so they render compactly without blank lines between items.
Copilot AI review requested due to automatic review settings May 6, 2026 19:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refines how APIView Copilot job results are converted into persisted CommentItemModel.CommentText markdown, reducing excess blank lines and rendering guideline links more compactly in the UI.

Changes:

  • Removed extra paragraph separators when composing Copilot-generated comment text.
  • Rendered guideline links as a Markdown bullet list to avoid blank lines between consecutive links.

Comment thread src/dotnet/APIView/APIViewWeb/HostedServices/CopilotJobProcessor.cs Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Member

@tjprescott tjprescott left a comment

Choose a reason for hiding this comment

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

Please provide a screenshot of a new comment with multiple guidelines cited so we can see what it looks like.

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.

[APIView] Too much whitespace in copilot comments

3 participants