Skip to content

Fixing Leaderboard updates for noblocks Play - #684

Merged
5ran6 merged 7 commits into
stablefrom
main
Aug 23, 2026
Merged

Fixing Leaderboard updates for noblocks Play#684
5ran6 merged 7 commits into
stablefrom
main

Conversation

@Dprof-in-tech

Copy link
Copy Markdown
Collaborator

Jira Issue

Jira Issue:

Description

This pull request improves error reporting and participant update logic in the fantasy worker system, and adds comprehensive tests for the new participant patch merging and upsert functionality. The main changes include introducing a utility for formatting errors, refactoring participant patch merging and batch updates to be more robust and efficient, and adding thorough unit tests for these changes.

Error Handling Improvements

  • Added a formatWorkerError utility to provide more readable and informative error messages for worker alerts, replacing generic stringification of errors throughout the runWorkerTick function. [1] [2] [3] [4] [5] [6] [7] [8]

Participant Patch Merging and Upsert Refactor

  • Introduced a new ParticipantPatch type and a mergeParticipantPatches function to normalize wallet addresses and merge multiple patches per wallet, ensuring later patches override earlier values.
  • Refactored batchUpsertParticipants to use the new merging logic, resolve canonical wallet addresses before updating, and cap concurrent in-flight updates to 25 per batch for efficiency and safety. [1] [2]

Testing Enhancements

  • Added a new test suite (fantasy-participant-patches.test.ts) with comprehensive unit tests for both mergeParticipantPatches and batchUpsertParticipants, covering normalization, merging, error handling, and concurrency limits.

This fixes the leaderboard no refresh for noblocks play.

Self-review

  • Reviewed diff against Jira acceptance criteria (including failure cases)
  • CodeRabbit / CI green

References

Testing

  • This change adds test coverage for new/changed/fixed functionality

Staging

  • Staging noblocks checked (wallet and transaction flows)

Checklist

  • I have added documentation and tests for new/changed functionality in this PR
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not main
  • If this PR adds a database migration, it follows expand/contract: the new code works against the pre-migration schema, the currently deployed code keeps working against the post-migration schema, and destructive changes (drops, renames, tightened constraints) are deferred until the old application version is no longer serving — migrations are applied around the deploy, not strictly before or after it

By submitting a PR, I agree to Paycrest's Contributor Code of Conduct and Contribution Guide.

Dprof-in-tech and others added 7 commits August 21, 2026 22:35
…kerError utility to provide clearer error messages. This change improves the reporting of errors during various operations, including fixture advances, refreshes, stats sync, rollovers, and score recomputations. Additionally, update batchUpsertParticipants to handle empty input gracefully and ensure terms acceptance is recorded correctly.
…nd ensure only existing participants are updated. Introduced chunking for wallet address queries to enhance performance and prevent errors during upserts. Added documentation for the new batch processing logic.
…s functions

- Introduced a new test file for fantasy participant patching logic.
- Added tests to validate merging of duplicate wallet entries and handling of distinct wallets.
- Implemented error handling tests for invalid batch sizes in batchUpsertParticipants function.
- Enhanced overall test coverage for participant-related operations.
- Added a mock for supabaseAdmin to facilitate testing.
- Improved the batchUpsertParticipants test to validate that invalid batch sizes do not trigger database access.
- Ensured that the from mock is reset before each test to maintain isolation and accuracy in test results.
- Introduced a new constant to cap in-flight participant updates at 25 to prevent overwhelming the database.
- Updated the implementation to process updates in fixed-size groups, improving performance and error handling.
- Added unit tests to validate the new concurrency limits and error propagation during updates.
…or-create-new-row

Enhance error handling in worker functions
@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2b3129fc-0ac8-4899-84f3-e761b0457506

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@5ran6
5ran6 merged commit b978618 into stable Aug 23, 2026
4 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.

2 participants