Skip to content

Fix/public n private tournament join status check - #778

Open
ruhandave19 wants to merge 2 commits into
AOSSIE-Org:mainfrom
ruhandave19:fix/public-n-private-tournament-join-status-check
Open

ruhandave19 wants to merge 2 commits into
AOSSIE-Org:mainfrom
ruhandave19:fix/public-n-private-tournament-join-status-check

Conversation

@ruhandave19

@ruhandave19 ruhandave19 commented Oct 24, 2026 •

Copy link
Copy Markdown

Addressed Issues:

Fixes Part of #740

Screenshots/Recordings:

Public Tournament fix-

Screenshot 2026-10-25 012317 Screenshot 2026-10-25 015850

Private Tournament fix -

Screenshot 2026-10-25 023153 Screenshot 2026-10-25 023332

Additional Notes:

This only focuses on a part of the issue, wherein previously the user could join public and private tournaments that are live or completed.
The remaining parts can be covered in upcoming PRs, based on the feedback given to this PR.

The changes made are:

  1. In backend/controllers/tournament_controller.go, the 'UpdateOne' filter in 'JoinPublicTournament' and 'JoinPrivateTournament' now requires status == "upcoming", so the check and the participant push happen in a single update. When no document matches, the handler returns 400 with a "not open for joining" message if the tournament isn't upcoming.
    2)In backend/tests/routes_test.go: 2 new tests 'TestJoinPublicTournamentLifecycleValidation' and 'TestJoinPrivateTournamentLifecycleValidation' were added, which create tournaments with upcoming, live, and completed status in a throwaway database and checks that the upcoming tournament accepts the join (200, participant added) and live and completed tournaments reject it (400, no participant added).

NOTE: To run the test and verify the changes, MONGO_TEST_URI will need to be set in the terminal, if it is not, the test will fail.

To verify, run the following in backend/ -

go test ./tests/ -run TestJoinPublicTournamentLifecycleValidation -v 
go test ./tests/ -run TestJoinPrivateTournamentLifecycleValidation -v 

Both should PASS

Check one of the checkboxes below:

  • This PR does not contain AI-generated code at all.
  • This PR contains AI-generated code. I have read the AI Usage Policy and this PR complies with this policy. I have tested the code locally and I am responsible for it.

I have used the following AI models and tools: Claude Sonnet 5.5

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • My code follows the project's code style and conventions
  • If applicable, I have made corresponding changes or additions to the documentation
  • If applicable, I have made corresponding changes or additions to tests
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contribution Guidelines
  • Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.
  • I have filled this PR template completely and carefully, and I understand that my PR may be closed without review otherwise.

Summary by CodeRabbit

  • Bug Fixes
    • Joining public or private tournaments is now closed once a tournament is live or completed. Attempts to join receive a clear error, and no participant or join request is added.
    • Upcoming tournaments continue to accept join requests.

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ce8610ad-f07e-4ae5-bd4a-101114a4c579
Commits

Reviewing files that changed from the base of the PR and between 6c6eefa and 9ee85f2.

Files selected for processing: 2
  • backend/controllers/tournament_controller.go
  • backend/tests/routes_test.go

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

Walkthrough

Public tournament joins and private join requests now update only upcoming tournaments. Route tests verify that upcoming tournaments accept joins, while live and completed tournaments reject them without storing participants or requests.

Changes: Tournament join status

Layer / File(s) Summary
Upcoming-only join checks
backend/controllers/tournament_controller.go, backend/tests/routes_test.go
Both join handlers restrict updates to upcoming tournaments and return a closed-joining error for other statuses. MongoDB-backed tests check response codes and stored participant or join-request counts.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix

Possibly related issues

  • AOSSIE-Org/DebateAI#740 — Reports successful joins to live and completed tournaments and calls for an atomic upcoming-status check.

Possibly related PRs

  • AOSSIE-Org/DebateAI#777 — Fixes the public-join lifecycle defect; this PR also applies the status check to private join requests.
  • AOSSIE-Org/DebateAI#690 — Implements the same admission rule through TournamentService; this PR applies it in the controller handlers.

Suggested reviewers: zaibamachhaliya, basharkhan7776

Merge Risk: Low · up to 9ee85

Retrying a rejected request after a private tournament closes can erase that request. The impact is limited, but owners should account for it before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title accurately identifies the main change: validating join status for public and private tournaments. Its wording is informal, but it remains clear and specific enough for the changeset.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gitcordapp

gitcordapp Bot commented Oct 25, 2026

Copy link
Copy Markdown

Link your account with Gitcord

Thanks for opening this PR, @ruhandave19!

To receive Discord notifications and contributor tracking for this organization:

  1. Join Discord: https://discord.gg/hjUhu33uAn
  2. In Discord, run /link ruhandave19
  3. Paste the verification code into your GitHub bio (or a public gist)
  4. Click Verify in Discord (or run /verify-link ruhandave19)

Once linked, Gitcord can notify you about reviews, merges, and more.

— Posted by Gitcord

This branch has not been deployed

No deployments
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.

1 participant