Skip to content

fix(pr-comments): make the review sidebar legible for structured bot markdown - #9209

Merged
nwparker merged 2 commits into
stablyai:mainfrom
tmchow:tmchow/pr-comments-sidebar-legibility
Jul 17, 2026
Merged

nwparker merged 2 commits into
stablyai:mainfrom
tmchow:tmchow/pr-comments-sidebar-legibility

Conversation

@tmchow

@tmchow tmchow commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Bot reviewers post long structured Markdown, but the review sidebar rendered compact paragraph and heading spans as a nearly undifferentiated inline wall. This restores scan-friendly hierarchy without changing the shared compact renderer's layout on its other consumers.

  • Restores block flow and spacing for top-level and nested Markdown paragraphs.
  • Uses the established 13px body and 18/16/15px heading scale.
  • Promotes bold-plus-linebreak bot section labels while avoiding extra top margin on the first label.
  • Raises code, preformatted text, tables, subscript, and superscript content out of illegible compact sizes.
  • Preserves heading navigation semantics with role="heading" and aria-level while retaining span flow on other compact surfaces.

Screenshots

Original typography comparison (the remote badges visible in this exploratory capture are not loaded by the final patch):

Orca 2026-07-17 10 17 37 CleanShot 2026-07-17 at 10 14 42@2x

Testing

  • Full Vitest suite: 2,969 files passed, 7 skipped; 31,496 tests passed, 53 skipped
  • Focused renderer/presentation tests: 28 passed
  • pnpm typecheck
  • Changed-file oxlint and React Doctor
  • Electron/Vite production build
  • Styled-scrollbar, reliability, and max-lines gates
  • Tailwind production compilation of the descendant and :has() selectors

AI Review Report

Four adversarial review passes covered UI/design-system behavior, accessibility, Markdown renderer/security boundaries, regression risk, and test adequacy. Findings fixed during review:

  1. Removed the proposed unconditional remote-image opt-in, which would have let arbitrary PR comments trigger public, loopback, or LAN requests.
  2. Removed the associated unbounded-image/private-attachment regressions and srcSet validation bypass by retaining the existing click-to-open remote-image guard.
  3. Added semantic heading roles/levels.
  4. Added spacing for adjacent paragraphs nested in disclosures/raw containers.
  5. Removed excess top margin when a promoted bot label is the first comment content.

The final review pass was clean from all three independent reviewers.

Security Audit

Remote compact images remain links and are not fetched automatically. Only the existing trusted blob: and constrained base64 image sources render inline, so this PR does not widen the renderer's network or sanitization trust boundary.

Notes

The full pnpm lint command reaches two failures that are already present unchanged on current main: switch-exhaustiveness errors in unrelated native-chat/skills files and an append-only bundled-skill snapshot failure. The PR's changed files and all applicable scoped gates are clean.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Compact Markdown headings now use level-specific classes and accessible heading attributes. Comment body typography changes to 13px with relaxed leading, while Markdown presentation rules cover block spacing, heading sizes, code, tables, subscript/superscript sizing, image alignment, and bold line-break labels. Tests were expanded for these styles and for paragraph rendering inside disclosure elements.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly matches the main change: improving PR comment sidebar readability for structured bot markdown.
Description check ✅ Passed The description is mostly complete and includes all required sections with detailed Summary, Screenshots, Testing, Review, Security, and Notes.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@AmethystLiang

Copy link
Copy Markdown
Contributor

reviewing now!

@nwparker
nwparker self-requested a review July 17, 2026 23:20
tmchow and others added 2 commits July 17, 2026 16:31
…markdown

The compact renderer emits <span> for paragraphs and headings, so markdown
blocks welded into one inline run and a dead `[&_p]` selector spaced nothing.
Bot reviewers (Cursor, Codex, CodeRabbit) now post long structured markdown
with heading trees, tables, badges, and severity labels that this panel
rendered as an undifferentiated 10-13px wall.

Scoped to the PR sidebar via descendant selectors on the body wrapper (the
compact renderer is shared by ~20 surfaces, so it stays untouched):

- Block flow keyed off every top-level block, so a <details>/<div> between
  paragraphs no longer collapses the tail spacing to zero.
- Type scale matching the document variant already used on the PR page: 13px
  body, 18/16/15 headings, and bold-then-linebreak section labels promoted to
  15px block titles (the shape bots actually use instead of `##` headings).
- Code/pre/tables lifted off 10px; nested sub/sup no longer compound to 7px.
- Remote images render behind a new opt-in `allowRemoteImages` prop (default
  off preserves the privacy guard on the other 20 surfaces), honoring the
  width/height the markup declares, staying inline, and keeping <picture>
  art-direction intact so badges match GitHub instead of ballooning to @3x.
@nwparker
nwparker force-pushed the tmchow/pr-comments-sidebar-legibility branch from fe2b0c3 to d6161e9 Compare July 17, 2026 23:37
@nwparker
nwparker merged commit 613dcd8 into stablyai:main Jul 17, 2026

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a73395be-a866-44ca-9742-b1feda31f05e

📥 Commits

Reviewing files that changed from the base of the PR and between fe2b0c3852a904622ee31d3eecc83db975344e3f and d6161e9.

📒 Files selected for processing (4)
  • src/renderer/src/components/right-sidebar/pr-comment-presentation.test.ts
  • src/renderer/src/components/right-sidebar/pr-comment-presentation.ts
  • src/renderer/src/components/sidebar/CommentMarkdown.test.tsx
  • src/renderer/src/components/sidebar/comment-markdown-element-renderers.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/renderer/src/components/right-sidebar/pr-comment-presentation.ts
  • src/renderer/src/components/right-sidebar/pr-comment-presentation.test.ts

Comment on lines +117 to +129
h4: ({ children }) => (
<span className="comment-md-h font-semibold" role="heading" aria-level={4}>
{children}
</span>
),
h5: ({ children }) => (
<span className="comment-md-h font-semibold" role="heading" aria-level={5}>
{children}
</span>
),
h6: ({ children }) => (
<span className="comment-md-h font-semibold" role="heading" aria-level={6}>
{children}

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Add level-specific classes for h4–h6.

These renderers omit comment-md-h4, comment-md-h5, and comment-md-h6, so the corresponding heading levels cannot receive distinct presentation styles. Add the level-specific classes and cover at least one of these levels in tests.

Proposed fix
-      <span className="comment-md-h font-semibold" role="heading" aria-level={4}>
+      <span className="comment-md-h comment-md-h4 font-semibold" role="heading" aria-level={4}>
...
-      <span className="comment-md-h font-semibold" role="heading" aria-level={5}>
+      <span className="comment-md-h comment-md-h5 font-semibold" role="heading" aria-level={5}>
...
-      <span className="comment-md-h font-semibold" role="heading" aria-level={6}>
+      <span className="comment-md-h comment-md-h6 font-semibold" role="heading" aria-level={6}>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
h4: ({ children }) => (
<span className="comment-md-h font-semibold" role="heading" aria-level={4}>
{children}
</span>
),
h5: ({ children }) => (
<span className="comment-md-h font-semibold" role="heading" aria-level={5}>
{children}
</span>
),
h6: ({ children }) => (
<span className="comment-md-h font-semibold" role="heading" aria-level={6}>
{children}
h4: ({ children }) => (
<span className="comment-md-h comment-md-h4 font-semibold" role="heading" aria-level={4}>
{children}
</span>
),
h5: ({ children }) => (
<span className="comment-md-h comment-md-h5 font-semibold" role="heading" aria-level={5}>
{children}
</span>
),
h6: ({ children }) => (
<span className="comment-md-h comment-md-h6 font-semibold" role="heading" aria-level={6}>
{children}
</span>
),

enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…markdown (stablyai#9209)

Restore readable block flow, typography, nested spacing, and heading semantics for structured review Markdown in the PR sidebar. Preserve the compact renderer's existing remote-image trust boundary.
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.

3 participants