Skip to content

Migration to Spring Boot 4.0.2, Java 25 and Gradle 9.3.1#820

Draft
viktormohl wants to merge 21 commits into
gessnerfl:mainfrom
viktormohl:switch-to-spring-4.x
Draft

Migration to Spring Boot 4.0.2, Java 25 and Gradle 9.3.1#820
viktormohl wants to merge 21 commits into
gessnerfl:mainfrom
viktormohl:switch-to-spring-4.x

Conversation

@viktormohl
Copy link
Copy Markdown

@viktormohl viktormohl commented Feb 14, 2026

Important

This MR is based on PR #819 and must be merged after this PR.

Summary

This MR migrates Fake SMTP Server from Spring Boot 3.5.5 to 4.0.2 and upgrades the toolchain to Java 25, Gradle 9.3.1, Node 24.13.1, and npm 11.8.0.

Planned release version: 2.6.0

Key Changes

Build and Platform

  • Introduced Gradle Version Catalog (gradle/libs.versions.toml) for plugins/dependencies.
  • Upgraded Gradle Wrapper to 9.3.1.
  • Switched Docker base image to bellsoft/liberica-runtime-container:jdk-25-slim-musl.
  • Java toolchain now targets 25.

Spring Boot 4 / Dependency Migration

  • Spring Boot upgraded to 4.0.2.
  • Added spring-boot-starter-webmvc-test (required for MockMvc setup in Boot 4).
  • Replaced flyway-core with spring-boot-starter-flyway.
  • Updated tests/imports to Boot 4 package changes.
  • Removed obsolete Jackson config (write-dates-as-timestamps).

Persistence and Deletion Behavior

  • Added EmailContentRepository and EmailInlineImageRepository.
  • Implemented explicit child-entity deletion (attachments/content/inline images) before parent email deletion.
  • Extended retention cleanup logic to delete child entities first.

Attachment / Inline Image Size Handling

  • Added configurable limit: FAKESMTP_MAX_ATTACHMENT_SIZE (default 10MB).
  • Oversized attachment/inline image parts are now skipped (not silently truncated):
    • processingStatus=SKIPPED_TOO_LARGE
    • processingMessage=<reason>
  • Downloading a skipped attachment from /api/emails/{mailId}/attachments/{attachmentId} returns HTTP 413.
  • Added DB migration V1_2_0__add_email_part_processing_status.sql for processing metadata columns.

Runtime Configuration

  • Graceful shutdown optimized:
    • spring.lifecycle.timeout-per-shutdown-phase=5s
    • server.servlet.async-timeout=5000

Test Results

  • Backend tests: ✅ 281 passed
  • Frontend tests: ✅ 52 passed
  • Includes new E2E SMTP tests and new tests for oversize attachment/inline-image skip behavior.

Reviewer Focus

  1. Boot 4 + Java 25 compatibility across CI/build/release.
  2. Cascade deletion paths (deleteEmailById, deleteAllEmails, retention timer).
  3. Oversize handling contract (status/message persistence, API 413, UI behavior).
  4. Configuration compatibility (application.yaml, application-mockserver.yaml, Flyway migration).

Breaking / Behavioral Notes

  • Java 25 is now required.
  • Boot 4 / Hibernate 7 stricter behavior required repository and delete-flow adjustments.
  • Oversized email binary parts are now explicitly marked and skipped instead of being partially stored.

Checklist

  • Project compiles with updated toolchain/dependencies.
  • Backend tests green (281).
  • Frontend tests green (52).
  • Migration/config/runtime changes documented.
  • Oversize part handling documented and tested.

…nerfl#815)

- Implement server-side session authentication with HttpOnly cookies
- Add configurable session timeout (FAKESMTP_WEBAPP_SESSION_TIMEOUT_MINUTES)
- Enable CSRF protection for API requests
- Add CSP headers on UI shell routes only
- Restructure static assets under /assets/ with reduced public surface
- Implement authenticated SSE with heartbeats, connection health indicator,
  Virtual Threads for high-performance delivery, and exponential backoff
- Expose session metadata via /api/meta-data for UI consumption
- Add SessionTimeoutManager with inactivity tracking
- Update build process to include assets in bootRun/test tasks
- Add configurable rate limiting for login attempts
- Add configurable support for concurrent sessions
@viktormohl viktormohl marked this pull request as draft February 14, 2026 02:25
@viktormohl viktormohl force-pushed the switch-to-spring-4.x branch 2 times, most recently from 88c7698 to 7b55bf4 Compare February 14, 2026 14:56
@viktormohl viktormohl marked this pull request as ready for review February 14, 2026 15:00
@viktormohl viktormohl marked this pull request as draft February 15, 2026 22:16
@viktormohl viktormohl force-pushed the switch-to-spring-4.x branch 5 times, most recently from f33cdbc to ed9ddef Compare February 21, 2026 01:39
- Upgrade platform stack to Spring Boot 4.0.2, Java 25, Gradle 9.3.1, Node.js 24.13.1, and npm 11.8.0.
- Adopt Gradle version catalog and align dependencies/configuration for framework compatibility.
- Refactor email processing and deletion flow, including `EmailDeletionService`, transactional handling, and batch deletes (`deleteAllInBatch`).
- Add inline image API support with Base64 decode on delivery and extend related coverage.
- Improve resilience and security around SSE/session/rate-limiting behavior (proxy headers, reconnect/cleanup, context-path handling).
- Expand backend/frontend test coverage (integration and unit tests), including SMTP flow, auth/rate-limit scenarios, and React test stability.
- Improve operational setup: optimize container base image/runtime and decouple `bootRun` from full SPA asset pipeline.
…responding tests

- Implement content type and Base64 data validation for inline images.
- Return HTTP 422 for invalid inline image content type or Base64 data.
- Extract helper methods for image data decoding and type parsing.
- Add unit and integration tests for invalid content scenarios.
- Add normalization logic for Content-ID header values.
- Handle malformed or improperly wrapped Content-ID values defensively.
- Extend test coverage to validate normalization and edge cases.
- Add test to skip inline images with missing Content-ID headers.
- Add parameterized tests for invalid Base64 data and content types.
- Refactor common logic into helper methods for setup and assertions.
- Replace single-case tests with parameterized tests for invalid Base64 data and content types.
- Add tests to validate persistence rejection for inline images with null data or content type.
…e metrics configuration

- Implement `MaxMessageSizeInputStream` to reject oversized messages during the `DATA` phase with `552 5.3.4 Message size exceeds fixed limit`.
- Add `MetricsProperties` to configure Micrometer metrics behavior, including optional address tags.
- Refactor data handling flow in `DataCommand` to support payload rejection and proper stream synchronization.
- Update management and metrics endpoints security and accessibility.
- Improve test coverage for max message size enforcement, metrics inclusion behavior, and actuator security.
… authentication state

- Introduce explicit `enabled` flag for Web UI authentication to ensure clear configuration.
- Enhance rate-limiting behavior: active only when authentication is enabled, inert otherwise.
- Enforce validation rules for authentication configuration to prevent invalid states.
- Update documentation to reflect new authentication semantics and rate-limiting behavior.
- Improve test coverage for authentication and rate-limiting edge cases.
- Introduce configurable TLS protocols with default fallback to TLSv1.3 and TLSv1.2.
- Add redaction of sensitive data in SMTP `AUTH` command debug logs.
- Update documentation with TLS and `AUTH` logging changes.
- Enhance test coverage for TLS protocol configuration and sensitive data redaction scenarios.
…flow

- Simplify actuator base path management by removing `WebEndpointProperties` dependency.
- Introduce a dedicated `SecurityFilterChain` for actuator endpoints with HTTP Basic authentication.
- Allow unauthenticated access to `/health` and `/info` while protecting other exposed endpoints.
- Add integration tests for actuator endpoints with root base path, both authenticated and unauthenticated.
- Refactor documentation to clarify access control for actuator endpoints.
- Introduce `.codex/config.toml` and `.codex/rules/dev.rules` to support asynchronous agent workflows with guarded Git operations.
- Add `webapp/AGENTS.md` detailing frontend-specific development guidelines and stack components.
- Update `AGENTS.md` and `README.md` with Codex agent setup instructions and repository-specific rules.
- Provide safe commands, policies, and coordination strategies for Codex-driven development.
- Introduce `docs/features/` with detailed documentation for backend, operations, and security features (`backend-features.md`, `operations-and-security-features.md`, `features-overview.md`).
- Add feature coverage matrix (`coverage-matrix.md`) to track implementation and documentation status.
- Refactor `AGENTS.md` to clarify AI-assisted development artifact flow and enforce task separation into `agent/plans/`, `agent/tasks/`, and `agent/process/`.
- Update `README.md` with links to feature documentation and AI artifact guidelines.
- Document AI-assisted development process in `agent/process/ai-development-flow.md`.
…n semantics, and observability details

- Add detailed notes for `EHLO` capability advertisements, `STARTTLS`/`AUTH` behavior, and strict parameter handling.
- Clarify email retention: deterministic ordering, transactional bulk deletes, and dependency cleanup.
- Introduce backend-side observability through `messages.delivered` and `messages.blocked` metrics with Micrometer instrumentation.
- Expand MIME processing details: support for `application/octet-stream` and unified size limits for attachments/inline images.
- Enhance `operations-and-security-features.md` with explicit authentication state handling and rate-limiting behavior.
- Revise coverage matrix post-audit for completed sections.
…ure references in README and coverage matrix.
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