Repository navigation
Leaderboard snapshot swap, edit deadline, compose, k6 gates - #2270
Merged
Olowodarey merged 1 commit intoNov 23, 2026
Merged
Conversation
Resolves Arena1X#1932. Resolves Arena1X#2204. Resolves Arena1X#2211. Resolves Arena1X#2212.
|
@Diyaq 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! 🚀 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1932, closes #2204, closes #2211, closes #2212
#1932 — Leaderboard snapshot consistency during recompute
backend/src/leaderboard/leaderboard.service.tsrecalculateRanks()now builds the whole next board in memory first, writes it in a single DB transaction, and only then publishes it. Publishing is one reference assignment (publishedBoard = Object.freeze({...})), so readers see either the old board or the new one, never a partial one.getPublishedBoard()returns the latest complete, frozen snapshot (version,computed_at,entries). While a recompute is running it keeps returning the previous snapshot. If the recompute fails, the previous snapshot is kept.recalculateRanks()calls share one in-flight run, so two recomputes can't interleave their writes.isRecomputing()reports whether one is running.leaderboard.service.spec.ts:#2204 — Enforce the prediction edit deadline on-chain
contracts/creator-event-manager/src/{match.rs,prediction.rs,lib.rs}match::prediction_edit_deadline(&Match)/get_prediction_edit_deadline(match_id): the deadline comes from the match start (match_timeminus the configured prediction lock lead-time, stored asprediction_lock_time).prediction::edit_prediction: only the owner can edit. Edits are rejected for cancelled events and once a result is in. An edit at or after the deadline is rejected withEditDeadlinePassedand emits("prediction", "edit_rejected")with(prediction_id, match_id, predictor, deadline, attempted_at). An edit before the deadline updates the scoreline and derived outcome, keepspredicted_at, and emits("prediction", "edited").edit_predictionandget_prediction_edit_deadline.edit_predictionreturnsfalseon a deadline rejection instead of panicking. A panic would roll back the rejection event, and this way it is persisted. Every other error still panics, as elsewhere in the contract.tests/prediction_edit_deadline_tests.rs:match_time - lock_lead#2211 — docker-compose for local development
docker-compose.yml: Postgres 16 with a healthcheck and a persistent volume. There is also an optional Adminer UI under thetoolsprofile. Values can be overridden throughPOSTGRES_*env vars.backend/.env.example:DATABASE_URLandJWT_SECRETnow default to working local values that match the compose file.backend/src/config/env.validation.ts: exportsLOCAL_DEV_DATABASE_URLand documents it onDATABASE_URL. A failed validation now tells the developer to rundocker compose up -dand copy.env.example. Validation is not loosened.README.md: new "Local services (Docker Compose)" step with commands, a defaults table and the override/cleanup workflow. The later steps are renumbered.env.validation.spec.ts:.env.exampleDATABASE_URLmatches the compose default.env.examplepasses validation as-is#2212 — Enforce k6 performance thresholds in CI
performance/k6-config.js: sharedbuildThresholds()sets p(95)/p(99) latency and error-rate limits (http_req_failed,errors). They can be overridden withK6_P95_MS,K6_P99_MSandK6_ERROR_RATE.k6-config.jsbut never exportedoptions. k6 only applies options exported by the entry script, so their thresholds were never enforced. Each script now re-exportsoptions.performance/smoke-test.js: 5 VUs for 30s against/api/v1/health/liveand/api/v1/health/ping, with thresholds enforced.performance/threshold-breach-check.sh: runs the smoke test with an impossiblep(95)<0msbudget and fails unless k6 exits non-zero. This proves a breach fails the run.backend/package.json: newperf:smokeandperf:smoke:breach-checkscripts..github/workflows/backend-ci.yml: new optional Performance smoke (k6) job. It runs onworkflow_dispatchor on PRs labelledperf, withtimeout-minutes: 10. It builds and migrates against a Postgres service, starts the API, then runs the smoke check and the breach check.performance/README.md: documents the thresholds, overrides, smoke run and CI job.Closes #1932
Closes #2204
Closes #2211
Closes #2212