Skip to content

[codex] Add benchmark competition capabilities - #563

Merged
zacjones93 merged 2 commits into
feat/hillerfit-planfrom
codex/hillerfit-m0a-registry-worker
Jun 20, 2026
Merged

[codex] Add benchmark competition capabilities#563
zacjones93 merged 2 commits into
feat/hillerfit-planfrom
codex/hillerfit-m0a-registry-worker

Conversation

@zacjones93

@zacjones93 zacjones93 commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements the M0a registry slice for the benchmark leaderboard stack.

  • Registers competitionType: "benchmark" in the existing capability registry.
  • Adds the perpetual capability.
  • Keeps benchmark out of generic create-picker options.
  • Gives benchmark videoSubmissions + perpetual, but not submissionWindows or optInResultPublishing.
  • Treats benchmark submission/window-status paths as open without seeded submission-window rows.
  • Moves public athlete/review submission route gates from literal online checks to the videoSubmissions capability.
  • Preserves the separate scoringAlgorithm === "online" axis.

No HillerFit-branded pages, routes, marketing surfaces, logos, theme treatments, product navigation, PDF extraction, or seed work are included in this slice.

Verification

  • lat search "benchmark leaderboard HillerFit branded pages training guide pdf capability registry M0a"
  • lat expand "should be explicit in stating we are not building any hillerfit branded pages, we will just build out the benchmark against the training pdf"
  • PATH="/Users/zacjones/.nvm/versions/node/v24.15.0/bin:$PATH" corepack pnpm --dir apps/wodsmith-start test test/lib/competitions/capabilities.test.ts test/routes/api/compete/scores/window-status.test.ts test/server-fns/video-submission-fns.test.ts test/routes/api/compete/submission-gates.test.ts test/server-fns/athlete-score-fns.test.ts test/routes/compete/video-submission-route-gates.test.ts
  • PATH="/Users/zacjones/.nvm/versions/node/v24.15.0/bin:$PATH" corepack pnpm --dir apps/wodsmith-start type-check
  • PATH="/Users/zacjones/.nvm/versions/node/v24.15.0/bin:$PATH" corepack pnpm --dir apps/wodsmith-start lint (passes with pre-existing warnings)
  • PATH="/Users/zacjones/.nvm/versions/node/v24.15.0/bin:$PATH" lat check (known unrelated crew refs only)
  • git diff --check
  • pre-push hook: monorepo pnpm lint and pnpm type-check

Known existing LAT issue, unrelated to this slice: lat check still fails on pre-existing crew refs in lat.md/crew.md and apps/crew/test/routes/event-import-tabs.test.tsx.

Summary by CodeRabbit

  • New Features

    • Added benchmark competition type with perpetual submission capabilities—submissions remain open without time windows
    • Video submissions now available for benchmark competitions
  • Improvements

    • Refactored submission validation to use flexible capability-based checks, improving support across competition types

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 03ac4d2f-4b8d-4d71-861d-b4877af65b7f

📥 Commits

Reviewing files that changed from the base of the PR and between 54ce9c8 and ab90aad.

📒 Files selected for processing (19)
  • apps/wodsmith-start/src/lib/competitions/capabilities.ts
  • apps/wodsmith-start/src/routes/api/compete/scores/submit.ts
  • apps/wodsmith-start/src/routes/api/compete/scores/window-status.ts
  • apps/wodsmith-start/src/routes/api/compete/video/submit.ts
  • apps/wodsmith-start/src/routes/compete/$slug/index.tsx
  • apps/wodsmith-start/src/routes/compete/$slug/review/$eventId/index.tsx
  • apps/wodsmith-start/src/routes/compete/$slug/workouts/$eventId.tsx
  • apps/wodsmith-start/src/routes/compete/$slug/workouts/index.tsx
  • apps/wodsmith-start/src/routes/compete/cohost/$competitionId/events/$eventId/submissions/index.tsx
  • apps/wodsmith-start/src/routes/compete/organizer/$competitionId/events/$eventId/submissions/index.tsx
  • apps/wodsmith-start/src/server-fns/athlete-score-fns.ts
  • apps/wodsmith-start/src/server-fns/video-submission-fns.ts
  • apps/wodsmith-start/test/lib/competitions/capabilities.test.ts
  • apps/wodsmith-start/test/routes/api/compete/scores/window-status.test.ts
  • apps/wodsmith-start/test/routes/api/compete/submission-gates.test.ts
  • apps/wodsmith-start/test/routes/compete/video-submission-route-gates.test.ts
  • apps/wodsmith-start/test/server-fns/athlete-score-fns.test.ts
  • apps/wodsmith-start/test/server-fns/video-submission-fns.test.ts
  • lat.md/competition-type-capabilities.md

Walkthrough

Adds a benchmark competition type to the registry with a perpetual capability and videoSubmissions support. All hardcoded competitionType === "online" guards in routes and server functions are replaced with competitionCan capability checks. Perpetual fast-path branches bypass submission-window lookups when the perpetual capability is present.

Changes

Benchmark Competition Type and Capability Migration

Layer / File(s) Summary
Capability registry: perpetual + benchmark
apps/wodsmith-start/src/lib/competitions/capabilities.ts
CompetitionCapability gains "perpetual", RegisteredCompetitionTypeId (includes "benchmark") and derived CompetitionTypeId (excludes "benchmark") are introduced, CompetitionTypeDef.id is tightened, COMPETITION_TYPE_REGISTRY is re-typed, and a "benchmark" entry is added with selectableOnCreate: false, leaderboardVariant: "online", and capabilities ["videoSubmissions", "perpetual"].
Perpetual fast-paths in server functions and API handlers
apps/wodsmith-start/src/server-fns/athlete-score-fns.ts, apps/wodsmith-start/src/server-fns/video-submission-fns.ts, apps/wodsmith-start/src/routes/api/compete/scores/submit.ts, apps/wodsmith-start/src/routes/api/compete/scores/window-status.ts, apps/wodsmith-start/src/routes/api/compete/video/submit.ts
Early-return branches are added to all submission-window check functions: when competitionCan(..., "perpetual") is true, each function immediately returns open/allowed without querying event window rows. getBatchEventVideoSubmissionsFn also replaces its !== "online" eligibility guard with competitionCan(..., "videoSubmissions") and adds a perpetual allow-branch.
Route gate migration from === "online" to competitionCan
apps/wodsmith-start/src/routes/compete/$slug/index.tsx, apps/wodsmith-start/src/routes/compete/$slug/review/$eventId/index.tsx, apps/wodsmith-start/src/routes/compete/$slug/workouts/$eventId.tsx, apps/wodsmith-start/src/routes/compete/$slug/workouts/index.tsx, apps/wodsmith-start/src/routes/compete/cohost/..., apps/wodsmith-start/src/routes/compete/organizer/...
All six compete routes replace literal competitionType === "online" / !== "online" guards with competitionCan(competition.competitionType, "videoSubmissions") (or "submissionWindows" for the sidebar card); competitionCan is imported and supportsVideoSubmissions intermediates are introduced where the flag is used across multiple branches.
Tests: capabilities, API routes, server fns, and route gates
apps/wodsmith-start/test/lib/competitions/capabilities.test.ts, apps/wodsmith-start/test/routes/api/compete/scores/window-status.test.ts, apps/wodsmith-start/test/routes/api/compete/submission-gates.test.ts, apps/wodsmith-start/test/routes/compete/video-submission-route-gates.test.ts, apps/wodsmith-start/test/server-fns/athlete-score-fns.test.ts, apps/wodsmith-start/test/server-fns/video-submission-fns.test.ts
Adds perpetual/benchmark entries to the capability truth-table test; adds new suites for window-status (online closed vs. benchmark open), submission API gates (benchmark score and video without window rows), athlete-score benchmark path, getVideoSubmissionFn/getBatchEventVideoSubmissionsFn benchmark cases, and a source-level assertion that no route files contain literal competitionType === "online" comparisons.
Documentation update
lat.md/competition-type-capabilities.md
Updates the capability spec to frame the system as a registry-backed discriminator, documents benchmark semantics, rewrites the truth-table description, and adds new sections for perpetual window-status, benchmark submission gating, and route-gate verification.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant APIRoute as Score/Video Submit API
    participant ServerFn as checkSubmissionWindow
    participant DB

    Client->>APIRoute: POST submission (benchmark competitionType)
    APIRoute->>ServerFn: checkSubmissionWindow(competition, ...)
    ServerFn->>ServerFn: competitionCan(competitionType, "perpetual")?
    Note over ServerFn: perpetual = true → short-circuit
    ServerFn-->>APIRoute: { isOpen: true } / { allowed: true }
    APIRoute-->>Client: HTTP 200 success (no DB window query)

    Client->>APIRoute: POST submission (online competitionType)
    APIRoute->>ServerFn: checkSubmissionWindow(competition, ...)
    ServerFn->>ServerFn: competitionCan(competitionType, "perpetual")? → false
    ServerFn->>DB: query submission window rows
    DB-->>ServerFn: window row (or empty)
    ServerFn-->>APIRoute: { isOpen: true/false, reason? }
    APIRoute-->>Client: HTTP 200 with open/closed status
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • wodsmith/thewodapp#212: Implements the original submission-window gating for online competitions in the same checkSubmissionWindow function where this PR adds the perpetual fast-path.
  • wodsmith/thewodapp#378: Restructures per-sub-event video submission loading in routes/compete/$slug/workouts/$eventId.tsx, the same file where this PR migrates competitionType === "online" guards to competitionCan.
  • wodsmith/thewodapp#513: Describes the capability-registry refactor spec that this PR implements by adding the benchmark/perpetual entries to COMPETITION_TYPE_REGISTRY.

Poem

🐇 Hop hop, a benchmark lands today,
No windows needed — open all the way!
competitionCan replaces every === "online" string,
The registry decides what each type can bring.
Perpetual glory for the benchmark beast,
Submit your scores — the window never ceased! 🏋️

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/hillerfit-m0a-registry-worker

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 and usage tips.

@zacjones93
zacjones93 marked this pull request as ready for review June 20, 2026 23:43
@zacjones93
zacjones93 merged commit 4383d92 into feat/hillerfit-plan Jun 20, 2026
14 checks passed
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