Skip to content

Conversation

ahmetsenturk
Copy link
Contributor

@ahmetsenturk ahmetsenturk commented Oct 5, 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 added multiple integration tests (Spring) related to the features (with a high test coverage).
  • I documented the Java code using JavaDoc style.

Motivation and Context

When Athena generates feedback, it makes use of competencies that are linked to exercises - so these competencies need to be passed to Athena.

Description

This PR extracts the competencies that are linked to an exercise and send to Athena when a feedback is requested.

Steps for Testing

Prerequisites:

  • 1 Programming/Modeling/Text Exercise with Athena modules enabled
  1. Log in to Artemis
  2. Navigate to an exercise
  3. Submit a solution and request for an AI feedback
  4. See that the feedback is generated and nothing crashes

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

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Test Coverage

Summary by CodeRabbit

  • New Features

    • Feedback suggestions (text, programming, modeling) can include optional course competency context to improve relevance.
    • Competency information is fetched per exercise and supplied with suggestion requests when available; no behavior change if competency data is absent.
    • A standardized competency data type was added to expose id, title, description, and taxonomy.
  • Bug Fixes

    • Minor documentation typo corrected.

@github-project-automation github-project-automation bot moved this to Work In Progress in Artemis Development Oct 5, 2025
@github-actions github-actions bot added server Pull requests that update Java code. (Added Automatically!) athena Pull requests that affect the corresponding module atlas Pull requests that affect the corresponding module labels Oct 5, 2025
Copy link

github-actions bot commented Oct 5, 2025

End-to-End (E2E) Test Results Summary

TestsPassed ☑️Skipped ⚠️Failed ❌️Time ⏱
End-to-End (E2E) Test Report205 ran200 passed3 skipped2 failed1h 14m 41s 339ms
TestResultTime ⏱
End-to-End (E2E) Test Report
e2e/exercise/quiz-exercise/QuizExerciseManagement.spec.ts
ts.Quiz Exercise Management › Quiz Exercise Creation › Creates a Quiz with Drag and Drop❌ failure2m 5s 990ms
e2e/exercise/programming/ProgrammingExerciseStaticCodeAnalysis.spec.ts
ts.Static code analysis tests › Configures SCA grading and makes a successful submission with SCA errors❌ failure2m 38s 385ms

@ahmetsenturk ahmetsenturk marked this pull request as ready for review October 6, 2025 08:34
@ahmetsenturk ahmetsenturk requested review from a team as code owners October 6, 2025 08:34
Copy link
Contributor

coderabbitai bot commented Oct 6, 2025

Walkthrough

Adds course competency support: new CourseCompetencyDTO and CourseCompetencyApi method, and updates AthenaFeedbackSuggestionsService to accept an optional CourseCompetencyApi, fetch/map competencies per exercise, compute latestSubmission, and include both in the RequestDTO used by feedback suggestion flows.

Changes

Cohort / File(s) Summary
Service: Feedback suggestions integration
src/main/java/de/tum/cit/aet/artemis/athena/service/AthenaFeedbackSuggestionsService.java
Constructor now accepts Optional<CourseCompetencyApi) and adds private final Optional<CourseCompetencyApi> courseCompetencyApi; computes latestSubmission; fetches and maps competencies when API present; extends RequestDTO to include latestSubmission and List<CourseCompetencyDTO> competencies; passes competencies (or null) into text/programming/modeling suggestion flows; minor javadoc typo fix.
Atlas API: Competency lookup
src/main/java/de/tum/cit/aet/artemis/atlas/api/CourseCompetencyApi.java
Adds public List<CourseCompetency> findAllByExerciseIdWithExerciseLinks(long exerciseId) delegating to repository to return exercise-linked competencies.
DTO: Competency transfer object
src/main/java/de/tum/cit/aet/artemis/atlas/dto/CourseCompetencyDTO.java
Adds public record CourseCompetencyDTO(long id, @NotNull String title, @Nullable String description, @Nullable CompetencyTaxonomy taxonomy) with JsonInclude.NON_EMPTY and public static CourseCompetencyDTO of(CourseCompetency competency) for mapping domain objects to DTOs.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Caller
  participant Service as AthenaFeedbackSuggestionsService
  participant API as CourseCompetencyApi
  participant Repo as CourseCompetencyRepository
  participant Builder as RequestDTO
  participant Engine as SuggestionEngine

  Caller->>Service: get*FeedbackSuggestions(exerciseId, ...)
  rect rgba(230,240,255,0.6)
    note right of Service: compute latestSubmission (if available)
  end

  alt CourseCompetencyApi present
    Service->>API: findAllByExerciseIdWithExerciseLinks(exerciseId)
    API->>Repo: findAllByExerciseIdWithExerciseLinks(exerciseId)
    Repo-->>API: List<CourseCompetency>
    API-->>Service: List<CourseCompetency>
    Service->>Service: Map to List<CourseCompetencyDTO>
  else CourseCompetencyApi absent
    Service->>Service: competencies = null
  end

  Service->>Builder: Build RequestDTO(..., latestSubmission, competencies)
  Builder-->>Service: RequestDTO
  Service->>Engine: send RequestDTO
  Engine-->>Service: suggestions
  Service-->>Caller: suggestions
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly and concisely identifies the core change of extracting and sending competencies to Athena for feedback under the Adaptive Learning initiative, making it specific and relevant to the changeset.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/athena/course-competencies

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.

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

🧹 Nitpick comments (1)
src/main/java/de/tum/cit/aet/artemis/athena/service/AthenaFeedbackSuggestionsService.java (1)

32-248: Consider factoring out competency lookups.

The new competency mapping logic repeats in all three request builders. A small helper such as private List<CourseCompetencyDTO> resolveCompetencies(long exerciseId) would keep the methods focused on request assembly and reduce duplication. Not urgent, but it would simplify future tweaks.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6099522 and 3a98ecd.

📒 Files selected for processing (4)
  • src/main/java/de/tum/cit/aet/artemis/athena/service/AthenaFeedbackSuggestionsService.java (7 hunks)
  • src/main/java/de/tum/cit/aet/artemis/atlas/api/CourseCompetencyApi.java (2 hunks)
  • src/main/java/de/tum/cit/aet/artemis/atlas/dto/CourseCompetencyDTO.java (1 hunks)
  • src/main/java/de/tum/cit/aet/artemis/atlas/repository/CourseCompetencyRepository.java (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/java/**/*.java

⚙️ CodeRabbit configuration file

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

Files:

  • src/main/java/de/tum/cit/aet/artemis/atlas/api/CourseCompetencyApi.java
  • src/main/java/de/tum/cit/aet/artemis/atlas/dto/CourseCompetencyDTO.java
  • src/main/java/de/tum/cit/aet/artemis/athena/service/AthenaFeedbackSuggestionsService.java
  • src/main/java/de/tum/cit/aet/artemis/atlas/repository/CourseCompetencyRepository.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Mend Security Check
  • GitHub Check: Build and Push Docker Image / Build linux/amd64 Docker Image for ls1intum/artemis
  • GitHub Check: Build and Push Docker Image / Build linux/arm64 Docker Image for ls1intum/artemis
  • GitHub Check: client-tests
  • GitHub Check: server-tests
  • GitHub Check: Analyse
🔇 Additional comments (3)
src/main/java/de/tum/cit/aet/artemis/atlas/repository/CourseCompetencyRepository.java (1)

318-320: Good reuse of existing fetch logic.

Leaning on findAllByExerciseIdWithExerciseLinks keeps behavior consistent while exposing the simpler API.

src/main/java/de/tum/cit/aet/artemis/atlas/api/CourseCompetencyApi.java (1)

3-30: Controller delegation looks spot on.

The API surface simply forwards to the repository, which is exactly what we need here—no extra logic leaked.

src/main/java/de/tum/cit/aet/artemis/atlas/dto/CourseCompetencyDTO.java (1)

1-14: DTO implementation looks clean.

Using a record with JsonInclude.NON_EMPTY keeps the payload lean, and the of factory is a tidy mapper.

coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 6, 2025
Copy link

github-actions bot commented Oct 6, 2025

End-to-End (E2E) Test Results Summary

TestsPassed ✅SkippedFailedTime ⏱
End-to-End (E2E) Test Report1 ran1 passed0 skipped0 failed1s 572ms
TestResultTime ⏱
No test annotations available

Copy link
Collaborator

@MaximilianAnzinger MaximilianAnzinger left a comment

Choose a reason for hiding this comment

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

Please have a look at my inline comment

@github-project-automation github-project-automation bot moved this from Work In Progress to Ready For Review in Artemis Development Oct 6, 2025
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: 0

🧹 Nitpick comments (1)
src/main/java/de/tum/cit/aet/artemis/atlas/api/CourseCompetencyApi.java (1)

28-30: Consider adding JavaDoc for the public API method.

The method implementation is clean and follows the existing delegation pattern. However, the PR checklist indicates "JavaDoc added," yet this public method lacks documentation. Adding JavaDoc would clarify the method's purpose, parameter constraints (e.g., valid exercise IDs), and return value behavior (empty list vs. populated list).

Apply this diff to add JavaDoc:

+    /**
+     * Finds all course competencies linked to the specified exercise.
+     *
+     * @param exerciseId the ID of the exercise
+     * @return a list of course competencies linked to the exercise, or an empty list if none exist
+     */
     public List<CourseCompetency> findAllByExerciseId(long exerciseId) {
         return courseCompetencyRepository.findAllByExerciseIdWithExerciseLinks(exerciseId);
     }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3a98ecd and 76c9350.

📒 Files selected for processing (1)
  • src/main/java/de/tum/cit/aet/artemis/atlas/api/CourseCompetencyApi.java (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/java/**/*.java

⚙️ CodeRabbit configuration file

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

Files:

  • src/main/java/de/tum/cit/aet/artemis/atlas/api/CourseCompetencyApi.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: Build and Push Docker Image / Build linux/arm64 Docker Image for ls1intum/artemis
  • GitHub Check: Build and Push Docker Image / Build linux/amd64 Docker Image for ls1intum/artemis
  • GitHub Check: Build .war artifact
  • GitHub Check: client-style
  • GitHub Check: bean-instantiation-check
  • GitHub Check: client-tests
  • GitHub Check: server-tests
  • GitHub Check: server-style
  • GitHub Check: Analyse
🔇 Additional comments (1)
src/main/java/de/tum/cit/aet/artemis/atlas/api/CourseCompetencyApi.java (1)

3-3: LGTM!

The import is necessary for the new method's return type and follows standard Java conventions.

coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 6, 2025
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: 3

🧹 Nitpick comments (1)
src/main/java/de/tum/cit/aet/artemis/athena/service/AthenaFeedbackSuggestionsService.java (1)

191-192: Consider adding error handling for competency fetching.

The extractLearnerProfile() method includes try-catch error handling (lines 163-169), but the competency fetching logic does not. For consistency and robustness, consider wrapping the competency API call in similar error handling.

If you extract the helper method as suggested above, add error handling:

private List<CourseCompetencyDTO> getCompetenciesForExercise(long exerciseId) {
    try {
        return courseCompetencyApi
                .map(api -> api.findAllByExerciseIdWithExerciseLinks(exerciseId).stream()
                        .map(CourseCompetencyDTO::of)
                        .toList())
                .orElse(null);
    }
    catch (Exception e) {
        log.error("Error retrieving competencies for exercise {}: {}", exerciseId, e.getMessage());
        return null;
    }
}
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 76c9350 and 359df50.

📒 Files selected for processing (2)
  • src/main/java/de/tum/cit/aet/artemis/athena/service/AthenaFeedbackSuggestionsService.java (7 hunks)
  • src/main/java/de/tum/cit/aet/artemis/atlas/api/CourseCompetencyApi.java (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/java/**/*.java

⚙️ CodeRabbit configuration file

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

Files:

  • src/main/java/de/tum/cit/aet/artemis/atlas/api/CourseCompetencyApi.java
  • src/main/java/de/tum/cit/aet/artemis/athena/service/AthenaFeedbackSuggestionsService.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: client-style
  • GitHub Check: client-tests
  • GitHub Check: server-style
  • GitHub Check: server-tests
  • GitHub Check: Build and Push Docker Image / Build linux/amd64 Docker Image for ls1intum/artemis
  • GitHub Check: Build and Push Docker Image / Build linux/arm64 Docker Image for ls1intum/artemis
  • GitHub Check: Build .war artifact
  • GitHub Check: Analyse
  • GitHub Check: bean-instantiation-check
🔇 Additional comments (2)
src/main/java/de/tum/cit/aet/artemis/athena/service/AthenaFeedbackSuggestionsService.java (2)

213-218: LGTM: Consistent implementation across feedback methods.

The addition of latestSubmission and competencies to the programming feedback flow follows the same pattern as the text feedback flow, ensuring consistency across exercise types.


241-247: LGTM: Consistent implementation across feedback methods.

The addition of latestSubmission and competencies to the modeling feedback flow follows the same pattern as the other feedback flows, ensuring consistency across exercise types.

Copy link

github-actions bot commented Oct 6, 2025

End-to-End (E2E) Test Results Summary

TestsPassed ✅SkippedFailedTime ⏱
End-to-End (E2E) Test Report1 ran1 passed0 skipped0 failed1s 683ms
TestResultTime ⏱
No test annotations available

coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 7, 2025
Copy link

github-actions bot commented Oct 7, 2025

End-to-End (E2E) Test Results Summary

TestsPassed ✅SkippedFailedTime ⏱
End-to-End (E2E) Test Report1 ran1 passed0 skipped0 failed1s 648ms
TestResultTime ⏱
No test annotations available

@helios-aet helios-aet bot temporarily deployed to artemis-test1.artemis.cit.tum.de October 7, 2025 12:29 Inactive
coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 7, 2025
Copy link

github-actions bot commented Oct 7, 2025

End-to-End (E2E) Test Results Summary

TestsPassed ✅SkippedFailedTime ⏱
End-to-End (E2E) Test Report1 ran1 passed0 skipped0 failed1s 532ms
TestResultTime ⏱
No test annotations available

Copy link
Collaborator

@MaximilianAnzinger MaximilianAnzinger left a comment

Choose a reason for hiding this comment

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

In my opinion you still fetch data that is not required. What do you need the links for?

@ahmetsenturk
Copy link
Contributor Author

In my opinion you still fetch data that is not required. What do you need the links for?

Well, I need to fetch the competencies that are linked to an exercise, and as far as I understand, I can do that through exercise links. @MaximilianAnzinger

Copy link

End-to-End (E2E) Test Results Summary

TestsPassed ✅Skipped ⚠️FailedTime ⏱
End-to-End (E2E) Test Report205 ran202 passed3 skipped0 failed1h 4m 1s 918ms
TestResultTime ⏱
No test annotations available

tobias-lippert
tobias-lippert previously approved these changes Oct 14, 2025
Copy link
Contributor

@tobias-lippert tobias-lippert left a comment

Choose a reason for hiding this comment

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

Lgtm, just one comment

Copy link
Contributor

@florian-glombik florian-glombik left a comment

Choose a reason for hiding this comment

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

Code

I agree that the annotations should be added to the records

Copy link
Contributor

@tobias-lippert tobias-lippert left a comment

Choose a reason for hiding this comment

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

reapprove code

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

🧹 Nitpick comments (1)
src/main/java/de/tum/cit/aet/artemis/atlas/dto/CourseCompetencyDTO.java (1)

14-16: Align null-safety in of(CourseCompetency) with other DTOs
Either annotate the competency parameter with @NotNull and add a null check (as in CompetencyJolDTO.of) or consistently omit parameter validation across all of(...) methods.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fb88e51 and 543dfd7.

📒 Files selected for processing (1)
  • src/main/java/de/tum/cit/aet/artemis/atlas/dto/CourseCompetencyDTO.java (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/java/**/*.java

⚙️ CodeRabbit configuration file

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

Files:

  • src/main/java/de/tum/cit/aet/artemis/atlas/dto/CourseCompetencyDTO.java
🧠 Learnings (1)
📚 Learning: 2024-07-02T21:16:24.494Z
Learnt from: JohannesStoehr
PR: ls1intum/Artemis#8947
File: src/main/java/de/tum/in/www1/artemis/service/ExerciseService.java:760-762
Timestamp: 2024-07-02T21:16:24.494Z
Learning: Even when the `NotNull` annotation is used, adding a null check in methods is recommended to catch potential issues early and provide clear error messages.

Applied to files:

  • src/main/java/de/tum/cit/aet/artemis/atlas/dto/CourseCompetencyDTO.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: server-style
  • GitHub Check: server-tests
  • GitHub Check: client-style
  • GitHub Check: client-tests
  • GitHub Check: Build and Push Docker Image / Build linux/amd64 Docker Image for ls1intum/artemis
  • GitHub Check: Build and Push Docker Image / Build linux/arm64 Docker Image for ls1intum/artemis
  • GitHub Check: Build .war artifact
  • GitHub Check: Mend Security Check
  • GitHub Check: bean-instantiation-check
  • GitHub Check: Analyse
🔇 Additional comments (1)
src/main/java/de/tum/cit/aet/artemis/atlas/dto/CourseCompetencyDTO.java (1)

11-12: LGTM!

The record definition follows best practices:

  • Uses Java record as per coding guidelines
  • All non-primitive fields are properly annotated with @NotNull or @Nullable as per past review guidance
  • Uses primitive long for id (prefer_primitives guideline)
  • Minimal data approach (single responsibility)
  • @JsonInclude(NON_EMPTY) appropriately excludes empty fields from JSON

Copy link
Contributor

@florian-glombik florian-glombik left a comment

Choose a reason for hiding this comment

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

Re-approve code

Copy link

End-to-End (E2E) Test Results Summary

TestsPassed ✅Skipped ⚠️FailedTime ⏱
End-to-End (E2E) Test Report205 ran202 passed3 skipped0 failed1h 12m 40s 316ms
TestResultTime ⏱
No test annotations available

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

athena Pull requests that affect the corresponding module atlas Pull requests that affect the corresponding module ready for review server Pull requests that update Java code. (Added Automatically!)

Projects

Status: Ready For Review

Development

Successfully merging this pull request may close these issues.

4 participants