-
Notifications
You must be signed in to change notification settings - Fork 297
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
Development
: Fix the broken git programming submission e2e tests
#9546
Development
: Fix the broken git programming submission e2e tests
#9546
Conversation
WalkthroughThe pull request modifies the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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: 0
🧹 Outside diff range and nitpick comments (2)
src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseParticipationService.java (1)
Line range hint
1-590
: Summary and RecommendationsThe changes to the
retrieveParticipationForRepository
method improve error handling when a student participation cannot be found. However, there are opportunities for further enhancements:
- Improve the error handling by using more efficient logging and avoiding exposure of sensitive information in exception messages.
- Consider refactoring the class to improve modularity, testability, and adherence to the Single Responsibility Principle.
- Standardize dependency injection by using constructor injection consistently throughout the class.
These changes will lead to a more maintainable and robust service class. Please review the suggested improvements and consider implementing them in future iterations.
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCServletService.java (1)
439-443
: LGTM! Method signature update improves context awareness.The updated
retrieveParticipationForRepository
method call now includes additional parameters (exercise
,isPracticeRepository
,includeInactive
), which aligns with the changes mentioned in the AI-generated summary. This update provides more context and flexibility when retrieving participations.Consider creating a separate GitHub issue to track the TODO item regarding the playwright configuration. This will help ensure it's not forgotten and can be addressed in future updates.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (2)
- src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseParticipationService.java (1 hunks)
- src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCServletService.java (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseParticipationService.java (1)
Pattern
src/main/java/**/*.java
: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_importssrc/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCServletService.java (1)
Pattern
src/main/java/**/*.java
: naming:CamelCase; principles:{single_responsibility,small_methods,no_duplication}; db:{perf_queries,datetime_not_timestamp}; rest:{stateless,singleton,delegate_logic,http_only,minimal_dtos}; dtos:{java_records,no_entities,min_data,single_resp}; di:constructor_injection; kiss:simple_code; file_handling:os_indep_paths; practices:{least_access,avoid_transactions,code_reuse,static_member_ref,prefer_primitives}; sql:{param_annotation,uppercase,avoid_subqueries};java:avoid_star_imports
🔇 Additional comments (2)
src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseParticipationService.java (2)
Line range hint
1-590
: Consider refactoring for improved modularity and testability.While the changes are focused on a specific method, there are some general improvements that could be made to enhance the overall quality of the class:
- The class has many responsibilities and is quite large. Consider breaking it down into smaller, more focused classes.
- Some methods are quite long and complex. Consider extracting some logic into private helper methods for better readability and testability.
- The class uses a mix of constructor injection and field injection. Consider using constructor injection consistently for all dependencies.
Here are some suggestions for refactoring:
- Extract repository-related operations into a separate
ProgrammingExerciseRepositoryService
class.- Create a
ParticipationFactory
class to handle the creation and setup of different types of participations.- Use constructor injection for all dependencies:
@Service public class ProgrammingExerciseParticipationService { private final ProgrammingExerciseStudentParticipationRepository studentParticipationRepository; private final SolutionProgrammingExerciseParticipationRepository solutionParticipationRepository; // ... other repositories private final VersionControlService versionControlService; private final GitService gitService; private final AuthorizationCheckService authorizationCheckService; private final UserRepository userRepository; private final AuxiliaryRepositoryService auxiliaryRepositoryService; public ProgrammingExerciseParticipationService( ProgrammingExerciseStudentParticipationRepository studentParticipationRepository, SolutionProgrammingExerciseParticipationRepository solutionParticipationRepository, // ... other repositories VersionControlService versionControlService, GitService gitService, AuthorizationCheckService authorizationCheckService, UserRepository userRepository, AuxiliaryRepositoryService auxiliaryRepositoryService) { this.studentParticipationRepository = studentParticipationRepository; this.solutionParticipationRepository = solutionParticipationRepository; // ... initialize other repositories this.versionControlService = versionControlService; this.gitService = gitService; this.authorizationCheckService = authorizationCheckService; this.userRepository = userRepository; this.auxiliaryRepositoryService = auxiliaryRepositoryService; } // ... rest of the class }To ensure these refactoring suggestions are applicable, let's check the usage of this service:
#!/bin/bash # Search for usages of ProgrammingExerciseParticipationService rg "ProgrammingExerciseParticipationService" -t java
523-530
:⚠️ Potential issueImprove error handling and logging for repository retrieval.
The changes introduce more detailed error handling when a student participation cannot be found by its repository URI. However, there are some areas for improvement:
- The error message construction could be more efficient.
- The exception message contains sensitive information that shouldn't be exposed in production.
- The code could benefit from better logging.
Consider the following improvements:
var opt = studentParticipationRepository.findByRepositoryUri(repositoryURI); if (opt.isEmpty()) { - var all = studentParticipationRepository.findAll(); - var li = all.stream().map(ProgrammingExerciseStudentParticipation::getRepositoryUri).toList(); - String listString = String.join(", ", li); - throw new EntityNotFoundException(listString + "\nrepori:: " + repositoryURI); + log.error("Could not find student participation for repository URI: {}", repositoryURI); + throw new EntityNotFoundException("Student participation not found for the given repository URI"); }To ensure this change doesn't break existing functionality, let's verify the usage of this method:
...java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseParticipationService.java
Outdated
Show resolved
Hide resolved
…ammingExerciseParticipationService.java
Development
: Fix broken git submission e2e testsDevelopment
: Fix the broken git programming submission e2e tests =
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.
|
This fix does not fix any authentication issue. The problem you noticed is only an issue on Ts5, and happens on all branches. Ts5 not use the integrated code lifecycle but GitlabCI. The problem is with authentication in general, to https://gitlab.artemis.cit.tum.de/users/sign_in |
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.
I tested on TS3 and was able to clone an exercise without any issues.
Development
: Fix the broken git programming submission e2e tests =Development
: Fix the broken git programming submission e2e tests
Checklist
General
Server
Motivation and Context
The MySQL, Local e2e tests have 6 failing tests at the moment. This is caused by a change in the authentication of users. Previously a repository was fetched by using the user name and the exercise id. In #9425 I changed this method, to use less database calls, and to fetch the repository directly by its repositoryURL from the database. It seems in the e2e tests is a misconfiguration somewhere, as the URLs requested to be fetched, do not seem to be in the database.
Description
To fix the tests, until we have found the problem in the e2e tests themselves, I reverted the change to use the old and more complex repository retrieval method.
Steps for Testing
Testserver States
Note
These badges show the state of the test servers.
Green = Currently available, Red = Currently locked
Click on the badges to get to the test servers.
Review Progress
Performance Review
Code Review
Test Coverage
Screenshots