Skip to content

Staging - #33

Merged
li4nee merged 2 commits into
mainfrom
staging
Jul 15, 2026
Merged

li4nee merged 2 commits into
mainfrom
staging

Conversation

@li4nee

@li4nee li4nee commented Jul 15, 2026 •

Copy link
Copy Markdown
Owner

This pull request introduces a comprehensive suite of load testing and backfill scripts, along with related documentation and housekeeping improvements. The main focus is on enabling realistic, automated performance testing of the ingestion path using k6, as well as providing one-off scripts for data backfills in MongoDB. Additional changes improve repository hygiene by updating ignore files.

Load testing infrastructure:

  • Added a set of k6 scripts (ingest-load-test.js, capacity-test.js, capacity-ceiling-retest.js, capacity-breaking-point.js, sustained-load-test.js) for various load and capacity testing scenarios on the ingestion API, including ramp-up, sustained, and breaking point tests. Each script generates realistic traffic and validates system behavior under different loads. [1] [2] [3] [4] [5]
  • Added monitor-queue.sh to poll RabbitMQ queue depth during tests, allowing correlation of HTTP acceptance with backend queue processing.
  • Updated README.md with a new section documenting load testing methodology, results, and tuning steps.

Data backfill scripts:

  • Added backfillEmailVerified.ts to set isEmailVerified=true for existing users missing this field, preventing retroactive lockouts after verification enforcement.
  • Removed the obsolete backfillApiHitExpiry.ts script, which previously set TTL expiry fields on legacy API hit documents.

Repository hygiene:

  • Updated .gitignore and .dockerignore to exclude log, CSV, and error files, preventing accidental commits of test artifacts. [1] [2]

Minor code quality improvements:

  • Minor formatting and style changes for improved readability in several backend files. [1] [2] [3]

Summary by CodeRabbit

  • New Features

    • Existing accounts are recognized as email-verified during account data updates.
    • Added load-testing tools for measuring ingestion capacity, sustained throughput, latency, errors, and queue performance.
  • Performance

    • Improved high-volume event publishing to support faster ingestion when confirmation checks are disabled.
    • Reduced routine ingestion logging noise.
  • Documentation

    • Added load-testing results, performance metrics, and tuning details to the project documentation.
  • Chores

    • Expanded exclusions for logs, CSV files, and error reports.
    • Removed an obsolete data migration utility.

li4nee and others added 2 commits July 15, 2026 14:10
- Updated method signatures in analytics, auth, and ingest services to use multi-line formatting for parameters.
- Changed logging level from info to debug in IngestController and EventProducer for more granular logging.
- Enhanced readability of the ClientRetentionCache documentation.
- Improved message publishing logic in EventProducer to handle fire-and-forget scenarios.
- Cleaned up email template utility functions for better formatting.
- Removed unnecessary blank lines and consolidated HTML escaping logic in html.utils.ts.
Refactor code for improved readability and consistency
@coderabbitai

coderabbitai Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0bf0f6f3-831c-43ae-bfac-351f963f8f45

📥 Commits

Reviewing files that changed from the base of the PR and between 0de5583 and 9aeb18a.

📒 Files selected for processing (24)
  • README.md
  • server/.dockerignore
  • server/.gitignore
  • server/scripts/backfillApiHitExpiry.ts
  • server/scripts/backfillEmailVerified.ts
  • server/scripts/k6/capacity-breaking-point.js
  • server/scripts/k6/capacity-ceiling-retest.js
  • server/scripts/k6/capacity-test.js
  • server/scripts/k6/ingest-load-test.js
  • server/scripts/k6/monitor-queue.sh
  • server/scripts/k6/sustained-load-test.js
  • server/scripts/k6/sustained-probe-3200-v2.logs
  • server/src/modules/analytics/services/analytics.service.ts
  • server/src/modules/auth/routes/auth.route.ts
  • server/src/modules/auth/services/auth.service.ts
  • server/src/modules/ingest/controllers/ingest.controller.ts
  • server/src/modules/processor/repos/endpointMetrics.repo.ts
  • server/src/modules/processor/repos/endpointMetricsBase.repo.ts
  • server/src/shared/infra/cache/clientRetentionCache.ts
  • server/src/shared/infra/messaging/eventProducer.ts
  • server/src/shared/infra/resilience/rateLimit.infra.ts
  • server/src/shared/utils/authEmailTemplates.utils.ts
  • server/src/shared/utils/emailVerification.utils.ts
  • server/src/shared/utils/html.utils.ts

📝 Walkthrough

Walkthrough

Adds k6 ingestion load tests and RabbitMQ monitoring, documents sustained-load results, supports configurable publisher confirmations, adds an email verification backfill, and includes logging, formatting, ignore-rule, and documentation updates.

Changes

Load testing and ingestion throughput

Layer / File(s) Summary
Ingestion load-test scenarios
server/scripts/k6/*.js
Adds constant-rate, sustained, capacity-ceiling, and breaking-point k6 tests for authenticated /api/v1/ingest requests, response checks, latency thresholds, and error counters.
Queue monitoring and sustained results
server/scripts/k6/monitor-queue.sh, server/scripts/k6/sustained-probe-3200-v2.logs, README.md, server/.dockerignore, server/.gitignore
Adds RabbitMQ queue metrics polling, records a sustained probe run, documents its results and tuning steps, and ignores generated log and data files.
Configurable message publishing
server/src/shared/infra/messaging/eventProducer.ts
Adds a publisher-confirm switch with local backpressure handling for fire-and-forget publishing and lowers successful publish logging to debug.

Email verification backfill

Layer / File(s) Summary
User verification migration
server/scripts/backfillEmailVerified.ts
Updates MongoDB users missing isEmailVerified to true, logs the count, disconnects, and reports success or failure through exit codes.

Code presentation and logging maintenance

Layer / File(s) Summary
Runtime maintenance
server/src/modules/..., server/src/shared/...
Reformats existing signatures and calls, changes ingest receipt logging to debug, shortens a cache comment, and preserves utility behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant K6 as k6 load test
  participant IngestAPI
  participant EventProducer
  participant RabbitMQ
  K6->>IngestAPI: POST ingest payload
  IngestAPI->>EventProducer: publish API hit event
  EventProducer->>RabbitMQ: publish message
  IngestAPI-->>K6: return 202 response
Loading
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch staging

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Biome (2.5.3)
server/scripts/k6/capacity-breaking-point.js

File contains syntax errors that prevent linting: Line 1: Illegal use of an import declaration outside of a module; Line 2: Illegal use of an import declaration outside of a module; Line 3: Illegal use of an import declaration outside of a module; Line 27: Illegal use of an export declaration outside of a module; Line 55: Illegal use of an export declaration outside of a module

server/scripts/k6/ingest-load-test.js

File contains syntax errors that prevent linting: Line 1: Illegal use of an import declaration outside of a module; Line 2: Illegal use of an import declaration outside of a module; Line 3: Illegal use of an import declaration outside of a module; Line 46: Illegal use of an export declaration outside of a module; Line 64: Illegal use of an export declaration outside of a module

server/scripts/k6/capacity-ceiling-retest.js

File contains syntax errors that prevent linting: Line 1: Illegal use of an import declaration outside of a module; Line 2: Illegal use of an import declaration outside of a module; Line 3: Illegal use of an import declaration outside of a module; Line 27: Illegal use of an export declaration outside of a module; Line 50: Illegal use of an export declaration outside of a module

  • 2 others

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.

@li4nee
li4nee merged commit ae18b3a into main Jul 15, 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.

1 participant