Skip to content

feat(api): WS ticket auth, Redis-backed matches, staked cancel, tournament API - #1540

Merged
chinweobtagaz merged 3 commits into
OpenKnight-Foundation:mainfrom
sketcherzee:fix/be-103-112-113-114-ws-ticket-matchmaking-redis-tournaments
Oct 24, 2026
Merged

chinweobtagaz merged 3 commits into
OpenKnight-Foundation:mainfrom
sketcherzee:fix/be-103-112-113-114-ws-ticket-matchmaking-redis-tournaments

Conversation

@sketcherzee

Copy link
Copy Markdown
Contributor

Closes #1380
Closes #1382
Closes #1383
Closes #1384

  • BE-103: single-use WS ticket from an authenticated REST call, accepted via query param / Sec-WebSocket-Protocol; frontend socket hooks updated
  • BE-112: request id -> queue key Redis hash so cancel removes staked requests; test added
  • BE-113: active matches stored in Redis with TTL
  • BE-114: GET/POST /v1/tournaments and POST /v1/tournaments/{id}/register backed by DB tables, 404/409 handling, tournament crate used for brackets

@drips-wave

drips-wave Bot commented Oct 22, 2026

Copy link
Copy Markdown

@sketcherzee Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

# Conflicts:
#	backend/modules/api/src/server.rs
#	frontend/lib/api.ts
- db_entity::tournament::Model derives Serialize/Deserialize so handlers can
  return it as JSON.
- Clone the bracket JSON before storing it, since it is also returned.
- Pass the bracket name as &str; create_bracket takes impl Into<String>, so
  "Test".into() was ambiguous.
@chinweobtagaz
chinweobtagaz merged commit 91a37d3 into OpenKnight-Foundation:main Oct 24, 2026
@chinweobtagaz

Copy link
Copy Markdown
Contributor

Merged, thanks @sketcherzee. To get it in, I resolved conflicts with main on your branch and fixed three compile errors in api/src/tournaments.rs:

  • db_entity::tournament::Model needed Serialize/Deserialize derives to be returned as JSON.
  • value was moved into Set(Some(value.into())) and then used again in Some(value). It now clones.
  • "Test".into() was ambiguous because create_bracket takes impl Into<String>. Passing "Test" directly fixes it.

Requiring a WS ticket also broke __tests__/chessSocketSync.test.ts, which now needs an access token and a mocked ticket endpoint. That's fixed on main.

Next time: run cargo check --workspace --tests and npx vitest run before pushing, and update any tests that depend on behaviour you change (here, how sockets connect).

chinweobtagaz added a commit that referenced this pull request Oct 25, 2026
* fix: restore green builds and tests after the Oct 24 merges

Backend
- api/lib.rs: remove the stray .configure(...) line (#1539) and stop
  compiling the unfinished player_stats module (sqlx/PgPool, wrong tables).
- api/players.rs: restore the service::players imports removed in #1542.
- pairing/swiss: treat a rematch as such when the history is recorded on
  either player; make the 'avoidance disabled' test actually disable it.

Frontend
- accessibility tests render inside AuthProvider, which
  GamePreferencesProvider now needs.
- socket tests: mock the WS ticket (#1540); default API port is 8080 (#1536).
- watch page: drop the unused setLiveGames.

CI
- generate-contract-bindings.sh is executable, so Contract Bindings CI can
  run it.

* fix(frontend): allow the 8080 API in the CSP; don't hang signing without Freighter

- lib/csp.ts: the connect-src fallback was still localhost:8000 after #1536
  moved the API default to 8080, so the browser blocked every API call
  (sign-in, matchmaking, tournaments).
- walletContext: only sign through @stellar/freighter-api when
  isConnected() reports the extension; otherwise signTransaction() waits
  forever for a reply (#1541).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants