Skip to content

feat(indexer): default contract_events ingested_at at the database#551

Merged
Jagadeeshftw merged 3 commits into
Fluxora-Org:mainfrom
Olasunkanmi975:feat/contract-events-ingested-at-default
Jun 29, 2026
Merged

feat(indexer): default contract_events ingested_at at the database#551
Jagadeeshftw merged 3 commits into
Fluxora-Org:mainfrom
Olasunkanmi975:feat/contract-events-ingested-at-default

Conversation

@Olasunkanmi975

Copy link
Copy Markdown
Contributor

##closed #509

Summary

Moves contract_events.ingested_at to a server-authoritative database default, ensuring all ingested events receive a consistent timestamp even when application code omits the value.

Changes

  • Added a database migration configuring contract_events.ingested_at with DEFAULT now().
  • Updated the event store insert path to rely on the database-generated timestamp.
  • Added TSDoc documenting timestamp precedence and server-authoritative behavior.
  • Added tests verifying automatic timestamp generation and compatibility with explicit timestamps (if supported).

Testing

Covered:

  • Insert without ingested_at.
  • Insert with explicit ingested_at (if supported).
  • ingested_at remains non-null.
  • Existing insertion behavior is preserved.

Validation

npm test

Security

Using database-generated ingest timestamps prevents missing timestamps and reduces reliance on callers for authoritative ingest time.

@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@Olasunkanmi975 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

@Olasunkanmi975

Copy link
Copy Markdown
Contributor Author

Hi maintainer, please review my work for approval

@Olasunkanmi975

Copy link
Copy Markdown
Contributor Author

@Jagadeeshftw hi maintainer please review my pr and merge

@Jagadeeshftw Jagadeeshftw merged commit a769789 into Fluxora-Org:main Jun 29, 2026
@Jagadeeshftw

Copy link
Copy Markdown
Contributor

solid change - moving ingested_at to a database default means the timestamp is always server-authoritative and can never be omitted or spoofed by application code. the migration sets DEFAULT now() at the db level, and the insert path no longer needs to supply the value. also prevents a class of bugs where a caller forgets the field and events end up with null timestamps.

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.

Persist ingested_at via a database default/trigger for contract_events instead of relying on app code in src/indexer/store.ts

3 participants