Repository navigation
Conversation
Add integration test suite in services/indexer/test/database-integration.test.ts exercising event projection, multi-event batch writes, foreign key tolerance, and checkpoint resume against PostgreSQL. Add db:migrate script to run SQL migrations in sequence and export projectEvents from watcher for test execution. Closes YieldAnchor#9
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.
Summary
Closes #9.
This pull request adds an integration testing tier for database migrations and indexer projections against PostgreSQL. The suite exercises event ingestion, foreign key tolerance, and checkpoint persistence to verify that the indexer handles out-of-order streams without corrupting ledger state. All tests pass.
Key Changes
pnpm run db:migrate. It appliesdatabase/migrations/001_create_tables.sqlanddatabase/migrations/002_create_protocol_tables.sqlin numeric sequence.services/indexer/test/database-integration.test.ts. Tests require PostgreSQL.projectEventsinservices/indexer/src/watcher.ts. This allows testing multi-event batches that write tovaultsandvault_events.database/schema/README.md. The document explains migration commands and integration test execution.Test Coverage
event_idrecords ignores redundant writes and preserves exact 128-bit base unit amounts (numeric(40,0)).initializeevent alongside adepositevent in a single batch populates bothvaultsandvault_eventsrecords.indexer_checkpointsatNumber.MAX_SAFE_INTEGER(9_007_199_254_740_991). Out-of-range ledgers narrow to0.