Skip to content

feat(discovery): index open_contest submissions into contest_submissions#14358

Open
dylanjeffers wants to merge 1 commit into
mainfrom
claude/open-contest
Open

feat(discovery): index open_contest submissions into contest_submissions#14358
dylanjeffers wants to merge 1 commit into
mainfrom
claude/open-contest

Conversation

@dylanjeffers
Copy link
Copy Markdown
Contributor

Summary

  • Adds an `open_contest` value to `EventType` (Python enum + a discovery-side DB-enum migration so SQLAlchemy round-trips work). Open contests have no parent track; `entity_id` on the event row stays NULL, which the existing column nullability already allows.
  • Adds the `SubmitToContest` ManageEntity action and a `submit_to_contest` handler that validates the contest event + track ownership and inserts a row into `contest_submissions` (table created by the api repo, migration 0203).
  • Teaches `get_remixes_of` to surface `contest_submissions` rows when a caller passes `contest_id` (no `track_id`) — the classic `remix_contest` path still uses the remixes-table join.

Companion PR: api repo branch `claude/gifted-tereshkova-989bfa` (table + action constant + endpoint).

Test plan

  • `bash packages/discovery-provider/ddl/local-test.sh` cleanly applies migration 0179 (and is a no-op on re-run because `ADD VALUE IF NOT EXISTS`).
  • Unit test or hand-traced flow: emit a Create/Event(`open_contest`) followed by SubmitToContest(track_id) and verify a row lands in `contest_submissions`. Negative paths: track owned by a different user, expired contest, contest of wrong type, duplicate submission.
  • `get_remixes_of({"contest_id": <event_id>})` returns the submitted tracks for an open_contest; the existing `remix_contest` callers (with `track_id`) keep their current behavior.

🤖 Generated with Claude Code

Adds an 'open_contest' event_type and a SubmitToContest ManageEntity
action that writes to the contest_submissions table (created by the
api repo, migration 0203). Open contests don't have a remix-parent
track, so submissions can't be inferred via the remixes-table join
that powers remix_contest; SubmitToContest provides an explicit
submission record instead.

- Add open_contest to EventType enum + extend the event_type DB enum
  in a discovery-side migration so SQLAlchemy values round-trip.
- Skip parent-entity / track-owner validation in create_event for
  open_contest, since entity_id/entity_type are intentionally null.
- Add Action.SUBMIT_TO_CONTEST and its non-CID metadata exception,
  pre-fetch the referenced track in collect_entities_to_fetch, and
  route to a new submit_to_contest handler that validates the track
  ownership / event state and inserts the contest_submissions row.
- Teach get_remixes_of to surface contest_submissions rows when a
  caller passes contest_id (no track_id) for open_contest entries.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 19, 2026

⚠️ No Changeset found

Latest commit: 7377ab8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant