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

Programming exercises: Fix build results not available after file import #10458

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

ekayandan
Copy link

@ekayandan ekayandan commented Mar 10, 2025

Checklist

General

Server

  • Important: I implemented the changes with a very good performance and prevented too many (unnecessary) and too complex database calls.
  • I strictly followed the principle of data economy for all database calls.
  • I strictly followed the server coding and design guidelines.
  • I documented the Java code using JavaDoc style.

Changes affecting Programming Exercises

  • High priority: I tested all changes and their related features with all corresponding user types on a test server configured with the integrated lifecycle setup (LocalVC and LocalCI).
  • I tested all changes and their related features with all corresponding user types on a test server configured with Gitlab and Jenkins.

Motivation and Context

Describe the bug
When importing a programming exercise from a file, the build results will not be available.
Programming exercises: Build results not available after file import #8562

Description

setupBuildPlansForNewExercise function had a isImportedFromFile check, which prevented scheduling of the initial build job for corresponding exercise

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 1 Course
  • 1 Programming exercise exported as zip file
  1. Log in to Artemis
  2. Navigate to Course Administration
  3. Create a new course
  4. Go to exercises
  5. Import programming exercise from the file
  6. Observe if build result is available

Testserver States

You can manage test servers using Helios. Check environment statuses in the environment list. To deploy to a test server, go to the CI/CD page, find your PR or branch, and trigger the deployment.

Review Progress

Performance Review

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Performance Tests

  • Test 1
  • Test 2

Test Coverage

Summary by CodeRabbit

  • Refactor
    • Streamlined the programming exercise creation and import workflows by eliminating redundant configuration options.
    • Ensured that build plans are now consistently set up for all exercises, providing a more predictable and simplified user experience.

@github-actions github-actions bot added server Pull requests that update Java code. (Added Automatically!) programming Pull requests that affect the corresponding module labels Mar 10, 2025
@ekayandan ekayandan changed the title Bugfix/programming exercises/build results not available after file import#8562 Bugfix/Programming exercises/build results not available after file import#8562 Mar 10, 2025
@ekayandan ekayandan changed the title Bugfix/Programming exercises/build results not available after file import#8562 Programming exercises: fix build results not available after file import#8562 Mar 10, 2025
@ekayandan ekayandan changed the title Programming exercises: fix build results not available after file import#8562 Programming exercises: fix build results not available after file import Mar 10, 2025
@ekayandan ekayandan changed the title Programming exercises: fix build results not available after file import Programming exercises: fix build results not available after file import Mar 10, 2025
@ekayandan ekayandan changed the title Programming exercises: fix build results not available after file import Programming exercises: Fix build results not available after file import Mar 10, 2025
@ekayandan ekayandan marked this pull request as ready for review March 10, 2025 15:19
@ekayandan ekayandan requested a review from a team as a code owner March 10, 2025 15:19
Copy link

coderabbitai bot commented Mar 10, 2025

Walkthrough

This pull request removes a boolean parameter from several method calls and their corresponding signatures. In particular, the createProgrammingExercise and setupBuildPlansForNewExercise methods in the service have been simplified by eliminating the flag previously used to indicate whether the exercise was imported from a file or if build plans should be conditionally recreated. The callers in the import and resource classes have been updated accordingly, ensuring that the methods are now invoked with a single argument.

Changes

File(s) Change Summary
.../ProgrammingExerciseImportFromFileService.java, .../ProgrammingExerciseResource.java, and .../ProgrammingExerciseService.java (for createProgrammingExercise) Removed the boolean parameter from the call to createProgrammingExercise and updated its signature from createProgrammingExercise(ProgrammingExercise, boolean) to createProgrammingExercise(ProgrammingExercise).
.../ProgrammingExerciseImportService.java and .../ProgrammingExerciseService.java (for setupBuildPlansForNewExercise) Removed the boolean parameter from the call to setupBuildPlansForNewExercise and updated its signature from setupBuildPlansForNewExercise(ProgrammingExercise, boolean) to setupBuildPlansForNewExercise(ProgrammingExercise).

Sequence Diagram(s)

sequenceDiagram
  participant Resource as ProgrammingExerciseResource
  participant Service as ProgrammingExerciseService
  Resource ->> Service: createProgrammingExercise(exercise)
  Note over Service: Exercise creation proceeds without the boolean flag.
  Service -->> Resource: newProgrammingExercise
Loading
sequenceDiagram
  participant ImportService as ProgrammingExerciseImportService
  participant Service as ProgrammingExerciseService
  ImportService ->> Service: setupBuildPlansForNewExercise(newExercise)
  Note over Service: Build plans are set up unconditionally.
  Service -->> ImportService: buildPlansConfigured
Loading

Possibly related PRs

Suggested labels

tests, ready to merge

Suggested reviewers

  • SimonEntholzer
  • JohannesStoehr
  • krusche
  • coolchock
  • florian-glombik

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 06f2da4 and e1ef488.

📒 Files selected for processing (4)
  • src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseImportFromFileService.java (1 hunks)
  • src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseImportService.java (1 hunks)
  • src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseService.java (4 hunks)
  • src/main/java/de/tum/cit/aet/artemis/programming/web/ProgrammingExerciseResource.java (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`src/main/java/**/*.java`: naming:CamelCase; principles:{sin...

src/main/java/**/*.java: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_imports

  • src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseImportService.java
  • src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseImportFromFileService.java
  • src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseService.java
  • src/main/java/de/tum/cit/aet/artemis/programming/web/ProgrammingExerciseResource.java
🧠 Learnings (1)
src/main/java/de/tum/cit/aet/artemis/programming/web/ProgrammingExerciseResource.java (1)
Learnt from: Hialus
PR: ls1intum/Artemis#8607
File: src/main/java/de/tum/in/www1/artemis/web/rest/programming/ProgrammingExerciseResource.java:64-64
Timestamp: 2024-11-12T12:51:51.201Z
Learning: For the Artemis project, import statements are automatically managed by formatters and should not be commented on.
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: server-tests-postgres
  • GitHub Check: server-tests-mysql
  • GitHub Check: client-tests
🔇 Additional comments (6)
src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseImportService.java (1)

318-318: Modified to remove boolean parameter from setupBuildPlansForNewExercise call

The method call has been updated to match the new signature of setupBuildPlansForNewExercise, which no longer takes a boolean parameter indicating whether to recreate build plans. This change ensures that build plans are always created for imported exercises, fixing the issue where build results were not available after file import.

src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseImportFromFileService.java (1)

110-110: Modified to remove boolean parameter from createProgrammingExercise call

The method call has been updated to match the new signature of createProgrammingExercise, which no longer takes a boolean parameter indicating whether the exercise is imported from a file. This change is part of the fix that ensures build results are always available after importing a programming exercise from a file.

src/main/java/de/tum/cit/aet/artemis/programming/web/ProgrammingExerciseResource.java (1)

254-254: Modified to remove boolean parameter from createProgrammingExercise call

The method call to programmingExerciseService.createProgrammingExercise has been updated to match the new method signature, which no longer takes a boolean parameter. This change is consistent with the service-layer modifications and ensures proper exercise creation regardless of the source.

src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseService.java (3)

279-279: Simplified createProgrammingExercise method signature

The method signature has been updated to remove the boolean parameter isImportedFromFile, which simplifies the API and helps maintain consistency. This change is part of the fix for issue #8562 where build results were not available after file import.


514-514: Simplified setupBuildPlansForNewExercise method signature

The method signature has been updated to remove the boolean parameter recreate, which simplifies the API. This is a key change to fix the issue where build results were not available after importing a programming exercise from a file, as the previous implementation conditionally triggered build plans based on this parameter.


541-543: Always trigger build plans for both template and solution participations

The conditional logic based on the removed boolean parameter has been eliminated, and build plans are now always triggered for both template and solution participations. This is the core fix for issue #8562, ensuring that build results are always available after importing a programming exercise.

✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • 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.
  • @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 or @coderabbitai title anywhere in the PR title to generate the title automatically.

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
Member

@BBesrour BBesrour left a comment

Choose a reason for hiding this comment

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

code lgtm

@@ -541,13 +538,9 @@ public void setupBuildPlansForNewExercise(ProgrammingExercise programmingExercis
programmingExerciseBuildConfigRepository.saveAndFlush(programmingExercise.getBuildConfig());
}

// if the exercise is imported from a file, the changes fixing the project name will trigger a first build anyway, so
Copy link
Contributor

Choose a reason for hiding this comment

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

for context, do you know if the he behavior mentioned in this comment changed, breaking this?

Copy link
Author

Choose a reason for hiding this comment

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

I didn't, but your question made me wonder. fixing the "project name" was never implemented, but it was planned. So this might be a behaviour ahead of its time. I am also currently working on fixing "project name" task. I will freeze this pr and check if planned implementation really fixes the issue. Thanks for the heads up!

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure though, but it could be a relic from the Bitbucket/Bamboo times of Artemis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix programming Pull requests that affect the corresponding module ready for review server Pull requests that update Java code. (Added Automatically!)
Projects
Status: Work In Progress
Development

Successfully merging this pull request may close these issues.

5 participants