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: Increase AI feedback request limit #8746

Merged
merged 4 commits into from
Jun 7, 2024

Conversation

maximiliansoelch
Copy link
Member

@maximiliansoelch maximiliansoelch commented Jun 5, 2024

Checklist

General

Server

Motivation and Context

Currently, a student can only do three feedback request. For an experiment that we want to conduct, the number needs to be increased to 20.
In the future, there will be a follow-up PR that let the instructor set the limit:

Description

Hardcodes the limit to 20 requests per exercise.

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked






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

@maximiliansoelch maximiliansoelch requested a review from a team as a code owner June 5, 2024 13:51
@github-actions github-actions bot added the server Pull requests that update Java code. (Added Automatically!) label Jun 5, 2024
@maximiliansoelch maximiliansoelch added this to the 7.2.0 milestone Jun 5, 2024
Copy link

coderabbitai bot commented Jun 5, 2024

Warning

Rate limit exceeded

@undernagruzez has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 12 minutes and 33 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 38951ab and 089db25.

Walkthrough

The recent changes primarily focus on increasing the threshold for the number of successful AI feedback requests from 3 to 20 across various components in the system. This adjustment affects the conditions for triggering exceptions and warning messages in both backend and frontend components. Additionally, tests have been updated to reflect this new threshold, ensuring that the system correctly handles and simulates the increased limit.

Changes

File Path Change Summary
src/main/java/.../ProgrammingExerciseCodeReviewFeedbackService.java Adjusted the threshold for successful AI feedback requests from 3 to 20 before triggering an exception.
src/main/webapp/app/overview/exercise-details/exercise-details-student-actions.component.ts Updated the condition to trigger a warning message when successful requests reach 20 instead of 3. Added numResults and results constants.
src/test/javascript/spec/component/overview/exercise-details/exercise-details-student-actions.component.spec.ts Added a loop to populate an array with assessment results and merged it into the existing results array to simulate reaching the new threshold. Added numResults and results constants.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant Student
    participant Frontend
    participant Backend
    participant Database

    Student->>Frontend: Submit request for AI feedback
    Frontend->>Backend: Forward request
    Backend->>Database: Increment successful request count
    Database-->>Backend: Return updated count
    Backend->>Frontend: Check if count >= 20
    alt Count < 20
        Frontend->>Student: Display success message
    else Count >= 20
        Frontend->>Student: Display warning message
    end
Loading

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.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jun 5, 2024
FelixTJDietrich
FelixTJDietrich previously approved these changes Jun 5, 2024
Copy link
Contributor

@FelixTJDietrich FelixTJDietrich left a comment

Choose a reason for hiding this comment

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

Thanks!

dmytropolityka
dmytropolityka previously approved these changes Jun 5, 2024
@dmytropolityka dmytropolityka dismissed stale reviews from FelixTJDietrich, coderabbitai[bot], and themself via 72b3c1f June 5, 2024 18:37
@github-actions github-actions bot added tests client Pull requests that update TypeScript code. (Added Automatically!) labels Jun 5, 2024
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

Outside diff range comments (6)
src/main/webapp/app/overview/exercise-details/exercise-details-student-actions.component.ts (4)

Line range hint 44-44: Consider specifying a more explicit type instead of any for better type safety and to leverage TypeScript's capabilities.

- any
+ SpecificType // Replace 'SpecificType' with the actual type you intend to use.

Line range hint 170-170: Avoid using non-null assertions as they can lead to runtime errors if not handled properly. Consider using optional chaining or proper checks before usage.

- participation!.id!
+ participation?.id

Also applies to: 202-202, 209-209, 210-210, 229-229


Line range hint 171-171: Avoid assignments within expressions to enhance code clarity and maintainability.

- const replacedIndex = this.exercise.studentParticipations!.indexOf(participation!);
+ const replacedIndex = this.exercise.studentParticipations?.indexOf(participation) ?? -1;

Also applies to: 203-203


Line range hint 305-305: Consider using optional chaining to make the code more robust and prevent runtime errors.

- const latestResult = this.gradedParticipation?.results && this.gradedParticipation.results.find(({ assessmentType }) => assessmentType === AssessmentType.AUTOMATIC);
+ const latestResult = this.gradedParticipation?.results?.find(({ assessmentType }) => assessmentType === AssessmentType.AUTOMATIC);

Also applies to: 320-320

src/test/javascript/spec/component/overview/exercise-details/exercise-details-student-actions.component.spec.ts (2)

Line range hint 83-83: Specify a more explicit type instead of any to improve type safety and leverage TypeScript's capabilities.

- any
+ SpecificType // Replace 'SpecificType' with the actual type you intend to use.
Tools
Biome

[error] 577-577: This variable's type is not allowed to evolve implicitly, leading to potential any types. (lint/nursery/noEvolvingAny)

The variable's type may evolve, leading to any. Use explicit type or initialization. Specifying an explicit type or initial value to avoid implicit type evolution.


Line range hint 495-495: Use template literals for string operations to enhance readability and maintainability.

- query + (args ? args : '')
+ `${query}${args || ''}`
Tools
Biome

[error] 577-577: This variable's type is not allowed to evolve implicitly, leading to potential any types. (lint/nursery/noEvolvingAny)

The variable's type may evolve, leading to any. Use explicit type or initialization. Specifying an explicit type or initial value to avoid implicit type evolution.

…xercise-details-student-actions.component.spec.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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

Outside diff range comments (3)
src/test/javascript/spec/component/overview/exercise-details/exercise-details-student-actions.component.spec.ts (3)

Line range hint 1-2: Optimize imports by using import type for type-only imports.

- import { HttpClient } from '@angular/common/http';
- import { DebugElement } from '@angular/core';
+ import type { HttpClient } from '@angular/common/http';
+ import type { DebugElement } from '@angular/core';
- import { Exercise, ExerciseMode, ExerciseType } from 'app/entities/exercise.model';
+ import type { Exercise, ExerciseMode, ExerciseType } from 'app/entities/exercise.model';
- import { ProgrammingExerciseStudentParticipation } from 'app/entities/participation/programming-exercise-student-participation.model';
+ import type { ProgrammingExerciseStudentParticipation } from 'app/entities/participation/programming-exercise-student-participation.model';
- import { StudentParticipation } from 'app/entities/participation/student-participation.model';
+ import type { StudentParticipation } from 'app/entities/participation/student-participation.model';
- import { ProgrammingExercise } from 'app/entities/programming-exercise.model';
+ import type { ProgrammingExercise } from 'app/entities/programming-exercise.model';
- import { QuizBatch, QuizExercise } from 'app/entities/quiz/quiz-exercise.model';
+ import type { QuizBatch, QuizExercise } from 'app/entities/quiz/quiz-exercise.model';
- import { TextExercise } from 'app/entities/text-exercise.model';
+ import type { TextExercise } from 'app/entities/text-exercise.model';
- import { Team } from 'app/entities/team.model';
+ import type { Team } from 'app/entities/team.model';
- import { User } from 'app/core/user/user.model';
+ import type { User } from 'app/core/user/user.model';
- import { AssessmentType } from 'app/entities/assessment-type.model';
+ import type { AssessmentType } from 'app/entities/assessment-type.model';

Also applies to: 6-7, 9-10, 11-12, 13-14, 22-23

Tools
GitHub Check: client-style

[failure] 577-577:
Replace , with ;


Line range hint 495-495: Use template literals instead of string concatenation for better readability and safety.

- ArtemisTranslatePipe, (query: any, args?: any) => query + (args ? args : '')
+ ArtemisTranslatePipe, (query: any, args?: any) => `${query}${args ? args : ''}`
Tools
GitHub Check: client-style

[failure] 577-577:
Replace , with ;


Line range hint 83-83: Specify a more appropriate type instead of any to enhance type safety.

- ArtemisTranslatePipe, (query: any, args?: any) => `${query}${args ? args : ''}`
+ ArtemisTranslatePipe, (query: string, args?: any) => `${query}${args ? args : ''}`
Tools
GitHub Check: client-style

[failure] 577-577:
Replace , with ;

…xercise-details-student-actions.component.spec.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@krusche krusche changed the title Programming Exercises: Increase AI Feedback Request Limit Programming exercises: Increase AI feedback request limit Jun 7, 2024
@krusche krusche merged commit b85044e into develop Jun 7, 2024
21 of 27 checks passed
@krusche krusche deleted the chore/increase-automatic-feedback-request-limit branch June 7, 2024 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Pull requests that update TypeScript code. (Added Automatically!) ready to merge server Pull requests that update Java code. (Added Automatically!) small tests
Projects
Archived in project
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants