Skip to content

Add External Competitions feature - #2508

Open
ihsaan-ullah wants to merge 2 commits into
developfrom
external_competitions
Open

Add External Competitions feature#2508
ihsaan-ullah wants to merge 2 commits into
developfrom
external_competitions

Conversation

@ihsaan-ullah

@ihsaan-ullah ihsaan-ullah commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Description

  • Adds a new External Competitions feature: Codabench can periodically fetch and list public competitions from other registered Codabench/CodaLab instances, linking users out to the original platform.
  • New external_competitions app with ExternalPlatform/ExternalCompetition/ExternalFetchLog models, per-platform fetchers, and a daily Celery sync task with partial-success handling (a failed page doesn't lose earlier successfully-fetched pages, and doesn't wrongly delete existing competitions).
  • New API endpoints (/api/external_competitions/, /api/external_competitions/platforms/) with search and platform filtering.
  • New public page + banner on the existing competitions/benchmarks list, linking users to the External Competitions view.
  • Feature is fully gated behind EXTERNAL_COMPETITIONS_ENABLED (off by default) — no visible change, routes, or scheduled task on existing instances unless explicitly turned on.
  • Full test coverage: fetchers, sync/diff logic, and API behavior (including flag on/off).
  • New docs page covering setup for self-hosters and a registration/unregistration process for other platform maintainers, linked from the deploy guide.

Screenshots

External competition banner in public benchmarks page
Screenshot 2026-08-22 at 4 03 04 PM

External competitions page
Screenshot 2026-08-22 at 4 05 28 PM

Checklist

  • Code review by me
  • Hand tested by me
  • I'm proud of my work
  • Code review by reviewer
  • Hand tested by reviewer
  • CircleCi tests are passing
  • Ready to merge

…Codabench/CodaLab instances

New app — external_competitions
- Models: ExternalPlatform (a registered remote instance), ExternalCompetition (a fetched competition), ExternalFetchLog (per-sync audit trail with SUCCESS/PARTIAL_SUCCESS/FAILURE status, counts, and error messages)
- admin.py registrations for all three models with list filters/search
- Initial migration

Fetchers
- fetchers/codabench_fetcher.py — paginated fetch from a Codabench instance's public competitions API, with a page-fetch throttle and a MAX_PAGES safety cap
- fetchers/codalab_fetcher.py — flat-list fetch from a CodaLab instance
- fetchers/exceptions.py — PartialFetchError, letting a fetcher hand back whatever it collected before a later page failed

Sync task
- fetch_sync.py — fetch_external_competitions Celery task (feature-flag gated, scheduled daily via CELERY_BEAT_SCHEDULE) and sync_platform, which diffs fetched data against the DB (create/update/delete), skipping the delete step on a partial fetch to avoid dropping valid competitions from unfetched pages

API
- api/serializers/external_competitions.py — ExternalCompetitionSerializer, ExternalPlatformFilterSerializer
- api/views/external_competitions.py — list view with search/platform filtering, and an unpaginated platforms list for the filter UI
- api/urls.py — both routes registered only when EXTERNAL_COMPETITIONS_ENABLED is on

Frontend
- external_competitions/urls.py + views.py + templates/external_competitions/public.html — the public page route
- static/riot/external_competitions/external_competition_list.tag — the competition list/filter/pagination UI
- client.js — API helpers for the two new endpoints
- public-list.tag — banner linking to the External Competitions page (shown only when the feature is enabled)
- base.html / context_processors.py — expose the feature flag and public URL to the frontend

Settings
- EXTERNAL_COMPETITIONS_ENABLED flag (settings/base.py, .env_sample), off by default
- external_competitions added to INSTALLED_APPS

Test data
- factories.py — ExternalPlatformFactory, ExternalCompetitionFactory

Tests
- external_competitions/tests/test_fetchers.py — unit tests for both fetchers (pagination, throttling, MAX_PAGES, error propagation, partial-fetch handling)
- external_competitions/tests/test_fetch_sync.py — unit tests for sync_platform/fetch_external_competitions (create/update/delete diffing, partial-success handling, per-platform failure isolation)
- api/tests/test_external_competitions.py — API tests for both endpoints, plus flag-gated URL registration tests

Documentation
- New External-Competitions.md page: enabling the flag, admin fields, sync mechanics, and registration/unregistration instructions for other platform maintainers
- zensical.toml nav entry
- Tip added to the deploy guide pointing self-hosters at registering their instance
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