Skip to content

Conversation

@Avi-Robusta
Copy link
Contributor

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Jul 28, 2025

Walkthrough

An optional named_sinks field was added to the configuration and CLI, allowing users to specify a list of sinks to which scan results should be published. Support for this parameter was propagated through the result/error publishing pipeline, updating function signatures and payloads to include and forward named_sinks as needed.

Changes

Cohort / File(s) Change Summary
Config Model Enhancement
robusta_krr/core/models/config.py
Added an optional named_sinks: Optional[list[str]] field to the Config class, defaulting to None.
Result Publishing Pipeline Update
robusta_krr/core/runner.py
Updated _send_result, publish_input_error, publish_error, and _send_scan_payload to accept and forward named_sinks. Modified payloads and logging to include named_sinks when provided.
CLI and Entry Point Update
robusta_krr/main.py
Added a new optional CLI parameter named_sinks to run_strategy, passed it to Config, and forwarded it to error publishing logic.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI (main.py)
    participant Config
    participant Runner
    participant HTTP Endpoint

    User->>CLI (main.py): Run CLI with --named_sinks option
    CLI (main.py)->>Config: Instantiate with named_sinks
    CLI (main.py)->>Runner: Start scan, pass named_sinks
    Runner->>Runner: Prepare result/error
    Runner->>HTTP Endpoint: POST scan payload (includes named_sinks if provided)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sink_support_push_results

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 87ce07a and ba5e53c.

📒 Files selected for processing (3)
  • robusta_krr/core/models/config.py (1 hunks)
  • robusta_krr/core/runner.py (5 hunks)
  • robusta_krr/main.py (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
robusta_krr/core/runner.py (2)
robusta_krr/core/models/result.py (1)
  • Result (62-115)
robusta_krr/formatters/json.py (1)
  • json (6-7)
🪛 Ruff (0.12.2)
robusta_krr/main.py

311-316: Do not perform function call typer.Option in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable

(B008)

🪛 Flake8 (7.2.0)
robusta_krr/main.py

[error] 369-369: closing bracket does not match indentation of opening bracket's line

(E123)

🔇 Additional comments (9)
robusta_krr/core/models/config.py (1)

67-67: LGTM! Clean configuration field addition.

The new named_sinks field is properly typed as Optional[list[str]] with a sensible default of None. The placement within the "Publishing to url settings" section is logical and consistent with the existing configuration structure.

robusta_krr/main.py (2)

311-316: LGTM! Well-structured CLI option addition.

The named_sinks CLI option is properly implemented with:

  • Correct type annotation Optional[List[str]]
  • Clear help text explaining its purpose
  • Appropriate placement in the "Publish Scan Settings" panel
  • Consistent naming convention with other CLI options

368-368: LGTM! Parameter correctly passed to Config.

The named_sinks parameter is properly forwarded to the Config constructor, maintaining consistency with other configuration parameters.

robusta_krr/core/runner.py (6)

9-9: LGTM! Import statement correctly updated.

The List type import is properly added to support the new named_sinks parameter typing.


523-525: LGTM! Method signature and call updated correctly.

The _send_result method properly:

  • Accepts the new named_sinks parameter with correct typing
  • Forwards it to _send_scan_payload in the right position
  • Maintains consistency with the overall parameter flow

531-531: LGTM! Correctly uses settings for named_sinks.

The publish_error function properly retrieves named_sinks from settings.named_sinks, maintaining consistency with how other settings are accessed.


547-554: LGTM! Function signature properly updated.

The _send_scan_payload function signature correctly:

  • Includes the new named_sinks parameter with proper typing
  • Maintains the existing parameter order
  • Uses appropriate Union types for flexible parameter handling

559-559: LGTM! Debug logging enhanced with sink information.

The debug log message now includes the named_sinks parameter, which will be helpful for troubleshooting scan payload routing.


576-577: LGTM! Conditional payload enhancement implemented correctly.

The logic properly:

  • Checks if named_sinks is provided (truthy check handles both None and empty list)
  • Adds the "sinks" key to the action request only when sinks are specified
  • Uses the correct key name in the payload structure

arikalon1
arikalon1 previously approved these changes Jul 29, 2025
Copy link
Contributor

@arikalon1 arikalon1 left a comment

Choose a reason for hiding this comment

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

nice work, left one comment

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: 0

♻️ Duplicate comments (1)
robusta_krr/main.py (1)

373-373: Fix the parameter order in the function call.

The parameter order is still incorrect. Based on the function signature in robusta_krr/core/runner.py (line 526-527), the correct order should be (url, scan_id, start_time, error, named_sinks).

Apply this diff to fix the parameter order:

-                    publish_input_error( publish_scan_url, start_time, scan_id, str(e), named_sinks)
+                    publish_input_error(publish_scan_url, scan_id, start_time, str(e), named_sinks)
🧹 Nitpick comments (1)
robusta_krr/main.py (1)

368-369: Fix indentation of closing bracket.

The named_sinks parameter addition is correct, but there's an indentation issue with the closing bracket.

Apply this diff to fix the indentation:

                        named_sinks=named_sinks,
-                        )
+                    )
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ba5e53c and 166295e.

📒 Files selected for processing (1)
  • robusta_krr/main.py (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
robusta_krr/main.py (2)
robusta_krr/core/models/config.py (2)
  • Config (20-192)
  • set_config (177-188)
robusta_krr/core/runner.py (1)
  • publish_input_error (527-528)
🪛 Ruff (0.12.2)
robusta_krr/main.py

311-316: Do not perform function call typer.Option in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable

(B008)

🪛 Flake8 (7.2.0)
robusta_krr/main.py

[error] 369-369: closing bracket does not match indentation of opening bracket's line

(E123)

🔇 Additional comments (1)
robusta_krr/main.py (1)

311-316: LGTM! CLI parameter addition is correct.

The named_sinks parameter follows the established pattern for CLI options in this codebase. The static analysis hint B008 can be safely ignored as it's a false positive - using typer.Option in argument defaults is the correct pattern for typer CLI applications.

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: 0

🧹 Nitpick comments (1)
robusta_krr/main.py (1)

368-369: Fix indentation of closing bracket.

The named_sinks parameter is correctly passed to the Config constructor, but there's an indentation issue with the closing bracket.

Apply this diff to fix the indentation:

                        named_sinks=named_sinks,
-                        )
+                    )
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 166295e and c090dcc.

📒 Files selected for processing (1)
  • robusta_krr/main.py (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
robusta_krr/main.py (1)
robusta_krr/core/runner.py (1)
  • publish_input_error (527-528)
🪛 Ruff (0.12.2)
robusta_krr/main.py

311-316: Do not perform function call typer.Option in argument defaults; instead, perform the call within the function, or read the default from a module-level singleton variable

(B008)

🪛 Flake8 (7.2.0)
robusta_krr/main.py

[error] 369-369: closing bracket does not match indentation of opening bracket's line

(E123)

🔇 Additional comments (2)
robusta_krr/main.py (2)

311-316: LGTM! Parameter definition follows established patterns.

The named_sinks parameter is correctly defined with appropriate type annotation, help text, and panel grouping, consistent with other CLI parameters in the function.

Note: The static analysis B008 warning about function calls in argument defaults is a false positive here, as typer.Option() is the standard pattern for typer CLI parameters.


373-373: LGTM! Function call parameter order is now correct.

The publish_input_error function call now has the correct parameter order matching the function signature: (url, scan_id, start_time, error, named_sinks).

Copy link
Contributor

@arikalon1 arikalon1 left a comment

Choose a reason for hiding this comment

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

nice work

@arikalon1 arikalon1 merged commit 7356b98 into main Jul 30, 2025
3 checks passed
@arikalon1 arikalon1 deleted the sink_support_push_results branch July 30, 2025 08:03
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