Skip to content

build: move to Spring Boot 4 - #185

Merged
uniqueg merged 9 commits into
devfrom
build/66-spring-boot-4
Nov 15, 2026
Merged

uniqueg merged 9 commits into
devfrom
build/66-spring-boot-4

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Summary

Moves TESK API from Spring Boot 2.7 (end of life) to Spring Boot 4.1 (Spring Framework 7, Spring Security 7, Jackson 3, Hibernate Validator 9, Tomcat 11), in one step instead of the planned detour through 3.5, for release 2.0.0. No behaviour changes apart from those of the framework, which docs/upgrading.md lists:

  • Framework: modular starters; javax -> jakarta; the lambda DSL of Spring Security 7 with authorizeHttpRequests (error dispatches stay permitted, as before) and @EnableMethodSecurity; the noauth profile without Spring Security's defaults, as with WebSecurityConfigurerAdapter(true) before.
  • JSON: Jackson 3 with spring.jackson.use-jackson2-defaults=true, so that the JSON of the API and of the tasks stored in Kubernetes stays as it was. Messages of 400 for unreadable JSON are worded by Jackson 3 (e.g. Unrecognized property instead of Unrecognized field).
  • API description: springdoc-openapi 3 instead of the unmaintained Springfox: OpenAPI 3.1 at /v3/api-docs; /v2/api-docs forwards there for one release (ApiDocsAliasController, tested in ApiDocsAliasIT, deprecation in the upgrade notes). The generated models and API stubs carry OpenAPI 3 annotations; the description keeps docker_login/docker_pass write-only and the field names of TES. The Swagger UI stays off by default (404 for all its paths); its configuration moves from /swagger-resources to /v3/api-docs/swagger-config; the OAuth2 settings of the Swagger UI keep working.
  • Limits kept: the TRS lookups during task creation keep their 10 s connect and read timeouts (Spring Boot 2.7 used OkHttp with these defaults; Spring Boot 4 would use the JDK client without timeouts); more than 50 accepted media types on a 401 are taken as */* (Spring 7 refuses to sort them).
  • Paths: PathPatternParser instead of AntPathMatcher; a trailing slash is still ignored (UrlHandlerFilter, ordered after Spring Security, so that security sees the original path; tests for both profiles).
  • Build: version overrides of the Spring Boot 2.7 era dropped (SnakeYAML, Gson, Commons Lang and Codec stay pinned to the Kubernetes client's versions); WireMock 3; Mockito's agent loaded at startup for the tests; OpenAPI Generator 7.27.0 with useSpringBoot3/useJakartaEe for the generate-swagger profile (stubs not regenerated; checked that the profile runs and that its output compiles apart from the documented manual parts).
  • Scan: .trivyignore.yaml is empty (file kept with header and example); Dependabot no longer holds back Spring Security, WireMock and the generator (Spring Boot majors stay ignored).
  • Docs: upgrade notes, release notes of 2.0.0, API, configuration and development docs.

Part of #66 (left open for #163, google-java-format update, and #167, JUnit 5).

Closes #166
Closes #168
Closes #169
Closes #170

Verification

  • ./mvnw clean verify (Java 21): BUILD SUCCESS, 18561 unit tests and 121 integration tests pass, "All coverage checks have been met" (100% lines and branches).
  • ./mvnw spotless:check checkstyle:check on Java 8, as the CI job Lint: passes. actionlint and shellcheck on the workflows: pass.
  • mkdocs build --strict: passes.
  • Docker image built from the Dockerfile; the Check responses step of the CI job smoke, extracted from ci.yml and run verbatim against it: passes (both profiles: service info, /v3/api-docs and /v2/api-docs with openapi: 3.x, Swagger UI paths 404 when off and 200 when on, 401 with auth, invalid TESK_API_SWAGGER_UI_ENABLED refused).
  • Trivy on the image with .trivyignore.yaml (critical and high, fixed only, as in CI): no findings. 25 medium findings remain, all in glibc of the Ubuntu base image.
  • CI on 6fd5e9b: all jobs pass (a transient download failure of the image build was re-run) (Lint, Test, Docs, Smoke test, Scan image, CI passed, Codecov patch and project). CodeQL: two CSRF alerts dismissed (see Decisions).

Declined review findings

Fixed from the local reviews: TRS lookups had lost their 10 s timeouts (now explicit), more than 50 accepted media types gave 500 instead of 401, /v3/api-docs.yaml needed a token, plus cleanups (shared path constants, no inheritance between the Swagger UI conditions, comment placement). Declined:

  • Rename .swagger-codegen-ignore to .openapi-generator-ignore: the plugin reads the file by its configured name; a rename is unrelated to the framework move.
  • Drop or extend the clientId test of SwaggerConfigAuthTest: the client ID's way into the Swagger UI is already checked by SwaggerOAuthClientSecretTest (swagger-initializer.js); the test covers the properties class.
  • Test the alias /v2/api-docs with noauth in an IT: the smoke test in CI checks it in both profiles; the IT covers the case that matters (auth, no token).
  • An issue for removing the alias: drafted for the maintainer rather than opened from this PR.
  • Upgrade notes for the TRS timeouts, the Accept fallback and /swagger-ui.html: none of them changes behaviour against 1.2.0 (the TRS lookups had the same 10 s timeouts through OkHttp; any number of media types was handled; /swagger-ui.html was never public), so there is nothing to upgrade for.
  • A TRS timeout test against a server that never answers: it would take 10 s per run; the unit test checks that the builder gets both timeouts, and the round-2 review confirmed that Boot 4 applies them to the JDK client it picks.
  • Sourcery: server.use-forward-headers (no-op since Spring Boot 2.2; Kubernetes gets the native strategy by default, unchanged), null in the schema of type (not allowed before either, nor in the TES spec), and the skipped Spring Boot 3.5 stage of build: move to Spring Boot 3.5 #168 (an unreleased stepping stone; its content is here on 4.1). Fixed from Sourcery: stored object/array tag values failed listings on Jackson 3, the user store is now checked in both application contexts, and a test pins the quality ordering of media types.
  • Moving the shared check of the Swagger UI setting into a utility class: optional; SwaggerUiDisabledCondition.isEnabled is package-private and used by both conditions.

Decisions

  • CodeQL java/spring-disabled-csrf-protection (alerts 506, 507): dismissed as "won't fix" by the maintainer. CSRF was already off on dev; the API is stateless and takes bearer tokens only from the header, without cookies.

Open questions

None.

🤖 Generated with Claude Code

uniqueg and others added 7 commits November 15, 2026 19:26
Spring Boot 4.1 (Spring Framework 7, Spring Security 7, Jackson 3,
Hibernate Validator 9, Tomcat 11) instead of 2.7, without behaviour
changes beyond those of the framework:

- Modular starters (webmvc, aspectj, validation, restclient) and their
  test starters; javax -> jakarta; Security 7 lambda DSL with
  authorizeHttpRequests, which keeps error dispatches unauthorised as
  before; @EnableMethodSecurity; noauth without Spring Security's
  defaults, as with WebSecurityConfigurerAdapter(true).
- Jackson 3 with spring.jackson.use-jackson2-defaults, so that the JSON
  of the API and of the stored tasks stays as it was.
- springdoc 3 instead of Springfox: the API description is OpenAPI 3 at
  /v3/api-docs, and still at /v2/api-docs (an alias, to be dropped
  later); the generated models and stubs have OpenAPI 3 annotations.
- PathPatternParser instead of AntPathMatcher; a trailing slash is
  ignored after Spring Security (UrlHandlerFilter), as with Spring 5.
- Version overrides of the Spring Boot 2.7 era dropped; WireMock 3;
  Mockito's agent loaded at startup for the tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The smoke test waits for /v3/api-docs, and checks the alias
/v2/api-docs (OpenAPI 3) in both profiles, and the Swagger UI
configuration of springdoc (/v3/api-docs/swagger-config) instead of
the paths of Springfox.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Spring Boot 4 brings fixed versions for all findings that were
accepted in .trivyignore.yaml; the file stays, with its header and an
example entry. Dependabot no longer holds back Spring Security,
WireMock and the OpenAPI generator; major versions of Spring Boot stay
ignored.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The profile generate-swagger uses OpenAPI Generator 7.27.0 with
useSpringBoot3 and useJakartaEe, so that it generates Jakarta and
OpenAPI 3 annotations, as the committed stubs have now. The stubs
themselves aren't regenerated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Upgrade notes for Spring Boot 4 (own properties of Spring Boot, log
timestamps, error messages), the API description at /v3/api-docs with
the deprecated alias /v2/api-docs, and the configuration of the
Swagger UI at /v3/api-docs/swagger-config; the API, configuration and
development docs and the notes of 2.0.0 follow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- TRS lookups during task creation time out after 10 s again (connect
  and read), as with OkHttp, which Spring Boot 2.7 used; Spring Boot 4
  uses the JDK client without timeouts.
- More than 50 accepted media types, which Spring 7 refuses to sort,
  are taken as */*, so that the answer stays 401 instead of 500.
- The YAML API description (/v3/api-docs.yaml) is public like the
  JSON one; documented.
- Paths of the API description from the constants of
  ApiDocsAliasController; /swagger-ui.html no longer public (Springfox
  didn't serve it); the Swagger UI conditions share one check instead
  of one extending the other; smaller cleanups.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The fallback for many accepted media types is checked to answer
JSON; the timeout test no longer repeats the constant. Comments
re-flowed, and the note on 404s for unknown paths is gone from
application.properties, as no property is left that it describes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg uniqueg self-assigned this Nov 15, 2026
@sourcery-ai

sourcery-ai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

API

Review the OpenAPI 3 description and compatibility alias alongside the generated TES API and model annotations, which define the public contract and preserve TES field names and write-only fields.

  • src/main/java/uk/ac/ebi/tsc/tesk/config/swagger/ApiDocsAliasController.java L1-26
  • src/main/java/uk/ac/ebi/tsc/tesk/config/swagger/ApiDocsConfiguration.java L1-43
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/api/ServiceInfoApi.java L9-14 (+3 small edits)
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/api/TasksApi.java L12-17 (+10 small edits)
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/model/Service.java L6-11 (+12 small edits)
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/model/ServiceOrganization.java L6-52 (4 small edits)
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/model/ServiceType.java L5-75 (5 small edits)
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/model/TesCreateTaskResponse.java L5-7, L12-13, L27
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/model/TesExecutor.java L6-286 (14 small edits)
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/model/TesExecutorLog.java L5-119 (7 small edits)
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/model/TesInput.java L7-10 (+8 small edits)
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/model/TesListTasksResponse.java L5-9 (+3 small edits)
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/model/TesOutput.java L7-10 (+7 small edits)
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/model/TesOutputFileLog.java L5-75 (5 small edits)
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/model/TesResources.java L8-15 (+8 small edits)
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/model/TesServiceInfo.java L6-333 (16 small edits)
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/model/TesServiceInfoAllOf.java L5-8 (+3 small edits)
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/model/TesServiceType.java L7-109 (5 small edits)
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/model/TesServiceTypeAllOf.java L7-9, L14, L61
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/model/TesTask.java L5-349 (15 small edits)
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/model/TesTaskLog.java L6-257 (10 small edits)

Review the generator configuration that produces the Jakarta and OpenAPI 3 API stubs, together with the existing generated stubs adapted to that public contract.

  • pom.xml L187, L210-211
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/api/ServiceInfoApiController.java L10
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/api/TasksApiController.java L76-83, L96-117, L122-137 (+5 small edits)

Implementation

Review the Jackson 3 conversion changes for stored Kubernetes task JSON, including compatibility behavior for tag values and output-log parsing.

  • src/main/java/uk/ac/ebi/tsc/tesk/k8s/convert/TesKubernetesConverter.java L399-413, L450-455, L473-476 (+8 small edits)
  • src/main/java/uk/ac/ebi/tsc/tesk/trs/model/ImageData.java L5-6, L13

Review the error-response adaptations and the trailing-slash filter, especially how request paths and error dispatches interact with security.

  • src/main/java/uk/ac/ebi/tsc/tesk/config/CustomErrorHandler.java L10-15, L140-144, L155-163 (+4 small edits)
  • src/main/java/uk/ac/ebi/tsc/tesk/config/TrailingSlashConfiguration.java L1-26
  • src/main/java/uk/ac/ebi/tsc/tesk/config/security/CustomAuthenticationEntryPoint.java L3-7, L133-138 (+5 small edits)
  • src/main/java/uk/ac/ebi/tsc/tesk/config/security/ResourceServerConfiguration.java L36-48, L93-120, L146-157 (+6 small edits)
  • src/main/java/uk/ac/ebi/tsc/tesk/config/security/UserInfoTokenIntrospector.java L149

Review the TRS client timeout preservation and the Swagger OAuth flow construction, which keep existing task-creation lookup limits and UI authentication behavior.

  • src/main/java/uk/ac/ebi/tsc/tesk/config/swagger/SwaggerConfigAuth.java L3-9, L26-63 (+3 small edits)
  • src/main/java/uk/ac/ebi/tsc/tesk/trs/TrsToolClient.java L24-30 (+3 small edits)
  • src/main/resources/application.properties L66-69

UI

Review how the Swagger UI is conditionally exposed and redirected, retaining its disabled-by-default behavior while switching to springdoc paths and initializer settings.

  • src/main/java/uk/ac/ebi/tsc/tesk/config/swagger/SwaggerUiDisabledCondition.java L5, L11, L20-34
  • src/main/java/uk/ac/ebi/tsc/tesk/config/swagger/SwaggerUiEnabledCondition.java L1-18
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/api/HomeController.java L3-16
  • src/main/java/uk/ac/ebi/tsc/tesk/config/swagger/SwaggerConfigNoAuth.java (deleted)
  • src/main/java/uk/ac/ebi/tsc/tesk/config/swagger/SwaggerUiDisabledConfiguration.java (deleted)

Configuration

Review the Spring Boot 4 dependency and starter migration, dependency overrides, test agents, and OpenAPI Generator setup as one build configuration change.

  • pom.xml L44-57, L106-144, L171-183 (+12 small edits)

Review the security-profile configuration changes, including the no-auth filter chain and resource-server authorization rules.

  • src/main/java/uk/ac/ebi/tsc/tesk/config/security/NoAuthConfiguration.java L6-9, L18-36

Review the application Jackson, springdoc, and Swagger UI properties that select compatibility defaults and public API-description paths.

  • src/main/resources/application.properties L1-3, L10 (removed lines), L59-64

Review CI smoke checks, vulnerability-ignore cleanup, and dependency-update policy for the new framework baseline.

  • .github/dependabot.yml L6-7, L16 (removed lines)
  • .github/workflows/ci.yml L226-233 (+4 small edits)
  • .trivyignore.yaml L8-16

Documentation

Review the user-facing API and upgrade documentation for the OpenAPI path migration, alias deprecation, Swagger UI configuration endpoint, and Spring Boot property changes.

  • docs/api.md L16-20, L314
  • docs/configuration.md L6, L36
  • docs/development.md L3-25, L62-68, L279-289 (+1 small edits)
  • docs/releases/2.0.0.md L1-45 (4 small edits)
  • docs/upgrading.md L17-48

Tests

Review tests covering the API-description alias, OpenAPI schema contract, Swagger UI exposure and OAuth configuration, and the behavior of both security profiles.

  • src/integration-test/java/uk/ac/ebi/tsc/tesk/ApiDocsAliasIT.java L1-76
  • src/integration-test/java/uk/ac/ebi/tsc/tesk/AuthErrorResponsesIT.java L22 (removed lines), L24
  • src/integration-test/java/uk/ac/ebi/tsc/tesk/AuthIT.java L24-29, L717-725, L859-868 (+3 small edits)
  • src/integration-test/java/uk/ac/ebi/tsc/tesk/ClaimAuthIT.java L20 (removed lines), L22
  • src/integration-test/java/uk/ac/ebi/tsc/tesk/LegacyUserLabelsIT.java L18 (removed lines), L20
  • src/integration-test/java/uk/ac/ebi/tsc/tesk/NoAuthIT.java L35-45, L241-266, L445-460 (+8 small edits)
  • src/integration-test/java/uk/ac/ebi/tsc/tesk/ServiceClientAuthIT.java L31 (removed lines), L33
  • src/integration-test/java/uk/ac/ebi/tsc/tesk/ServiceInfoNoAuthIT.java L11
  • src/integration-test/java/uk/ac/ebi/tsc/tesk/ServiceInfoTokenRequiredIT.java L18 (removed lines), L20
  • src/integration-test/java/uk/ac/ebi/tsc/tesk/SingleTaskJobsIT.java L30 (removed lines), L32
  • src/integration-test/java/uk/ac/ebi/tsc/tesk/SwaggerUiAuthIT.java L14 (removed lines), L16, L61-66
  • src/integration-test/java/uk/ac/ebi/tsc/tesk/SwaggerUiDisabledIT.java L13
  • src/integration-test/java/uk/ac/ebi/tsc/tesk/SwaggerUiEnabledAuthIT.java L12 (removed lines), L14
  • src/integration-test/java/uk/ac/ebi/tsc/tesk/SwaggerUiEnabledIT.java L14
  • src/integration-test/java/uk/ac/ebi/tsc/tesk/trs/TrsToolClientIT.java L11-25 (4 small edits)
  • src/test/java/uk/ac/ebi/tsc/tesk/UrlConstants.java L3-4, L14-20, L25-26
  • src/test/java/uk/ac/ebi/tsc/tesk/config/CustomErrorHandlerTest.java L6, L9 (removed lines), L11
  • src/test/java/uk/ac/ebi/tsc/tesk/config/security/CustomAuthenticationEntryPointTest.java L125-135, L166-179 (+4 small edits)
  • src/test/java/uk/ac/ebi/tsc/tesk/config/security/UserDetailsServiceTest.java L1-26
  • src/test/java/uk/ac/ebi/tsc/tesk/config/swagger/ApiDocsConfigurationTest.java L1-54
  • src/test/java/uk/ac/ebi/tsc/tesk/config/swagger/ApiDocsFileTypeTest.java L15, L35-36
  • src/test/java/uk/ac/ebi/tsc/tesk/config/swagger/SwaggerConfigAuthTest.java L6-9, L22-51, L58-75 (+2 small edits)
  • src/test/java/uk/ac/ebi/tsc/tesk/config/swagger/SwaggerOAuthClientSecretTest.java L54-64 (+4 small edits)
  • src/test/java/uk/ac/ebi/tsc/tesk/config/swagger/SwaggerUiEnabledConditionTest.java L1-44
  • src/test/java/uk/ac/ebi/tsc/tesk/k8s/convert/TesKubernetesConverterMinimalTest.java L53-58, L741-759 (+4 small edits)
  • src/test/java/uk/ac/ebi/tsc/tesk/k8s/convert/TesKubernetesConverterTest.java L44-47, L999-1016 (+4 small edits)
  • src/test/java/uk/ac/ebi/tsc/tesk/k8s/service/KubernetesClientWrapperTest.java L30 (removed lines), L32, L48-50
  • src/test/java/uk/ac/ebi/tsc/tesk/tes/api/TasksApiControllerTest.java L43-47, L82-101 (+3 small edits)
  • src/test/java/uk/ac/ebi/tsc/tesk/tes/model/Tes11FieldsTest.java L10 (removed lines), L12
  • src/test/java/uk/ac/ebi/tsc/tesk/tes/model/TesFileTypeDefaultTest.java L7
  • src/test/java/uk/ac/ebi/tsc/tesk/tes/service/TesServiceImplCancelTest.java L18 (removed lines), L33
  • src/test/java/uk/ac/ebi/tsc/tesk/tes/service/TesServiceImplListTest.java L17 (removed lines), L29
  • src/test/java/uk/ac/ebi/tsc/tesk/trs/TrsToolClientTest.java L12
  • src/test/java/uk/ac/ebi/tsc/tesk/trs/TrsToolClientTimeoutTest.java L1-30

Other changes

Files not grouped.

  • src/integration-test/java/uk/ac/ebi/tsc/tesk/MockUtil.java L18, L36
  • src/main/java/uk/ac/ebi/tsc/tesk/config/swagger/OAuth2ClientProperties.java L3, L8 (removed lines)
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/api/ApiUtil.java L5
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/service/ServiceInfoService.java L3, L9 (removed lines)

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

@codecov

codecov Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (9007fe8) to head (6fd5e9b).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #185   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           51        53    +2     
  Lines         2262      2260    -2     
  Branches       254       255    +1     
=========================================
- Hits          2262      2260    -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@uniqueg
uniqueg marked this pull request as ready for review November 15, 2026 21:21
@uniqueg uniqueg mentioned this pull request Nov 15, 2026
3 tasks

@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 found 5 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="pom.xml" line_range="17" />
<code_context>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-parent</artifactId>
-        <version>2.7.18</version>
+        <version>4.1.2</version>
         <relativePath/> <!-- lookup parent from repository -->
     </parent>
</code_context>
<issue_to_address>
**Proxy details are ignored**

When the service runs behind a reverse proxy that supplies forwarded headers, spring Boot 4 no longer applies the `server.use-forward-headers` setting in `application.properties`, so the application ignores forwarded host, scheme, and client-address information; generated absolute URLs can use the internal service address.

Replace the legacy setting with `server.forward-headers-strategy` configured to process forwarded headers.
</issue_to_address>

### Comment 2
<location path="src/main/java/uk/ac/ebi/tsc/tesk/config/security/CustomAuthenticationEntryPoint.java" line_range="133-134" />
<code_context>
         // q=0: not acceptable
         accepted.removeIf(mediaType -> mediaType.getQualityValue() == 0);
-        MediaType.sortBySpecificityAndQuality(accepted);
+        try {
+            MimeTypeUtils.sortBySpecificity(accepted);
+        } catch (InvalidMimeTypeException e) {
+            // more than 50 media types, which Spring refuses to sort: answer as without Accept
</code_context>
<issue_to_address>
**Error responses use lower-ranked formats**

When an `Accept` header lists equally specific writable media types with different `q` values and puts the lower-quality type first, `MimeTypeUtils.sortBySpecificity` does not sort equally specific types by quality, so `CustomAuthenticationEntryPoint.write` can select the lower-quality type; callers receive the error response in a less-preferred format.

Sort accepted media types by both specificity and quality before selecting a converter.
</issue_to_address>

### Comment 3
<location path="src/main/java/uk/ac/ebi/tsc/tesk/k8s/convert/TesKubernetesConverter.java" line_range="406" />
<code_context>
-                                        tag.getValue().isNull() ? null : tag.getValue().asText()));
+                                        tag.getValue().isNull()
+                                                ? null
+                                                : tag.getValue().asString()));
         return result;
     }
</code_context>
<issue_to_address>
**Malformed tags break filtered listings**

When a taskmaster job's stored `json-input` annotation contains a non-null, non-string scalar in `tags`, `extractTags` calls `asString()` without checking the stored tag value's type, so a non-string scalar in a task's `json-input` annotation throws while `TesServiceImpl.listTasks` evaluates a tag filter; the whole listing fails instead of returning matching tasks.

Check each non-null tag value is a string before converting it, and handle other types without aborting the listing.
</issue_to_address>

### Comment 4
<location path="src/main/java/uk/ac/ebi/tsc/tesk/tes/model/TesInput.java" line_range="151" />
<code_context>
-  @ApiModelProperty(
-      value = "FILE if left out or null; directories need DIRECTORY",
-      allowableValues = "DIRECTORY,FILE")
+  @Schema(description = "FILE if left out or null; directories need DIRECTORY", requiredMode = Schema.RequiredMode.NOT_REQUIRED, allowableValues = {"DIRECTORY", "FILE"})
   @NotNull

</code_context>
<issue_to_address>
**OpenAPI rejects valid null types**

When a client uses the OpenAPI 3 schema to validate or generate a request containing `inputs[].type: null` or `outputs[].type: null`, the generated OpenAPI schemas list only `FILE` and `DIRECTORY` and omit `type` from `required`, but do not allow `null`; generated clients that validate against the schema reject requests the API accepts.

Represent null as an allowed schema value for both type fields while keeping them optional.

Also at `src/main/java/uk/ac/ebi/tsc/tesk/tes/model/TesOutput.java:252`.
</issue_to_address>

### Comment 5
<location path="src/test/java/uk/ac/ebi/tsc/tesk/config/security/UserDetailsServiceTest.java" line_range="15-16" />
<code_context>
+
+    @Test
+    public void noAuth_hasNoUsers() {
+        assertThat(new NoAuthConfiguration().userDetailsService().loadUserByUsername("user"))
+                .isNull();
+    }
+
</code_context>
<issue_to_address>
**Default user store can remain**

When either configuration's `@Bean` registration is removed, `noAuth_hasNoUsers` and `auth_hasNoUsers` construct configuration objects directly (lines 15 and 21–24), so both still pass if `@Bean` is removed and Spring Boot's generated in-memory user store is no longer replaced.

Load each profile's configuration in a Spring test context and assert that the registered `UserDetailsService` replaces Boot's generated in-memory service.

Also at `src/test/java/uk/ac/ebi/tsc/tesk/config/security/UserDetailsServiceTest.java:23-24`.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 5 findings to address first, the security scan did not finish, and a regression in the migrated security matchers or filter-chain setup could let unauthenticated requests reach task endpoints or expose task data; reverting restores the prior checks, but access that occurred while the change was live cannot be undone.

Blocking findings: pom.xml:17, src/main/java/uk/ac/ebi/tsc/tesk/config/security/CustomAuthenticationEntryPoint.java:134, src/main/java/uk/ac/ebi/tsc/tesk/k8s/convert/TesKubernetesConverter.java:406, src/main/java/uk/ac/ebi/tsc/tesk/tes/model/TesInput.java:151, src/test/java/uk/ac/ebi/tsc/tesk/config/security/UserDetailsServiceTest.java:16


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread pom.xml Resolved
Jackson 3's asString() refuses objects and arrays, which Jackson 2's
asText() read as "": a tag value of that kind in a stored task (only
possible if changed by hand) failed the listing of tasks. Read them as
"" again.

Tests from the automated review: the user store without users in the
application contexts of both profiles, and the higher quality among
equally specific types on a 401.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Nov 15, 2026

Copy link
Copy Markdown

Linked issues

Checked at commit 6fd5e9b

#166 build: replace Springfox with springdoc · 3 of 3 met

# Requirement Status Notes
1 Replace Springfox with springdoc and keep the Swagger UI toggle and OAuth settings. ✅ Met The build uses springdoc, the auth configuration defines the OAuth flow, and the UI remains controlled by TESK_API_SWAGGER_UI_ENABLED.
2 Serve a public OpenAPI description at /v3/api-docs for the TES endpoints, with the Swagger UI working when enabled and off by default. ✅ Met The new endpoint, UI configuration, public access rules, and disabled/enabled behavior are covered by the changes and tests.
3 Update the API, configuration, smoke-test, and upgrade documentation for the moved API description. ✅ Met The docs and CI smoke checks use the springdoc paths; the upgrade notes identify the move.

#168 build: move to Spring Boot 3.5 · 2 of 3 met

# Requirement Status Notes
1 Build and pass the tests on Spring Boot 3.5.x as an intermediate migration step. 🟡 Partly met The Jakarta migration and related framework changes are present, but the project uses and verifies Spring Boot 4.1.2 instead of 3.5.x; the PR says it moves to Boot 4 “in one step instead of the planned detour through 3.5.”
2 Use WireMock 3 and OpenAPI Generator 7, remove the Boot 2.7-era overrides and Dependabot holds, and update the migration-related configuration. ✅ Met WireMock 3 and OpenAPI Generator 7 are configured, and the obsolete overrides and holds are removed.
3 Check and document API-visible Spring 6 changes, including trailing-slash behavior. ✅ Met Trailing slashes are explicitly handled to retain the prior behavior and are covered by tests.

#169 build: move to Spring Boot 4 · 4 of 4 met

# Requirement Status Notes
1 Move to Spring Boot 4.1 with its modular starters, Jackson 3, Hibernate Validator 9, and springdoc 3.x. ✅ Met The parent is Spring Boot 4.1.2, and the build and application configuration use the corresponding starters, Jackson 3 defaults, and springdoc.
2 Remove the Spring Boot, Framework, and Security vulnerability entries from the Trivy ignore file. ✅ Met The file now has an empty vulnerabilities list.
3 Update the development and upgrade documentation for Spring Boot 4. ✅ Met Both documentation areas describe the migration and its relevant compatibility changes.
4 Build and pass tests on Spring Boot 4.1, pass the image scan without Spring entries, and pass the smoke test. ✅ Met The PR’s verification section reports successful build/tests, image scan, and smoke test.

#170 build: clear the Trivy ignore list · 2 of 2 met

# Requirement Status Notes
1 Remove the Trivy ignore entries and obsolete dependency-management pins, and remove Dependabot rules that point to #66. ✅ Met The Trivy list is empty, the dependencyManagement block is removed, and the Dependabot holds are gone.
2 Run the scan and fix or justify any remaining findings. ✅ Met The PR reports that the configured image scan passes without findings requiring ignore entries.

@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.

New gaps against the linked issues

Comment thread pom.xml Resolved
@uniqueg
uniqueg merged commit f8eed81 into dev Nov 15, 2026
41 of 43 checks passed
@uniqueg
uniqueg deleted the build/66-spring-boot-4 branch November 15, 2026 21: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.

build: clear the Trivy ignore list build: move to Spring Boot 4 build: move to Spring Boot 3.5 build: replace Springfox with springdoc

2 participants