Skip to content

fix: verify challenge attempt count before accepting submissions in SubmissionService - #498

Merged
MaryammAli merged 3 commits into
BlockDash-Studios:mainfrom
eulami:fix/issue-359-attempt-limit-verification
Jul 28, 2026
Merged

fix: verify challenge attempt count before accepting submissions in SubmissionService#498
MaryammAli merged 3 commits into
BlockDash-Studios:mainfrom
eulami:fix/issue-359-attempt-limit-verification

Conversation

@eulami

@eulami eulami commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Closes #359

Problem: Learners could submit more attempts than allowed by the challenge policy because the active SubmissionService (used by SubmissionModule) had no attempt-limit verification. A separate SubmissionsService with verification existed but its module was not imported by the app.

Changes:

  • Added ChallengesService and MonitoringService injection to SubmissionService
  • Added attempt limit verification to SubmissionService.create() and SubmissionService.publishDraft()
  • Added verifyChallengeAttemptLimit(), recordChallengeAttempt(), and isChallengeTask() helpers
  • Imported ChallengesModule and MonitoringModule in SubmissionModule
  • Updated tests with mock providers for the new dependencies

Testing: All 37 tests pass across challenges and submissions modules.

eulami added 2 commits July 27, 2026 20:42
Learners could previously submit more attempts than allowed by the challenge policy, bypassing the configured limit.

- Add attempt limit tracking to ChallengesService with configurable max attempts per challenge (default: 3)
- Add POST /challenges/:challengeId/submit endpoint with verification
- Add GET /challenges/:challengeId/attempts/:userId status endpoint
- Add PUT /challenges/:challengeId/attempts/limit admin endpoint
- Add attempt limit check in SubmissionsService.create() for challenge tasks
- Record domain events in monitoring when limits are exceeded

Closes BlockDash-Studios#359

@MaryammAli MaryammAli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@eulami Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

**Bug: challenge submissions are accepted without verifying the current attempt count

2 participants