-
Notifications
You must be signed in to change notification settings - Fork 350
Programming exercises: Notify active editors when new changes are saved by another user
#11712
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
base: develop
Are you sure you want to change the base?
Conversation
…e active client saves changes to Problem Statement and Tests/Solution/Template/Auxiliary repositories.
…cise synchronization service
End-to-End (E2E) Test Results Summary
|
||||||||||||||||||||||||||||||
Programming Exercise: Notify active editors when new changes are saved by another user
Programming Exercise: Notify active editors when new changes are saved by another userProgramming exercises: Notify active editors when new changes are saved by another user
… detection logic to ExerciseVersionService
...va/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseSynchronizationService.java
Outdated
Show resolved
Hide resolved
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/TestRepositoryResource.java
Outdated
Show resolved
Hide resolved
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/TestRepositoryResource.java
Show resolved
Hide resolved
wasnertobias
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reviewed code and functionality in person - comments added by yourself. (Small changes left => Afterwards looks good to me!)
End-to-End (E2E) Test Results Summary
|
||||||||||||||||||
…ctive-editors-when-new-changes-are-saved
…ses to better reflect their purpose for editor synchronization
…when-new-changes-are-saved' of github.com:ls1intum/Artemis into feature/exercise-synchronization/notify-active-editors-when-new-changes-are-saved
End-to-End (E2E) Test Results Summary
|
||||||||||||||||||||||||
…n repository resources
End-to-End (E2E) Test Results Summary
|
||||||||||||||||||||||||||||||
End-to-End (E2E) Test Results Summary
|
||||||||||||||||||||||||||||||
…ctive-editors-when-new-changes-are-saved
End-to-End (E2E) Test Results Summary
|
||||||||||||||||||||||||
…ctive-editors-when-new-changes-are-saved
End-to-End (E2E) Test Results Summary
|
||||||||||||||||||||||||||||||
…ctive-editors-when-new-changes-are-saved
WalkthroughAdds real-time editor synchronization: new sync domain types and DTOs, a backend WebSocket broadcasting service, wiring of broadcasts into exercise-version creation and repository operations, a frontend WebSocket subscription service with client-instance filtering and user alerts, plus tests and i18n strings. Changes
Sequence Diagram(s)sequenceDiagram
participant FE-A as Frontend (Editor A)
participant Backend as HTTP API
participant RepoSvc as Repository/ExerciseVersion logic
participant SyncSvc as ProgrammingExerciseEditorSyncService
participant WS as WebSocket Broker
participant FE-B as Frontend (Editor B)
FE-A->>Backend: HTTP modify repo/commit/version
Backend->>RepoSvc: persist change / create version
RepoSvc->>RepoSvc: determine changed sync target(s)
RepoSvc->>SyncSvc: broadcastChange(exerciseId, target, auxId?)
SyncSvc->>WS: send ProgrammingExerciseEditorSyncEventDTO(topic)
WS->>FE-B: deliver sync message
FE-B->>FE-B: ignore if same client-instance
alt relevant change
FE-B->>FE-B: show localized alert (repositoryChanged / problemStatementChanged)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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). (11)
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. Comment |
There was a problem hiding this 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 (4)
src/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.java (1)
295-315: Consider usingclearInvocationsinstead ofreseton the WebSocket spy (optional)For the
websocketMessagingServicespy, you only need to clear previous interactions before thenever()verification.reset(websocketMessagingService)also clears any stubbing on that bean, which can be surprising in more complex tests.If you don’t rely on any stubbing, this is harmless; otherwise, prefer:
- reset(websocketMessagingService); + clearInvocations(websocketMessagingService);This keeps existing behavior but avoids unintentionally dropping stubs on the spy.
src/main/java/de/tum/cit/aet/artemis/programming/domain/ProgrammingExerciseEditorSyncTarget.java (1)
3-8: Enum definition is appropriate;@JsonIncludeis redundant (optional)The
ProgrammingExerciseEditorSyncTargetenum cleanly covers all synchronization targets used across backend and frontend.The
@JsonInclude(JsonInclude.Include.NON_EMPTY)on the enum itself is not needed (Jackson won’t serialize “empty” enums), but it doesn’t cause harm. You can remove it for clarity if you prefer:-import com.fasterxml.jackson.annotation.JsonInclude; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) public enum ProgrammingExerciseEditorSyncTarget { PROBLEM_STATEMENT, TEMPLATE_REPOSITORY, SOLUTION_REPOSITORY, TESTS_REPOSITORY, AUXILIARY_REPOSITORY }src/main/java/de/tum/cit/aet/artemis/exercise/service/ExerciseVersionService.java (1)
166-212: Consider documenting the prioritization behavior.The method uses a prioritized if-else chain (template → solution → tests → auxiliary → problem statement) that broadcasts only the first detected change. If multiple repositories are modified in a single version, only one notification is sent. Consider adding a JavaDoc comment explaining this prioritization to help future maintainers understand the intended behavior.
Example:
/** * Compare two exercise snapshots and return the change that should be broadcast to clients. + * If multiple changes are detected, only the highest-priority change is broadcast: + * 1. Template Repository + * 2. Solution Repository + * 3. Tests Repository + * 4. Auxiliary Repositories + * 5. Problem Statement * * @param exerciseId the exercise id * @param newSnapshot the new snapshot * @param previousSnapshot the previous snapshot (optional) */ private void determineSynchronizationForActiveEditors(Long exerciseId, ExerciseSnapshotDTO newSnapshot, ExerciseSnapshotDTO previousSnapshot) {src/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-base-container.component.ts (1)
206-232: Consider user experience implications of non-dismissible alerts.The alerts use
timeout: 0, meaning they never auto-dismiss. If multiple rapid changes occur from other editors, users could be overwhelmed with persistent alerts. Consider either:
- Using a reasonable timeout (e.g., 10000ms)
- Implementing alert deduplication
- Using a less intrusive notification mechanism for frequent updates
Example with timeout:
if (problemStatementChanged) { this.alertService.addAlert({ type: AlertType.WARNING, message: 'artemisApp.editor.synchronization.problemStatementChanged', - timeout: 0, + timeout: 10000, }); } if (repositoryChanged) { this.alertService.addAlert({ type: AlertType.WARNING, message: 'artemisApp.editor.synchronization.repositoryChanged', - timeout: 0, + timeout: 10000, }); }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
.github/workflows/bean-instantiations.ymlis excluded by!**/*.ymlpackage-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (18)
src/main/java/de/tum/cit/aet/artemis/exercise/service/ExerciseVersionService.java(6 hunks)src/main/java/de/tum/cit/aet/artemis/programming/domain/ProgrammingExerciseEditorSyncTarget.java(1 hunks)src/main/java/de/tum/cit/aet/artemis/programming/dto/ProgrammingExerciseEditorSyncEventDTO.java(1 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseEditorSyncService.java(1 hunks)src/main/java/de/tum/cit/aet/artemis/programming/web/repository/AuxiliaryRepositoryResource.java(5 hunks)src/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryProgrammingExerciseParticipationResource.java(10 hunks)src/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryResource.java(3 hunks)src/main/java/de/tum/cit/aet/artemis/programming/web/repository/TestRepositoryResource.java(5 hunks)src/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-and-editor-container.componente.spec.ts(5 hunks)src/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-base-container.component.ts(5 hunks)src/main/webapp/app/programming/manage/services/programming-exercise-editor-sync.service.spec.ts(1 hunks)src/main/webapp/app/programming/manage/services/programming-exercise-editor-sync.service.ts(1 hunks)src/main/webapp/i18n/de/editor.json(1 hunks)src/main/webapp/i18n/en/editor.json(1 hunks)src/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.java(4 hunks)src/test/java/de/tum/cit/aet/artemis/programming/RepositoryIntegrationTest.java(10 hunks)src/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.java(8 hunks)src/test/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseEditorSyncServiceTest.java(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
src/test/java/**/*.java
⚙️ CodeRabbit configuration file
test_naming: descriptive; test_size: small_specific; fixed_data: true; junit5_features: true; assert_use: assertThat; assert_specificity: true; archunit_use: enforce_package_rules; db_query_count_tests: track_performance; util_service_factory_pattern: true; avoid_db_access: true; mock_strategy: static_mocks; context_restart_minimize: true
Files:
src/test/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseEditorSyncServiceTest.javasrc/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/programming/RepositoryIntegrationTest.java
src/main/webapp/**/*.ts
⚙️ CodeRabbit configuration file
Files:
src/main/webapp/app/programming/manage/services/programming-exercise-editor-sync.service.spec.tssrc/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-base-container.component.tssrc/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-and-editor-container.componente.spec.tssrc/main/webapp/app/programming/manage/services/programming-exercise-editor-sync.service.ts
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/programming/web/repository/RepositoryResource.javasrc/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryProgrammingExerciseParticipationResource.javasrc/main/java/de/tum/cit/aet/artemis/programming/web/repository/AuxiliaryRepositoryResource.javasrc/main/java/de/tum/cit/aet/artemis/programming/dto/ProgrammingExerciseEditorSyncEventDTO.javasrc/main/java/de/tum/cit/aet/artemis/programming/domain/ProgrammingExerciseEditorSyncTarget.javasrc/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseEditorSyncService.javasrc/main/java/de/tum/cit/aet/artemis/programming/web/repository/TestRepositoryResource.javasrc/main/java/de/tum/cit/aet/artemis/exercise/service/ExerciseVersionService.java
src/main/webapp/i18n/de/**/*.json
⚙️ CodeRabbit configuration file
German language translations should be informal (dutzen) and should never be formal (sietzen). So the user should always be addressed with "du/dein" and never with "sie/ihr".
Files:
src/main/webapp/i18n/de/editor.json
🧠 Learnings (53)
📚 Learning: 2024-11-26T20:43:17.588Z
Learnt from: magaupp
Repo: ls1intum/Artemis PR: 9751
File: src/test/java/de/tum/cit/aet/artemis/programming/util/ProgrammingExerciseFactory.java:143-148
Timestamp: 2024-11-26T20:43:17.588Z
Learning: In `src/test/java/de/tum/cit/aet/artemis/programming/util/ProgrammingExerciseFactory.java`, the test package name assigned in `populateUnreleasedProgrammingExercise` does not need to adhere to naming conventions.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseEditorSyncServiceTest.javasrc/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryProgrammingExerciseParticipationResource.javasrc/main/java/de/tum/cit/aet/artemis/programming/web/repository/AuxiliaryRepositoryResource.javasrc/main/java/de/tum/cit/aet/artemis/programming/dto/ProgrammingExerciseEditorSyncEventDTO.javasrc/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.javasrc/main/java/de/tum/cit/aet/artemis/programming/domain/ProgrammingExerciseEditorSyncTarget.javasrc/main/java/de/tum/cit/aet/artemis/programming/web/repository/TestRepositoryResource.javasrc/test/java/de/tum/cit/aet/artemis/programming/RepositoryIntegrationTest.javasrc/main/java/de/tum/cit/aet/artemis/exercise/service/ExerciseVersionService.java
📚 Learning: 2025-07-07T11:43:11.736Z
Learnt from: bassner
Repo: ls1intum/Artemis PR: 10705
File: src/test/java/de/tum/cit/aet/artemis/lecture/service/SlideUnhideServiceTest.java:54-57
Timestamp: 2025-07-07T11:43:11.736Z
Learning: In the Artemis test framework, the AbstractArtemisIntegrationTest base class provides common MockitoSpyBean fields like instanceMessageSendService as protected fields, making them available to all test subclasses through inheritance.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseEditorSyncServiceTest.javasrc/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.javasrc/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-and-editor-container.componente.spec.tssrc/test/java/de/tum/cit/aet/artemis/programming/RepositoryIntegrationTest.java
📚 Learning: 2024-10-15T11:33:17.915Z
Learnt from: alexjoham
Repo: ls1intum/Artemis PR: 9455
File: src/test/java/de/tum/cit/aet/artemis/iris/IrisTextExerciseChatMessageIntegrationTest.java:401-401
Timestamp: 2024-10-15T11:33:17.915Z
Learning: In the Artemis project, when new fields are added to classes like `PyrisChatStatusUpdateDTO`, corresponding tests may be implemented in separate integration test classes such as `IrisChatTokenTrackingIntegrationTest`.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseEditorSyncServiceTest.javasrc/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/programming/RepositoryIntegrationTest.java
📚 Learning: 2025-08-11T13:22:05.140Z
Learnt from: Wallenstein61
Repo: ls1intum/Artemis PR: 10989
File: src/test/java/de/tum/cit/aet/artemis/programming/service/sharing/ExerciseSharingResourceImportTest.java:128-131
Timestamp: 2025-08-11T13:22:05.140Z
Learning: In the ExerciseSharingResourceImportTest class in Artemis, mockServer.verify() is not needed in the tearDown method as the test design doesn't require strict verification of all mocked HTTP expectations. The mockServer field is managed differently in this test class.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseEditorSyncServiceTest.javasrc/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/programming/RepositoryIntegrationTest.java
📚 Learning: 2025-10-22T21:31:54.240Z
Learnt from: Elfari1028
Repo: ls1intum/Artemis PR: 11491
File: src/main/java/de/tum/cit/aet/artemis/exercise/web/ExerciseResource.java:376-378
Timestamp: 2025-10-22T21:31:54.240Z
Learning: In Artemis, ExerciseVersionService.createExerciseVersion(...) (src/main/java/de/tum/cit/aet/artemis/exercise/service/ExerciseVersionService.java) eagerly re-fetches the target exercise (via type-specific findForVersioningById) before building the ExerciseSnapshotDTO. Controllers (e.g., ExerciseResource.toggleSecondCorrectionEnabled) do not need to reload the exercise before invoking createExerciseVersion.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseEditorSyncServiceTest.javasrc/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryResource.javasrc/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryProgrammingExerciseParticipationResource.javasrc/main/java/de/tum/cit/aet/artemis/programming/web/repository/AuxiliaryRepositoryResource.javasrc/main/java/de/tum/cit/aet/artemis/programming/dto/ProgrammingExerciseEditorSyncEventDTO.javasrc/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.javasrc/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseEditorSyncService.javasrc/main/java/de/tum/cit/aet/artemis/programming/web/repository/TestRepositoryResource.javasrc/test/java/de/tum/cit/aet/artemis/programming/RepositoryIntegrationTest.javasrc/main/java/de/tum/cit/aet/artemis/exercise/service/ExerciseVersionService.java
📚 Learning: 2025-09-01T10:20:40.706Z
Learnt from: Michael-Breu-UIbk
Repo: ls1intum/Artemis PR: 10989
File: src/main/webapp/app/programming/manage/detail/programming-exercise-detail.component.with-sharing.spec.ts:132-149
Timestamp: 2025-09-01T10:20:40.706Z
Learning: In the Artemis codebase, Angular component test files for ProgrammingExerciseDetailComponent follow a pattern where the component is imported but not explicitly declared in TestBed.configureTestingModule(), yet TestBed.createComponent() still works successfully. This pattern is consistently used across test files like programming-exercise-detail.component.spec.ts and programming-exercise-detail.component.with-sharing.spec.ts.
Applied to files:
src/main/webapp/app/programming/manage/services/programming-exercise-editor-sync.service.spec.tssrc/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-and-editor-container.componente.spec.ts
📚 Learning: 2024-10-13T12:03:02.430Z
Learnt from: pzdr7
Repo: ls1intum/Artemis PR: 9463
File: src/test/javascript/spec/component/shared/monaco-editor/monaco-editor.service.spec.ts:50-55
Timestamp: 2024-10-13T12:03:02.430Z
Learning: In `src/test/javascript/spec/component/shared/monaco-editor/monaco-editor.service.spec.ts`, when a function is called multiple times in a test, use `toHaveBeenCalledTimes` and `toHaveBeenNthCalledWith` assertions instead of `toHaveBeenCalledExactlyOnceWith`.
Applied to files:
src/main/webapp/app/programming/manage/services/programming-exercise-editor-sync.service.spec.tssrc/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-and-editor-container.componente.spec.ts
📚 Learning: 2024-10-20T22:00:52.335Z
Learnt from: pzdr7
Repo: ls1intum/Artemis PR: 9505
File: src/test/javascript/spec/integration/code-editor/code-editor-container.integration.spec.ts:179-181
Timestamp: 2024-10-20T22:00:52.335Z
Learning: In `src/test/javascript/spec/integration/code-editor/code-editor-container.integration.spec.ts`, `ResizeObserver` is mocked within the `beforeEach` block.
Applied to files:
src/main/webapp/app/programming/manage/services/programming-exercise-editor-sync.service.spec.tssrc/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-and-editor-container.componente.spec.ts
📚 Learning: 2025-06-15T13:49:43.096Z
Learnt from: ahmetsenturk
Repo: ls1intum/Artemis PR: 10916
File: src/main/java/de/tum/cit/aet/artemis/atlas/web/LearnerProfileResource.java:36-41
Timestamp: 2025-06-15T13:49:43.096Z
Learning: In the Artemis codebase, the development team has decided to allow direct injection of repositories into REST resources rather than always delegating to service layers. This architectural decision was communicated and decided with peer developers.
Applied to files:
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryResource.javasrc/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryProgrammingExerciseParticipationResource.javasrc/main/java/de/tum/cit/aet/artemis/programming/web/repository/AuxiliaryRepositoryResource.javasrc/main/java/de/tum/cit/aet/artemis/programming/web/repository/TestRepositoryResource.java
📚 Learning: 2025-08-19T09:13:51.235Z
Learnt from: ekayandan
Repo: ls1intum/Artemis PR: 11027
File: src/main/java/de/tum/cit/aet/artemis/programming/service/GitArchiveHelper.java:0-0
Timestamp: 2025-08-19T09:13:51.235Z
Learning: The domain Repository class (de.tum.cit.aet.artemis.programming.domain.Repository) extends JGit's FileRepository, making it polymorphically compatible with JGit APIs while providing additional Artemis-specific methods like getParticipation() and getLocalPath().
Applied to files:
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryResource.javasrc/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryProgrammingExerciseParticipationResource.javasrc/main/java/de/tum/cit/aet/artemis/programming/web/repository/AuxiliaryRepositoryResource.javasrc/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.javasrc/main/java/de/tum/cit/aet/artemis/programming/web/repository/TestRepositoryResource.javasrc/test/java/de/tum/cit/aet/artemis/programming/RepositoryIntegrationTest.java
📚 Learning: 2025-02-11T12:05:49.151Z
Learnt from: janthoXO
Repo: ls1intum/Artemis PR: 9406
File: src/main/java/de/tum/cit/aet/artemis/programming/web/ProgrammingExerciseParticipationResource.java:209-209
Timestamp: 2025-02-11T12:05:49.151Z
Learning: In ProgrammingExerciseParticipationResource, exam-related authorization checks and sensitive information filtering for results and feedbacks are handled by resultService.filterSensitiveInformationIfNecessary().
Applied to files:
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryResource.javasrc/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryProgrammingExerciseParticipationResource.javasrc/main/java/de/tum/cit/aet/artemis/programming/web/repository/TestRepositoryResource.javasrc/test/java/de/tum/cit/aet/artemis/programming/RepositoryIntegrationTest.java
📚 Learning: 2025-08-08T08:50:28.791Z
Learnt from: tobias-lippert
Repo: ls1intum/Artemis PR: 11248
File: src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseParticipationService.java:401-402
Timestamp: 2025-08-08T08:50:28.791Z
Learning: In src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseParticipationService.java, method findStudentParticipationWithLatestSubmissionResultAndFeedbacksElseThrow(long), using List.of() for latestSubmission.setResults(...) is acceptable because the results list is not mutated afterward and is only returned to the client; no follow-up code appends to it.
Applied to files:
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryProgrammingExerciseParticipationResource.javasrc/test/java/de/tum/cit/aet/artemis/programming/RepositoryIntegrationTest.java
📚 Learning: 2024-07-17T12:13:45.428Z
Learnt from: SimonEntholzer
Repo: ls1intum/Artemis PR: 8929
File: src/main/java/de/tum/in/www1/artemis/repository/ParticipationVCSAccessTokenRepository.java:27-29
Timestamp: 2024-07-17T12:13:45.428Z
Learning: The method naming convention `deleteByParticipation_id` in `ParticipationVCSAccessTokenRepository.java` is necessary due to specific framework or library constraints in the Artemis project.
Applied to files:
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryProgrammingExerciseParticipationResource.java
📚 Learning: 2025-09-15T11:18:26.439Z
Learnt from: SamuelRoettgermann
Repo: ls1intum/Artemis PR: 11378
File: src/main/java/de/tum/cit/aet/artemis/exam/service/ExamRoomDistributionService.java:13-16
Timestamp: 2025-09-15T11:18:26.439Z
Learning: In ExamRoomDistributionService.distributeRegisteredStudents method in src/main/java/de/tum/cit/aet/artemis/exam/service/ExamRoomDistributionService.java, the team has decided not to use Transactional annotation despite multiple repository operations, based on human reviewer consultation.
Applied to files:
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryProgrammingExerciseParticipationResource.java
📚 Learning: 2025-02-06T17:24:13.928Z
Learnt from: magaupp
Repo: ls1intum/Artemis PR: 10265
File: src/main/resources/templates/dart/exercise/lib/bubble_sort.dart:1-1
Timestamp: 2025-02-06T17:24:13.928Z
Learning: In programming exercise template files (e.g., src/main/resources/templates/dart/exercise/*), implementations should be left empty or incomplete as they are meant to be completed by students as part of the exercise.
Applied to files:
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryProgrammingExerciseParticipationResource.javasrc/test/java/de/tum/cit/aet/artemis/programming/RepositoryIntegrationTest.java
📚 Learning: 2024-10-08T15:35:42.972Z
Learnt from: magaupp
Repo: ls1intum/Artemis PR: 8802
File: src/main/resources/templates/rust/exercise/src/context.rs:1-1
Timestamp: 2024-10-08T15:35:42.972Z
Learning: Code inside the `exercise` directories in the Artemis platform is provided to students and is intended for them to implement. TODO comments in these directories are meant to guide students and should not be addressed in the PR.
Applied to files:
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryProgrammingExerciseParticipationResource.javasrc/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/programming/RepositoryIntegrationTest.javasrc/main/java/de/tum/cit/aet/artemis/exercise/service/ExerciseVersionService.java
📚 Learning: 2025-06-10T12:26:42.449Z
Learnt from: Wallenstein61
Repo: ls1intum/Artemis PR: 10989
File: src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseImportFromFileService.java:108-117
Timestamp: 2025-06-10T12:26:42.449Z
Learning: In ProgrammingExerciseImportFromFileService, the current directory traversal logic for sharing imports (walking importExerciseDir before extraction) is working correctly in practice and should not be changed to more complex solutions, even if there are theoretical issues with the approach.
Applied to files:
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryProgrammingExerciseParticipationResource.javasrc/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.java
📚 Learning: 2025-08-27T09:46:36.480Z
Learnt from: ekayandan
Repo: ls1intum/Artemis PR: 11027
File: src/test/java/de/tum/cit/aet/artemis/programming/util/ProgrammingExerciseTestService.java:1839-1839
Timestamp: 2025-08-27T09:46:36.480Z
Learning: In the Artemis codebase, when stubbing GitService.getBareRepository() in tests, it's valid to return a JGit Repository (org.eclipse.jgit.lib.Repository) even though the method signature returns the domain Repository (de.tum.cit.aet.artemis.programming.domain.Repository), because the domain Repository extends JGit's FileRepository, making them polymorphically compatible.
Applied to files:
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryProgrammingExerciseParticipationResource.javasrc/main/java/de/tum/cit/aet/artemis/programming/web/repository/AuxiliaryRepositoryResource.javasrc/main/java/de/tum/cit/aet/artemis/programming/web/repository/TestRepositoryResource.javasrc/test/java/de/tum/cit/aet/artemis/programming/RepositoryIntegrationTest.java
📚 Learning: 2024-10-27T11:50:42.955Z
Learnt from: bensofficial
Repo: ls1intum/Artemis PR: 9608
File: src/main/java/de/tum/cit/aet/artemis/programming/service/gitlabci/GitLabCIService.java:202-203
Timestamp: 2024-10-27T11:50:42.955Z
Learning: In `src/main/java/de/tum/cit/aet/artemis/programming/service/gitlabci/GitLabCIService.java`, exception messages are used internally, and minor inconsistencies are acceptable due to performance considerations.
Applied to files:
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryProgrammingExerciseParticipationResource.java
📚 Learning: 2025-05-11T22:58:13.489Z
Learnt from: theblobinthesky
Repo: ls1intum/Artemis PR: 10581
File: src/main/webapp/app/exercise/import/from-file/exercise-import-from-file.component.ts:57-60
Timestamp: 2025-05-11T22:58:13.489Z
Learning: The ProgrammingExerciseBuildConfig constructor initializes all fields with default values, including new fields like allowBranching (false) and branchRegex ('.*'), so explicit handling of these fields isn't needed when importing old exercise configurations.
Applied to files:
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryProgrammingExerciseParticipationResource.java
📚 Learning: 2025-08-26T14:21:27.867Z
Learnt from: tobias-lippert
Repo: ls1intum/Artemis PR: 11318
File: src/main/java/de/tum/cit/aet/artemis/exercise/web/ParticipationResource.java:548-549
Timestamp: 2025-08-26T14:21:27.867Z
Learning: The countPresentationScoresForParticipant method in StudentParticipationRepository handles both individual student IDs and team IDs correctly in a single query. When a team ID is passed as the participant ID, the query uses JOIN logic to count presentation scores for team members, so no special branching logic is needed in the calling code.
Applied to files:
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryProgrammingExerciseParticipationResource.java
📚 Learning: 2025-08-26T14:21:27.867Z
Learnt from: tobias-lippert
Repo: ls1intum/Artemis PR: 11318
File: src/main/java/de/tum/cit/aet/artemis/exercise/web/ParticipationResource.java:548-549
Timestamp: 2025-08-26T14:21:27.867Z
Learning: The countPresentationScoresForParticipant method in StudentParticipationRepository uses a LEFT JOIN with team.students and an OR condition (p.student.id = :participantId OR ts.id = :participantId) to correctly handle both individual and team participations in a single query. The method properly counts presentation scores for both participation types without requiring additional branching logic in the calling code.
Applied to files:
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryProgrammingExerciseParticipationResource.java
📚 Learning: 2025-08-26T13:23:05.331Z
Learnt from: tobias-lippert
Repo: ls1intum/Artemis PR: 11318
File: src/main/java/de/tum/cit/aet/artemis/exercise/web/ParticipationResource.java:549-552
Timestamp: 2025-08-26T13:23:05.331Z
Learning: The method findGradeScoresForAllExercisesForCourseAndStudent in StudentParticipationRepository handles both individual and team exercises by combining results from separate queries for individual grades, individual quiz grades, and team grades.
Applied to files:
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryProgrammingExerciseParticipationResource.javasrc/test/java/de/tum/cit/aet/artemis/programming/RepositoryIntegrationTest.java
📚 Learning: 2025-06-17T12:31:09.178Z
Learnt from: jfr2102
Repo: ls1intum/Artemis PR: 10983
File: src/main/java/de/tum/cit/aet/artemis/exercise/repository/StudentParticipationRepository.java:110-126
Timestamp: 2025-06-17T12:31:09.178Z
Learning: The query `findByExamIdWithEagerLatestLegalSubmissionsRatedResultAndIgnoreTestRunParticipation` in StudentParticipationRepository fetches all rated results (not just the latest) because the second correction round feature requires access to multiple assessment results per submission for proper correction round management.
Applied to files:
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryProgrammingExerciseParticipationResource.java
📚 Learning: 2024-06-10T19:44:09.116Z
Learnt from: valentin-boehm
Repo: ls1intum/Artemis PR: 7384
File: src/test/java/de/tum/in/www1/artemis/exam/StudentExamIntegrationTest.java:988-993
Timestamp: 2024-06-10T19:44:09.116Z
Learning: The `testSubmitStudentExam_differentUser` method does not require additional checks to verify the state of `studentExam1` after receiving a `HttpStatus.FORBIDDEN` because the control flow in the `StudentExamResource` is straightforward and ensures no state change occurs.
Applied to files:
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryProgrammingExerciseParticipationResource.javasrc/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/programming/RepositoryIntegrationTest.java
📚 Learning: 2024-06-10T19:44:09.116Z
Learnt from: florian-glombik
Repo: ls1intum/Artemis PR: 8597
File: src/main/webapp/app/exercises/programming/manage/repositories-checkout-directories-dto.ts:8-8
Timestamp: 2024-06-10T19:44:09.116Z
Learning: DTOs are typically defined in the `src/main/webapp/app/entities` folder on the client side in the Artemis project.
Applied to files:
src/main/java/de/tum/cit/aet/artemis/programming/dto/ProgrammingExerciseEditorSyncEventDTO.java
📚 Learning: 2024-10-08T15:35:42.972Z
Learnt from: JohannesStoehr
Repo: ls1intum/Artemis PR: 8679
File: src/main/java/de/tum/in/www1/artemis/web/rest/tutorialgroups/TutorialGroupSessionResource.java:37-37
Timestamp: 2024-10-08T15:35:42.972Z
Learning: The DTOs `CompetencyProgressForLearningPathDTO`, `ProgrammingExerciseResetOptionsDTO`, and `CourseWithIdDTO` do not contain nullable values or `Optional` types, making the `JsonInclude` annotation unnecessary for them.
Applied to files:
src/main/java/de/tum/cit/aet/artemis/programming/dto/ProgrammingExerciseEditorSyncEventDTO.java
📚 Learning: 2025-08-10T18:33:22.476Z
Learnt from: Wallenstein61
Repo: ls1intum/Artemis PR: 10989
File: src/test/java/de/tum/cit/aet/artemis/programming/AbstractProgrammingIntegrationLocalCILocalVCTest.java:3-9
Timestamp: 2025-08-10T18:33:22.476Z
Learning: In the Artemis test framework, `MockitoBean` from `org.springframework.test.context.bean.override.mockito` is the standard annotation used for mocking beans in test classes, not `MockBean`. This is used consistently across test base classes like `AbstractProgrammingIntegrationLocalCILocalVCTest`, `AbstractSpringIntegrationIndependentTest`, and `AbstractSpringIntegrationLocalVCSamlTest`. The project also uses `MockitoSpyBean` from the same package.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/programming/RepositoryIntegrationTest.java
📚 Learning: 2024-10-08T18:07:58.425Z
Learnt from: iyannsch
Repo: ls1intum/Artemis PR: 9379
File: src/main/webapp/app/shared/components/code-button/code-button.component.ts:364-372
Timestamp: 2024-10-08T18:07:58.425Z
Learning: In the `initTheia` method of `CodeButtonComponent` (`code-button.component.ts`), removing the null check for `this.exercise` inside the `subscribe` callback causes a compile-time error, so it should be kept.
Applied to files:
src/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-base-container.component.ts
📚 Learning: 2024-10-29T12:28:57.305Z
Learnt from: SimonEntholzer
Repo: ls1intum/Artemis PR: 9478
File: src/main/webapp/app/shared/user-settings/ssh-settings/details/ssh-user-settings-key-details.component.ts:104-111
Timestamp: 2024-10-29T12:28:57.305Z
Learning: In `ssh-user-settings-key-details.component.ts`, changing the error handling code by adding optional chaining (`?.`) and replacing `.indexOf()` with `.includes()` may alter semantics and should be avoided.
Applied to files:
src/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-base-container.component.ts
📚 Learning: 2024-10-08T15:35:52.595Z
Learnt from: florian-glombik
Repo: ls1intum/Artemis PR: 8597
File: src/main/webapp/app/exercises/programming/shared/build-details/programming-exercise-repository-and-build-plan-details.component.ts:52-59
Timestamp: 2024-10-08T15:35:52.595Z
Learning: When handling errors in Angular components, ensure to integrate with the alert service for consistent error display across the application.
Applied to files:
src/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-base-container.component.tssrc/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-and-editor-container.componente.spec.ts
📚 Learning: 2025-02-11T15:46:35.616Z
Learnt from: Wallenstein61
Repo: ls1intum/Artemis PR: 9909
File: src/main/webapp/app/sharing/search-result-dto.model.ts:50-55
Timestamp: 2025-02-11T15:46:35.616Z
Learning: The `IExerciseType` enum in `src/main/webapp/app/sharing/search-result-dto.model.ts` must maintain its current naming (with 'I' prefix) and lowercase string values to ensure compatibility with the external sharing platform connector interface. This is an intentional exception to our TypeScript naming conventions.
Applied to files:
src/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-base-container.component.tssrc/main/webapp/app/programming/manage/services/programming-exercise-editor-sync.service.ts
📚 Learning: 2024-10-20T21:59:11.630Z
Learnt from: pzdr7
Repo: ls1intum/Artemis PR: 9505
File: src/main/webapp/app/exercises/programming/shared/code-editor/monaco/code-editor-monaco.component.html:9-9
Timestamp: 2024-10-20T21:59:11.630Z
Learning: In Angular templates within the Artemis project (e.g., `src/main/webapp/app/exercises/programming/shared/code-editor/monaco/code-editor-monaco.component.html`), properties like `selectedFile()`, `readOnlyManualFeedback()`, `highlightDifferences()`, and `course()` are signals. It is appropriate to call these signals directly in the template.
Applied to files:
src/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-base-container.component.ts
📚 Learning: 2024-10-10T11:42:23.069Z
Learnt from: pzdr7
Repo: ls1intum/Artemis PR: 9443
File: src/test/javascript/spec/component/hestia/git-diff-report/git-diff-modal.component.spec.ts:55-60
Timestamp: 2024-10-10T11:42:23.069Z
Learning: In `git-diff-report-modal.component.spec.ts`, using `fakeAsync` and `tick` does not work for handling asynchronous operations in the tests; alternative methods are needed.
Applied to files:
src/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-and-editor-container.componente.spec.ts
📚 Learning: 2025-04-01T17:19:55.677Z
Learnt from: tobias-lippert
Repo: ls1intum/Artemis PR: 10610
File: src/test/javascript/spec/service/guided-tour.service.spec.ts:193-193
Timestamp: 2025-04-01T17:19:55.677Z
Learning: In the guide tour service tests, the `router.navigateByUrl` mock should remain synchronous (returning boolean) rather than returning a Promise to maintain compatibility with existing test logic that depends on synchronous behavior.
Applied to files:
src/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-and-editor-container.componente.spec.ts
📚 Learning: 2024-10-08T15:35:52.595Z
Learnt from: pzdr7
Repo: ls1intum/Artemis PR: 9407
File: src/test/javascript/spec/component/programming-exercise/programming-exercise-custom-aeolus-build-plan.component.spec.ts:172-175
Timestamp: 2024-10-08T15:35:52.595Z
Learning: When testing components that use `MonacoEditorComponent`, it's acceptable not to test `MonacoEditorComponent` functionality within those tests, as dedicated tests already exist for it.
Applied to files:
src/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-and-editor-container.componente.spec.ts
📚 Learning: 2025-07-03T14:51:57.407Z
Learnt from: ekayandan
Repo: ls1intum/Artemis PR: 10885
File: src/main/webapp/app/programming/shared/git-diff-report/git-diff-report/git-diff-report.component.ts:63-74
Timestamp: 2025-07-03T14:51:57.407Z
Learning: In the `GitDiffReportComponent` (`src/main/webapp/app/programming/shared/git-diff-report/git-diff-report/git-diff-report.component.ts`), directly mutating the `diffInformation` array from `repositoryDiffInformation().diffInformations` to update the `diffReady` property works correctly with Angular's OnPush change detection strategy in this codebase.
Applied to files:
src/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-and-editor-container.componente.spec.ts
📚 Learning: 2024-10-08T15:35:48.767Z
Learnt from: pzdr7
Repo: ls1intum/Artemis PR: 9407
File: src/test/javascript/spec/component/shared/monaco-editor/monaco-editor-communication-action.integration.spec.ts:46-46
Timestamp: 2024-10-08T15:35:48.767Z
Learning: In integration tests, it's acceptable to import the actual `MonacoEditorComponent` instead of mocking it.
Applied to files:
src/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-and-editor-container.componente.spec.ts
📚 Learning: 2025-09-01T13:47:02.624Z
Learnt from: Michael-Breu-UIbk
Repo: ls1intum/Artemis PR: 10989
File: src/main/webapp/app/programming/manage/detail/programming-exercise-detail.component.with-sharing.spec.ts:167-169
Timestamp: 2025-09-01T13:47:02.624Z
Learning: In Jest tests, prefer using jest.spyOn() over direct method assignment for mocking service methods, as spies are automatically restored by Jest's cleanup mechanisms (jest.restoreAllMocks()), while direct assignment bypasses this system and can lead to test pollution where mocked methods affect subsequent tests.
Applied to files:
src/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-and-editor-container.componente.spec.ts
📚 Learning: 2024-10-20T22:04:39.861Z
Learnt from: pzdr7
Repo: ls1intum/Artemis PR: 9505
File: src/test/javascript/spec/integration/code-editor/code-editor-container.integration.spec.ts:233-234
Timestamp: 2024-10-20T22:04:39.861Z
Learning: In the Artemis codebase's TypeScript test files (`*.spec.ts`), the Jest matcher `toHaveBeenCalledOnce()` is acceptable and can be used in tests.
Applied to files:
src/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-and-editor-container.componente.spec.ts
📚 Learning: 2024-10-12T16:55:30.551Z
Learnt from: magaupp
Repo: ls1intum/Artemis PR: 9440
File: src/main/resources/templates/typescript/exercise/package.json:4-7
Timestamp: 2024-10-12T16:55:30.551Z
Learning: In TypeScript programming exercises in Artemis, tests are not run by the students, so it's unnecessary to include a test script in the package.json file.
Applied to files:
src/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-and-editor-container.componente.spec.ts
📚 Learning: 2025-07-04T07:39:46.773Z
Learnt from: Wallenstein61
Repo: ls1intum/Artemis PR: 10989
File: src/main/webapp/app/sharing/sharing.component.spec.ts:125-125
Timestamp: 2025-07-04T07:39:46.773Z
Learning: In the Artemis codebase TypeScript test files (`*.spec.ts`), `toHaveBeenCalledOnce()` is the preferred Jest assertion method and is enforced by pre-commit hooks. Do not suggest changing it to `toHaveBeenCalledTimes(1)`.
Applied to files:
src/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-and-editor-container.componente.spec.ts
📚 Learning: 2024-07-09T19:09:34.276Z
Learnt from: florian-glombik
Repo: ls1intum/Artemis PR: 8858
File: src/test/javascript/spec/component/shared/sidebar/sidebar-accordion.component.spec.ts:91-96
Timestamp: 2024-07-09T19:09:34.276Z
Learning: For the PR ls1intum/Artemis#8858, avoid suggesting to change `expect(component.expandAll).toHaveBeenCalledOnce()` to `expect(component.expandAll).toHaveBeenCalledTimes(1)`.
Applied to files:
src/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-and-editor-container.componente.spec.ts
📚 Learning: 2024-07-09T19:09:58.572Z
Learnt from: florian-glombik
Repo: ls1intum/Artemis PR: 8858
File: src/test/javascript/spec/component/shared/sidebar/sidebar-accordion.component.spec.ts:115-115
Timestamp: 2024-07-09T19:09:58.572Z
Learning: For the PR ls1intum/Artemis#8858, avoid suggesting to change `expect(component.setStoredCollapseState).toHaveBeenCalledOnce()` to `expect(component.setStoredCollapseState).toHaveBeenCalledTimes(1)`.
Applied to files:
src/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-and-editor-container.componente.spec.ts
📚 Learning: 2025-04-22T10:22:01.154Z
Learnt from: tobias-lippert
Repo: ls1intum/Artemis PR: 10714
File: src/main/webapp/app/exercise/exercise-create-buttons/exercise-manage-button/exercise-manage-button.component.ts:38-43
Timestamp: 2025-04-22T10:22:01.154Z
Learning: In the Artemis codebase, the ExerciseType enum has uppercase keys (PROGRAMMING, MODELING, etc.) but lowercase string values ('programming', 'modeling', etc.), which are used directly in translation keys and route paths.
Applied to files:
src/main/java/de/tum/cit/aet/artemis/programming/domain/ProgrammingExerciseEditorSyncTarget.javasrc/main/java/de/tum/cit/aet/artemis/exercise/service/ExerciseVersionService.java
📚 Learning: 2024-10-14T10:27:58.500Z
Learnt from: florian-glombik
Repo: ls1intum/Artemis PR: 8858
File: src/main/webapp/i18n/de/student-dashboard.json:36-37
Timestamp: 2024-10-14T10:27:58.500Z
Learning: Avoid suggesting the translation change for "noExercisesFoundWithAppliedFilter" in the PR ls1intum/Artemis#8858. The preferred translation is "Keine Aufgaben passen zu den gewählten Filtern."
Applied to files:
src/main/webapp/i18n/de/editor.json
📚 Learning: 2024-06-10T19:44:09.116Z
Learnt from: valentin-boehm
Repo: ls1intum/Artemis PR: 7384
File: src/test/java/de/tum/in/www1/artemis/exam/StudentExamIntegrationTest.java:975-980
Timestamp: 2024-06-10T19:44:09.116Z
Learning: The `testSubmitStudentExam_notInTime` method does not require additional checks to verify the state of `studentExam1` after receiving a `HttpStatus.FORBIDDEN` because the control flow in the `StudentExamResource` is straightforward and ensures no state change occurs.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/programming/RepositoryIntegrationTest.java
📚 Learning: 2024-06-10T19:44:09.116Z
Learnt from: valentin-boehm
Repo: ls1intum/Artemis PR: 7384
File: src/test/java/de/tum/in/www1/artemis/exam/StudentExamIntegrationTest.java:2836-2846
Timestamp: 2024-06-10T19:44:09.116Z
Learning: The `testAbandonStudentExamNotInTime` method does not require additional checks to verify the state of `studentExam1` after receiving a `HttpStatus.FORBIDDEN` because the control flow in the `StudentExamResource` is straightforward and ensures no state change occurs.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/programming/RepositoryIntegrationTest.java
📚 Learning: 2024-06-10T19:44:09.116Z
Learnt from: valentin-boehm
Repo: ls1intum/Artemis PR: 7384
File: src/test/java/de/tum/in/www1/artemis/exam/StudentExamIntegrationTest.java:2804-2810
Timestamp: 2024-06-10T19:44:09.116Z
Learning: The `postWithoutLocation` method used in the `testAbandonStudentExam` test case already checks the response status, ensuring that the abandonment of the exam is accepted.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/programming/RepositoryIntegrationTest.java
📚 Learning: 2024-06-10T19:44:09.116Z
Learnt from: pzdr7
Repo: ls1intum/Artemis PR: 8703
File: src/main/java/de/tum/in/www1/artemis/web/rest/QuizParticipationResource.java:39-39
Timestamp: 2024-06-10T19:44:09.116Z
Learning: The `Profile(PROFILE_CORE)` annotation in `QuizParticipationResource.java` is used to ensure that all nodes, not just those with the scheduling profile, can handle quiz participations.
Applied to files:
src/main/java/de/tum/cit/aet/artemis/exercise/service/ExerciseVersionService.java
📚 Learning: 2025-09-25T11:25:54.261Z
Learnt from: Elfari1028
Repo: ls1intum/Artemis PR: 11351
File: src/main/java/de/tum/cit/aet/artemis/versioning/dto/QuizExerciseSnapshotDTO.java:52-53
Timestamp: 2025-09-25T11:25:54.261Z
Learning: In the Artemis versioning system, quiz questions processed by QuizExerciseSnapshotDTO should always have valid IDs (non-null getId()) since versioning works with persisted entities, making null filtering unnecessary according to Elfari1028.
Applied to files:
src/main/java/de/tum/cit/aet/artemis/exercise/service/ExerciseVersionService.java
📚 Learning: 2025-04-04T09:39:24.832Z
Learnt from: eceeeren
Repo: ls1intum/Artemis PR: 10533
File: src/main/java/de/tum/cit/aet/artemis/core/web/CourseResource.java:839-857
Timestamp: 2025-04-04T09:39:24.832Z
Learning: In the Artemis application, filtering of unreleased exercises is handled at the database level through SQL queries in the repository methods rather than in the application code. The method findByCourseIdWithFutureDueDatesAndCategories in ExerciseRepository applies this filtering, making additional application-level filtering unnecessary.
Applied to files:
src/main/java/de/tum/cit/aet/artemis/exercise/service/ExerciseVersionService.java
📚 Learning: 2025-10-22T21:32:19.993Z
Learnt from: Elfari1028
Repo: ls1intum/Artemis PR: 11491
File: src/main/java/de/tum/cit/aet/artemis/exercise/service/ExerciseVersionService.java:114-126
Timestamp: 2025-10-22T21:32:19.993Z
Learning: For ExerciseVersion, the maintainer prefers to keep separate records if two different authors produce the same snapshot at the same time; any deduplication should therefore include author_id in the uniqueness key.
Applied to files:
src/main/java/de/tum/cit/aet/artemis/exercise/service/ExerciseVersionService.java
🧬 Code graph analysis (5)
src/main/webapp/app/programming/manage/services/programming-exercise-editor-sync.service.spec.ts (2)
src/main/webapp/app/programming/manage/services/programming-exercise-editor-sync.service.ts (1)
ProgrammingExerciseEditorSyncMessage(17-21)src/main/webapp/app/programming/shared/code-editor/services/code-editor-repository.service.ts (1)
message(46-48)
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/AuxiliaryRepositoryResource.java (1)
src/main/java/de/tum/cit/aet/artemis/programming/domain/Repository.java (1)
Repository(17-84)
src/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-base-container.component.ts (2)
src/main/webapp/app/programming/shared/code-editor/services/code-editor-repository.service.ts (1)
message(46-48)src/main/webapp/app/programming/manage/services/programming-exercise-editor-sync.service.ts (1)
ProgrammingExerciseEditorSyncMessage(17-21)
src/main/webapp/app/programming/manage/code-editor/instructor-and-editor-container/code-editor-instructor-and-editor-container.componente.spec.ts (1)
src/main/webapp/app/programming/manage/services/programming-exercise-editor-sync.service.ts (1)
ProgrammingExerciseEditorSyncMessage(17-21)
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/TestRepositoryResource.java (1)
src/main/java/de/tum/cit/aet/artemis/programming/domain/Repository.java (1)
Repository(17-84)
⏰ 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: 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: client-tests
- GitHub Check: server-tests
- GitHub Check: Analyse
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/TestRepositoryResource.java
Show resolved
Hide resolved
| import de.tum.cit.aet.artemis.programming.domain.ProgrammingExerciseEditorSyncTarget; | ||
| import de.tum.cit.aet.artemis.programming.domain.Repository; | ||
| import de.tum.cit.aet.artemis.programming.dto.FileMove; | ||
| import de.tum.cit.aet.artemis.programming.dto.ProgrammingExerciseEditorSyncEventDTO; | ||
| import de.tum.cit.aet.artemis.programming.dto.RepositoryStatusDTO; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit-flag sync tests don’t match their names and likely miss intended scenarios
The broadcast tests for folder/file create/rename/delete, reset, and PUT /files?commit=false with actual file submissions look correct: they verify a single synchronization message on the expected topic with target=AUXILIARY_REPOSITORY and the correct auxiliaryRepositoryId.
However, the two tests meant to cover commit=true behavior appear misconfigured:
- Line 297 (
testUpdateFilesWithCommitDoesNotBroadcast) calls:PUT ... "/files?commit=false"withList.of()
- Line 308 (
testUpdateFilesCommitTrueWithSubmissionsDoesNotBroadcast) also calls:PUT ... "/files?commit=false"withList.of()
So both tests:
- Use
commit=falseinstead ofcommit=true, contradicting their method names and the distinction the PR describes between committed and non-committed updates. - Send an empty list instead of representing “with submissions” in the second test, so the “withSubmissions” aspect is not covered.
- Are effectively duplicates of each other and do not assert any behavior specific to commit=true scenarios.
This likely leaves the commit=true paths of the resource untested and may hide regressions in synchronization behavior around committed changes.
Consider updating them along these lines:
@@
- void testUpdateFilesWithCommitDoesNotBroadcast() throws Exception {
+ void testUpdateFilesWithCommitDoesNotBroadcast() throws Exception {
programmingExerciseRepository.save(programmingExercise);
reset(websocketMessagingService);
- request.put(testRepoBaseUrl + auxiliaryRepository.getId() + "/files?commit=false", List.of(), HttpStatus.OK);
+ request.put(testRepoBaseUrl + auxiliaryRepository.getId() + "/files?commit=true", List.of(), HttpStatus.OK);
@@
- void testUpdateFilesCommitTrueWithSubmissionsDoesNotBroadcast() throws Exception {
+ void testUpdateFilesCommitTrueWithSubmissionsDoesNotBroadcast() throws Exception {
programmingExerciseRepository.save(programmingExercise);
reset(websocketMessagingService);
- request.put(testRepoBaseUrl + auxiliaryRepository.getId() + "/files?commit=false", List.of(), HttpStatus.OK);
+ request.put(
+ testRepoBaseUrl + auxiliaryRepository.getId() + "/files?commit=true",
+ getFileSubmissions(),
+ HttpStatus.OK
+ );If different semantics are intended (e.g., “with submissions” meaning something else), then at minimum the query parameter in these tests should reflect commit=true, and the test names or setup should be adjusted so they accurately describe what is being verified.
Also applies to: 211-332
src/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.java
Show resolved
Hide resolved
End-to-End (E2E) Test Results Summary
|
||||||||||||||||||||||||||||||
…ctive-editors-when-new-changes-are-saved
…when-new-changes-are-saved' of github.com:ls1intum/Artemis into feature/exercise-synchronization/notify-active-editors-when-new-changes-are-saved
There was a problem hiding this 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
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.java(5 hunks)src/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.java(8 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/test/java/**/*.java
⚙️ CodeRabbit configuration file
test_naming: descriptive; test_size: small_specific; fixed_data: true; junit5_features: true; assert_use: assertThat; assert_specificity: true; archunit_use: enforce_package_rules; db_query_count_tests: track_performance; util_service_factory_pattern: true; avoid_db_access: true; mock_strategy: static_mocks; context_restart_minimize: true
Files:
src/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.java
🧠 Learnings (18)
📚 Learning: 2025-08-11T13:22:05.140Z
Learnt from: Wallenstein61
Repo: ls1intum/Artemis PR: 10989
File: src/test/java/de/tum/cit/aet/artemis/programming/service/sharing/ExerciseSharingResourceImportTest.java:128-131
Timestamp: 2025-08-11T13:22:05.140Z
Learning: In the ExerciseSharingResourceImportTest class in Artemis, mockServer.verify() is not needed in the tearDown method as the test design doesn't require strict verification of all mocked HTTP expectations. The mockServer field is managed differently in this test class.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.java
📚 Learning: 2025-07-07T11:43:11.736Z
Learnt from: bassner
Repo: ls1intum/Artemis PR: 10705
File: src/test/java/de/tum/cit/aet/artemis/lecture/service/SlideUnhideServiceTest.java:54-57
Timestamp: 2025-07-07T11:43:11.736Z
Learning: In the Artemis test framework, the AbstractArtemisIntegrationTest base class provides common MockitoSpyBean fields like instanceMessageSendService as protected fields, making them available to all test subclasses through inheritance.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.java
📚 Learning: 2024-11-26T20:43:17.588Z
Learnt from: magaupp
Repo: ls1intum/Artemis PR: 9751
File: src/test/java/de/tum/cit/aet/artemis/programming/util/ProgrammingExerciseFactory.java:143-148
Timestamp: 2024-11-26T20:43:17.588Z
Learning: In `src/test/java/de/tum/cit/aet/artemis/programming/util/ProgrammingExerciseFactory.java`, the test package name assigned in `populateUnreleasedProgrammingExercise` does not need to adhere to naming conventions.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.java
📚 Learning: 2024-10-15T11:33:17.915Z
Learnt from: alexjoham
Repo: ls1intum/Artemis PR: 9455
File: src/test/java/de/tum/cit/aet/artemis/iris/IrisTextExerciseChatMessageIntegrationTest.java:401-401
Timestamp: 2024-10-15T11:33:17.915Z
Learning: In the Artemis project, when new fields are added to classes like `PyrisChatStatusUpdateDTO`, corresponding tests may be implemented in separate integration test classes such as `IrisChatTokenTrackingIntegrationTest`.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.java
📚 Learning: 2025-08-10T18:33:22.476Z
Learnt from: Wallenstein61
Repo: ls1intum/Artemis PR: 10989
File: src/test/java/de/tum/cit/aet/artemis/programming/AbstractProgrammingIntegrationLocalCILocalVCTest.java:3-9
Timestamp: 2025-08-10T18:33:22.476Z
Learning: In the Artemis test framework, `MockitoBean` from `org.springframework.test.context.bean.override.mockito` is the standard annotation used for mocking beans in test classes, not `MockBean`. This is used consistently across test base classes like `AbstractProgrammingIntegrationLocalCILocalVCTest`, `AbstractSpringIntegrationIndependentTest`, and `AbstractSpringIntegrationLocalVCSamlTest`. The project also uses `MockitoSpyBean` from the same package.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.java
📚 Learning: 2025-10-22T21:31:54.240Z
Learnt from: Elfari1028
Repo: ls1intum/Artemis PR: 11491
File: src/main/java/de/tum/cit/aet/artemis/exercise/web/ExerciseResource.java:376-378
Timestamp: 2025-10-22T21:31:54.240Z
Learning: In Artemis, ExerciseVersionService.createExerciseVersion(...) (src/main/java/de/tum/cit/aet/artemis/exercise/service/ExerciseVersionService.java) eagerly re-fetches the target exercise (via type-specific findForVersioningById) before building the ExerciseSnapshotDTO. Controllers (e.g., ExerciseResource.toggleSecondCorrectionEnabled) do not need to reload the exercise before invoking createExerciseVersion.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.java
📚 Learning: 2025-08-30T20:20:17.236Z
Learnt from: SamuelRoettgermann
Repo: ls1intum/Artemis PR: 11111
File: src/test/java/de/tum/cit/aet/artemis/exam/ExamRoomIntegrationTest.java:0-0
Timestamp: 2025-08-30T20:20:17.236Z
Learning: In ExamRoomIntegrationTest.validateAdminOverview(), the first assertion should use subset containment (contains) rather than exact equality because the admin overview shows all newest unique exam rooms in the system including those from previous uploads, not just rooms from the current upload being tested. The test only needs to verify that the expected rooms from the current upload are present in the response.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.java
📚 Learning: 2024-10-04T23:23:49.139Z
Learnt from: magaupp
Repo: ls1intum/Artemis PR: 9261
File: src/main/resources/templates/c_plus_plus/test/testUtils/TestFailedError.py:6-6
Timestamp: 2024-10-04T23:23:49.139Z
Learning: In the Artemis project, when adding new programming language templates like C++, files such as `src/main/resources/templates/c_plus_plus/test/testUtils/TestFailedError.py` may be copied from existing templates without modifications. In such cases, suggesting modifications to these files (e.g., removing unnecessary `pass` statements) may not be necessary.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.java
📚 Learning: 2024-10-20T18:37:45.365Z
Learnt from: SamuelRoettgermann
Repo: ls1intum/Artemis PR: 9303
File: src/main/java/de/tum/in/www1/artemis/service/exam/StudentExamService.java:296-300
Timestamp: 2024-10-20T18:37:45.365Z
Learning: When reviewing code changes in `StudentExamService.saveSubmission`, if the PR aims to improve readability without changing logic, avoid suggesting changes that alter logic, such as adding exceptions in the default case of switch statements.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.java
📚 Learning: 2024-06-10T19:44:09.116Z
Learnt from: valentin-boehm
Repo: ls1intum/Artemis PR: 7384
File: src/test/java/de/tum/in/www1/artemis/exam/StudentExamIntegrationTest.java:988-993
Timestamp: 2024-06-10T19:44:09.116Z
Learning: The `testSubmitStudentExam_differentUser` method does not require additional checks to verify the state of `studentExam1` after receiving a `HttpStatus.FORBIDDEN` because the control flow in the `StudentExamResource` is straightforward and ensures no state change occurs.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.java
📚 Learning: 2025-08-19T09:13:51.235Z
Learnt from: ekayandan
Repo: ls1intum/Artemis PR: 11027
File: src/main/java/de/tum/cit/aet/artemis/programming/service/GitArchiveHelper.java:0-0
Timestamp: 2025-08-19T09:13:51.235Z
Learning: The domain Repository class (de.tum.cit.aet.artemis.programming.domain.Repository) extends JGit's FileRepository, making it polymorphically compatible with JGit APIs while providing additional Artemis-specific methods like getParticipation() and getLocalPath().
Applied to files:
src/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.java
📚 Learning: 2025-06-10T12:26:42.449Z
Learnt from: Wallenstein61
Repo: ls1intum/Artemis PR: 10989
File: src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseImportFromFileService.java:108-117
Timestamp: 2025-06-10T12:26:42.449Z
Learning: In ProgrammingExerciseImportFromFileService, the current directory traversal logic for sharing imports (walking importExerciseDir before extraction) is working correctly in practice and should not be changed to more complex solutions, even if there are theoretical issues with the approach.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.java
📚 Learning: 2024-10-08T15:35:42.972Z
Learnt from: magaupp
Repo: ls1intum/Artemis PR: 8802
File: src/main/resources/templates/rust/exercise/src/context.rs:1-1
Timestamp: 2024-10-08T15:35:42.972Z
Learning: Code inside the `exercise` directories in the Artemis platform is provided to students and is intended for them to implement. TODO comments in these directories are meant to guide students and should not be addressed in the PR.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.javasrc/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.java
📚 Learning: 2025-09-20T16:47:54.380Z
Learnt from: MoritzSpengler
Repo: ls1intum/Artemis PR: 11382
File: src/main/java/de/tum/cit/aet/artemis/quiz/service/QuizTrainingService.java:43-54
Timestamp: 2025-09-20T16:47:54.380Z
Learning: In QuizTrainingService.submitForTraining, cross-course mismatch protection is handled through PreAuthorize("hasAccessToCourse(#courseId)") authorization at the REST layer, ensuring users can only submit for courses they have access to, rather than through explicit courseId validation in the service method.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.java
📚 Learning: 2024-10-08T15:35:42.972Z
Learnt from: jakubriegel
Repo: ls1intum/Artemis PR: 8050
File: src/test/java/de/tum/in/www1/artemis/plagiarism/PlagiarismUtilService.java:62-66
Timestamp: 2024-10-08T15:35:42.972Z
Learning: The `createCourseWithUsers` method in `PlagiarismUtilService.java` uses fixed inputs as it is designed to be a test helper method for simplifying the setup of courses and users in tests.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.java
📚 Learning: 2025-09-20T16:47:54.380Z
Learnt from: MoritzSpengler
Repo: ls1intum/Artemis PR: 11382
File: src/main/java/de/tum/cit/aet/artemis/quiz/service/QuizTrainingService.java:43-54
Timestamp: 2025-09-20T16:47:54.380Z
Learning: In QuizTrainingService.submitForTraining, cross-course validation is handled by the REST layer through authCheckService.checkHasAtLeastRoleInCourseElseThrow() which validates user access to the course before the service method is called, eliminating the need for additional courseId validation in the service layer.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.java
📚 Learning: 2024-06-10T19:44:09.116Z
Learnt from: valentin-boehm
Repo: ls1intum/Artemis PR: 7384
File: src/test/java/de/tum/in/www1/artemis/exam/StudentExamIntegrationTest.java:2836-2846
Timestamp: 2024-06-10T19:44:09.116Z
Learning: The `testAbandonStudentExamNotInTime` method does not require additional checks to verify the state of `studentExam1` after receiving a `HttpStatus.FORBIDDEN` because the control flow in the `StudentExamResource` is straightforward and ensures no state change occurs.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.java
📚 Learning: 2024-10-08T15:35:48.767Z
Learnt from: jakubriegel
Repo: ls1intum/Artemis PR: 8050
File: src/test/java/de/tum/in/www1/artemis/plagiarism/PlagiarismUtilService.java:125-136
Timestamp: 2024-10-08T15:35:48.767Z
Learning: The `createTeamTextExerciseAndSimilarSubmissions` method in `PlagiarismUtilService.java` uses fixed inputs as it is designed to be a test helper method for simplifying the setup of team exercises and submissions in tests.
Applied to files:
src/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.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). (11)
- GitHub Check: client-tests
- GitHub Check: client-tests-selected
- GitHub Check: client-style
- GitHub Check: server-style
- GitHub Check: server-tests
- GitHub Check: Codacy Static Code Analysis
- 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/test/java/de/tum/cit/aet/artemis/programming/TestRepositoryResourceIntegrationTest.java (1)
191-439: LGTM! Synchronization broadcast tests are well-structured.The new tests properly verify WebSocket broadcasts for repository operations:
- Consistent use of
ArgumentCaptorto capture and validate theProgrammingExerciseEditorSyncEventDTO- Correct assertions on
target(TESTS_REPOSITORY) andauxiliaryRepositoryId(null for test repository)- The distinction between empty submissions (no broadcast) and actual file submissions (broadcast) at lines 403-412 vs 426-439 is logical and covers different code paths
The past review concern about duplicate tests with misleading names appears to have been addressed.
src/test/java/de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.java (1)
211-310: LGTM! Auxiliary repository broadcast tests are comprehensive.The new synchronization broadcast tests correctly verify:
- WebSocket messages sent to the proper topic with
ArgumentCaptor- Target set to
AUXILIARY_REPOSITORYauxiliaryRepositoryIdmatches the repository's IDThe test at lines 282-293 (
testUpdateFilesBroadcastsWhenNotCommitted) appropriately covers the non-committed file updates scenario with actual file submissions.
.../de/tum/cit/aet/artemis/exercise/programming/AuxiliaryRepositoryResourceIntegrationTest.java
Outdated
Show resolved
Hide resolved
End-to-End (E2E) Test Results Summary
|
||||||||||||||||||
End-to-End (E2E) Test Results Summary
|
||||||||||||||||||||||||
kaleliguray
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR was tested as described. However, there is some issue which you can see on the screenshots. I opened two browser to test the case. Then created programing exercise, tried to edit it in the "Edit in Editor" section. I could modified the exercise as depicted, and I got an warning in the management browser (safari), however, I could not get an warning in the testion browser (chrome). Moreover, I have got an error while checking in the testing browser (chrome). Due to the fact that those problem and my control, there was no warning pop-up corresponding to update.
Browser:
Safari Version 26.1 (21622.2.11.11.9) ---> management browser
Chrome Version 142.0.7444.176 (Official Build) (arm64) ---> testing browser
Test Account
Role: Instructor
Account: artemis_test_user_18
Steps for Testing:
I followed the same steps depicted in the PR page.
- Log in to Artemis as an instructor
- Create a programming exercise that was mentioned in the PR description
- The exercise was published as expected, the warning appeared, and saw it in the testing browser
- Go to the exercise section and click on the "Edit in editor" button
- Made some modifications in the Problem Statement section
- Save it, and click on the Submit button
- You will see a warning pop-up in the management browser(Safari); however, there was no warning pop-up in the testing browser(Chrome).
- Also, you can get some errors in Chrome while checking (use inspector -> console)
ScreenShots
Checklist
General
Server
Client
Changes affecting Programming Exercises
Motivation and Context
While iterating on Problem Statement, Template, Solution, Test and Auxiliary repositories of Programming Exercises, multilple people could be editing them at the same time, often resulting in one overwriting someone else's changes, causing data loss and delays in work.
This PR introduces a basic synchronization notification:
Description
Server
Added new
ProgrammingExerciseEditorSyncService: handles Websocket connection to clients, and with one public methodbroadcastChangeto send messages to all clients currently subscribed to/topic/programming-exercises/{exerciseId}/synchronizationwithProgrammingExerciseEditorSyncEventDTOExerciseVersionServicenow has one more step after anExerciseVersionhas been logged: callsdetermineSynchronizationForActiveEditorsto determine whether a synchronization notification should be sent to clients.ExerciseVersionServicebroadcasts changes when: 1. Problem statement is different from previous version 2. Template/Solution/Tests/Auxiliary repository has a new commitSince it is possible in online editor to save file without committing it, addtional synchronization notification is needed when files changes without commit:
AuxiliaryRepositoryResource,RepositoryProgrammingExerciseParticipationResource,TestRepositoryResourcenow broadcast changes whenput,post,deleterequests are made. Additionally,RepositoryProgrammingExerciseParticipationResourceonly broadcast changes when it's a Solution/Template repositoryClient
ProgrammingExerciseEditorSyncServiceto manage websocket subscription forcode-editor-instructor-and-editor-container.component.tsCodeEditorInstructorBaseContainerComponentnow opens a websocket subcription to receive messages notifying them about other user's changes.ProgrammingExerciseEditorSyncTargetbeingproblem_statement, regardless of which repository is being viewed, a notification will notify user to refresh the pageProgrammingExerciseEditorSyncTargetbeing a repository type, the code will compare it with currently selected repository, a notification will notify user to refresh the page if the edit was made on the same repositorySteps for Testing
Prerequisites:
Deploy on test server:
Follow these steps on two different browsers, or tabs, or different users (etc.)
Path 1:
1: Add some changes in Problem Statement and click "Submit", notice in the other browser tab you receive a notification reading "This repository was updated in another session. Refresh the files to sync the changes."
You can do this after selecting " Template" repository for one browser and "Solution" for another browser and notice the same notification
Path 2:
a. Do one of these actions: Create file, rename file, delete file.
OR b. edit a file by adding some lines (and wait for 30 seconds for autosave to be triggerred)
c. Click "Submit" to commit the changes
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
Manual Tests
Exam Mode Test
Performance Tests
Test Coverage
Screenshots
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.