Skip to content

feat: persist stream events in indexer - #83

Open
onyekachi66 wants to merge 1 commit into
Fundable-Protocol:devfrom
onyekachi66:indexer/streams-persistence
Open

feat: persist stream events in indexer#83
onyekachi66 wants to merge 1 commit into
Fundable-Protocol:devfrom
onyekachi66:indexer/streams-persistence

Conversation

@onyekachi66

Copy link
Copy Markdown

Closes #52

Summary

This PR implements the database persistence layer for the streams package in the indexer, replacing previous log-only handlers with durable database writes.

Key changes include:

  • Repository Addition: Created StreamRepository (and StreamPersistence interface) to manage database operations for creating streams, funding, withdrawing, and canceling.
  • Idempotency: Injected the shared EventIdentityStore into the stream handlers. Handlers now safely verify if an event has already been processed and record the event post-processing, avoiding duplicate updates and double-counting during replays.
  • Precision Safety: Mathematical operations like funding streams or incrementing withdrawn amounts are executed via TypeORM .setParameter() strings to ensure native BIGINT evaluation on Postgres, preventing floating-point precision loss.
  • Cleanup: Renamed streamCreated.ts to stream-created.handler.ts to align with standard handler footprint conventions and removed the legacy #32 persistence TODOs.

Area

  • Backend API (src/)
  • Indexer common infrastructure (indexer/common/)
  • Streams indexer (indexer/streams/)
  • Distributions indexer (indexer/distributions/)
  • Tooling, docs, CI, or Docker

Scope

  • This PR addresses one scoped issue or task
  • Unrelated formatting, generated files, and follow-up work were left out
  • Backend and indexer package boundaries were respected

Verification

  • bun run type-check
  • bun run test
  • bun run lint
  • bun run indexer:type-check if indexer files changed
  • bun run indexer:test if indexer files changed
  • bun run indexer:lint if indexer files changed

Indexer Safety

  • Event processing changes are idempotent or do not affect event processing
  • Cursor changes advance only after successful processing
  • Event names and payload shapes were confirmed from contracts, if relevant
  • Backfill and replay behavior was considered, if relevant

Notes

nil

@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@onyekachi66 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! 🚀

Learn more about application limits

@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7e7dede6-576f-44fa-9ff3-a364a6d6b675


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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.

Wire stream event handlers to persistence

1 participant