-
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
: Improve git operations performance
#9809
base: develop
Are you sure you want to change the base?
Development
: Improve git operations performance
#9809
Conversation
…still a challenge
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/ArtemisGitServletService.java
Outdated
Show resolved
Hide resolved
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 pmd (7.8.0)src/test/java/de/tum/cit/aet/artemis/shared/base/AbstractSpringIntegrationLocalCILocalVCTest.javaThe following rules are missing or misspelled in your ruleset file category/vm/bestpractices.xml: BooleanInstantiation, DontImportJavaLang, DuplicateImports, EmptyFinallyBlock, EmptyIfStmt, EmptyInitializer, EmptyStatementBlock, EmptyStatementNotInLoop, EmptySwitchStatements, EmptySynchronizedBlock, EmptyTryBlock, EmptyWhileStmt, ExcessiveClassLength, ExcessiveMethodLength, ImportFromSamePackage, MissingBreakInSwitch, SimplifyBooleanAssertion. Please check your ruleset configuration. WalkthroughThe pull request introduces significant updates to various repository and service classes related to programming exercise participation. Key changes include the removal of outdated methods and the introduction of new methods that utilize eager fetching of submissions. The Changes
Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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: 15
🧹 Outside diff range and nitpick comments (13)
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCPushFilter.java (1)
Line range hint
40-65
: Consider additional performance optimizationsWhile the changes improve efficiency by reducing parsing overhead, consider these additional optimizations:
- Use asynchronous logging to prevent I/O operations from blocking the filter chain
- Consider caching authorization results for subsequent requests from the same user
- Evaluate if the VCS access log update could be moved to a background task
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/ArtemisGitServletService.java (1)
Line range hint
1-85
: Architectural Concerns: State Management vs PerformanceWhile this PR aims to improve git operations performance, the introduced changes raise several concerns:
- The implementation adds shared state to a singleton servlet, which could degrade performance under load
- The stateful approach contradicts REST principles from the coding guidelines
- The changes don't clearly address the stated goal of improving git operations performance
Consider these recommendations:
- Remove all shared state (
c
variable and related code)- Use proper session management for tracking push attempts
- Focus on actual performance improvements such as:
- Connection pooling
- Caching repository access
- Optimizing hook execution
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCPostPushHook.java (1)
Line range hint
22-26
: Update class documentation to reflect caching behavior.The class documentation should be updated to explain the caching of session data and its performance benefits. Consider adding:
- Description of cached fields
- Lifecycle of cached data
- Performance implications
/** * Contains an onPostReceive method that is called by JGit after a push has been received (i.e. after the pushed files were successfully written to disk). + * + * This implementation caches session data (participation, exercise, and VCS access log) to optimize performance by reducing + * redundant database calls during push processing. The cached data is obtained either from SSH session attributes or HTTP + * session attributes, depending on the access method. */src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/VcsAccessLogService.java (1)
99-111
: Good improvements in separation of concerns and resource handling.The changes improve the method by:
- Separating log creation from storage
- Using try-with-resources for safe Git operations
- Adding flexibility with Optional return type
Consider enhancing error handling and readability.
A few suggestions for improvement:
- Add error logging for GitAPIException
- Extract participation type check to a utility method
- Consider a more concise name like
createCodeEditorAccessLog
Here's the suggested implementation:
- public Optional<VcsAccessLog> createPreliminaryCodeEditorAccessLog(Repository repo, User user, Long participationId) throws GitAPIException { + public Optional<VcsAccessLog> createCodeEditorAccessLog(Repository repo, User user, Long participationId) throws GitAPIException { try (Git git = new Git(repo)) { String lastCommitHash = git.log().setMaxCount(1).call().iterator().next().getName(); var participation = participationRepository.findById(participationId); - if (participation.isPresent() && participation.get() instanceof ProgrammingExerciseParticipation programmingParticipation) { + return participation + .filter(p -> p instanceof ProgrammingExerciseParticipation) + .map(p -> (ProgrammingExerciseParticipation) p) + .map(programmingParticipation -> { log.debug("Storing access operation for user {}", user); - - return Optional.of(new VcsAccessLog(user, (Participation) programmingParticipation, user.getName(), user.getEmail(), RepositoryActionType.WRITE, - AuthenticationMechanism.CODE_EDITOR, lastCommitHash, null)); - } + return new VcsAccessLog(user, (Participation) programmingParticipation, user.getName(), + user.getEmail(), RepositoryActionType.WRITE, + AuthenticationMechanism.CODE_EDITOR, lastCommitHash, null); + }); + } catch (GitAPIException e) { + log.error("Error getting last commit hash for repository: {}", repo.getLocalPath(), e); + throw e; } - return Optional.empty(); }src/main/java/de/tum/cit/aet/artemis/programming/repository/SolutionProgrammingExerciseParticipationRepository.java (1)
46-47
: LGTM! Good performance optimization.The method correctly implements eager loading for submissions using
@EntityGraph
, which will help prevent N+1 query issues. The naming clearly indicates the eager loading behavior, maintaining consistency with other repository interfaces.Consider monitoring the query execution plan and response times in production, especially for cases with large numbers of submissions, to ensure optimal performance.
src/main/java/de/tum/cit/aet/artemis/programming/service/RepositoryService.java (1)
458-461
: Consider renaming the method to better reflect its responsibilitiesThe method now has dual responsibility: committing changes and creating a log entry. Consider renaming it to
commitChangesAndCreateLog
to better reflect its behavior.-public Optional<VcsAccessLog> commitChanges(Repository repository, User user, Long domainId) throws GitAPIException { +public Optional<VcsAccessLog> commitChangesAndCreateLog(Repository repository, User user, Long domainId) throws GitAPIException {src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseParticipationService.java (2)
130-141
: Method signature simplified and performance improved.The method now consistently uses eager loading for submissions and students, which is good for performance when both are frequently needed together. However, this might impact performance when only the participation data is needed.
Consider adding a separate method for cases where submissions and students are not needed, to avoid unnecessary data fetching.
Line range hint
439-475
: Potential performance bottleneck in repository type checks.The method performs multiple repository type checks and database queries. While eager loading improves individual query performance, the sequential nature of checks could be optimized.
Consider using a switch expression or enum map to reduce branching:
- if (repositoryTypeOrUserName.equals(RepositoryType.SOLUTION.toString()) || repositoryTypeOrUserName.equals(RepositoryType.TESTS.toString()) || isAuxiliaryRepository) { - return solutionParticipationRepository.findWithEagerResultsAndSubmissionsByProgrammingExerciseIdElseThrow(exercise.getId()); - } - - if (repositoryTypeOrUserName.equals(RepositoryType.TEMPLATE.toString())) { - return templateParticipationRepository.findWithEagerResultsAndSubmissionsByProgrammingExerciseIdElseThrow(exercise.getId()); - } + return switch(RepositoryType.valueOf(repositoryTypeOrUserName.toUpperCase())) { + case SOLUTION, TESTS -> solutionParticipationRepository.findWithEagerResultsAndSubmissionsByProgrammingExerciseIdElseThrow(exercise.getId()); + case TEMPLATE -> templateParticipationRepository.findWithEagerResultsAndSubmissionsByProgrammingExerciseIdElseThrow(exercise.getId()); + default -> handleStudentOrTeamParticipation(exercise, repositoryTypeOrUserName, isPracticeRepository, isExamEditorRepository); + };src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCServletService.java (5)
441-442
: Remove Commented-Out Code and Address TODOThe commented-out code can lead to confusion and clutter in the codebase. Additionally, there's a TODO indicating the need to add back the code once issues are resolved.
Consider removing the commented code or creating a GitHub issue to track this task. Would you like assistance in refactoring this section or opening an issue to address the TODO?
Also applies to: 445-447
488-499
: Handle Missing Request or Session GracefullyThe code logs a warning if neither the HTTP request nor the server session is present. Consider handling this scenario appropriately, possibly by throwing an exception or implementing a fallback.
Apply this diff to throw an exception when both are absent:
} else { - log.warn("authorizeUser: Neither HTTP request nor server session found"); + throw new IllegalStateException("Neither HTTP request nor server session is present. Cannot cache attributes."); }
538-545
: Update Method DocumentationThere's a TODO to fix the documentation for the
repository
parameter.Please update the documentation to accurately reflect the purpose of the
repository
parameter. Would you like assistance in drafting the updated documentation?
800-800
: Address Missing DocumentationThe TODO comment indicates missing documentation. Ensure that all public methods are properly documented according to the project's coding guidelines.
Would you like assistance in generating the necessary documentation for this method?
806-807
: Ensure Consistent Use of @async AnnotationThe methods
updateAndStoreVCSAccessLogForCloneAndPullHTTPS
,updateAndStoreVCSAccessLogForPushHTTPS
, andupdateAndStoreVCSAccessLogForCloneAndPullSSH
should consistently use the@Async
annotation if they are intended to run asynchronously.Apply this diff to add the
@Async
annotation where missing:+@Async public void updateAndStoreVCSAccessLogForPushHTTPS(String method, String authorizationHeader, VcsAccessLog vcsAccessLog) { // method implementation } +@Async public void updateAndStoreVCSAccessLogForCloneAndPullSSH(ServerSession session, int clientOffered) { // method implementation }Also applies to: 834-834, 864-864
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (17)
src/main/java/de/tum/cit/aet/artemis/programming/repository/ProgrammingExerciseStudentParticipationRepository.java
(1 hunks)src/main/java/de/tum/cit/aet/artemis/programming/repository/SolutionProgrammingExerciseParticipationRepository.java
(1 hunks)src/main/java/de/tum/cit/aet/artemis/programming/repository/TemplateProgrammingExerciseParticipationRepository.java
(1 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseParticipationService.java
(5 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/RepositoryService.java
(2 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/ArtemisGitServletService.java
(3 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/HttpsConstants.java
(1 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCFetchPreUploadHook.java
(2 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCFetchPreUploadHookSSH.java
(1 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCPostPushHook.java
(3 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCPushFilter.java
(4 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCServletService.java
(16 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/SshGitLocationResolverService.java
(2 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/VcsAccessLogService.java
(3 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/ssh/SshConstants.java
(1 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/ssh/SshGitCommand.java
(1 hunks)src/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryResource.java
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/HttpsConstants.java
🧰 Additional context used
📓 Path-based instructions (16)
src/main/java/de/tum/cit/aet/artemis/programming/repository/ProgrammingExerciseStudentParticipationRepository.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
src/main/java/de/tum/cit/aet/artemis/programming/repository/SolutionProgrammingExerciseParticipationRepository.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
src/main/java/de/tum/cit/aet/artemis/programming/repository/TemplateProgrammingExerciseParticipationRepository.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
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_imports
src/main/java/de/tum/cit/aet/artemis/programming/service/RepositoryService.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
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/ArtemisGitServletService.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
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCFetchPreUploadHook.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
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCFetchPreUploadHookSSH.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
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCPostPushHook.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
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCPushFilter.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
src/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
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/SshGitLocationResolverService.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
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/VcsAccessLogService.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
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/ssh/SshConstants.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
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/ssh/SshGitCommand.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
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryResource.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 (34)
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCFetchPreUploadHookSSH.java (2)
16-19
: LGTM! Constructor follows best practices
The simplified constructor properly implements dependency injection and maintains immutability through final fields.
23-23
: Verify performance impact of the new storage operation
The method name change from updateVCSAccessLogForCloneAndPullSSH
to updateAndStoreVCSAccessLogForCloneAndPullSSH
suggests an additional storage operation. Given the PR's focus on git operations performance and the context of large course setups (2000+ students), we should verify that this change doesn't introduce performance bottlenecks.
Let's check the implementation of the new method:
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/ssh/SshConstants.java (2)
9-11
: LGTM! Import statements follow best practices.
The imports are properly organized and avoid wildcards, following Java conventions.
20-24
: LGTM! Constants are well-defined and properly typed.
The new constants follow the established pattern and maintain consistency with the existing code structure.
Let's verify the usage of these new constants in the context of git operations:
✅ Verification successful
Constants are correctly used for session attribute management in git operations
The verification shows that the constants are properly used across the codebase:
REPOSITORY_EXERCISE_KEY
is used inSshGitLocationResolverService
andLocalVCPostPushHook
for exercise trackingVCS_ACCESS_LOG_KEY
is used consistently in both SSH and HTTPS contexts for access loggingPARTICIPATION_KEY
is used inLocalVCServletService
andLocalVCPostPushHook
for participation tracking
The usage patterns align with git operation performance improvements by:
- Maintaining consistent session state across git operations
- Properly tracking VCS access logs for both SSH and HTTPS protocols
- Ensuring exercise and participation data is available for post-push hooks
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check usage patterns of the new constants to ensure they align with the PR's performance improvement goals
# Search for REPOSITORY_EXERCISE_KEY usage
echo "=== REPOSITORY_EXERCISE_KEY usage ==="
rg "REPOSITORY_EXERCISE_KEY" -A 3
# Search for VCS_ACCESS_LOG_KEY usage
echo "=== VCS_ACCESS_LOG_KEY usage ==="
rg "VCS_ACCESS_LOG_KEY" -A 3
# Search for PARTICIPATION_KEY usage
echo "=== PARTICIPATION_KEY usage ==="
rg "PARTICIPATION_KEY" -A 3
# Look for potential performance-related patterns around these constants
echo "=== Performance-related patterns ==="
rg -A 5 "getAttribute.*(?:REPOSITORY_EXERCISE_KEY|VCS_ACCESS_LOG_KEY|PARTICIPATION_KEY)"
Length of output: 16189
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCPushFilter.java (1)
4-4
: LGTM: Clean import addition
The import follows Java coding guidelines and is appropriately specific.
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/ArtemisGitServletService.java (1)
68-68
: Verify user authentication and request handling in hooks
While moving to session-based user retrieval is good, there are some concerns:
- Need to verify null user handling in PrePushHook
- Passing the entire request object to PostPushHook could lead to memory leaks if stored
Let's verify the hooks implementation:
Also applies to: 70-70
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/SshGitLocationResolverService.java (4)
10-10
: LGTM: Clean import addition
The explicit import of Optional is appropriate for the updated method signature.
Line range hint 43-94
: Verify alignment with performance objectives
While these changes improve session management and authorization flexibility, it's not immediately clear how they contribute to the PR's stated goal of improving git operations performance. Consider:
- Documenting the performance impact of these changes
- Adding metrics or logging to measure any performance improvements
- Explaining how session management changes relate to git operation optimization
#!/bin/bash
# Look for performance-related changes in nearby files
rg -g '*.java' -B 2 -A 2 'performance|optimization'
# Check for any performance metrics or monitoring
ast-grep --pattern 'Timer|Metrics|StopWatch'
82-84
: Document authorization flow changes
The authorization now supports optional parameters, but:
- The rationale for passing Optional.empty() for request while including the session should be documented
- The relationship between HttpServletRequest and ServerSession should be clarified
Consider adding a comment explaining:
- Why HttpServletRequest is omitted
- The authorization flow with SSH sessions
✅ Verification successful
Let me generate additional scripts to check the authorization flow.
The previous search didn't yield the relevant information, so I'm trying to specifically look for the authorization method implementation and SSH authentication patterns to understand the relationship between HttpServletRequest and ServerSession in the context of SSH authentication.
Based on the search results, I can now generate the final response as we have enough context about the authorization flow. The results show that there are two different authorization patterns: one for HTTP requests (with HttpServletRequest) and another for SSH sessions (with ServerSession), and they are handled appropriately in the codebase.
Authorization flow is correctly implemented
The code correctly handles two distinct authentication mechanisms:
- HTTP: Uses
Optional.of(request), Optional.empty()
for the request/session parameters - SSH: Uses
Optional.empty(), Optional.of(session)
for the request/session parameters
This is a valid pattern as these are mutually exclusive authentication paths - HTTP requests will have a servlet request but no SSH session, while SSH connections will have a session but no HTTP request.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check the LocalVCServletService implementation for authorization logic
ast-grep --pattern 'authorizeUser($$$) {
$$$
}'
# Look for similar authorization patterns
rg -A 5 'authorizeUser.*Optional'
Length of output: 31355
Script:
#!/bin/bash
# Check the LocalVCServletService implementation for authorizeUser method
ast-grep --pattern 'authorizeUser($$$) {
$$$
}'
# Look for similar authorization patterns in the codebase
rg -A 5 'authorizeUser.*Optional'
# Check for any SSH authentication related code
rg -A 5 'AuthenticationMechanism.SSH'
Length of output: 4185
75-75
: Consider session storage implications
Storing the entire exercise object in the session might lead to:
- Memory overhead for large exercise objects
- Stale data if the exercise is modified during the session
- Potential serialization issues in a distributed environment
Consider:
- Storing only the necessary exercise attributes
- Adding a comment explaining why this session storage is needed
- Implementing a cleanup mechanism
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCPostPushHook.java (3)
5-20
: LGTM! Import statements follow guidelines.
The imports are properly organized and avoid using wildcard imports as per coding guidelines.
29-33
: LGTM! Field declarations follow best practices.
Fields are properly encapsulated (private) and immutable (final), following the principle of least access.
87-87
: LGTM! Method changes improve performance.
The use of Optional.ofNullable for cached session data reduces redundant database calls while maintaining null safety.
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/ssh/SshGitCommand.java (2)
88-88
: LGTM: Simplified hook constructor.
The removal of the rootDir
parameter from LocalVCFetchPreUploadHookSSH
constructor aligns with the principle of passing only necessary dependencies.
94-94
: LGTM: Enhanced session handling in post-push hook.
The addition of getServerSession()
to LocalVCPostPushHook
constructor improves the hook's ability to access session context.
Let's verify the hook behavior changes:
✅ Verification successful
Let me gather more information about the hook implementations to verify the session handling changes.
Let me check one more aspect to verify how the session is being used in both hooks.
Based on the verification results, I can now provide the final response:
Verified: Session handling enhancement is correctly implemented
The session integration in LocalVCPostPushHook
is properly implemented with:
- Consistent constructor usage across both SSH and HTTP contexts
- Proper session attribute extraction for participation, exercise, and VCS access log
- Parallel implementation with
LocalVCFetchPreUploadHookSSH
for session handling
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the impact of hook constructor changes
# Check if the hooks are used consistently across the codebase
echo "Checking LocalVCFetchPreUploadHookSSH usage..."
ast-grep --pattern 'new LocalVCFetchPreUploadHookSSH($$$)'
echo "Checking LocalVCPostPushHook usage..."
ast-grep --pattern 'new LocalVCPostPushHook($$$)'
# Verify if there are any remaining references to rootDir in hook implementations
echo "Checking for rootDir references in hooks..."
rg -l "rootDir" --type java
Length of output: 1462
Script:
#!/bin/bash
# Check the implementation of LocalVCPostPushHook to verify session handling
echo "Checking LocalVCPostPushHook implementation..."
ast-grep --pattern 'class LocalVCPostPushHook {
$$$
}'
# Check the constructor parameters and usage of session in LocalVCPostPushHook
echo "Checking LocalVCPostPushHook constructor and session usage..."
rg -A 10 "class LocalVCPostPushHook"
# Check if there are any other session-related hooks
echo "Checking for other session-related hooks..."
rg -l "Session" --type java | grep -i "hook"
Length of output: 2172
Script:
#!/bin/bash
# Check how session is used in both hooks
echo "Checking session usage in LocalVCPostPushHook..."
rg -A 20 "serverSession" src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCPostPushHook.java
echo "Checking session usage in LocalVCFetchPreUploadHookSSH..."
rg -A 20 "serverSession" src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCFetchPreUploadHookSSH.java
# Check the interface implementation
echo "Checking PostReceiveHook interface..."
rg -A 5 "interface PostReceiveHook"
Length of output: 2965
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/VcsAccessLogService.java (1)
5-6
: LGTM: Import addition is appropriate.
The Optional import is necessary for the new return type and follows Java import conventions.
src/main/java/de/tum/cit/aet/artemis/programming/repository/TemplateProgrammingExerciseParticipationRepository.java (2)
54-55
: LGTM! Consistent error handling pattern.
The convenience method follows the repository's established pattern for exception handling and maintains consistency with other similar methods in the codebase.
51-52
: LGTM! Verify performance improvement with large datasets.
The eager loading of submissions through @EntityGraph
is a good optimization that should reduce N+1 query problems. This aligns well with the PR's performance improvement objectives.
Let's verify the query performance improvement:
✅ Verification successful
Let me gather more specific information about the repository methods and their usage patterns.
Based on the search results, I can now generate the final response:
Eager loading optimization is correctly implemented and consistent with codebase patterns
The implementation of findWithSubmissionsByRepositoryUri
with @EntityGraph
follows the established pattern in the codebase for optimizing database queries. Similar eager loading patterns are used throughout the codebase, particularly in:
- Other template participation repositories
- Student participation repositories (e.g.,
findByExerciseIdWithEagerSubmissions
) - Programming exercise repositories
The change aligns with the codebase's approach to preventing N+1 query problems through strategic eager loading of related entities.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Search for potential N+1 query patterns in repository methods
# that might still need optimization
# Look for other repository methods that might benefit from similar optimization
rg -g '*.java' -A 5 'findBy.*Repository.*\(' src/main/java
# Look for potential lazy loading in related service classes
ast-grep --pattern 'class $SERVICE_CLASS implements $_ {
$$$
public $_ find$_($$_) {
$$$
getSubmissions()
$$$
}
$$$
}'
Length of output: 2308
Script:
#!/bin/bash
# Look for related repository methods and their entity graph usage
rg -g '*.java' -B 2 -A 2 '@EntityGraph.*findBy' src/main/java
# Search for repository methods specifically dealing with submissions
rg -g '*.java' 'findBy.*[Ss]ubmission.*\(' src/main/java
# Look for similar template participation repository usages
ast-grep --pattern 'interface $_Repository extends $_ {
$$$
Optional<$_> findBy$_($_);
$$$
}'
Length of output: 38667
src/main/java/de/tum/cit/aet/artemis/programming/repository/SolutionProgrammingExerciseParticipationRepository.java (2)
49-51
: LGTM! Good error handling pattern.
The method follows the repository's consistent pattern for throwing methods, properly delegating to the optional-returning method and reusing the existing error handling utility.
46-51
: Verify performance with large datasets
Since the PR aims to improve git operations performance and mentions "large course setups with over 2000 students", we should verify the eager loading behavior with large datasets.
✅ Verification successful
Eager loading pattern is appropriate for this use case
The eager loading of submissions using @EntityGraph
is a verified performance optimization pattern in this codebase, supported by several findings:
- The codebase shows consistent use of
@EntityGraph
for optimizing database queries, particularly in repository methods that need related entities. - The repository follows established patterns seen in other repositories like
ResultRepository
which use similar optimizations to "avoid performance issues". - The eager loading of submissions is appropriate here as the repository URI lookup is typically used in git operations where submission data is immediately needed.
- The codebase contains multiple performance-related optimizations and comments showing careful consideration of database query performance.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for test files that might contain relevant performance tests
echo "Searching for performance tests..."
rg -l "Performance|@Test.*large|@Test.*timeout" --type java
# Look for existing test data setup with large datasets
echo "Searching for test data setup..."
rg -A 5 "setUp|@BeforeEach" --type java | rg -A 5 "2000|large|many"
# Check if there are any existing performance benchmarks
echo "Searching for performance benchmarks..."
fd -e java -e yml -e yaml | rg -l "benchmark|performance"
Length of output: 586
Script:
#!/bin/bash
# Let's examine the content of the found files to understand the performance context
echo "Checking CourseService.java for performance-related code..."
rg -A 10 "Performance|large" src/main/java/de/tum/cit/aet/artemis/core/service/CourseService.java
echo "Checking StaticCodeAnalysisConfigurer.java for performance-related code..."
rg -A 10 "Performance|large" src/main/java/de/tum/cit/aet/artemis/core/config/StaticCodeAnalysisConfigurer.java
# Let's also check for similar repository patterns with EntityGraph
echo "Checking for similar repository patterns with EntityGraph..."
ast-grep --pattern 'interface $_ {
@EntityGraph(type = LOAD, attributePaths = { $$$ })
$$$
}'
# Check for any existing performance-related tests for repositories
echo "Checking for repository tests..."
fd -e java | rg -l "RepositoryTest|IntegrationTest"
Length of output: 4073
Script:
#!/bin/bash
# Let's check for similar repository methods and their EntityGraph usage
echo "Checking for similar repository methods with EntityGraph..."
rg -B 2 -A 2 "@EntityGraph.*findWith.*" --type java
# Let's examine the base repository class for any performance-related configurations
echo "Checking base repository implementation..."
rg -l "extends.*Repository|implements.*Repository" --type java | xargs rg -l "getValueElseThrow"
# Let's check for any existing pagination or batch processing
echo "Checking for pagination in repositories..."
rg "Pageable|@BatchSize|FetchMode" --type java
# Let's look for any performance-related comments or documentation
echo "Checking for performance-related comments..."
rg "(?i)//.*perform|/\*.*perform" --type java
Length of output: 80636
src/main/java/de/tum/cit/aet/artemis/programming/repository/ProgrammingExerciseStudentParticipationRepository.java (2)
84-85
: LGTM! Clean implementation of convenience method.
The default method follows the repository's established pattern for throwing methods and maintains consistency with other similar methods in the interface.
81-82
: LGTM! Verify performance impact of eager loading.
The use of @EntityGraph
for eager loading submissions is a good approach for optimizing repository queries. This aligns well with the PR's objective of improving git operations performance.
Let's verify the query performance and usage:
✅ Verification successful
Based on the results, I can now generate the final response as we have sufficient information about the usage context.
Verified: Eager loading of submissions is appropriate for all use cases
The method is used in ProgrammingExerciseParticipationService
where submissions data is consistently needed across different repository types (solution, template, student). The eager loading strategy is justified because:
- All repository types (solution, template, student) implement similar patterns with
@EntityGraph
- The service layer uses these methods in contexts where submission data is required
- No cases found where submissions data is fetched but not used
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for potential N+1 query issues and verify the usage context
# Find all service layer calls to this repository method
rg -A 3 "findWithSubmissionsByRepositoryUri|findByRepositoryUri" --type java
# Look for potential places where submissions might not be needed
ast-grep --pattern 'findWithSubmissionsByRepositoryUri($repositoryUri)'
Length of output: 5743
src/main/java/de/tum/cit/aet/artemis/programming/service/RepositoryService.java (2)
48-48
: LGTM!
The import is properly organized and follows Java conventions.
458-461
: Verify all callers handle the new Optional return type
The method's return type has changed from void
to Optional<VcsAccessLog>
. This is a breaking change that requires updates to all calling code.
✅ Verification successful
Let me analyze the results and generate a final response.
The Optional return type is properly handled by callers
The search results show that commitChanges()
is only called from RepositoryResource.java
and its subclasses. The main caller in RepositoryResource.java
properly handles the return value by storing it in a variable:
var vcsAccessLog = repositoryService.commitChanges(repository, user, domainId);
The other occurrences are in subclasses that simply delegate to the superclass implementation:
TestRepositoryResource
AuxiliaryRepositoryResource
RepositoryProgrammingExerciseParticipationResource
The return value is not used in the subsequent code, which is acceptable since Optional
is designed to handle cases where the value may or may not be present.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Find all callers of the commitChanges method to ensure they handle the Optional return type
# Search for method calls
echo "Searching for direct method calls to commitChanges..."
ast-grep --pattern 'commitChanges($$$)'
# Search for method references
echo "Searching for method references..."
rg "commitChanges\(" -A 2
Length of output: 4158
src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseParticipationService.java (1)
165-177
: Verify error handling for the test run flag.
The method correctly uses eager loading for submissions, but the error message doesn't mention the test run flag which was used in the query.
Consider updating the error message to include the test run status:
- throw new EntityNotFoundException("Participation could not be found by exerciseId " + exercise.getId() + " and user " + username);
+ throw new EntityNotFoundException("Participation could not be found by exerciseId " + exercise.getId() + ", user " + username + " and testRun " + isTestRun);
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCFetchPreUploadHook.java (2)
11-11
: Properly importing VcsAccessLog
The import statement for VcsAccessLog
is necessary for the new implementation and follows the coding guidelines.
26-30
: Correctly handling VCS access log with type checking
The updated code retrieves the VcsAccessLog
from the request attributes and uses an instanceof
check to ensure type safety before updating the access log. This approach enhances robustness and prevents potential ClassCastException
.
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCServletService.java (7)
54-54
: Unused Imports Detected
The added import statements for Participation
and VcsAccessLog
are necessary for the new code additions. Ensure that they are used appropriately in the codebase.
Also applies to: 63-63
257-257
: Method Invocation Matches Updated Signature
The call to authorizeUser
now includes the optional parameters Optional.of(request)
and Optional.empty()
, aligning with the updated method signature.
460-460
: Method Invocation Consistency
The cacheAttributesInRequestOrSession
method is called with all the necessary parameters. Ensure that the parameters match the updated method signature and are correctly passed.
535-537
: Overloaded Method Clarity
Introduced an overloaded processNewPush
method with additional parameters for caching. Ensure that the method overloading does not lead to confusion and that method documentation is updated accordingly.
556-558
: Efficient Use of Optional Parameters
The use of Optional
parameters for caching exercise and participation improves efficiency by reducing redundant database calls. Ensure that this pattern is consistently applied where appropriate.
426-428
: Confirm Access Control Logic
Ensure that the access control logic correctly prevents students from accessing test and auxiliary repositories. The condition checks if the user is at least a teaching assistant and whether the repository is of type TESTS or an auxiliary repository.
Run the following script to verify that students cannot access these repositories:
✅ Verification successful
Access Control Logic Verified
The code correctly implements access control for test and auxiliary repositories:
-
The condition checks both repository type and user role:
if (authorizationCheckService.isAtLeastTeachingAssistantForExercise(exercise, user) && (repositoryTypeOrUserName.equals(RepositoryType.TESTS.toString()) || auxiliaryRepositoryService.isAuxiliaryRepositoryOfExercise(repositoryTypeOrUserName, exercise)))
-
Multiple security layers are enforced:
- Role check via
isAtLeastTeachingAssistantForExercise
- Repository type validation
- Additional repository access check via
checkAccessTestOrAuxRepositoryElseThrow
- Role check via
-
The implementation is used consistently across the codebase in relevant classes like:
LocalVCServletService
ProgrammingExerciseParticipationResource
AuxiliaryRepositoryResource
-
All repository access endpoints are protected with
@EnforceAtLeastTutor
annotation
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify that only users with TA role or above can access TESTS and auxiliary repositories.
# Test: Attempt to access TESTS repository as a student user. Expect: Access denied.
curl -u student_user:password -X GET 'http://localhost/git/{projectKey}/tests'
# Test: Attempt to access auxiliary repository as a student user. Expect: Access denied.
curl -u student_user:password -X GET 'http://localhost/git/{projectKey}/{auxRepositoryName}'
Length of output: 246
Script:
#!/bin/bash
# Let's verify the access control implementation in the codebase
# Check for other security checks related to repository access
rg -A 5 "isAtLeastTeachingAssistantForExercise|isAtLeastInstructorInCourse" --type java
# Look for repository access control implementations
ast-grep --pattern 'if ($authService.isAtLeastTeachingAssistantForExercise($_)) {
$$$
}'
# Check for auxiliary repository related security
rg -A 5 "auxiliaryRepository|RepositoryType.TESTS" --type java
# Look for other endpoints or methods handling repository access
ast-grep --pattern 'public $_ get$_Repository($_) {
$$$
}'
Length of output: 309155
608-609
: Assess Eager Loading Impact on Performance
The methods retrieveParticipationWithSubmissionsByRepository
could lead to performance issues due to eager loading of submissions, especially in large courses with over 2000 students.
[performance]
Run the following script to analyze the performance impact:
Consider implementing pagination or lazy loading if performance degradation is observed.
Also applies to: 769-769
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCPushFilter.java
Outdated
Show resolved
Hide resolved
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCPushFilter.java
Outdated
Show resolved
Hide resolved
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/ArtemisGitServletService.java
Outdated
Show resolved
Hide resolved
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/ArtemisGitServletService.java
Outdated
Show resolved
Hide resolved
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/ArtemisGitServletService.java
Outdated
Show resolved
Hide resolved
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCServletService.java
Outdated
Show resolved
Hide resolved
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCServletService.java
Outdated
Show resolved
Hide resolved
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCServletService.java
Outdated
Show resolved
Hide resolved
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCServletService.java
Outdated
Show resolved
Hide resolved
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCServletService.java
Outdated
Show resolved
Hide resolved
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: 2
🧹 Outside diff range and nitpick comments (4)
src/main/java/de/tum/cit/aet/artemis/programming/repository/TemplateProgrammingExerciseParticipationRepository.java (1)
51-56
: Consider documenting the performance optimization strategy.These changes are part of a broader effort to improve git operations performance through eager loading. Consider adding documentation in the repository interface explaining:
- The overall strategy for optimizing repository queries
- Guidelines for when to use eager vs. lazy loading
- The relationship between these optimizations and git operations performance
This documentation would help maintain consistency as the codebase evolves.
src/main/java/de/tum/cit/aet/artemis/programming/repository/ProgrammingExerciseStudentParticipationRepository.java (1)
81-85
: Consider documenting the performance implicationsWhile the implementation is solid, it would be beneficial to document the performance characteristics of these methods, especially since they're part of a performance improvement initiative.
Consider adding Javadoc comments that:
- Explain the eager loading behavior
- Document potential performance implications with large datasets
- Provide usage guidelines for optimal performance
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCServletService.java (2)
Line range hint
445-473
: Consider using an enum for the connection type.Replace the boolean
usingSSH
parameter with an enum to improve code readability and maintainability.Consider this refactor:
+public enum ConnectionType { + SSH, + HTTPS +} -public Optional<ProgrammingExerciseParticipation> authorizeUser(String repositoryTypeOrUserName, User user, ProgrammingExercise exercise, - RepositoryActionType repositoryActionType, LocalVCRepositoryUri localVCRepositoryUri, boolean usingSSH) +public Optional<ProgrammingExerciseParticipation> authorizeUser(String repositoryTypeOrUserName, User user, ProgrammingExercise exercise, + RepositoryActionType repositoryActionType, LocalVCRepositoryUri localVCRepositoryUri, ConnectionType connectionType) -if (usingSSH) { +if (connectionType == ConnectionType.SSH) {
475-499
: Add missing documentation for the method parameters.The TODO comment indicates missing documentation. Please complete the JavaDoc for all parameters and the return value.
Add this documentation:
/** * Checks if the provided repository is an auxiliary or test repository. * Only load auxiliary repositories if a user is at least teaching assistant; students are not allowed to access them - * // TODO docs * - * @param exercise - * @param repositoryTypeOrUserName - * @param repositoryActionType - * @param user - * @return + * @param exercise The programming exercise to check + * @param repositoryTypeOrUserName The type of repository or username to check + * @param repositoryActionType The type of action being performed on the repository + * @param user The user attempting to access the repository + * @return true if the repository is an auxiliary or test repository and the user has appropriate access, false otherwise * @throws LocalVCForbiddenException if the user doesn't have sufficient permissions */
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (13)
src/main/java/de/tum/cit/aet/artemis/programming/repository/ProgrammingExerciseStudentParticipationRepository.java
(1 hunks)src/main/java/de/tum/cit/aet/artemis/programming/repository/SolutionProgrammingExerciseParticipationRepository.java
(1 hunks)src/main/java/de/tum/cit/aet/artemis/programming/repository/TemplateProgrammingExerciseParticipationRepository.java
(1 hunks)src/main/java/de/tum/cit/aet/artemis/programming/repository/VcsAccessLogRepository.java
(1 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseParticipationService.java
(4 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/ArtemisGitServletService.java
(2 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCFetchPreUploadHook.java
(1 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCFetchPreUploadHookSSH.java
(1 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCPostPushHook.java
(3 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCPushFilter.java
(1 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCServletService.java
(15 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/SshGitLocationResolverService.java
(1 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/VcsAccessLogService.java
(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (8)
- src/main/java/de/tum/cit/aet/artemis/programming/repository/SolutionProgrammingExerciseParticipationRepository.java
- src/main/java/de/tum/cit/aet/artemis/programming/service/ProgrammingExerciseParticipationService.java
- src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/ArtemisGitServletService.java
- src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCFetchPreUploadHook.java
- src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCFetchPreUploadHookSSH.java
- src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCPostPushHook.java
- src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/SshGitLocationResolverService.java
- src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/VcsAccessLogService.java
🧰 Additional context used
📓 Path-based instructions (5)
src/main/java/de/tum/cit/aet/artemis/programming/repository/ProgrammingExerciseStudentParticipationRepository.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
src/main/java/de/tum/cit/aet/artemis/programming/repository/TemplateProgrammingExerciseParticipationRepository.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
src/main/java/de/tum/cit/aet/artemis/programming/repository/VcsAccessLogRepository.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
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCPushFilter.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
src/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 (13)
src/main/java/de/tum/cit/aet/artemis/programming/repository/VcsAccessLogRepository.java (2)
30-41
: LGTM! Well-optimized query implementation.
The updated query is efficient and follows best practices:
- Uses primary key (id) for ordering
- Includes LIMIT clause for early result return
- Clear and concise SQL structure
50-58
: Verify query performance with TREAT clause.
While the query structure is sound, there are potential performance considerations:
- The TREAT clause with LEFT JOIN might impact query performance for large datasets
- Consider adding an index on repositoryUri if not already present
Let's verify the index existence and analyze similar patterns:
src/main/java/de/tum/cit/aet/artemis/programming/repository/TemplateProgrammingExerciseParticipationRepository.java (2)
54-56
: LGTM! Implementation follows repository patterns.
The method maintains consistent error handling patterns and properly reuses the existing helper method.
51-52
: Add documentation and verify query performance.
While the method follows the repository's pattern for eager loading, it would benefit from documentation explaining its purpose and usage context. Additionally, let's verify the query performance.
src/main/java/de/tum/cit/aet/artemis/programming/repository/ProgrammingExerciseStudentParticipationRepository.java (2)
84-85
: LGTM! Consistent error handling implementation
The method follows the repository's established pattern for handling missing entities and maintains consistency with other similar methods in the codebase.
81-82
: LGTM! Verify eager loading behavior
The implementation correctly uses @EntityGraph
for eager loading of submissions, which should improve performance by reducing N+1 queries.
Let's verify the eager loading implementation:
✅ Verification successful
Based on the extensive search results, I can now provide a definitive response regarding the eager loading implementation:
Verified: Eager loading pattern is consistently implemented across repositories
The implementation of @EntityGraph
for eager loading submissions is correctly used and follows a consistent pattern across the codebase:
- The method
findWithSubmissionsByRepositoryUri
inProgrammingExerciseStudentParticipationRepository
matches similar implementations in related repositories likeSolutionProgrammingExerciseParticipationRepository
andTemplateProgrammingExerciseParticipationRepository
- The eager loading of submissions is used appropriately with
type = LOAD
andattributePaths = { "submissions" }
- The pattern is part of a broader consistent approach for optimizing database queries across the application, with similar methods for loading other related entities
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for consistent usage of eager loading patterns
# Look for other repository methods that might benefit from similar optimization
# Search for similar repository methods that fetch submissions
rg --type java "findBy.*Repository.*Uri" -B 2 -A 2
# Look for potential N+1 query patterns in related repositories
ast-grep --pattern 'interface $REPO extends $_ {
$$$
@Query("SELECT $_ FROM $_ WHERE $_ IN $_")
$$$
}'
Length of output: 6137
Script:
#!/bin/bash
# Let's check for the usage patterns of these repository methods and EntityGraph annotations
# Check for all findByRepositoryUri usages to understand the context
rg --type java "findByRepositoryUri" -B 3 -A 3
# Look for EntityGraph usage in related repository interfaces
rg --type java "@EntityGraph.*submissions" -B 2 -A 2
# Check for any other methods that fetch submissions in these repositories
rg --type java "find.*Submissions.*" -B 2 -A 2
Length of output: 288059
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCServletService.java (7)
224-227
: LGTM: Early validation of authorization header.
The early check for the authorization header's presence is a good practice that fails fast and provides a clear error message.
260-261
: LGTM: Efficient handling of participation data.
The changes improve performance by reusing the participation data for VCS logging instead of fetching it again.
266-285
: LGTM: Well-structured VCS access logging.
The method properly handles error cases and follows a clear flow for storing access logs.
295-295
: LGTM: Clear method naming.
The rename to resolveHTTPSAuthenticationMechanism
better reflects the method's specific purpose.
Line range hint 567-628
: LGTM: Efficient push processing with cached data.
The overloaded method improves performance by allowing the reuse of already loaded data, reducing database queries.
793-793
: LGTM: Efficient participation retrieval.
Using retrieveParticipationWithSubmissionsByRepository
improves performance by eager loading submissions.
Line range hint 825-869
: LGTM: Well-documented VCS access logging.
The method names and documentation clearly describe their purpose and parameters.
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCServletService.java
Outdated
Show resolved
Hide resolved
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCServletService.java
Show resolved
Hide resolved
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.
code lgtm.
just a few nitpicks and typos
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCServletService.java
Outdated
Show resolved
Hide resolved
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCServletService.java
Outdated
Show resolved
Hide resolved
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCServletService.java
Show resolved
Hide resolved
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCServletService.java
Show resolved
Hide resolved
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCServletService.java
Outdated
Show resolved
Hide resolved
src/main/java/de/tum/cit/aet/artemis/programming/service/RepositoryService.java
Outdated
Show resolved
Hide resolved
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
♻️ Duplicate comments (2)
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryResource.java (1)
284-291
: 🛠️ Refactor suggestionConsider passing repository context to optimize performance.
While splitting commit and logging operations improves clarity, passing
Optional.empty()
for both exercise and participation toprocessNewPush
might lead to unnecessary database queries if these objects are needed later in the process.src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/VcsAccessLogService.java (1)
92-98
: 🛠️ Refactor suggestionConsider aligning with class patterns and best practices.
The method should follow existing patterns in the class by adding debug logging and considering access level.
- @Async - public void saveVcsAccesslog(VcsAccessLog vcsAccessLog) { - vcsAccessLogRepository.save(vcsAccessLog); - } + @Async + private void saveVcsAccesslog(VcsAccessLog vcsAccessLog) { + log.debug("Storing VCS access log for user {}", vcsAccessLog.getUser()); + vcsAccessLogRepository.save(vcsAccessLog); + }
🧹 Nitpick comments (6)
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCServletService.java (3)
275-294
: Consider more specific exception handlingThe catch block catches all exceptions when retrieving the commit hash. Consider catching specific exceptions (GitAPIException) to handle different error scenarios appropriately.
- catch (Exception e) { + catch (GitAPIException e) { log.warn("Failed to obtain commit hash for repository {}. Error: {}", localVCRepositoryUri.getRelativeRepositoryPath().toString(), e.getMessage()); + } catch (IOException e) { + log.warn("Failed to access repository {}. Error: {}", localVCRepositoryUri.getRelativeRepositoryPath().toString(), e.getMessage()); }
Line range hint
660-718
: Good performance optimization with cachingExcellent use of Optional for caching exercise and participation data to reduce database queries. This aligns well with the PR's performance improvement goals.
However, consider extracting the error handling logic into a separate method for better maintainability.
+ private void handleParticipationRetrievalError(EntityNotFoundException e, RepositoryType repositoryType, ProgrammingExercise exercise) { + if (repositoryType.equals(RepositoryType.AUXILIARY) || repositoryType.equals(RepositoryType.TESTS)) { + return retrieveSolutionParticipation(exercise); + } + throw new VersionControlException("Could not find participation for repository", e); + } - catch (EntityNotFoundException e) { - repositoryType = getRepositoryType(repositoryTypeOrUserName, exercise); - if (repositoryType.equals(RepositoryType.AUXILIARY) || repositoryType.equals(RepositoryType.TESTS)) { - participation = retrieveSolutionParticipation(exercise); - } - else { - throw new VersionControlException("Could not find participation for repository", e); - } - } + catch (EntityNotFoundException e) { + repositoryType = getRepositoryType(repositoryTypeOrUserName, exercise); + participation = handleParticipationRetrievalError(e, repositoryType, exercise); + }
Line range hint
900-970
: Improve error handling in VCS access loggingWhile the separation of concerns between HTTPS and SSH is good, the empty catch blocks could hide important errors. Consider at least logging these errors at debug level.
- catch (Exception ignored) { + catch (Exception e) { + log.debug("Failed to update VCS access log: {}", e.getMessage()); }src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/VcsAccessLogService.java (3)
68-73
: Add debug logging for not-found case.Consider adding debug logging when no VcsAccessLog is found to help with troubleshooting.
var vcsAccessLog = vcsAccessLogRepository.findNewestByParticipationId(participation.getId()); if (vcsAccessLog.isPresent()) { vcsAccessLog.get().setCommitHash(commitHash); vcsAccessLogRepository.save(vcsAccessLog.get()); +} else { + log.debug("No VcsAccessLog found for participation {}", participation.getId()); }
102-121
: Improve type safety and null handling.The current implementation has room for improvement in type safety and null handling:
- Consider using pattern matching for instanceof (if using Java 16+)
- Add debug logging for the case when participation is not found or is of wrong type
- if (participation.isPresent() && participation.get() instanceof ProgrammingExerciseParticipation programmingParticipation) { + if (participation.isEmpty()) { + log.debug("No participation found for id {}", participationId); + return Optional.empty(); + } + if (!(participation.get() instanceof ProgrammingExerciseParticipation programmingParticipation)) { + log.debug("Participation {} is not a ProgrammingExerciseParticipation", participationId); + return Optional.empty(); + } + log.debug("Creating preliminary access log for user {} and participation {}", user.getId(), participationId);
Line range hint
1-123
: Consider transaction management for async operations.The class uses @async for all database operations but lacks explicit transaction management. While this improves performance by making operations non-blocking, it could lead to data consistency issues.
Consider adding appropriate transaction management:
- Add @transactional to methods that modify data
- Configure transaction propagation and isolation levels based on your requirements
- Consider using @TransactionalEventListener for better control over transaction boundaries in async operations
Example:
@Async +@Transactional(propagation = Propagation.REQUIRES_NEW) public void saveAccessLog(User user, ProgrammingExerciseParticipation participation, ...) { // ... existing code ... }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/main/java/de/tum/cit/aet/artemis/programming/service/RepositoryService.java
(2 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCServletService.java
(19 hunks)src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/VcsAccessLogService.java
(3 hunks)src/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryResource.java
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
src/main/java/de/tum/cit/aet/artemis/programming/web/repository/RepositoryResource.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
src/main/java/de/tum/cit/aet/artemis/programming/service/RepositoryService.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
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/VcsAccessLogService.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
src/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 (7)
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/LocalVCServletService.java (4)
223-226
: Improved security with early authentication check
Good addition of an early check for the authorization header. This fails fast and provides clear error messaging.
259-260
: Performance improvement: Reuse participation data
Good optimization to reuse the participation data from authorization for VCS access logging, reducing duplicate database queries.
Line range hint 376-405
: Extract token validation logic for better maintainability
The method handles multiple concerns including token validation, participation retrieval, and token storage. Consider extracting the token validation logic into a separate method.
551-577
: Well-optimized repository type checking
Excellent optimization that avoids unnecessary database queries for auxiliary repository checks when the user is a student. The code is well-documented and clearly explains the reasoning behind the optimization.
src/main/java/de/tum/cit/aet/artemis/programming/service/RepositoryService.java (2)
462-472
: LGTM! Well-structured logging method.
The new method effectively separates logging concerns, handles null cases appropriately with Optional, and is well-documented.
457-460
: Verify impact of breaking API change.
The removal of the domainId
parameter from commitChanges
is a breaking change. While this improves the method's focus on core commit operations, we should verify all callers have been updated.
✅ Verification successful
Let me verify the git history to see if there were any other callers of this method before the change.
Let me try one more search to find any references to this method, including potential usages through the interface or superclass.
Breaking change is properly handled
Based on the codebase analysis, the removal of domainId
parameter from commitChanges
method is safe. The only caller of this method is in RepositoryResource.java
, and it has been updated to use the new signature. No other usages were found in the codebase, including test files.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Find all calls to commitChanges to verify they've been updated
# to match the new signature (2 parameters instead of 3)
# Search for old method calls with 3 parameters
rg "commitChanges\([^,)]+,[^,)]+,[^,)]+\)" --type java
# Search for current method calls with 2 parameters
rg "commitChanges\([^,)]+,[^,)]+\)" --type java
Length of output: 426
Script:
#!/bin/bash
# Search for the file in git history to see previous callers
git log -L :commitChanges:src/main/java/de/tum/cit/aet/artemis/programming/service/RepositoryService.java
# Also search for any test files that might be using this method
fd "Test.*\.java$" --exec rg "commitChanges" {}
Length of output: 176
Script:
#!/bin/bash
# Search for any class that might be extending or implementing RepositoryService
ast-grep --pattern 'class $_ extends RepositoryService'
ast-grep --pattern 'class $_ implements RepositoryService'
# Search for any interface or abstract class that might declare this method
fd ".*\.java$" --exec rg "void\s+commitChanges\s*\([^)]*\)" {}
Length of output: 522
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/VcsAccessLogService.java (1)
51-51
: LGTM! Method rename aligns with Spring Data JPA conventions.
The rename from storeAccessLog
to saveAccessLog
better aligns with standard Spring Data JPA naming conventions.
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/VcsAccessLogService.java
Show resolved
Hide resolved
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.
Tested on TS3 - cloning and pushing changes works for all repos using all cloning methods. No problems creating and managing the exercise as well.
src/main/java/de/tum/cit/aet/artemis/programming/service/localvc/ArtemisGitServletService.java
Show resolved
Hide resolved
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.
Code 👍
Checklist
General
Server
Changes affecting Programming Exercises
Motivation and Context
In exams with programming exercises, it becomes noticeable, that push and clone operations are quite resource intensive. This can go so far, that the DB is overloaded, especially in the end phase of an exam.
Description
We want to mitigate this issue with several changes:
For an in depth analysis of all DB queries used during clone and push see https://confluence.ase.in.tum.de/spaces/ArTEMiS/pages/232759897/DB+Queries+for+using+LocalVC
Steps for Testing
As a tester, please fill out the check marks for the aspects which need to be tested, and which you tested:
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
Manual Tests
Exam Mode Test
Test Coverage
Screenshots
Before the improvement:
After this improvement:
Summary by CodeRabbit
Release Notes
New Features
Improvements
Bug Fixes
Refactor