feat: implement SDK codegen, bulk dead-letter replay, and ContractEvent partitioning - #1397
Merged
Conversation
…ng, bulk replay, SDK codegen)
|
@Izebby 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! 🚀 |
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.
This PR addresses three distinct enhancements across the backend, SDK, and database layers to improve data lifecycle management, API usability, and developer experience.
Closes #1278
Closes #1279
Closes #1280
Changes Made
TypeScript SDK: Integrated @graphql-codegen/cli and @graphql-codegen/typescript to automatically generate types from the backend GraphQL schema. Added a generate script to package.json.
Python SDK: Integrated ariadne-codegen into pyproject.toml to dynamically generate Pydantic models/types based on the schema.
CI Pipeline: Updated .github/workflows/sdk-release.yml to run generation scripts during the build process and fail the build if the generated SDK types drift from the current backend schema.
Created a new REST endpoint (POST /v1/webhooks/dead-letters/bulk-replay) in django-backend/soroscan/v1/views.py.
Wired the endpoint to the existing create_replay_job logic to iterate over an array of dead_letter_ids and spawn asynchronous replay tasks.
Updated route definitions in django-backend/soroscan/v1/urls.py.
Added a custom raw SQL migration (0054_contractevent_partitioning.py) to convert the ingest_contractevent table into a partitioned table.
Partitioning is implemented using the RANGE strategy on the timestamp and ledger_sequence columns.
Created initial month-bound partitions to ensure seamless event ingestion without downtime.
How to Test / Verify
Database:
Run python manage.py migrate in the django-backend directory. Verify that the table ingest_contractevent is successfully converted to a partitioned table in your local Postgres instance.
API:
Make a POST request to /v1/webhooks/dead-letters/bulk-replay with a payload of {"dead_letter_ids": [1, 2, 3]} and verify that WebhookReplayJob instances are created in the database.
SDK Codegen:
Navigate to sdk/typescript and run npm run generate.
Navigate to sdk/python and run ariadne-codegen.
Verify that both commands execute without errors and produce the expected type definition files.
Checklist
[x] I have performed a self-review of my own code.
[x] I have added/updated necessary migrations.
[x] I have verified that SDK type generation works locally.
[x] I have updated the CI/CD workflows to enforce codegen synchronization.