Skip to content

feat: Update validation constraints for analysis type and enhance err…#185

Merged
rostilos merged 1 commit into
mainfrom
1.5.7-rc
May 22, 2026
Merged

feat: Update validation constraints for analysis type and enhance err…#185
rostilos merged 1 commit into
mainfrom
1.5.7-rc

Conversation

@rostilos
Copy link
Copy Markdown
Owner

@rostilos rostilos commented May 22, 2026

…or handling in request processing

Summary by CodeRabbit

  • New Features

    • Enhanced validation for pipeline processing requests to ensure required fields are properly specified
    • Improved error handling for invalid request payloads with clearer 400 error responses
  • Tests

    • Added validation tests for analysis request parameters

Review Change Stack

@rostilos rostilos merged commit 57938b7 into main May 22, 2026
1 check was pending
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 19ccddcc-a024-49b5-b986-e41f68728004

📥 Commits

Reviewing files that changed from the base of the PR and between d9e9cd7 and 8f9d79e.

📒 Files selected for processing (6)
  • java-ecosystem/libs/analysis-engine/src/main/java/org/rostilos/codecrow/analysisengine/dto/request/processor/BranchProcessRequest.java
  • java-ecosystem/libs/analysis-engine/src/main/java/org/rostilos/codecrow/analysisengine/dto/request/processor/PrProcessRequest.java
  • java-ecosystem/libs/analysis-engine/src/test/java/org/rostilos/codecrow/analysisengine/dto/request/processor/BranchProcessRequestTest.java
  • java-ecosystem/libs/analysis-engine/src/test/java/org/rostilos/codecrow/analysisengine/dto/request/processor/PrProcessRequestTest.java
  • java-ecosystem/services/pipeline-agent/src/it/java/org/rostilos/codecrow/pipelineagent/PipelineAgentSecurityIT.java
  • java-ecosystem/services/pipeline-agent/src/main/java/org/rostilos/codecrow/pipelineagent/generic/controller/ProviderPipelineActionController.java

📝 Walkthrough

Walkthrough

This PR enhances request validation by updating DTO field constraints to require non-null analysisType values, adding tests to verify constraint annotations, implementing comprehensive server-side validation logic in the webhook controller, and updating integration tests to verify validation behavior.

Changes

Request Validation Enhancement

Layer / File(s) Summary
DTO field validation annotations
java-ecosystem/libs/analysis-engine/src/main/java/org/rostilos/codecrow/analysisengine/dto/request/processor/BranchProcessRequest.java, PrProcessRequest.java
BranchProcessRequest changes analysisType validation from @NotBlank to @NotNull. PrProcessRequest adds @NotNull annotation to previously unannotated analysisType field.
Annotation verification tests
java-ecosystem/libs/analysis-engine/src/test/java/org/rostilos/codecrow/analysisengine/dto/request/processor/BranchProcessRequestTest.java, PrProcessRequestTest.java
Both test files add Jakarta validation imports and new nested ValidationTests classes that use reflection to verify analysisType fields have @NotNull and lack @NotBlank annotations.
Controller request validation logic
java-ecosystem/services/pipeline-agent/src/main/java/org/rostilos/codecrow/pipelineagent/generic/controller/ProviderPipelineActionController.java
Controller adds validation methods to check projectId presence and validate required payload fields (commitHash, targetBranchName, analysisType, sourceBranchName for PR requests, pullRequestId for PR_REVIEW analysis). Branch webhook handler catches IllegalArgumentException to return 400 invalid_request responses. Error responses now explicitly set application/json content type.
Integration test validation verification
java-ecosystem/services/pipeline-agent/src/it/java/org/rostilos/codecrow/pipelineagent/PipelineAgentSecurityIT.java
Protected endpoints test now sends incomplete payload (only projectId) to verify authentication succeeds but validation fails with 400 response.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 In the land of requests, we build a wall,
Where @NotNull guards the analysisType call,
Tests verify constraints with mirrors so bright,
Controllers catch errors and set them right,
Validation is flowing—complete and quite tight! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 1.5.7-rc

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.

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.

1 participant