Skip to content

feat(indexer): add request correlation ID generation#188

Merged
therealjhay merged 2 commits into
Betta-Pay:mainfrom
Bolajiomo99:feat-Add-request-correlation-ID-to-indexer
Jun 30, 2026
Merged

feat(indexer): add request correlation ID generation#188
therealjhay merged 2 commits into
Betta-Pay:mainfrom
Bolajiomo99:feat-Add-request-correlation-ID-to-indexer

Conversation

@Bolajiomo99

Copy link
Copy Markdown
Contributor

Description

This pull request adds request correlation ID generation to the BettaPay indexer by configuring the Fastify server to use the shared genReqId utility from @bettapay/validation.

Previously, the indexer did not explicitly generate standardized request correlation IDs, making it more difficult to trace requests across services and correlate logs during debugging. This implementation introduces the shared request ID generator directly into the Fastify constructor while preserving all existing server behavior.

Changes Made

  • Imported genReqId from @bettapay/validation.
  • Added genReqId to the Fastify constructor options.
  • Preserved existing Fastify configuration and request handling.
  • Verified that request IDs are automatically generated for incoming requests.
  • Added/updated tests to ensure request ID generation works without affecting existing functionality.

This solution follows the shared backend convention for request tracing while remaining fully backwards-compatible and requiring no API changes.

Fixes / Closes: #75


Type of Change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking Change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring / Performance (clean-up or performance optimization without behavioral changes)
  • Documentation / CI (changes to docs, workflows, config files)

Verification & Test Plan

Automated Tests

pnpm build
pnpm test
pnpm lint

Manual Verification

  1. Start the indexer locally and send requests to existing API endpoints.
  2. Verify that each incoming request is assigned a unique correlation ID (request.id) generated by genReqId.
  3. Confirm existing endpoints continue to function without any behavioral changes.

Sub-System Checklist

1. Smart Contracts (BettaPay-Contract)

  • Code compiles without warnings (cargo build --release --target wasm32-unknown-unknown)
  • Cargo test suite passes locally (cargo test)
  • Emits events for state changes
  • Implemented proper authorization controls (auth.require_auth())

2. Backend Services (BettaPay-Backend)

  • Prisma models updated and migrated (if database schema changes)
  • Zod validation checks added/updated
  • API routes and services build successfully (pnpm build)
  • Local env variables updated in .env.example

3. Frontend Dashboard (BettaPay-Frontend)

  • Local build completes successfully (pnpm build)
  • Focus states, labels, and aria attributes tested for accessibility
  • No regression on styling or components
  • Env parameters documented in .env.local

Checklist

  • My code follows the style guidelines of this project (run formatters/linters)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

@therealjhay

Copy link
Copy Markdown
Contributor

kindly resolve conflict

@Bolajiomo99

Copy link
Copy Markdown
Contributor Author

Conflict resolved

@therealjhay therealjhay merged commit 3cbab8f into Betta-Pay:main Jun 30, 2026
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.

Add request correlation ID to indexer

2 participants