Skip to content

OU-1465: feat: parse descriptions as markdown#119

Open
jgbernalp wants to merge 1 commit into
openshift:mainfrom
jgbernalp:parse-markdown-in-rca-description
Open

OU-1465: feat: parse descriptions as markdown#119
jgbernalp wants to merge 1 commit into
openshift:mainfrom
jgbernalp:parse-markdown-in-rca-description

Conversation

@jgbernalp

Copy link
Copy Markdown
Contributor

This PR parses the descriptions as markdown text, sanitizing them with dompurify.

Screenshot 2026-07-13 at 15 04 23

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 13, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 13, 2026

Copy link
Copy Markdown

@jgbernalp: This pull request references OU-1465 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

This PR parses the descriptions as markdown text, sanitizing them with dompurify.

Screenshot 2026-07-13 at 15 04 23

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot requested review from harche and xrajesh July 13, 2026 13:05
@openshift-ci

openshift-ci Bot commented Jul 13, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign raptorsun for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@jgbernalp, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 7e3e2b02-d0e4-4dbc-9545-daf476399432

📥 Commits

Reviewing files that changed from the base of the PR and between 1476db1 and 488cdeb.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json, !**/package-lock.json
📒 Files selected for processing (12)
  • .ai/spec/how/project-structure.md
  • package.json
  • src/components/runs/RunDetailPage.tsx
  • src/components/runs/RunListPage.tsx
  • src/components/runs/detail/AnalysisSummary.tsx
  • src/components/runs/detail/ExecutionSummary.tsx
  • src/components/runs/detail/RemediationOptionCard.tsx
  • src/components/runs/detail/VerificationSummary.tsx
  • src/global.d.ts
  • src/models/agenticrun.ts
  • src/utils/approval.test.ts
  • src/utils/markdown.ts
📝 Walkthrough

Walkthrough

Changes

Markdown Rendering Integration

Layer / File(s) Summary
Markdown utility and sanitization
package.json, src/utils/markdown.ts, src/global.d.ts, .ai/spec/how/project-structure.md
Adds synchronous block and inline Markdown parsing, DOMPurify sanitization, hardened links, dependencies, browser typing, and module documentation.
Run detail Markdown output
src/components/runs/detail/*Summary.tsx, src/components/runs/detail/RemediationOptionCard.tsx
Run analysis, execution, remediation, and verification fields now render sanitized Markdown HTML.
Formatting maintenance
src/components/runs/RunDetailPage.tsx, src/components/runs/RunListPage.tsx, src/models/agenticrun.ts, src/utils/approval.test.ts
Applies whitespace and formatting-only changes without altering behavior.

Sequence Diagram(s)

sequenceDiagram
  participant RunDetailComponents
  participant markdown.ts
  participant marked
  participant DOMPurify
  RunDetailComponents->>markdown.ts: Pass Markdown text
  markdown.ts->>marked: Parse block or inline Markdown
  marked-->>markdown.ts: Return HTML
  markdown.ts->>DOMPurify: Sanitize HTML and harden anchors
  DOMPurify-->>RunDetailComponents: Return sanitized HTML
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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
Title check ✅ Passed The title clearly matches the main change: parsing descriptions as markdown.
Description check ✅ Passed The description is directly related and correctly states that descriptions are parsed as markdown and sanitized with DOMPurify.
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.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/utils/markdown.ts (1)

4-9: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

DOMPurify hook is a global side effect at import time.

DOMPurify.addHook mutates the shared DOMPurify singleton. Any other module that imports dompurify directly will also get target="_blank" and rel="noopener noreferrer" on all sanitized links—potentially unexpected. Use an isolated instance to contain the hook.

♻️ Use an isolated DOMPurify instance
-import DOMPurify from 'dompurify';
+import createDOMPurify from 'dompurify';
+
+const purify = createDOMPurify(window);
 
-DOMPurify.addHook('afterSanitizeAttributes', (node) => {
+purify.addHook('afterSanitizeAttributes', (node) => {
   if (node.tagName === 'A') {
     node.setAttribute('target', '_blank');
     node.setAttribute('rel', 'noopener noreferrer');
   }
 });
 
 export function renderMarkdown(text: string): string {
-  return DOMPurify.sanitize(marked.parse(text ?? '', { async: false }));
+  return purify.sanitize(marked.parse(text ?? '', { async: false }));
 }
 
 export function renderMarkdownInline(text: string): string {
-  return DOMPurify.sanitize(marked.parseInline(text ?? '', { async: false }));
+  return purify.sanitize(marked.parseInline(text ?? '', { async: false }));
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/utils/markdown.ts` around lines 4 - 9, Replace the global DOMPurify hook
setup with an isolated DOMPurify instance in the markdown sanitization module,
and register the afterSanitizeAttributes hook on that instance only. Ensure the
module’s existing sanitization flow uses the isolated instance so direct imports
of the shared DOMPurify singleton remain unaffected.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/utils/markdown.ts`:
- Around line 4-9: Replace the global DOMPurify hook setup with an isolated
DOMPurify instance in the markdown sanitization module, and register the
afterSanitizeAttributes hook on that instance only. Ensure the module’s existing
sanitization flow uses the isolated instance so direct imports of the shared
DOMPurify singleton remain unaffected.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: c6c819ac-62c3-4882-9be4-7fc49ca6f2b4

📥 Commits

Reviewing files that changed from the base of the PR and between 6d638b8 and d5f9c5f.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json, !**/package-lock.json
📒 Files selected for processing (5)
  • .ai/spec/how/project-structure.md
  • package.json
  • src/components/runs/detail/AnalysisSummary.tsx
  • src/components/runs/detail/ExecutionSummary.tsx
  • src/utils/markdown.ts

@jgbernalp jgbernalp force-pushed the parse-markdown-in-rca-description branch 3 times, most recently from f2e49f6 to 4b2543d Compare July 13, 2026 14:24

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/components/runs/detail/RemediationOptionCard.tsx (1)

139-147: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use <strong dangerouslySetInnerHTML={...}> directly instead of nesting <Content p> inside <strong>.

Nesting a <p> (via Content) inside <strong> is semantically unusual and may introduce paragraph margins in the card header flex layout. AnalysisSummary.tsx already uses the cleaner pattern of putting dangerouslySetInnerHTML directly on <strong>.

♻️ Proposed refactor
-            <strong>
-              <Content
-                component={ContentVariants.p}
-                dangerouslySetInnerHTML={{
-                  __html: renderMarkdownInline(option.title),
-                }}
-              />
-            </strong>
+            <strong
+              dangerouslySetInnerHTML={{
+                __html: renderMarkdownInline(option.title),
+              }}
+            />
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/runs/detail/RemediationOptionCard.tsx` around lines 139 - 147,
Update the option title rendering in RemediationOptionCard by removing the
nested Content component and applying dangerouslySetInnerHTML directly to the
surrounding strong element, matching the existing pattern in
AnalysisSummary.tsx.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/components/runs/detail/RemediationOptionCard.tsx`:
- Around line 139-147: Update the option title rendering in
RemediationOptionCard by removing the nested Content component and applying
dangerouslySetInnerHTML directly to the surrounding strong element, matching the
existing pattern in AnalysisSummary.tsx.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: c842d995-de85-409b-b140-95d47d9ea8f5

📥 Commits

Reviewing files that changed from the base of the PR and between d5f9c5f and 4b2543d.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json, !**/package-lock.json
📒 Files selected for processing (11)
  • .ai/spec/how/project-structure.md
  • package.json
  • src/components/runs/RunDetailPage.tsx
  • src/components/runs/RunListPage.tsx
  • src/components/runs/detail/AnalysisSummary.tsx
  • src/components/runs/detail/ExecutionSummary.tsx
  • src/components/runs/detail/RemediationOptionCard.tsx
  • src/components/runs/detail/VerificationSummary.tsx
  • src/models/agenticrun.ts
  • src/utils/approval.test.ts
  • src/utils/markdown.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • .ai/spec/how/project-structure.md
  • src/utils/markdown.ts
  • package.json

@jgbernalp jgbernalp force-pushed the parse-markdown-in-rca-description branch 2 times, most recently from ea2aba4 to 1476db1 Compare July 13, 2026 16:12

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/runs/detail/RemediationOptionCard.tsx (1)

176-176: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

action.description not rendered as Markdown — inconsistent with ExecutionSummary.

Line 176 renders action.description as plain text, while ExecutionSummary.tsx line 138 renders the same field through renderMarkdownInline. Given the PR objective to parse descriptions as Markdown, this looks like an oversight.

💚 Proposed fix
                       <Label variant="outline" isCompact>
                         {action.type}
                       </Label>{' '}
-                      {action.description}
+                      <span dangerouslySetInnerHTML={{ __html: renderMarkdownInline(action.description) }} />
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/runs/detail/RemediationOptionCard.tsx` at line 176, Update the
description rendering in RemediationOptionCard to pass action.description
through the existing renderMarkdownInline helper, matching ExecutionSummary’s
handling of the same field while preserving the surrounding card layout.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/components/runs/detail/RemediationOptionCard.tsx`:
- Line 176: Update the description rendering in RemediationOptionCard to pass
action.description through the existing renderMarkdownInline helper, matching
ExecutionSummary’s handling of the same field while preserving the surrounding
card layout.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 2fc3f04b-f1b2-449f-982b-238a95b129f4

📥 Commits

Reviewing files that changed from the base of the PR and between 4b2543d and 1476db1.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json, !**/package-lock.json
📒 Files selected for processing (12)
  • .ai/spec/how/project-structure.md
  • package.json
  • src/components/runs/RunDetailPage.tsx
  • src/components/runs/RunListPage.tsx
  • src/components/runs/detail/AnalysisSummary.tsx
  • src/components/runs/detail/ExecutionSummary.tsx
  • src/components/runs/detail/RemediationOptionCard.tsx
  • src/components/runs/detail/VerificationSummary.tsx
  • src/global.d.ts
  • src/models/agenticrun.ts
  • src/utils/approval.test.ts
  • src/utils/markdown.ts
🚧 Files skipped from review as they are similar to previous changes (7)
  • src/components/runs/RunDetailPage.tsx
  • .ai/spec/how/project-structure.md
  • src/components/runs/RunListPage.tsx
  • src/utils/approval.test.ts
  • package.json
  • src/utils/markdown.ts
  • src/models/agenticrun.ts

Signed-off-by: Gabriel Bernal <gbernal@redhat.com>
@jgbernalp jgbernalp force-pushed the parse-markdown-in-rca-description branch from 1476db1 to 488cdeb Compare July 13, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants