Skip to content

refactor: Cannot verify email#73

Merged
taiphanvan2k3 merged 1 commit intomainfrom
fix/cannot-verify-email
Dec 2, 2025
Merged

refactor: Cannot verify email#73
taiphanvan2k3 merged 1 commit intomainfrom
fix/cannot-verify-email

Conversation

@taiphanvan2k3
Copy link
Copy Markdown
Member

@taiphanvan2k3 taiphanvan2k3 commented Dec 2, 2025

  • Removed unused ITracingService dependency from UserCreatedEventHandler.
  • Streamlined email verification logic with improved exception handling and logging.
  • Updated EmailService to URL-encode the verification token for better link handling.
  • Added OpenTelemetry sink configuration in SerilogExtensions for structured logging to Aspire Dashboard.

Summary by CodeRabbit

  • Bug Fixes

    • Improved email verification link security through proper token encoding.
  • Chores

    • Enhanced logging and observability infrastructure for improved system monitoring.

✏️ Tip: You can customize this high-level summary in your review settings.

- Removed unused ITracingService dependency from UserCreatedEventHandler.
- Streamlined email verification logic with improved exception handling and logging.
- Updated EmailService to URL-encode the verification token for better link handling.
- Added OpenTelemetry sink configuration in SerilogExtensions for structured logging to Aspire Dashboard.
@taiphanvan2k3 taiphanvan2k3 self-assigned this Dec 2, 2025
@taiphanvan2k3 taiphanvan2k3 merged commit e1b9192 into main Dec 2, 2025
2 of 3 checks passed
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 2, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request refactors the tracing and logging architecture by removing tracing dependencies from event handlers, consolidating OpenTelemetry resource configuration across tracing and logging pipelines, integrating an OpenTelemetry sink into Serilog, and adding URL encoding for email verification tokens.

Changes

Cohort / File(s) Summary
Event Handler Simplification
src/Application/EventHandlers/UserCreatedEventHandler.cs
Removed ITracingService dependency and associated activity/tracing code from constructor; simplified nested try/catch to single try block; retained token generation and email sending flow with logging.
Email Service Enhancement
src/Infrastructure/Services/Email/EmailService.cs
Added WebUtility.UrlEncode() encoding for email verification token in verification URL construction.
OpenTelemetry Configuration
src/Web.Api/Extensions/OpenTelemetryExtensions.cs
Refactored to use unified ResourceBuilder for both tracing and logging; introduced centralized OTLP endpoint variable with http://localhost:4317 fallback; reordered EF Core instrumentation before ASP.NET Core; updated console/log messages to reflect tracing context.
Serilog OpenTelemetry Integration
src/Web.Api/Extensions/SerilogExtensions.cs
Added OpenTelemetry sink to Serilog configuration; reads OTLP endpoint from OTEL_EXPORTER_OTLP_ENDPOINT environment variable with fallback; sets resource attributes (service.name, service.version, service.namespace).
Project Dependencies
src/Web.Api/Web.Api.csproj
Added Serilog.Sinks.OpenTelemetry (v4.1.0) NuGet package reference.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify that URL encoding for verification tokens does not break token validation logic or existing integration tests
  • Validate that unified OTLP endpoint and ResourceBuilder configuration correctly applies to both tracing and logging pipelines without duplication
  • Confirm that Serilog OpenTelemetry sink integrates cleanly with existing Console and File sinks
  • Review event handler simplification to ensure removal of tracing does not impact observability requirements

Poem

🐰 A rabbit hops through telemetry streams,
Encoding tokens in digital dreams,
With Serilog sinks and resources aligned,
The traces now shine, refined and designed!
No tracing clutter clutters the way—
Clean handlers dance on this blessed day! ✨


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between 4d2e2a0 and 3aca7ba.

📒 Files selected for processing (5)
  • src/Application/EventHandlers/UserCreatedEventHandler.cs (1 hunks)
  • src/Infrastructure/Services/Email/EmailService.cs (1 hunks)
  • src/Web.Api/Extensions/OpenTelemetryExtensions.cs (3 hunks)
  • src/Web.Api/Extensions/SerilogExtensions.cs (2 hunks)
  • src/Web.Api/Web.Api.csproj (1 hunks)

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

@taiphanvan2k3 taiphanvan2k3 deleted the fix/cannot-verify-email branch December 2, 2025 09:47
taiphanvan2k3 added a commit that referenced this pull request Dec 22, 2025
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