Updating Prompts, RCA Stages, Making UI More Aligned To Figma#33
Updating Prompts, RCA Stages, Making UI More Aligned To Figma#33shekhar316 wants to merge 2 commits intocausaai:poc-mar26from
Conversation
Signed-off-by: Shekhar Saxena <shekhar.saxena@ibm.com>
Reviewer's GuideImplements a structured RCA overview and metadata pipeline end-to-end: the LLM prompt now produces severity, structured evidence, symptoms and affected services; the backend parses and persists these fields (including a partial pre-validation report) and the dashboard UI is updated to show an RCA overview side‑by‑side with highlights and evidence aligned with the new design. Sequence diagram for RCA analysis with partial report storagesequenceDiagram
actor User
participant Dashboard
participant AnalysisTrackingService
participant RcaOrchestrator
participant RootCauseAnalyst
participant RcaAssertionExtractor
User->>Dashboard: Start RCA for pod
Dashboard->>AnalysisTrackingService: createSession
AnalysisTrackingService-->>Dashboard: RcaAnalysisSession
Dashboard->>RcaOrchestrator: runAnalysisInternal(sessionId, namespace, podName)
RcaOrchestrator->>RootCauseAnalyst: analyzeRootCause(anomalyType, llmContext)
RootCauseAnalyst-->>RcaOrchestrator: rcaOutput (structured text)
RcaOrchestrator->>RcaOrchestrator: extractRootCauseTitle(rcaOutput)
RcaOrchestrator->>RcaOrchestrator: extractRootCause(rcaOutput)
RcaOrchestrator->>RcaOrchestrator: extractKeyEvidence(rcaOutput)
RcaOrchestrator->>RcaOrchestrator: extractSupportedLogs(rcaOutput)
RcaOrchestrator->>RcaOrchestrator: extractSeverity(rcaOutput)
RcaOrchestrator->>RcaOrchestrator: extractSupportingEvidenceBullets(rcaOutput)
RcaOrchestrator->>RcaOrchestrator: extractObservableSymptoms(rcaOutput)
RcaOrchestrator->>RcaOrchestrator: extractAffectedServices(rcaOutput)
RcaOrchestrator->>RcaOrchestrator: build partialReport map
RcaOrchestrator->>RcaOrchestrator: map -> partialJson -> partialRcaReport
RcaOrchestrator->>AnalysisTrackingService: storePartialReport(sessionId, partialRcaReport)
AnalysisTrackingService-->>RcaOrchestrator: ack
AnalysisTrackingService-->>Dashboard: updated session with partial report
Dashboard-->>User: Show RCA overview immediately
RcaOrchestrator->>RcaAssertionExtractor: extractAssertions(rcaSection, artifacts)
RcaAssertionExtractor-->>RcaOrchestrator: finalAssertions, weightedScore, finalStatus
RcaOrchestrator->>RcaOrchestrator: compute confidence, finalDecision
RcaOrchestrator->>RcaOrchestrator: build finalReport map
RcaOrchestrator->>AnalysisTrackingService: storeFinalReport(sessionId, finalRcaReport)
AnalysisTrackingService-->>RcaOrchestrator: ack
AnalysisTrackingService-->>Dashboard: session completed with final report
Dashboard-->>User: Show validated RCA report with severity and confidence
Class diagram for updated RCA reporting and tracking modelclassDiagram
class RcaReport {
+String title
+String issue
+String highLevelIssue
+String subLevelIssue
+String evidence
+List~String~ supportedLogs
+List~String~ validationChecks
+List~AssertionItem~ assertions
+FinalDecision finalDecision
+String severity
+String confidenceLevel
+List~String~ supportingEvidenceBullets
+List~String~ observableSymptoms
+List~String~ affectedServices
}
class RcaAnalysisSession {
+String sessionId
+RcaReport report
+AnalysisStatus status
}
class AnalysisTrackingService {
+boolean storeArtifacts(sessionId, artifacts)
+boolean storePartialReport(sessionId, report)
+boolean storeFinalReport(sessionId, report)
+void updateStatus(sessionId, status, message)
+Optional~RcaAnalysisSession~ findBySessionId(sessionId)
}
class RcaOrchestrator {
+void runAnalysisInternal(sessionId, namespace, podName)
-String extractRootCauseTitle(rcaOutput)
-String extractRootCause(rcaOutput)
-List~String~ extractSupportedLogs(rcaOutput)
-String extractKeyEvidence(rcaOutput)
-String extractSeverity(rcaOutput)
-List~String~ extractSupportingEvidenceBullets(rcaOutput)
-List~String~ extractObservableSymptoms(rcaOutput)
-List~String~ extractAffectedServices(rcaOutput)
-String extractGcExplanation(rawResponse)
}
class RootCauseAnalyst {
<<interface>>
+String analyzeRootCause(anomalyType, llmContext)
}
class RcaAssertionExtractor {
<<interface>>
+String extractAssertions(rootCauseSection, artifacts)
}
class EvidenceMatcherAgent {
<<interface>>
+String matchEvidence(rootCauseSection, logs)
}
AnalysisTrackingService --> RcaAnalysisSession : manages
RcaAnalysisSession --> RcaReport : has
RcaOrchestrator --> AnalysisTrackingService : uses
RcaOrchestrator --> RootCauseAnalyst : calls
RcaOrchestrator --> RcaAssertionExtractor : calls
RcaOrchestrator --> EvidenceMatcherAgent : may_call
RcaOrchestrator --> RcaReport : builds
Flow diagram for parsing structured RCA output into report fieldsflowchart TD
A_rcaOutput["RCA output from RootCauseAnalyst"] --> B_extractTitle["extractRootCauseTitle(rcaOutput)"]
A_rcaOutput --> C_extractIssue["extractRootCause(rcaOutput)"]
A_rcaOutput --> D_extractEvidence["extractKeyEvidence(rcaOutput)"]
A_rcaOutput --> E_extractSupportedLogs["extractSupportedLogs(rcaOutput)"]
A_rcaOutput --> F_extractSeverity["extractSeverity(rcaOutput)"]
A_rcaOutput --> G_extractSupportingEvidenceBullets["extractSupportingEvidenceBullets(rcaOutput)"]
A_rcaOutput --> H_extractObservableSymptoms["extractObservableSymptoms(rcaOutput)"]
A_rcaOutput --> I_extractAffectedServices["extractAffectedServices(rcaOutput)"]
B_extractTitle --> J_buildPartialReport["Build partialReport map"]
C_extractIssue --> J_buildPartialReport
D_extractEvidence --> J_buildPartialReport
E_extractSupportedLogs --> J_buildPartialReport
F_extractSeverity --> J_buildPartialReport
G_extractSupportingEvidenceBullets --> J_buildPartialReport
H_extractObservableSymptoms --> J_buildPartialReport
I_extractAffectedServices --> J_buildPartialReport
J_buildPartialReport --> K_serialize["Serialize to JSON"]
K_serialize --> L_deserialize["Deserialize to RcaReport"]
L_deserialize --> M_storePartial["AnalysisTrackingService.storePartialReport"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The RCA output parsing now happens in multiple separate regex-based methods (severity, supporting evidence, symptoms, services, etc.); consider centralizing this into a single parser or shared helper to keep the format assumptions in one place and make future prompt/output format changes easier to manage.
- In
extractSeverity, unknown or malformed SEVERITY values silently fall back to "Medium"; adding a warning log or explicit handling for unexpected values would make it easier to detect prompt/output drift or LLM formatting issues in production.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The RCA output parsing now happens in multiple separate regex-based methods (severity, supporting evidence, symptoms, services, etc.); consider centralizing this into a single parser or shared helper to keep the format assumptions in one place and make future prompt/output format changes easier to manage.
- In `extractSeverity`, unknown or malformed SEVERITY values silently fall back to "Medium"; adding a warning log or explicit handling for unexpected values would make it easier to detect prompt/output drift or LLM formatting issues in production.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Signed-off-by: Shekhar Saxena <shekhar.saxena@ibm.com>
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- In
analysisDetails.htmlthe Evidence tab headings seem swapped: the first section titled "Supported Logs" renderssession.report.evidence, while the second section titled "Evidence" renderssession.report.supportedLogs, which will be confusing for users; consider correcting the section titles to match their content. - The new RCA parsing helpers in
RcaOrchestrator(extractSupportedLogs,extractKeyEvidence,extractSupportingEvidenceBullets,extractObservableSymptoms,extractAffectedServices,extractSeverity) share similar regex and line-splitting patterns; consider extracting a small parser/utility class to centralize this logic and make future prompt/format changes easier to manage. - Several of the new RCA overview CSS rules (e.g., hard-coded hex colors like
#0f62fe,#ff832b,#e8f4fd) bypass the existing design tokens; consider replacing these with the existing CSS variables (or adding new tokens) to keep theming consistent and simplify future visual tweaks.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `analysisDetails.html` the Evidence tab headings seem swapped: the first section titled "Supported Logs" renders `session.report.evidence`, while the second section titled "Evidence" renders `session.report.supportedLogs`, which will be confusing for users; consider correcting the section titles to match their content.
- The new RCA parsing helpers in `RcaOrchestrator` (`extractSupportedLogs`, `extractKeyEvidence`, `extractSupportingEvidenceBullets`, `extractObservableSymptoms`, `extractAffectedServices`, `extractSeverity`) share similar regex and line-splitting patterns; consider extracting a small parser/utility class to centralize this logic and make future prompt/format changes easier to manage.
- Several of the new RCA overview CSS rules (e.g., hard-coded hex colors like `#0f62fe`, `#ff832b`, `#e8f4fd`) bypass the existing design tokens; consider replacing these with the existing CSS variables (or adding new tokens) to keep theming consistent and simplify future visual tweaks.
## Individual Comments
### Comment 1
<location path="src/main/java/com/causa/rca/service/RcaOrchestrator.java" line_range="528-532" />
<code_context>
private String extractRootCause(String rcaOutput) {
Pattern pattern = Pattern.compile(
- "(?i)ROOT[_ ]CAUSE\\s*:\\s*(.*?)(?=KEY[_ ]EVIDENCE\\s*:|SUPPORTED[_ ]LOGS\\s*:|$)",
+ "(?i)ROOT[_\\s]CAUSE\\s*:\\s*(.*?)(?=SUPPORTING[_\\s]EVIDENCE\\s*:|KEY[_\\s]EVIDENCE\\s*:|SUPPORTED[_\\s]LOGS\\s*:|$)",
</code_context>
<issue_to_address>
**suggestion:** Line splitting assumes `\n` only, which can misbehave with `\r\n` or mixed line endings.
This affects the new extractors (`extractSupportedLogs`, `extractSupportingEvidenceBullets`, `extractObservableSymptoms`) that use `split("\n")`, which can leave stray `\r` characters and break bullet regex matching. Consider using `split("\\R")` or normalizing all `\r\n` to `\n` once up front to make the parsing resilient to mixed line endings.
Suggested implementation:
```java
split("\\R")
```
Based on your comment, you should verify and update all usages in:
1. `extractSupportedLogs(...)`
2. `extractSupportingEvidenceBullets(...)`
3. `extractObservableSymptoms(...)`
If any of these methods currently perform manual trimming of `\r` or similar workarounds, those can typically be removed once `split("\\R")` is in place, since the line terminators will no longer be part of the returned strings.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| Pattern pattern = Pattern.compile( | ||
| "(?i)ROOT[_ ]CAUSE\\s*:\\s*(.*?)(?=KEY[_ ]EVIDENCE\\s*:|SUPPORTED[_ ]LOGS\\s*:|$)", | ||
| "(?i)ROOT[_\\s]CAUSE\\s*:\\s*(.*?)(?=SUPPORTING[_\\s]EVIDENCE\\s*:|KEY[_\\s]EVIDENCE\\s*:|SUPPORTED[_\\s]LOGS\\s*:|$)", | ||
| Pattern.DOTALL); | ||
|
|
||
| Matcher matcher = pattern.matcher(rcaOutput); |
There was a problem hiding this comment.
suggestion: Line splitting assumes \n only, which can misbehave with \r\n or mixed line endings.
This affects the new extractors (extractSupportedLogs, extractSupportingEvidenceBullets, extractObservableSymptoms) that use split("\n"), which can leave stray \r characters and break bullet regex matching. Consider using split("\\R") or normalizing all \r\n to \n once up front to make the parsing resilient to mixed line endings.
Suggested implementation:
split("\\R")Based on your comment, you should verify and update all usages in:
extractSupportedLogs(...)extractSupportingEvidenceBullets(...)extractObservableSymptoms(...)
If any of these methods currently perform manual trimming of \r or similar workarounds, those can typically be removed once split("\\R") is in place, since the line terminators will no longer be part of the returned strings.
|
@dinogun could we please review this and merge it into the poc-mar26 branch? Thanks. |
This PR updates prompts, and makes UI more aligned with Figma
Summary by Sourcery
Refine RCA analysis outputs and dashboard presentation for clearer, structured incident insights and faster UI feedback.
New Features:
Enhancements: