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 #10467

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

Conversation

ekayandan
Copy link

@ekayandan ekayandan commented Mar 12, 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

Test Coverage

Summary by CodeRabbit

  • Refactor
    • Simplified the creation process for programming exercises by streamlining the initialization steps.
    • New exercises now automatically configure all associated build plans for both template and solution setups, ensuring a more consistent experience.
    • Removed redundant configuration parameters to reduce complexity and enhance overall stability.

@ekayandan ekayandan requested a review from BBesrour March 12, 2025 13:22
@ekayandan ekayandan self-assigned this Mar 12, 2025
@ekayandan ekayandan requested a review from a team as a code owner March 12, 2025 13:22
@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 12, 2025
@ekayandan ekayandan requested review from BBesrour, SimonEntholzer, jfr2102, bensofficial and magaupp and removed request for BBesrour March 12, 2025 13:23
Copy link

coderabbitai bot commented Mar 12, 2025

Walkthrough

This pull request removes boolean parameters from several method calls and signatures related to programming exercise creation and build plan setup. The changes affect the import and resource classes as well as the core programming exercise service. With the removal of the boolean flags, methods now rely on default behavior without explicit configuration for import conditions, and build plans are consistently set up for new exercises.

Changes

File(s) Change Summary
src/.../ProgrammingExerciseImportFromFileService.java, src/.../ProgrammingExerciseImportService.java, src/.../ProgrammingExerciseResource.java Removed boolean parameters from method calls for creating programming exercises and setting up build plans; updated invocations to match the revised service method signatures.
src/.../ProgrammingExerciseService.java Removed boolean parameters from both createProgrammingExercise and setupBuildPlansForNewExercise method signatures; simplified internal logic by always triggering build plans regardless of import status.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client
    participant Resource as ProgrammingExerciseResource
    participant Service as ProgrammingExerciseService
    Client->>Resource: createProgrammingExercise(request)
    Resource->>Service: createProgrammingExercise(exercise)
    Service->>Service: Initialize exercise (no import flag)
    Service->>Service: setupBuildPlansForNewExercise(exercise)
    Service-->>Resource: Return created exercise
    Resource-->>Client: Response with exercise details
Loading

Possibly related PRs

Suggested labels

tests, server, programming, ready to merge, exercise

Suggested reviewers

  • SimonEntholzer
  • JohannesStoehr
  • krusche
  • florian-glombik
  • JohannesWt

📜 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 b099120 and d627414.

📒 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/ProgrammingExerciseImportFromFileService.java
  • src/main/java/de/tum/cit/aet/artemis/programming/web/ProgrammingExerciseResource.java
  • src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseImportService.java
  • src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseService.java
🧠 Learnings (1)
src/main/java/de/tum/cit/aet/artemis/programming/web/ProgrammingExerciseResource.java (3)
Learnt from: Hialus
PR: ls1intum/Artemis#8607
File: src/main/java/de/tum/in/www1/artemis/web/rest/programming/ProgrammingExerciseResource.java:64-64
Timestamp: 2025-03-12T13:17:43.235Z
Learning: For the Artemis project, import statements are automatically managed by formatters and should not be commented on.
Learnt from: iyannsch
PR: ls1intum/Artemis#8965
File: src/main/java/de/tum/in/www1/artemis/domain/ProgrammingExercise.java:312-314
Timestamp: 2025-03-12T13:17:29.521Z
Learning: For the Artemis project, the setter methods for boolean fields can use the primitive type `boolean` instead of the wrapper class `Boolean` to avoid null values and ensure consistency.
Learnt from: iyannsch
PR: ls1intum/Artemis#8965
File: src/main/java/de/tum/in/www1/artemis/domain/ProgrammingExercise.java:97-98
Timestamp: 2025-03-12T13:17:29.521Z
Learning: For the Artemis project, the field `allowOnlineIde` in the `ProgrammingExercise` class should use the primitive type `boolean` to ensure it is non-nullable.
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: Call Build Workflow / Build .war artifact
  • GitHub Check: Call Build Workflow / Build and Push Docker Image
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: client-style
  • GitHub Check: client-tests
  • GitHub Check: server-style
  • GitHub Check: server-tests
  • GitHub Check: Analyse
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (6)
src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseImportService.java (1)

318-318: Removed conditional check for imported files ensures build plans are always set up

This change now calls setupBuildPlansForNewExercise without the boolean parameter that previously prevented build plan setup for imported exercises. This will fix the issue where build results weren't available after file import.

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

252-252: Method call updated to match new method signature

The call to createProgrammingExercise has been updated to match the new method signature that no longer includes the boolean parameter. This ensures consistency with the service implementation.

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

110-110: Method call updated to match new method signature

The call to createProgrammingExercise has been modified to remove the boolean parameter that previously indicated this was an import from file. This change ensures that build plans will be properly set up for exercises imported from files.

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

279-279: Simplified method signature by removing conditional parameter

The isImportedFromFile parameter has been removed from the method signature, simplifying the API and preventing conditional treatment of exercises based on their import status.


514-514: Simplified method signature by removing conditional parameter

Removed the isImportedFromFile parameter from the method signature, which previously controlled whether build plans would be set up for imported exercises.


541-543: Build plans are now always triggered for both participations

These lines now unconditionally trigger builds for both template and solution participations, regardless of whether the exercise was imported from a file. This addresses the core issue in the PR objectives where build results weren't available after file import.

✨ 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.

@ekayandan ekayandan changed the title Bugfix/programming exercises/build results not available after file import Programming exercises: Fix build results not available after file import Mar 12, 2025
@helios-aet helios-aet bot temporarily deployed to artemis-test6.artemis.cit.tum.de March 12, 2025 13:27 Inactive
@helios-aet helios-aet bot temporarily deployed to artemis-test6.artemis.cit.tum.de March 12, 2025 14:50 Inactive
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

@helios-aet helios-aet bot temporarily deployed to artemis-test4.artemis.cit.tum.de March 12, 2025 19:58 Inactive
Copy link
Contributor

@SimonEntholzer SimonEntholzer left a comment

Choose a reason for hiding this comment

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

Works on Ts4 👍 fixes the issue
image

Copy link
Contributor

@jfr2102 jfr2102 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

@ekayandan ekayandan removed the request for review from bensofficial March 13, 2025 14:10
Copy link
Contributor

@jfr2102 jfr2102 left a comment

Choose a reason for hiding this comment

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

Also tested now on TS4. Builds get triggered successfully after importing.

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 ready to merge 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