Skip to content

[codex] improve division capacity editing#509

Open
zacjones93 wants to merge 3 commits into
mainfrom
codex/division-capacity-affordances
Open

[codex] improve division capacity editing#509
zacjones93 wants to merge 3 commits into
mainfrom
codex/division-capacity-affordances

Conversation

@zacjones93

@zacjones93 zacjones93 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Reworked organizer division rows so editable model fields look editable: division name, team size, per-division capacity, and description/metadata are all surfaced in the row experience.
  • Added live capacity status beside each division as registered / cap, including unlimited, near-capacity, at-capacity, and over-capacity states.
  • Updated the division update server function to persist teamSize changes after a division has been created.
  • Renamed the competition-level capacity panel to a dedicated Capacity section and clarified how the default per-division cap relates to row-level overrides.

Validation

  • PATH=/Users/ianjones/.nvm/versions/node/v24.14.1/bin:$PATH pnpm --filter wodsmith-start type-check
  • PATH=/Users/ianjones/.nvm/versions/node/v24.14.1/bin:$PATH pnpm --filter wodsmith-start exec biome lint src/components/divisions/organizer-division-item.tsx src/components/divisions/organizer-division-manager.tsx 'src/routes/compete/organizer/$competitionId/-components/capacity-settings-form.tsx' src/server-fns/competition-divisions-fns.ts
  • git diff --check

Notes

  • Tried to launch the local dev server for a browser smoke, but this fresh worktree is missing apps/wodsmith-start/.alchemy/local/wrangler.jsonc; Vite exits with the existing Alchemy config-path error until local Alchemy state is generated.

Summary by cubic

Make division rows truly editable: name, team size, capacity, and notes are inline with a live capacity badge and state-aware styling. Also persist teamSize on the backend and clarify capacity defaults in the Competition settings.

  • New Features

    • Inline editing for name, team size (1–10 via select), per-division capacity, and notes.
    • Live capacity badge shows "registered / cap" with unlimited/near/full/over states, row colors, and a short status message.
    • Team size shown as a compact "Individual/Team of N" badge; capacity panel renamed to "Capacity" with clearer default vs. override guidance.
  • Refactors

    • updateCompetitionDivisionFn accepts optional teamSize and persists it.
    • Organizer manager saves team size with optimistic UI and toasts; minor copy/validation tweaks in CapacitySettingsForm.

Written for commit 5f3611f. Summary will update on new commits.

Review in cubic

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@theianjones, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 50 minutes and 55 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 66b2cc7e-22ff-4d2a-9219-e3377117bb62

📥 Commits

Reviewing files that changed from the base of the PR and between cd37de1 and 5f3611f.

📒 Files selected for processing (5)
  • apps/wodsmith-start/src/components/divisions/organizer-division-item.tsx
  • apps/wodsmith-start/src/components/divisions/organizer-division-manager.tsx
  • apps/wodsmith-start/src/routes/compete/organizer/$competitionId/-components/capacity-settings-form.tsx
  • apps/wodsmith-start/src/server-fns/competition-divisions-fns.ts
  • lat.md/domain.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/division-capacity-affordances

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.

@theianjones theianjones marked this pull request as ready for review June 11, 2026 23:46

@cubic-dev-ai cubic-dev-ai Bot 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.

3 issues found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="apps/wodsmith-start/src/components/divisions/organizer-division-item.tsx">

<violation number="1" location="apps/wodsmith-start/src/components/divisions/organizer-division-item.tsx:307">
P2: Pressing Enter in the division name field triggers `onLabelSave` twice (keydown + blur), causing duplicate save requests.</violation>
</file>

<file name="apps/wodsmith-start/src/components/divisions/organizer-division-manager.tsx">

<violation number="1" location="apps/wodsmith-start/src/components/divisions/organizer-division-manager.tsx:237">
P1: Team-size no-op guard compares against stale `initialDivisions`, which can block legitimate updates after prior optimistic edits.</violation>

<violation number="2" location="apps/wodsmith-start/src/components/divisions/organizer-division-manager.tsx:277">
P2: Team-size rollback uses stale initial value, so a failed later edit can incorrectly revert to an older team size.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

newTeamSize: number,
) => {
const original = initialDivisions.find((d) => d.id === divisionId)
if (original && original.teamSize === newTeamSize) return

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.

P1: Team-size no-op guard compares against stale initialDivisions, which can block legitimate updates after prior optimistic edits.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/wodsmith-start/src/components/divisions/organizer-division-manager.tsx, line 237:

<comment>Team-size no-op guard compares against stale `initialDivisions`, which can block legitimate updates after prior optimistic edits.</comment>

<file context>
@@ -220,6 +229,58 @@ export function OrganizerDivisionManager({
+    newTeamSize: number,
+  ) => {
+    const original = initialDivisions.find((d) => d.id === divisionId)
+    if (original && original.teamSize === newTeamSize) return
+
+    setDivisions((prev) =>
</file context>
Suggested change
if (original && original.teamSize === newTeamSize) return
if (divisions.find((d) => d.id === divisionId)?.teamSize === newTeamSize) return

Comment on lines +307 to +312
onKeyDown={(e) => {
if (e.key === "Enter" && localLabel !== label) {
onLabelSave(localLabel)
e.currentTarget.blur()
}
}}

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.

P2: Pressing Enter in the division name field triggers onLabelSave twice (keydown + blur), causing duplicate save requests.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/wodsmith-start/src/components/divisions/organizer-division-item.tsx, line 307:

<comment>Pressing Enter in the division name field triggers `onLabelSave` twice (keydown + blur), causing duplicate save requests.</comment>

<file context>
@@ -201,38 +268,118 @@ export function OrganizerDivisionItem({
+                    onLabelSave(localLabel)
+                  }
+                }}
+                onKeyDown={(e) => {
+                  if (e.key === "Enter" && localLabel !== label) {
+                    onLabelSave(localLabel)
</file context>
Suggested change
onKeyDown={(e) => {
if (e.key === "Enter" && localLabel !== label) {
onLabelSave(localLabel)
e.currentTarget.blur()
}
}}
onKeyDown={(e) => {
if (e.key === "Enter") {
e.currentTarget.blur()
}
}}

setDivisions((prev) =>
prev.map((d) =>
d.id === divisionId
? { ...d, teamSize: original?.teamSize ?? newTeamSize }

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.

P2: Team-size rollback uses stale initial value, so a failed later edit can incorrectly revert to an older team size.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/wodsmith-start/src/components/divisions/organizer-division-manager.tsx, line 277:

<comment>Team-size rollback uses stale initial value, so a failed later edit can incorrectly revert to an older team size.</comment>

<file context>
@@ -220,6 +229,58 @@ export function OrganizerDivisionManager({
+      setDivisions((prev) =>
+        prev.map((d) =>
+          d.id === divisionId
+            ? { ...d, teamSize: original?.teamSize ?? newTeamSize }
+            : d,
+        ),
</file context>

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.

2 participants