Fix: launch: constrain the network column so a typo cannot split the dataset (Auto-Generated) - #480
Open
privyy-bit wants to merge 6 commits into
Open
Conversation
…_constrain_network.sql
|
@privyy-bit 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! 🚀 |
Depo-dev
added a commit
to ravendevhub/Trident
that referenced
this pull request
Aug 31, 2026
…Labs#252, Telocel-Labs#435) Reworked from Telocel-Labs#534 and Telocel-Labs#480, both of which were unmergeable as written. Telocel-Labs#534 also renamed the vocabulary (mainnet -> pubnet, standalone -> local) across every table. That rename is dropped: 16 files in services/ and crates/ write 'mainnet' and only the indexer config mentions 'pubnet' at all, as an accepted alias — so migrating the data without changing those writers would have made every subsequent INSERT violate the new constraints. It also numbered its migration 0027, already taken by webhook_secret_rotation; this is 0031, the next free slot. Telocel-Labs#480's crates/common/src/types.rs replaced the file rather than adding to it, deleting seven existing types (E0432 on ContractLiveness, SorobanEvent and five others). The Network enum is appended here instead. Its FromStr impl declared 'fn fromStr', which does not satisfy the trait, and the FUTUREnet constant broke naming convention; both fixed. Telocel-Labs#480's Go ValidateNetwork collided with the existing query-param validator of the same name in validators.go, as did its test function. Renamed to ValidateNetworkValue / TestValidateNetworkValue. The migration normalises any legacy pubnet/standalone/local rows before adding the constraints, so it is safe against a database seeded by the earlier draft. All three layers now agree on mainnet/testnet/futurenet/sandbox: cargo clippy -p trident-common --all-targets -- -D warnings passes, go vet and go test ./validation/ pass.
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 #435
This pull request was generated automatically and scoped strictly to issue #435.
Changes
Constrain the
networkcolumn across trident_events, api_keys, and webhook_subscriptions tables to known values ('mainnet', 'testnet', 'futurenet', 'sandbox') via a CHECK constraint and database migration. Validate network parameter in the API layer before it reaches SQL with a documented INVALID_ARGUMENT error code, and add unit/integration tests asserting bad values are rejected at both API and DB layers.Verification
Linked with
Closes #435so the Drips Wave bot resolves the issue on merge.