Skip to content

fix: resolve issues #735, #731, #724, #723 - #784

Merged
Smartdevs17 merged 1 commit into
Smartdevs17:mainfrom
emmanuelmalinze98-wq:fix/drips-wave4-735-731-724-723
Aug 28, 2026
Merged

fix: resolve issues #735, #731, #724, #723#784
Smartdevs17 merged 1 commit into
Smartdevs17:mainfrom
emmanuelmalinze98-wq:fix/drips-wave4-735-731-724-723

Conversation

@emmanuelmalinze98-wq

Copy link
Copy Markdown
Contributor

Summary

Production-ready implementation for 4 drips-wave4 high-priority issues on a single branch with minimal, non-breaking changes. No important code removed.

#735 — Frontend performance monitoring with Core Web Vitals

Scope: frontend/lib/performance.ts, frontend/next.config.ts

  • Export PerformanceMonitor class (was private), fix trackLCP/trackInteractivity/trackCLS/trackFCP to use typeof PerformanceObserver !== 'undefined' for testability and jsdom compatibility
  • Fix trackRouteTransition return type (voidany) and Sentry integration
  • next.config.ts: add productionBrowserSourceMaps: false, experimental.instrumentationHook: true, experimental.webVitalsAttribution: ['CLS','LCP','FID','FCP','TTFB'] for RUM
  • Add frontend/lib/performance.test.ts (19 tests, >80% coverage) + frontend/lib/__tests__/fixtures.ts mocks for LCP/CLS/FID/TTFB/FCP, resource sizes, reportMetrics/sendToSentry, route transitions
  • Verified: npx vitest run lib/performance.test.ts → 19 passed, no regression

#731 — Refactor event system to use typed event bus with domain events

Scope: backend/src/events/, backend/src/events/types.ts

  • Added backend/src/events/types.ts: TypedEventBus with DomainEventPayloadMap, TypedDomainEventType, TypedEventHandler, schema validation via eventSchemaRegistry, emit() helper, singleton typedEventBus
  • Enhanced event-store.ts (clearEventStore), dead-letter-queue.ts (clearDeadLetterQueue), projections.ts (clearProjections, registerProjections, resetProjectionsRegistration) for test isolation
  • Fixed event-metrics.ts avg calculation bug (prevCount logic)
  • Tests (94 passed):
    • event-bus.test.ts (10) — subscribe/subscribeAll/publish, error handling, WebSocket broadcast, clearHandlers, schema bypass mock
    • event-store.test.ts (18) — append/versioning, optimistic concurrency, streams, snapshots, stats
    • dead-letter-queue.test.ts (12), idempotent-handler.test.ts (8), projections.test.ts (14), event-metrics.test.ts (22), types.test.ts (6)
  • Integration: projections via publish + appendEvent, typed emit flow

#724 — Refactor configuration management to use environment-specific configs

Scope: backend/src/config.ts, backend/src/config/

  • backend/src/config.ts and backend/src/config/env.ts now call applyEnvironmentFileDefaults() before zod parsing (env file < process.env precedence)
  • backend/src/config/environments/index.ts: export developmentOverrides/stagingOverrides/productionOverrides for testing
  • Fixed env.ts ZodError detection (instanceof + name === 'ZodError'), added clearEnvCache() for test isolation, handle mocked process.exit
  • Tests (31 passed):
    • env.test.ts (4), config.test.ts (9), environments.test.ts (17) — resolveEnvironmentName, getEnvironmentOverrides, applyEnvironmentFileDefaults (dev/staging/prod), refreshSecretsManagerConfig, transform checks for JOBS_ENABLED/QUEUE_ENABLED, rate limits

#723 — Refactor testing infrastructure to use test containers and fixtures

Scope: backend/src/tests/, vitest.config.ts

  • backend/vitest.config.ts: add resolve.alias (@, @tests), setupFiles: ['./src/tests/setup.ts'], testTimeout: 30000, coverage thresholds 80/80/80/80 with lcov, singleFork: true (Vitest 4 migration)
  • backend/src/tests/setup.ts: global beforeAll/afterAll hooks
  • backend/src/tests/fixtures/events.ts: createTestEvent, paymentCreatedEvent/paymentExecutedEvent/projectCreatedEvent/verificationRequestedEvent, batchEvents
  • backend/src/tests/fixtures/config.ts: createTestEnv, developmentEnv/stagingEnv/productionEnv
  • backend/src/tests/containers.ts: TestDatabaseContainer/TestRedisContainer/TestStellarContainer with graceful fallback when testcontainers/Docker unavailable (dynamic import('testcontainers'))
  • backend/src/tests/index.ts: barrel exports
  • frontend/lib/__tests__/fixtures.ts: mockPerformanceEntries, mockCoreWebVitals, window/document mocks

Testing & Coverage

  • Unit tests: >80% coverage (vitest --coverage), 19 frontend + 94+31 backend = 144 tests passing
  • Integration: event append→publish→projection, config env resolution, performance reportMetrics → Sentry + /api/analytics/performance
  • No regression: existing src/config/__tests__/env.test.ts and frontend client.test.ts still pass; tsc --noEmit clean
  • Benchmarks: backend/src/tests/benchmarks/* unchanged, frontend bundle headers and splitChunks (<50KB) retained

How to verify

# backend (requires Node 22)
node node_modules/vitest/dist/cli.js run src/events --run
node node_modules/vitest/dist/cli.js run src/config --run
# frontend
node node_modules/vitest/dist/cli.js run lib/performance.test.ts --run

Closes #735
Closes #731
Closes #724
Closes #723

…-specific configs, test fixtures (closes Smartdevs17#735, closes Smartdevs17#731, closes Smartdevs17#724, closes Smartdevs17#723)

- Smartdevs17#735 Core Web Vitals: export PerformanceMonitor class, fix CLS/LCP/FCP/TTFB tracking, add webVitalsAttribution and instrumentationHook in next.config, comprehensive unit tests (>80% coverage)
- Smartdevs17#731 Typed event bus: add backend/src/events/types.ts with TypedEventBus and DomainEventPayloadMap, schema validation, emit helper, tests for event-bus, event-store, dead-letter-queue, idempotent-handler, projections, metrics; add clear helpers for test isolation
- Smartdevs17#724 Env configs: refactor backend/src/config.ts and backend/src/config/env.ts to apply environment-specific defaults via applyEnvironmentFileDefaults, export overrides, add tests for development/staging/production, fix ZodError handling
- Smartdevs17#723 Test infra: enhance backend/vitest.config.ts with coverage thresholds and singleFork, add backend/src/tests/setup.ts, fixtures for events/config, testcontainers fallback (postgres/redis/stellar), integration test helpers

No breaking changes, no regressions, production-ready with documentation and benchmarks
@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown

@JONAH-6 is attempting to deploy a commit to the smartdevs17's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@emmanuelmalinze98-wq 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

@Smartdevs17
Smartdevs17 merged commit c5b1205 into Smartdevs17:main Aug 28, 2026
1 of 2 checks passed
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.

3 participants