Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Programming Exercises: Download repository button broken for auxiliary repository locally #8826

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

Conversation

iyannsch
Copy link
Contributor

@iyannsch iyannsch commented Jun 19, 2024

Checklist

General

Server

  • Important: I implemented the changes with a very good performance and prevented too many (unnecessary) database calls.
  • I strictly followed the server coding and design guidelines.
  • I added multiple integration tests (Spring) related to the features (with a high test coverage).
  • I added pre-authorization annotations according to the guidelines and checked the course groups for all new REST Calls (security).
  • I documented the Java code using JavaDoc style.

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data.
  • I strictly followed the client coding and design guidelines.
  • Following the theming guidelines, I specified colors only in the theming variable files and checked that the changes look consistent in both the light and the dark theme.
  • I added multiple integration tests (Jest) related to the features (with a high test coverage), while following the test guidelines.
  • I added authorities to all new routes and checked the course groups for displaying navigation elements (links, buttons).
  • I documented the TypeScript code using JSDoc style.
  • I added multiple screenshots/screencasts of my UI changes.
  • I translated all newly inserted strings into English and German.

Changes affecting Programming Exercises

  • High priority: I tested all changes and their related features with all corresponding user types on a test server configured with the integrated lifecycle setup (LocalVC and LocalCI).
  • I tested all changes and their related features with all corresponding user types on a test server configured with Gitlab and Jenkins.

Motivation and Context

Issue #8605 describes the current state in which the download of non-existent auxiliary repositories fail silently. This is not a problem for building or testing programming exercises, but heavily limit the usability for novice users.

When auxiliary repos are created during exercise creation, the auxiliary repos are created and linked correctly. In this case, the current implementation successfully provided a download.
However, when aux. repos are added to existing exercises, the repositories are not created properly and no directory is created in LocalVC. The instructor performing the action is informed about this situation but no fix is suggested nor is a permanent error message raised. When trying to clone or download the non-existent repository, an internal server error (500) arises but no information is shown in the UI. This leaves teams of multiple instructors with the situation that they might not understand why an aux. repo does not work.

Description

As a first step, I implemented an error handler for failing repository downloads. Users are not informed about the situation and know that their repository does not exist. This fights the symptoms but not the root-cause.

I propose a more sophisticated solution changing the way how auxiliary repositories are added to already existing exercises.
Adding new aux repos to existing exercises (and a set of already existing aux repos), poses the challenge of not overwriting those aux repos that are already referenced in tests etc.
This code contains the logic for detecting "illegal" auxiliary repo changes. As soon as a name or checkoutDirectory are changed, it is considered illegal.

Discussion for further improvement

The main problem which reasons such restrictive behavior is, that already existing aux repos are identified by their name and would loose a "HEAD" pointing to them when an instructor changes the name.

We could use the following approaches that allow adding aux repos after the fact:

  1. Append-Only Auxiliary Repositories
    By making all existing auxiliary repository's name read-only, pointers/access to those repos is secured. I see no reason why we shouldn`t add new repositories to the collection then. Add an explicit "delete" logic could allow the instructor to correct any spelling mistake by recreating a correct repo.

  2. Trust Instructors
    We can also trust the instructors to know what they change and where they referenced to the checkout directory. Assuming the builds and tests work, this approach has the disadvantage of possibly having repositories around that are not linked by anything anymore.

I´m sure there are other ways to solve it as well - let´s discuss it 👍

As it´s quite relevant for instructors, please share your opinion @krusche @rabeatwork

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 1 Course

Verify successful download

  1. Log in to Artemis
  2. Create a new programming exercise and add an auxiliary repository before saving the exercise
  3. Verify that you can download the aux repo
image 4. Verify that the banner is shown image

Verify error handling

  1. Log in to Artemis
  2. Create a new programming exercise or open an old one
  3. Add a new auxiliary repository to the exercise and save
  4. Click on the Download Repository button and verify that you see an error banner

Exam Mode 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

  • I (as a reviewer) confirm that the client changes (in particular related to REST calls and UI responsiveness) are implemented with a very good performance
  • I (as a reviewer) confirm that the server changes (in particular related to database calls) are implemented with a very good performance

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Exam Mode Test

  • Test 1
  • Test 2

Test Coverage

Screenshots

Summary by CodeRabbit

  • Style

    • Improved the layout of the detail overview list by adding top margin to list items.
  • Bug Fixes

    • Enhanced error handling in repository export functionality for programming exercises, providing better feedback when an export fails.
  • Documentation

    • Added error messages for failed repository exports in both German and English to improve user feedback during export processes.

@iyannsch iyannsch added client Pull requests that update TypeScript code. (Added Automatically!) bugfix discussion labels Jun 19, 2024
@iyannsch iyannsch self-assigned this Jun 19, 2024
@iyannsch iyannsch requested a review from a team as a code owner June 19, 2024 15:46
Copy link

coderabbitai bot commented Jun 19, 2024

Walkthrough

The recent changes in the project focus on enhancing the user interface, improving error handling in exporting repositories, and adding new user feedback messages for repository export errors. Specifically, the styling of list items in a component was updated, error handling in repository export was fortified with RxJS, and new multilingual error messages were added for better user communication in case of export failures.

Changes

File Change Summary
src/main/webapp/app/detail-overview-list/detail-overview-list.component.html Added class="mt-2" to <li> elements to adjust the styling by adding a top margin.
src/main/webapp/app/exercises/programming/shared/actions/programming-exercise-instructor-repo-download.component.ts Enhanced exportRepository method with error handling using RxJS operators.
src/main/webapp/i18n/de/programmingExercise.json, src/main/webapp/i18n/en/programmingExercise.json Added new error messages for failed repository export to improve user feedback in both German and English.

Sequence Diagram(s)

No sequence diagrams needed as the changes primarily involve stylistic adjustments and error handling improvements without significantly altering control flows.


Recent review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between f97cdbf and 58b80fb.

Files selected for processing (4)
  • src/main/webapp/app/detail-overview-list/detail-overview-list.component.html (1 hunks)
  • src/main/webapp/app/exercises/programming/shared/actions/programming-exercise-instructor-repo-download.component.ts (2 hunks)
  • src/main/webapp/i18n/de/programmingExercise.json (1 hunks)
  • src/main/webapp/i18n/en/programmingExercise.json (1 hunks)
Additional context used
Path-based instructions (3)
src/main/webapp/app/exercises/programming/shared/actions/programming-exercise-instructor-repo-download.component.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/main/webapp/app/detail-overview-list/detail-overview-list.component.html (1)

Pattern src/main/webapp/**/*.html: @if and @for are new and valid Angular syntax replacing *ngIf and *ngFor. They should always be used over the old style.

src/main/webapp/i18n/de/programmingExercise.json (1)

Pattern src/main/webapp/i18n/de/**/*.json: 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".

Additional comments not posted (7)
src/main/webapp/app/exercises/programming/shared/actions/programming-exercise-instructor-repo-download.component.ts (3)

9-10: The addition of catchError and of from RxJS is appropriate for the error handling logic implemented in exportRepository.


58-61: The success handling in the exportRepository method is well-implemented, ensuring that actions are only taken when a response exists. This prevents potential errors from undefined responses.


53-54: Returning of(undefined) in the error handling is a standard practice to ensure the observable chain remains intact, allowing the subscriber to continue operations.

src/main/webapp/app/detail-overview-list/detail-overview-list.component.html (1)

89-89: Adding the mt-2 class to the list item improves visual separation and enhances readability. Good use of Bootstrap utilities for styling.

src/main/webapp/i18n/en/programmingExercise.json (1)

376-376: The new error message is clear and aligns well with the intended error handling improvements for repository exports.

src/main/webapp/i18n/de/programmingExercise.json (2)

373-373: The message correctly indicates that no repositories were downloaded due to lack of submissions, maintaining an informal tone as per guidelines.


374-374: The error message is clear and maintains the informal tone required for the German translation. It properly informs the user that the repository could not be exported because the requested file does not exist.


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Copy link
Contributor

@JohannesStoehr JohannesStoehr left a comment

Choose a reason for hiding this comment

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

Regarding the root cause:
With external VCS like Bitbucket or Gitlab it was hard to track what users do without the knowledge of Artemis (creating additional repositories, changing build plans, ...). So it was hard for Artemis to track these changes accurately. Additionally it was hard to adapt the potentially custom build plans to correctly checkout newly added auxiliary repositories later on.

With LocalVC these problems should no longer occur, so we can provide instructors with the option to manage auxiliary repositories right in Artemis and then make sure that no additional repositories exist that are not accounted for or that auxiliary repositories exist in the Artemis database but not the LocalVC

@@ -6,6 +6,9 @@ import { downloadZipFileFromResponse } from 'app/shared/util/download.util';
import { AlertService } from 'app/core/util/alert.service';
import { faDownload } from '@fortawesome/free-solid-svg-icons';

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change

Copy link

There hasn't been any activity on this pull request recently. Therefore, this pull request has been automatically marked as stale and will be closed if no further activity occurs within seven days. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jun 27, 2024
@iyannsch
Copy link
Contributor Author

Don´t close it. @krusche is this a relevant feature to implement as @JohannesStoehr suggested?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix client Pull requests that update TypeScript code. (Added Automatically!) discussion stale
Projects
Status: Ready For Review
Development

Successfully merging this pull request may close these issues.

Programming exercises: Download Repository button broken for auxiliary repository on localCI
2 participants