Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add inconsistency check pipeline #197

Merged
merged 8 commits into from
Jan 28, 2025

Conversation

FelixTJDietrich
Copy link
Contributor

@FelixTJDietrich FelixTJDietrich commented Jan 24, 2025

Motivation

We want to offer instructor assistance and make it easier for them to find inconsistencies within a programming exercise. The aim is to offer a more correct exercise to the students so that they are less confused and frustrated when solving the exercise.

Description

This pull request introduces a new pipeline for checking inconsistencies in programming exercises.

Right now it is just a simple prompt taking problem statement and the template files.

TODOs (potentially for follow-up PRs):

  • Graph of thoughts / chain of thoughts reasoning (with more status updated)
  • Handling large template repositories

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Added a new pipeline for inconsistency checks in programming exercises.
    • Introduced a new API endpoint for running inconsistency check pipelines.
    • Implemented a detailed AI-powered inconsistency detection process for exercise problem statements.
    • Added new enumeration value for inconsistency checks and related data transfer objects (DTOs).
  • Technical Improvements

    • Enhanced error handling and logging for the new pipeline functionality.

Copy link
Contributor

coderabbitai bot commented Jan 24, 2025

Walkthrough

This pull request introduces a new pipeline for performing inconsistency checks in a programming exercise context. The changes span multiple files to implement a comprehensive feature that allows identifying and reporting inconsistencies between a problem statement and a template repository. The implementation includes creating new data transfer objects (DTOs), adding a pipeline execution route, defining a prompt for inconsistency analysis, and establishing a callback mechanism for tracking the pipeline's progress.

Changes

File Change Summary
app/common/PipelineEnum.py Added new enumeration IRIS_INCONSISTENCY_CHECK
app/domain/__init__.py Imported InconsistencyCheckPipelineExecutionDTO
app/domain/inconsistency_check_pipeline_execution_dto.py New DTO class with execution and exercise attributes
app/domain/status/inconsistency_check_status_update_dto.py New status update DTO inheriting from StatusUpdateDTO
app/pipeline/prompts/inconsistency_check_prompts.py Added basic_prompt for inconsistency checking
app/web/routers/pipelines.py Added worker function and route for inconsistency check pipeline
app/web/status/status_update.py Introduced InconsistencyCheckCallback with stages and error handling
app/pipeline/inconsistency_check_pipeline.py New pipeline class for executing inconsistency checks

Possibly related PRs

  • FAQ rewriting pipeline #191: The addition of the IRIS_INCONSISTENCY_CHECK enumeration in the main PR is related to the new InconsistencyCheckPipelineExecutionDTO class introduced in the retrieved PR, which also deals with inconsistency checks within the pipeline context.
  • Add ChatGPT wrapper pipeline #196: The changes in the main PR regarding the PipelineEnum class are relevant to the modifications in the app/web/routers/pipelines.py file in this PR, which introduces a new pipeline that may utilize the updated enumeration values for handling different pipeline types, including inconsistency checks.

Suggested reviewers

  • sebastianloose
  • isabellagessl
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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
Contributor

@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: 6

🧹 Nitpick comments (11)
app/pipeline/inconsistenct_check_pipeline.py (5)

1-3: Code formatting required
The code must be reformatted to comply with Black style as indicated in the pipeline failures.

🧰 Tools
🪛 GitHub Actions: Run linters

[warning] Code formatting does not comply with Black style. File needs reformatting.


4-8: Ensure dependencies are pinned
You might consider pinning langchain_core and langsmith versions in your requirements to avoid unexpected breaking changes.

🧰 Tools
🪛 GitHub Actions: Run linters

[warning] Code formatting does not comply with Black style. File needs reformatting.


25-43: Constructor clarity
The constructor is logically structured. However, adding a descriptive docstring at the class level would make usage expectations clearer.

🧰 Tools
🪛 GitHub Actions: Run linters

[warning] Code formatting does not comply with Black style. File needs reformatting.


53-55: Validate exercise presence
It's good that you check dto.exercise. Consider adding more context to the error message for easier debugging.

- logger.error("Inconsistency check pipeline requires an exercise")
+ logger.error(
+     "Inconsistency check pipeline requires an exercise, but dto.exercise is missing. DTO contents: %s",
+     dto
+ )
🧰 Tools
🪛 GitHub Actions: Run linters

[warning] Code formatting does not comply with Black style. File needs reformatting.


77-77: Ensure final callback is always invoked
If an exception occurs before line 77, the callback might never fire. Consider using a try/finally approach to guarantee the pipeline updates its status.

+ try:
+     ...
+ finally:
+     self.callback.done(final_result=response, tokens=self.tokens)
🧰 Tools
🪛 GitHub Actions: Run linters

[warning] Code formatting does not comply with Black style. File needs reformatting.

app/domain/status/inconsistency_check_status_update_dto.py (1)

1-5: Add a class-level docstring
A docstring explaining how result is used in the context of status updates would make this DTO clearer.

+ """
+ This DTO updates the status and captures the final result of the inconsistency check pipeline.
+ """
app/pipeline/prompts/inconsistency_check_prompts.py (1)

1-28: Correct grammatical repetition.

Line 4 contains a repeated word “the the.” Removing the extra “the” improves readability. Also remember to run Black to address style warnings.

- The student will use the the template repository...
+ The student will use the template repository...
app/web/status/status_update.py (1)

143-144: Confirm conditionally resetting suggestions.

The conditionally set suggestions = None logic is acceptable, but verify that suggestions is indeed optional or absent in certain DTOs. Otherwise, you might streamline with a typed field instead of relying on hasattr.

🧰 Tools
🪛 GitHub Actions: Run linters

[warning] Code formatting does not comply with Black style. File needs reformatting.

app/web/routers/pipelines.py (1)

238-260: Thorough exception handling.

This worker function properly logs and handles exceptions, transitioning the pipeline into an error state when needed. Consider adding unit tests to simulate failure scenarios.

🧰 Tools
🪛 GitHub Actions: Run linters

[warning] Code formatting does not comply with Black style. File needs reformatting.

app/domain/inconsistency_check_pipeline_execution_dto.py (2)

6-6: Remove extra empty line.

There's an unnecessary extra empty line that can be removed to maintain consistent spacing between imports and class definition.

 from .data.programming_exercise_dto import ProgrammingExerciseDTO
 
-
 class InconsistencyCheckPipelineExecutionDTO(BaseModel):

7-9: Add documentation and field descriptions.

The class would benefit from:

  1. A docstring explaining its purpose and usage
  2. Field descriptions for better API documentation
  3. Optional validation rules if needed
 class InconsistencyCheckPipelineExecutionDTO(BaseModel):
-    execution: PipelineExecutionDTO
-    exercise: ProgrammingExerciseDTO
+    """Data Transfer Object for inconsistency check pipeline execution.
+    
+    This DTO encapsulates the necessary data for executing an inconsistency check
+    between a programming exercise and its implementation.
+    """
+    execution: PipelineExecutionDTO = Field(
+        description="Pipeline execution details and context"
+    )
+    exercise: ProgrammingExerciseDTO = Field(
+        description="Programming exercise to check for inconsistencies"
+    )
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ddd77de and 4c4f526.

📒 Files selected for processing (8)
  • app/common/PipelineEnum.py (1 hunks)
  • app/domain/__init__.py (1 hunks)
  • app/domain/inconsistency_check_pipeline_execution_dto.py (1 hunks)
  • app/domain/status/inconsistency_check_status_update_dto.py (1 hunks)
  • app/pipeline/inconsistenct_check_pipeline.py (1 hunks)
  • app/pipeline/prompts/inconsistency_check_prompts.py (1 hunks)
  • app/web/routers/pipelines.py (4 hunks)
  • app/web/status/status_update.py (4 hunks)
🧰 Additional context used
🪛 Ruff (0.8.2)
app/domain/__init__.py

9-9: .inconsistency_check_pipeline_execution_dto.InconsistencyCheckPipelineExecutionDTO imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)

🪛 GitHub Actions: Run linters
app/domain/__init__.py

[warning] Code formatting does not comply with Black style. File needs reformatting.

app/web/status/status_update.py

[warning] Code formatting does not comply with Black style. File needs reformatting.

app/web/routers/pipelines.py

[warning] Code formatting does not comply with Black style. File needs reformatting.

app/pipeline/inconsistenct_check_pipeline.py

[warning] Code formatting does not comply with Black style. File needs reformatting.

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Build and Push Docker Image
  • GitHub Check: Mend Security Check
🔇 Additional comments (13)
app/pipeline/inconsistenct_check_pipeline.py (4)

9-16: Imports appear consistent
All referenced imports appear to be used correctly in the code. No immediate concerns here.

🧰 Tools
🪛 GitHub Actions: Run linters

[warning] Code formatting does not comply with Black style. File needs reformatting.


17-19: Logger usage is optimal
Using logger = logging.getLogger(__name__) follows standard best practices for Python logging.

🧰 Tools
🪛 GitHub Actions: Run linters

[warning] Code formatting does not comply with Black style. File needs reformatting.


45-51: Docstring is thorough
The documentation for the __call__ method is clear and comprehensive, explaining the pipeline steps precisely. Good job!

🧰 Tools
🪛 GitHub Actions: Run linters

[warning] Code formatting does not comply with Black style. File needs reformatting.


73-75: Thread-safety verification
If _append_tokens can be called from multiple threads, appending to self.tokens might lead to concurrency issues. Confirm usage patterns to avoid data races.

✅ Verification successful

Thread safety confirmed: No concurrency issues with _append_tokens
Each pipeline instance is created per request and runs in its own thread with isolated state. The _append_tokens method operates only on instance-specific self.tokens list, making it thread-safe by design.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Searching for concurrency references that might call _append_tokens in parallel.
rg '_append_tokens' -A 10
ast-grep --pattern $'Thread($_, $_)'

Length of output: 12367


Script:

#!/bin/bash
# Check worker implementations and pipeline instance creation
rg "run_.*_pipeline_worker" -A 10

Length of output: 9183


Script:

#!/bin/bash
# Check pipeline instantiation and storage patterns
rg "= .*Pipeline\(" -A 5
rg "global.*pipeline" -i

Length of output: 6948

🧰 Tools
🪛 GitHub Actions: Run linters

[warning] Code formatting does not comply with Black style. File needs reformatting.

app/common/PipelineEnum.py (1)

17-17: New pipeline enumeration
Adding IRIS_INCONSISTENCY_CHECK aligns well with the existing naming convention.

app/web/status/status_update.py (3)

15-15: Usage confirmed.

This import is used later in the InconsistencyCheckCallback class. No issues found.

🧰 Tools
🪛 GitHub Actions: Run linters

[warning] Code formatting does not comply with Black style. File needs reformatting.


175-176: Same suggestion as above.

🧰 Tools
🪛 GitHub Actions: Run linters

[warning] Code formatting does not comply with Black style. File needs reformatting.


281-301: New callback class looks good.

The InconsistencyCheckCallback class is clear, properly initializes stages, and logs errors. Consider adding docstrings or test coverage for completeness.

🧰 Tools
🪛 GitHub Actions: Run linters

[warning] Code formatting does not comply with Black style. File needs reformatting.

app/web/routers/pipelines.py (4)

13-13: Import usage is valid.

This import is used in the new worker function and route to handle the DTO.

🧰 Tools
🪛 GitHub Actions: Run linters

[warning] Code formatting does not comply with Black style. File needs reformatting.


24-24: Import usage is valid.

InconsistencyCheckCallback is instantiated in the worker function. No issues found.

🧰 Tools
🪛 GitHub Actions: Run linters

[warning] Code formatting does not comply with Black style. File needs reformatting.


31-31: Import usage is valid.

InconsistencyCheckPipeline is properly invoked in the new worker function.

🧰 Tools
🪛 GitHub Actions: Run linters

[warning] Code formatting does not comply with Black style. File needs reformatting.


338-345: Additional variant registration.

The new pipeline variant is clearly defined here. Remember to run Black on this file to address style warnings.

🧰 Tools
🪛 GitHub Actions: Run linters

[warning] Code formatting does not comply with Black style. File needs reformatting.

app/domain/inconsistency_check_pipeline_execution_dto.py (1)

7-9: Well-structured DTO with clear purpose.

The class is well-designed:

  • Clear and specific naming that follows the established pattern
  • Appropriate use of Pydantic for data validation
  • Good separation of concerns by having a dedicated DTO for this pipeline type

app/pipeline/inconsistenct_check_pipeline.py Outdated Show resolved Hide resolved
app/pipeline/inconsistenct_check_pipeline.py Outdated Show resolved Hide resolved
app/pipeline/inconsistenct_check_pipeline.py Outdated Show resolved Hide resolved
app/pipeline/inconsistenct_check_pipeline.py Outdated Show resolved Hide resolved
app/domain/__init__.py Outdated Show resolved Hide resolved
app/web/routers/pipelines.py Outdated Show resolved Hide resolved
@FelixTJDietrich FelixTJDietrich force-pushed the feature/artemis-intelligence/inconsistency-check branch from 8f3f96e to 0c9cca4 Compare January 27, 2025 08:47
@FelixTJDietrich FelixTJDietrich marked this pull request as ready for review January 27, 2025 08:48
Copy link
Contributor

@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 (3)
app/pipeline/inconsistency_check_pipeline.py (1)

1-74: Reformat using Black
The pipeline failures indicate that this file does not comply with Black. Please run Black to ensure consistent formatting.

🧰 Tools
🪛 GitHub Actions: Run linters

[warning] File needs to be reformatted using Black

app/web/routers/pipelines.py (2)

238-260: Check for variant usage
Within run_inconsistency_check_pipeline_worker, the _variant parameter is unused when constructing and running the pipeline. If variants matter for the inconsistency check, consider passing _variant to InconsistencyCheckPipeline for clarity or removing the parameter if it's unnecessary.

🧰 Tools
🪛 GitHub Actions: Run linters

[warning] File needs to be reformatted using Black


Line range hint 1-345: Reformat using Black
Lint checks indicate this file needs reformatting to comply with Black style guidelines.

🧰 Tools
🪛 GitHub Actions: Run linters

[warning] File needs to be reformatted using Black

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4c4f526 and 0c9cca4.

📒 Files selected for processing (3)
  • app/pipeline/inconsistency_check_pipeline.py (1 hunks)
  • app/pipeline/prompts/inconsistency_check_prompts.py (1 hunks)
  • app/web/routers/pipelines.py (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/pipeline/prompts/inconsistency_check_prompts.py
🧰 Additional context used
🪛 GitHub Actions: Run linters
app/web/routers/pipelines.py

[warning] File needs to be reformatted using Black

app/pipeline/inconsistency_check_pipeline.py

[warning] File needs to be reformatted using Black

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build and Push Docker Image
🔇 Additional comments (3)
app/web/routers/pipelines.py (3)

Line range hint 13-31: Imports look good
All added imports for InconsistencyCheckPipelineExecutionDTO, InconsistencyCheckCallback, and InconsistencyCheckPipeline are consistent with usage in this file.

🧰 Tools
🪛 GitHub Actions: Run linters

[warning] File needs to be reformatted using Black


262-274: Route aligned with other endpoints
The new endpoint follows the established pattern of creating a thread to run the pipeline worker. This is consistent with the existing pipeline approach.

🧰 Tools
🪛 GitHub Actions: Run linters

[warning] File needs to be reformatted using Black


338-345: Variant listing is consistent
Listing a default variant for "INCONSISTENCY_CHECK" aligns with the approach for other pipeline features.

🧰 Tools
🪛 GitHub Actions: Run linters

[warning] File needs to be reformatted using Black

app/pipeline/inconsistency_check_pipeline.py Outdated Show resolved Hide resolved
app/pipeline/inconsistency_check_pipeline.py Outdated Show resolved Hide resolved
coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 27, 2025
bassner
bassner previously approved these changes Jan 28, 2025
@bassner
Copy link
Member

bassner commented Jan 28, 2025

@FelixTJDietrich Can you review the conflicts, please?

@FelixTJDietrich
Copy link
Contributor Author

@bassner should be good now

Copy link
Contributor

@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: 1

🧹 Nitpick comments (1)
app/web/routers/pipelines.py (1)

325-334: Add logging for pipeline start similar to rewriting pipeline.

For consistency with other routes (e.g., rewriting pipeline), add logging when the pipeline starts.

Apply this diff:

 def run_inconsistency_check_pipeline(
     variant: str, dto: InconsistencyCheckPipelineExecutionDTO
 ):
+    logger.info(f"Inconsistency check pipeline started with variant: {variant} and dto: {dto}")
     thread = Thread(target=run_inconsistency_check_pipeline_worker, args=(dto, variant))
     thread.start()
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0c9cca4 and 5b370f6.

📒 Files selected for processing (6)
  • app/common/PipelineEnum.py (1 hunks)
  • app/domain/__init__.py (1 hunks)
  • app/pipeline/inconsistency_check_pipeline.py (1 hunks)
  • app/pipeline/prompts/inconsistency_check_prompts.py (1 hunks)
  • app/web/routers/pipelines.py (6 hunks)
  • app/web/status/status_update.py (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • app/common/PipelineEnum.py
  • app/pipeline/prompts/inconsistency_check_prompts.py
  • app/web/status/status_update.py
🧰 Additional context used
🪛 Ruff (0.8.2)
app/domain/__init__.py

10-10: .inconsistency_check_pipeline_execution_dto.InconsistencyCheckPipelineExecutionDTO imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Build and Push Docker Image
  • GitHub Check: Mend Security Check
🔇 Additional comments (4)
app/domain/__init__.py (1)

9-11: Verify the import's usage in the codebase.

Let's confirm that this DTO is being used elsewhere in the codebase.

✅ Verification successful

Import is valid and actively used in the codebase

The InconsistencyCheckPipelineExecutionDTO is properly used in multiple components:

  • Used for type hints in app/pipeline/inconsistency_check_pipeline.py
  • Used in multiple function signatures in app/web/routers/pipelines.py
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for usages of InconsistencyCheckPipelineExecutionDTO
rg "InconsistencyCheckPipelineExecutionDTO" --type python

Length of output: 88


Script:

#!/bin/bash
# Search for both the class name and the file
echo "=== Searching for class usage ==="
rg "InconsistencyCheckPipelineExecutionDTO"

echo -e "\n=== Searching for the file ==="
fd "inconsistency_check_pipeline_execution_dto.py"

echo -e "\n=== Searching for imports using ast-grep ==="
ast-grep --pattern 'from $_ import InconsistencyCheckPipelineExecutionDTO'

Length of output: 1265

🧰 Tools
🪛 Ruff (0.8.2)

10-10: .inconsistency_check_pipeline_execution_dto.InconsistencyCheckPipelineExecutionDTO imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)

app/pipeline/inconsistency_check_pipeline.py (2)

20-41: ⚠️ Potential issue

Consider adding error handling for callback initialization.

The callback is assigned directly without checking if it's None, which could lead to NullPointerException when calling callback methods.

Apply this diff to add error handling:

     def __init__(self, callback: Optional[InconsistencyCheckCallback] = None):
         super().__init__(implementation_id="inconsistency_check_pipeline")
         completion_args = CompletionArguments(temperature=0, max_tokens=2000)
         self.llm = IrisLangchainChatModel(
             request_handler=CapabilityRequestHandler(
                 requirements=RequirementList(
                     gpt_version_equivalent=4.5,
                     context_length=16385,
                 )
             ),
             completion_args=completion_args,
         )
         self.prompt = PromptTemplate.from_template(basic_prompt)
         self.pipeline = self.prompt | self.llm | StrOutputParser()
-        self.callback = callback
+        self.callback = callback or NoOpInconsistencyCheckCallback()
         self.tokens = []

Likely invalid or redundant comment.


42-71: 🛠️ Refactor suggestion

Add error handling for template repository processing.

The template repository processing could fail if the dictionary is empty or contains invalid entries.

Also, consider adding input validation for the problem statement.

Apply this diff to add validation:

         if not dto.exercise:
             logger.error("Inconsistency check pipeline requires an exercise")
             raise ValueError("Exercise is required")
 
+        if not dto.exercise.problem_statement:
+            logger.error("Problem statement is required")
+            raise ValueError("Problem statement is required")
+
+        if not dto.exercise.template_repository:
+            logger.error("Template repository is required")
+            raise ValueError("Template repository is required")
+
         logger.info("Running inconsistency check pipeline...")
app/web/routers/pipelines.py (1)

399-406: LGTM!

The pipeline variant definition is consistent with other pipeline variants.

app/web/routers/pipelines.py Show resolved Hide resolved
@bassner bassner merged commit d37f5c4 into main Jan 28, 2025
7 checks passed
@bassner bassner deleted the feature/artemis-intelligence/inconsistency-check branch January 28, 2025 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants