Skip to content

Conversation

@adityathebe
Copy link
Member

@adityathebe adityathebe commented Dec 24, 2025

Summary by CodeRabbit

  • New Features

    • Added support for Prometheus action type in playbooks.
  • Improvements

    • Simplified styling for SQL query results in playbook action displays.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Dec 24, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
aws-preview Ready Ready Preview Dec 24, 2025 1:44pm
flanksource-ui Ready Ready Preview Dec 24, 2025 1:44pm

@netlify
Copy link

netlify bot commented Dec 24, 2025

Deploy Preview for flanksource-demo-stable ready!

Name Link
🔨 Latest commit a63ef65
🔍 Latest deploy log https://app.netlify.com/projects/flanksource-demo-stable/deploys/694bed5151d4140008517adb
😎 Deploy Preview https://deploy-preview-2800--flanksource-demo-stable.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link

coderabbitai bot commented Dec 24, 2025

Walkthrough

This PR extends the playbook system with support for a new "prometheus" action type. Changes include type definitions for the new action category, service-level mapping logic to identify prometheus actions, and UI simplifications for SQL result display formatting.

Changes

Cohort / File(s) Summary
Prometheus Action Type Support
src/api/types/playbooks.ts, src/api/services/playbooks.ts
Added new "prometheus" action type to CategorizedPlaybookRunAction union. Added optional prometheus?: any field to PlaybookAction interface. Updated action type resolution logic to check for actionSpec?.prometheus and map to "prometheus" before falling back to existing pod/logs/exec type checks.
SQL Results Display Refactoring
src/components/Playbooks/Runs/Actions/PlaybooksActionsResults.tsx
Simplified query tab className by removing "overflow-auto" style. Removed branching logic in rows tab that differentiated between SQL and object action types; content now consistently uses formatSqlRowsToMarkdown() with "text/markdown" display type and "whitespace-pre" className.

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: Prometheus playbook action' directly and concisely summarizes the main change: adding support for Prometheus as a new playbook action type.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/prometheus-playbook-action

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 and usage tips.

@netlify
Copy link

netlify bot commented Dec 24, 2025

Deploy Preview for clerk-saas-ui failed. Why did it fail? →

Name Link
🔨 Latest commit a63ef65
🔍 Latest deploy log https://app.netlify.com/projects/clerk-saas-ui/deploys/694bed514a1fca0008b96e3d

@adityathebe adityathebe requested a review from moshloop December 24, 2025 13:45
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/api/types/playbooks.ts (1)

132-132: LGTM! Consider stronger typing for prometheus field.

The optional prometheus field follows the established pattern. While any is consistent with other action type fields, consider defining a more specific type in a future refactor for better type safety.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c1ad8eb and a63ef65.

📒 Files selected for processing (3)
  • src/api/services/playbooks.ts
  • src/api/types/playbooks.ts
  • src/components/Playbooks/Runs/Actions/PlaybooksActionsResults.tsx
🔇 Additional comments (2)
src/api/types/playbooks.ts (1)

66-66: LGTM!

The prometheus action type is correctly added to the type union.

src/components/Playbooks/Runs/Actions/PlaybooksActionsResults.tsx (1)

233-236: The simplified logic is correct. SQL action results have a defined structure where the rows property is always an array of objects (as confirmed by test cases). The formatSqlRowsToMarkdown function appropriately handles non-array inputs by returning null, triggering the fallback "No rows returned". This defensive handling is suitable for validation.

Comment on lines +161 to +167
: actionSpec?.prometheus
? "prometheus"
: actionSpec?.pod
? "pod"
: actionSpec?.logs
? "logs"
: "exec";
Copy link

@coderabbitai coderabbitai bot Dec 24, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's look at the context around the change in playbooks.ts
cat -n src/api/services/playbooks.ts | sed -n '150,180p'

Repository: flanksource/flanksource-ui

Length of output: 1087


🏁 Script executed:

# Search for action type handling patterns
rg -n 'action\.type|actionType' --type=ts --type=tsx -g '!**/node_modules/**' | head -30

Repository: flanksource/flanksource-ui

Length of output: 97


🏁 Script executed:

# Search for existing action type conditionals/switches
rg -n -B2 -A5 'case.*"sql"|case.*"mysql"|case.*"pod"|case.*"logs"|case.*"exec"' --type=ts --type=tsx -g '!**/node_modules/**'

Repository: flanksource/flanksource-ui

Length of output: 97


🏁 Script executed:

# Search for prometheus-related code in UI components
rg -n 'prometheus' --type=ts --type=tsx -g '!**/node_modules/**'

Repository: flanksource/flanksource-ui

Length of output: 97


🏁 Script executed:

# Look for where action type is used in result preprocessing
rg -n 'preprocessResult|resultPreprocess|formatResult' --type=ts --type=tsx -g '!**/node_modules/**' | head -20

Repository: flanksource/flanksource-ui

Length of output: 97


🏁 Script executed:

# Search for action type handling without type restrictions
rg -n 'action\.type|actionType' --type=ts -g '!**/node_modules/**' | head -40

Repository: flanksource/flanksource-ui

Length of output: 1636


🏁 Script executed:

# Search for switch/case statements handling action types
rg -n -B2 -A5 'case\s+"(sql|mysql|pod|logs|exec|http|gitops)' --type=ts -g '!**/node_modules/**' | head -50

Repository: flanksource/flanksource-ui

Length of output: 2230


🏁 Script executed:

# Look for result preprocessing/formatting functions
rg -n -B3 -A10 'getResultForAction|formatActionResult|handleActionResult' --type=ts -g '!**/node_modules/**'

Repository: flanksource/flanksource-ui

Length of output: 52


🏁 Script executed:

# Search for prometheus references specifically
rg -n 'prometheus' --type=ts -g '!**/node_modules/**'

Repository: flanksource/flanksource-ui

Length of output: 2729


🏁 Script executed:

# Look at how other action types like 'sql' are handled in UI
rg -n -B5 -A5 '"sql".*:' --type=ts -g '!**/node_modules/**' | head -60

Repository: flanksource/flanksource-ui

Length of output: 1030


Add missing "prometheus" case to action result preprocessing in PlaybooksActionsResults.tsx.

The prometheus action type is now returned from playbooks.ts but the result preprocessing switch statement in src/components/Playbooks/Runs/Actions/PlaybooksActionsResults.tsx (line 152) is missing a handler for it. Currently, only "http", "exec", "sql", and a default case exist. Add an explicit "prometheus" case to ensure prometheus action results are properly preprocessed and displayed in the UI, rather than falling through to the default handler.

🤖 Prompt for AI Agents
In src/components/Playbooks/Runs/Actions/PlaybooksActionsResults.tsx around line
152, the switch that preprocesses action results lacks an explicit "prometheus"
case so prometheus results fall through to the default handler; add a
"prometheus" case that mirrors the preprocessing used for other structured
action types (e.g., parse JSON if the action result contains JSON, or otherwise
keep the raw text) and assign the preprocessed result into the same
variable/shape the rest of the component expects so prometheus results are
rendered correctly instead of using the default renderer.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's fine. we don't need special handling

Copy link

Choose a reason for hiding this comment

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

@adityathebe, understood! The default handler will be used for prometheus action results.

if (action.type === "sql") {
tab.displayContentType = "application/sql";
tab.className = "overflow-auto whitespace-pre";
tab.className = "whitespace-pre";
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, let's find and examine the PlaybooksActionsResults.tsx file
find . -name "PlaybooksActionsResults.tsx" -type f

Repository: flanksource/flanksource-ui

Length of output: 137


🏁 Script executed:

# Get the file size first
wc -l ./src/components/Playbooks/Runs/Actions/PlaybooksActionsResults.tsx

Repository: flanksource/flanksource-ui

Length of output: 141


🏁 Script executed:

# Read the file to examine the relevant sections
cat -n ./src/components/Playbooks/Runs/Actions/PlaybooksActionsResults.tsx | sed -n '220,240p'

Repository: flanksource/flanksource-ui

Length of output: 891


🏁 Script executed:

# Check around line 321 to see the parent container overflow settings
cat -n ./src/components/Playbooks/Runs/Actions/PlaybooksActionsResults.tsx | sed -n '310,335p'

Repository: flanksource/flanksource-ui

Length of output: 985


🏁 Script executed:

# Check around lines 390-398 to see CodeBlock component usage
cat -n ./src/components/Playbooks/Runs/Actions/PlaybooksActionsResults.tsx | sed -n '380,405p'

Repository: flanksource/flanksource-ui

Length of output: 952


🏁 Script executed:

# Find the CodeBlock component to understand its overflow handling
find . -name "*CodeBlock*" -type f | head -20

Repository: flanksource/flanksource-ui

Length of output: 181


🏁 Script executed:

# Read the CodeBlock component to understand overflow handling
cat -n ./src/ui/Code/CodeBlock.tsx

Repository: flanksource/flanksource-ui

Length of output: 4282


🏁 Script executed:

# Let's check the renderResult function to see how className is used
cat -n ./src/components/Playbooks/Runs/Actions/PlaybooksActionsResults.tsx | sed -n '370,380p'

Repository: flanksource/flanksource-ui

Length of output: 454


🏁 Script executed:

# Check how the className is passed through - look at the full renderTabContent function
cat -n ./src/components/Playbooks/Runs/Actions/PlaybooksActionsResults.tsx | sed -n '363,376p'

Repository: flanksource/flanksource-ui

Length of output: 611


🏁 Script executed:

# Find where renderTabContent is called and what className is passed
cat -n ./src/components/Playbooks/Runs/Actions/PlaybooksActionsResults.tsx | sed -n '340,360p'

Repository: flanksource/flanksource-ui

Length of output: 801


🏁 Script executed:

# Let's verify what className is actually passed and used - check the default className value parameter
cat -n ./src/components/Playbooks/Runs/Actions/PlaybooksActionsResults.tsx | sed -n '250,280p'

Repository: flanksource/flanksource-ui

Length of output: 1128


🏁 Script executed:

# Check the function signature to see what the default className parameter is
cat -n ./src/components/Playbooks/Runs/Actions/PlaybooksActionsResults.tsx | sed -n '125,165p'

Repository: flanksource/flanksource-ui

Length of output: 1524


🏁 Script executed:

# Let's see how the className parameter is actually used in CodeBlock
grep -n "className" ./src/ui/Code/CodeBlock.tsx | head -20

Repository: flanksource/flanksource-ui

Length of output: 892


🏁 Script executed:

# Let's trace through what happens for SQL syntax highlighting
# Check if there are any tests that show SQL query display behavior
cat -n ./src/ui/Code/__tests__/CodeBlock.unit.test.tsx

Repository: flanksource/flanksource-ui

Length of output: 681


🏁 Script executed:

# Let's check the Tabs component to understand how contentClassName is used
find . -name "Tabs.tsx" -o -name "Tabs.jsx" | head -5

Repository: flanksource/flanksource-ui

Length of output: 92


🏁 Script executed:

# Read the Tabs component
cat -n ./src/ui/Tabs/Tabs.tsx

Repository: flanksource/flanksource-ui

Length of output: 4187


Add horizontal overflow handling for SQL query display.

The tab.className = "whitespace-pre" at line 228 handles whitespace preservation but doesn't add overflow handling. Combined with the parent Tabs container only having overflow-y-auto (line 321), long SQL queries will overflow horizontally without a scrollbar. Consider adding overflow-x-auto or overflow-auto to the tab className for SQL query tabs to ensure long queries are scrollable.

🤖 Prompt for AI Agents
In src/components/Playbooks/Runs/Actions/PlaybooksActionsResults.tsx around line
228, the tab element currently sets className to "whitespace-pre" which
preserves spacing but allows long SQL to overflow horizontally; update the
className to include horizontal overflow handling (e.g., "whitespace-pre
overflow-x-auto" or "whitespace-pre overflow-auto") so long queries become
horizontally scrollable and keep other existing classes intact.

@adityathebe adityathebe merged commit f6141d3 into main Dec 24, 2025
18 of 20 checks passed
@adityathebe adityathebe deleted the feat/prometheus-playbook-action branch December 24, 2025 14:12
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.

2 participants