Skip to content

Fix transitive category bracket resets - #22

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-b3f4
Draft

Fix transitive category bracket resets#22
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-b3f4

Conversation

@cursor

@cursor cursor Bot commented May 27, 2026

Copy link
Copy Markdown

Bug and impact

Editing a completed upstream category knockout match could reset only its direct child while leaving deeper downstream matches (for example, the final in an 8-team bracket) completed with stale teams, scores, and winners. Bets on matches that were reset by bracket recomputation also remained settled.

Root cause

recomputeCategoryBracketAfterWinnerChange computed winners/losers from a single stale DB snapshot and performed one pass, so descendants still saw intermediate feeder matches as completed with their old winner.

Fix

  • Recompute category bracket slots through an in-memory match graph until downstream state stabilizes.
  • Reset every affected downstream match and return those match IDs.
  • Re-settle/void bets for reset downstream matches after recomputation.
  • Add a regression test for an out-of-order 8-team bracket where a quarterfinal winner change invalidates both a semifinal and the final.

Validation

  • npm test -- --run tests/knockoutAdvance.test.ts
  • npm run typecheck
  • npm run lint (passes with existing warnings)
  • npm test
Open in Web View Automation 

Co-authored-by: Octavio Frangipani <octapf@users.noreply.github.com>
@vercel

vercel Bot commented May 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
matchpoint Ready Ready Preview, Comment May 27, 2026 10:41am

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