Skip to content

feat: implement analytics schema registry - #1075

Open
onyekachi66 wants to merge 1 commit into
Pulsefy:mainfrom
onyekachi66:feature/analytics-registry
Open

onyekachi66 wants to merge 1 commit into
Pulsefy:mainfrom
onyekachi66:feature/analytics-registry

Conversation

@onyekachi66

Copy link
Copy Markdown
Contributor

Closes #822

Description:
This PR introduces a central schema registry for analytics events to prevent dashboards from silently breaking when fields are modified.

Changes:

  • New Package analytics-registry: Created a dedicated, standalone package at @quickex/analytics-registry.
  • Zod-Based Validation: Defined precise event schemas (like payment_initiated, payment_completed, etc.) using Zod. Each schema explicitly includes a version field.
  • Runtime Emit Validation: Refactored the frontend event tracking (app/frontend/src/app/pay/PaymentPageClient.tsx) to validate payloads against the registry on emit. Invalid payloads are rejected and an invalid event counter is incremented.
  • CI Safety Checks: Implemented scripts/check-schema.mjs and integrated it into our ci.yml pipeline. This asserts that any changes adding required fields or removing existing fields will fail the CI build unless the corresponding schema's version is incremented.
  • Dashboards Exportable Structure: Authored an exportRegistry method that exposes the schemas (along with their property typings and required fields) into a readable JSON object, which can be extracted directly into dashboards or external consumers. A schemas.snapshot.json file is additionally maintained to track historical breaking changes across versions.

Acceptance Criteria Verified:

  • Every analytics event has a versioned schema in a central registry.
  • Events are validated against their schema before being recorded; invalid events are rejected and counted.
  • Adding a required field or removing a field fails CI unless the schema version is incremented.
  • The registry is exported in a form dashboards and consumers can read.

@drips-wave

drips-wave Bot commented Sep 23, 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

@Cedarich

Copy link
Copy Markdown
Contributor

Kindly fix the failed workflow

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.

BE-123: Analytics Event Schema Registry and Validation

2 participants