Improve file diff display in GitHub PR comments#12918
Conversation
… diffs Show added files at the top of the files changed table with a separator row between added and non-added files. Auto-expand the details view when there are added files and fewer than 5 total files, since those are the most relevant to review. https://claude.ai/code/session_01537nbMDhPg49b2qpqEjftP
Simplify the summary line: drop verbose "Show files changed (N in total):" prefix, hide zero-count categories, reorder counts to match table order (added first), and use middot separators for a cleaner look. https://claude.ai/code/session_01537nbMDhPg49b2qpqEjftP
Switch from markdown table to HTML <table> inside the <details> element, removing the visual gap between the summary and table content. Separate added, modified, and deleted files into distinct groups with empty row separators between each. https://claude.ai/code/session_01537nbMDhPg49b2qpqEjftP
Replace the repeated status column on every file row with section headings (➕ Added, 📝 Modified, ➖ Deleted) that group files by change type, similar to the optgroup pattern used in the addons file diff selector. Files are indented under their group heading for visual hierarchy. https://claude.ai/code/session_01537nbMDhPg49b2qpqEjftP
Replace the HTML table with a more natural display pattern: - Single added file shown inline (no list wrapper needed) - Multiple files use <ul> lists (not tabular data) - When < 5 added files: auto-expand and show them prominently, collapse modified/deleted into nested <details> sections - Group headings on the nested details summaries replace the redundant per-file status labels - Remove unused non_added property - Change should_auto_expand to key off added count, not total https://claude.ai/code/session_01537nbMDhPg49b2qpqEjftP
Remove nested <details> complexity in favor of a simple flat layout: - < 5 total files → auto-expand (open), regardless of change type - Single file in a group → inline with emoji prefix (➕ path) - Multiple files in a group → bold heading + <ul> list - Groups always ordered: added, modified, deleted - No nested collapsing, no conditional nesting logic https://claude.ai/code/session_01537nbMDhPg49b2qpqEjftP
Switch from HTML elements to native markdown inside <details>: - Code-formatted paths with backticks for visual distinction - Consistent section headings (➕ Added, 📝 Modified, ➖ Deleted) - Native markdown bullet lists instead of <ul>/<li>/<table> - Simpler template with no conditional nesting or single-file special cases — every group gets a heading + list https://claude.ai/code/session_01537nbMDhPg49b2qpqEjftP
Large diffs (e.g. 50 modified files) now show the first 10 files per group with "and N more..." at the end, keeping the comment scannable. Uses Django's slice filter — no Python changes needed. https://claude.ai/code/session_01537nbMDhPg49b2qpqEjftP
Simple layout (< 5 files, auto-expanded): no headings, no breakdown in summary — just emoji + code-formatted path per file. Clean and compact. Complex layout (>= 5 files, collapsed): full summary breakdown, grouped sections with bold headings, bullet lists capped at 10 per group with "and N more..." overflow. https://claude.ai/code/session_01537nbMDhPg49b2qpqEjftP
Bare lines with blank lines between them render as separate <p> tags in GitHub. Switch to a markdown list (- ➕ path) so items stay tight in a single <ul>. https://claude.ai/code/session_01537nbMDhPg49b2qpqEjftP
Drop the bullet markers — they're redundant alongside the emoji. Use HTML <br> line breaks with <code> paths instead, giving a clean display without bullets or <p> wrappers. https://claude.ai/code/session_01537nbMDhPg49b2qpqEjftP
Replace emoji (➕, 📝, ➖) with code-formatted text symbols for consistent visual weight. Uses <code> tags in HTML contexts and backtick spans in markdown contexts. The ± symbol for modified matches the convention already used in the addons file diff selector. https://claude.ai/code/session_01537nbMDhPg49b2qpqEjftP
humitos
left a comment
There was a problem hiding this comment.
Looks good. I'd like to use icons instead of code text since they render better and are easier to scan quickly.
| <details open> | ||
| <summary>{{ diff.files|length }} files changed</summary> | ||
| <br> | ||
| {% for file in diff.added %}<code>+</code> <a href="{{ file.url }}"><code>{{ file.path }}</code></a><br> |
There was a problem hiding this comment.
Is there a reason why you removed the icons we had? I personally can't distinguish the -, ± and +. They are rendered pretty small and look very similar.
There was a problem hiding this comment.
The current icons match the Addons approach
That's a good point, actually.
However, when looking at that in addons I don't really look at the icons since they are split in sections which is a lot more relevant.
My main problem with the -, + and ± is when there is no section separator, like in the compact form of the comment (less than 5 files). It's probably irrelevant, tho.
This one works fine:
This one is confusing to me; they all look the same:
There was a problem hiding this comment.
Yea the AI tried color bubbles but they were pretty visually loud. 🔴🟢
I think if we were investing in this, we would do some images or custom art... I don't think it would really be hard to do it. We're just trying to keep things pretty constrained with the current approach.
There was a problem hiding this comment.
I'm happy to move forward here. We can always come back and change the icons. That shouldn't block the PR.
Replace code-styled text symbols with colored circle emoji that are all the same shape/size for consistent visual weight and easy scanning. Green=added, yellow=modified, red=deleted — matching common diff color conventions. Also adds <br> after summary in complex layout per review feedback. https://claude.ai/code/session_01537nbMDhPg49b2qpqEjftP
Go back to ➕ and ➖ for added/deleted, use ± for modified to match the addons file diff selector convention. Simpler than colored circles and consistent with the existing UI. https://claude.ai/code/session_01537nbMDhPg49b2qpqEjftP

Summary
Redesigns the file diff section of the build overview comment posted on pull requests. Added files are now sorted first, the display adapts based on the number of changes, and large lists are capped to keep comments scannable.
+,±,-) matching the addons convention<details>for small diffsOutput examples
Simple layout (< 5 files total — auto-expanded)
Clean lines with code-styled status symbols and paths. No bullets, no headings:
3 files changed
+conf/portland/2026/news/one-month-out/index.html±blog/index.html-legacy/old-page.htmlSimple layout — only added files
2 files changed
+guides/new-tutorial.html+guides/new-tutorial/setup.htmlComplex layout (>= 5 files — collapsed)
Grouped by status with bold headings, bullet lists, and a full breakdown in the summary:
8 files changed ·
+1 added ·±6 modified ·-1 deleted+Addedconf/portland/2026/news/one-month-out/index.html±Modifiedblog/index.htmlblog/newsletter-signup/index.htmlconf/portland/2026/index.htmlapi/v3.htmlguides/custom-domains.htmltutorial/index.html-Deletedlegacy/old-page.htmlComplex layout with truncation (large diff)
Groups are capped at 10 files each:
27 files changed ·
+2 added ·±25 modified+Addedguides/new-feature.htmlguides/new-feature/setup.html±Modifiedbuild-customization.htmldownloadable-documentation.htmlgenindex.htmlsupport.htmltraffic-analytics.htmluser-defined-redirects.htmlabout/index.htmlapi/index.htmlapi/v2.htmlapi/v3.htmlTest plan
TestPostBuildOverviewtestshttps://claude.ai/code/session_01537nbMDhPg49b2qpqEjftP