Skip to content

chore: add TODO.md to .gitignore to prevent tracking of temporary files - #1

Merged
DoniLite merged 4 commits into
masterfrom
patch/docker-deployment
Apr 23, 2026
Merged

chore: add TODO.md to .gitignore to prevent tracking of temporary files#1
DoniLite merged 4 commits into
masterfrom
patch/docker-deployment

Conversation

@DoniLite

@DoniLite DoniLite commented Apr 22, 2026

Copy link
Copy Markdown
Owner

Summary by Sourcery

Add comprehensive integration and unit test coverage across core crates and wire them into CI using a standardized Rust toolchain version.

Enhancements:

  • Introduce a workspace-level Rust 1.88 toolchain requirement and align Docker build image and rust-toolchain configuration accordingly.

Build:

  • Add required dev-dependencies for HTTP, JSON, URL encoding, and intra-crate integration tests across API, SMTP, and queue crates.

CI:

  • Extend CI environment configuration to expose Mailpit and disable dotenv-based config loading for tests.

Documentation:

  • Add a CLAUDE.md contributor guide documenting commands, architecture, configuration, templates, and Docker workflow for the project.

Tests:

  • Add SMTP unit tests covering HTML fallback text, mailbox parsing, message construction, and custom headers.
  • Add template renderer tests validating control flow, default handling, syntax errors, and locale exposure.
  • Add end-to-end API tests that spin up the full app, enqueue email via HTTP, and assert delivery to Mailpit plus auth protection behavior.
  • Add queue integration tests against Postgres and Mailpit as well as JSON serialization tests for mail jobs and SMTP overrides.

@sourcery-ai

sourcery-ai Bot commented Apr 22, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds comprehensive tests and integration infrastructure around SMTP, queue, templates, config loading, and the HTTP API; introduces Mailpit-based end-to-end tests, bumps the Rust toolchain/workspace version to 1.88, wires new dev-dependencies and CI env vars, and adds a CLAUDE.md/rust-toolchain configuration for contributors.

Sequence diagram for Mailpit-based end-to-end email send test

sequenceDiagram
    actor Tester
    participant MailifyAPI as mailify_api
    participant Queue as mailify_queue
    participant Smtp as mailify_smtp
    participant MailpitSMTP as mailpit_smtp
    participant MailpitHTTP as mailpit_http

    Tester->>MailifyAPI: HTTP POST /mail/send
    MailifyAPI->>Queue: enqueue MailJob in Postgres
    activate Queue
    Queue-->>MailifyAPI: ack enqueued
    deactivate Queue
    MailifyAPI-->>Tester: 202 Accepted

    note over Queue,Smtp: Worker runtime picks up MailJob
    Queue->>Smtp: build_message and send
    Smtp->>MailpitSMTP: SMTP transaction (MAIL FROM, RCPT TO, DATA)
    MailpitSMTP-->>Smtp: 250 OK
    Smtp-->>Queue: job completed

    Tester->>MailpitHTTP: HTTP GET /api/v1/messages
    MailpitHTTP-->>Tester: JSON with delivered message
    Tester->>Tester: assert subject, recipients, headers
Loading

File-Level Changes

Change Details Files
Add unit tests for SMTP helpers and template rendering behavior.
  • Add tests for fallback_text HTML stripping and whitespace behavior.
  • Add tests for parse_mailbox covering plain, named, and invalid addresses.
  • Add tests for build_message ensuring subject/recipients and custom headers are present.
  • Add tests validating minijinja control flow, defaulting, syntax errors, and locale exposure in templates.
crates/mailify-smtp/src/lib.rs
crates/mailify-templates/tests/renderer.rs
Introduce Mailpit-backed integration tests for SMTP sending, queue persistence/worker execution, and HTTP API behavior.
  • Add mailify-smtp integration test that sends email via Mailpit and verifies delivery through its HTTP API.
  • Add mailify-queue integration test that enqueues a MailJob in Postgres and asserts Mailpit delivery after worker execution.
  • Add mailify-api end-to-end test wiring full AppConfig, JWT issuance, queue runtime, and HTTP router to send custom mail and verify Mailpit delivery.
  • Add mailify-api auth integration test ensuring protected routes reject missing/invalid JWTs and conditionally skip when DB/Mailpit are unavailable.
crates/mailify-smtp/tests/it_mailpit.rs
crates/mailify-queue/tests/it_postgres.rs
crates/mailify-api/tests/it_e2e.rs
Add tests around configuration loading, SMTP override behavior, and queue job serialization.
  • Add AppConfig tests covering defaults, env overrides (including nested keys and API key maps), and error paths for invalid ports.
  • Add smtp_override tests verifying TlsMode Display/serde behavior and SmtpOverride defaults/roundtrip.
  • Add MailJob serde tests covering registered/custom kind tagging, field roundtrips, and omission of smtp_override when None.
crates/mailify-config/tests/load.rs
crates/mailify-core/tests/smtp_override.rs
crates/mailify-queue/tests/job_serde.rs
Wire required dev-dependencies and environment for new integration tests.
  • Add reqwest, tokio-util, urlencoding, and crate cross-deps as dev-dependencies for mailify-api.
  • Add dev-dependencies for mailify-smtp (tokio, reqwest, serde_json, uuid, urlencoding, mailify-config).
  • Add dev-dependencies for mailify-queue (uuid, serde_json, reqwest, urlencoding).
  • Extend CI workflow env with MAILPIT_API_URL and disable dotenv to avoid env interference in tests.
crates/mailify-api/Cargo.toml
crates/mailify-smtp/Cargo.toml
crates/mailify-queue/Cargo.toml
.github/workflows/ci.yml
Standardize project on Rust 1.88 and pin toolchain for contributors/CI.
  • Bump workspace rust-version from 1.80 to 1.88 in Cargo.toml.
  • Update Docker builder image from rust:1.82-slim to rust:1.88-slim for consistency with workspace.
  • Add rust-toolchain.toml specifying channel 1.88 with rustfmt and clippy components for minimal profile.
Cargo.toml
docker/Dockerfile
rust-toolchain.toml
Document repository workflows and architecture for AI/code assistants.
  • Add CLAUDE.md describing Makefile commands, crate architecture, request flow, config precedence, template contract, and Docker build details to guide automated tools/users.
CLAUDE.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

- Bump Rust version from 1.80 to 1.88 in Cargo.toml and Dockerfile.
- Update Cargo.lock with new dependencies: reqwest and urlencoding.
- Add integration tests for end-to-end email sending via Mailpit.
- Implement tests for job serialization and SMTP override behavior.
- Enhance existing tests for template rendering and configuration loading.
- Introduce CLAUDE.md for developer guidance on repository usage.
@DoniLite

Copy link
Copy Markdown
Owner Author

@sourcery-ai review

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The config and mailpit-related helper functions (smtp_host, mailpit_api, mailpit_reachable, env URL builders, mailpit purge/search loops) are duplicated across multiple test crates; consider extracting them into a shared test utility module to keep behavior consistent and avoid drift.
  • In mailify-config/tests/load.rs, clear_mailify_vars mutates the environment while iterating and wraps set_var/remove_var in unsafe; it would be safer and clearer to first collect matching keys into a vector and then remove them using the safe APIs without unsafe.
  • The integration tests use hard-coded polling intervals and deadlines (e.g., 10–20s loops when checking Mailpit); consider centralizing these as constants or making them configurable via env vars so they can be tuned for CI stability versus local test speed.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The config and mailpit-related helper functions (`smtp_host`, `mailpit_api`, `mailpit_reachable`, env URL builders, mailpit purge/search loops) are duplicated across multiple test crates; consider extracting them into a shared test utility module to keep behavior consistent and avoid drift.
- In `mailify-config/tests/load.rs`, `clear_mailify_vars` mutates the environment while iterating and wraps `set_var`/`remove_var` in `unsafe`; it would be safer and clearer to first collect matching keys into a vector and then remove them using the safe APIs without `unsafe`.
- The integration tests use hard-coded polling intervals and deadlines (e.g., 10–20s loops when checking Mailpit); consider centralizing these as constants or making them configurable via env vars so they can be tuned for CI stability versus local test speed.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@DoniLite
DoniLite merged commit 0383015 into master Apr 23, 2026
6 checks passed
@DoniLite
DoniLite deleted the patch/docker-deployment branch April 23, 2026 05:54
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