Skip to content

feat: drop unsupported backend_parameters - #147

Merged
uniqueg merged 5 commits into
devfrom
feat/145-drop-backend-parameters
Nov 12, 2026
Merged

uniqueg merged 5 commits into
devfrom
feat/145-drop-backend-parameters

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Summary

TES 1.1 says three things about resources.backend_parameters: service info lists the keys a backend supports, backends log a warning for unsupported keys, and they don't store or return them. TESK supports no keys. This PR:

  • Removes the parameters on create: POST /tasks removes backend_parameters from the task before it is converted. They are no longer in the taskmaster job's json-input annotation, its ConfigMap or any response, also on retries after a job name collision. Strict tasks are still refused with 400 (feat: accept the task fields of TES 1.1 #133).
  • Warns about them: the ignored keys (not their values) go into a new annotation of the taskmaster's job, ignored-backend-parameters (a JSON array). A warning naming them is logged when the task is created. With the view FULL, it is also returned in logs[0].system_logs, after the taskmaster's log: Ignored backend_parameters, which TESK doesn't support: ["VmSize"]. Keys are quoted as JSON without HTML escaping, so the message stays on one line whatever the keys are.
  • Covers older tasks: tasks created by earlier versions stored the parameters. They are removed when such tasks are read, so they aren't returned either, but those tasks get no warning.
  • Adds the field to service info: TesServiceInfo has tesResources_backend_parameters. SnakeYAML now maps that key to the Java property; before, a file with the key failed to load. The built-in service-info.yaml sets it to []. Service info always reports [], whatever the file lists; a file that lists keys logs a warning on every load and reload.
  • Adds accessors: TesResources gets accessors for backend_parameters and backend_parameters_strict, and both now count in equals/hashCode/toString.
  • Docs: docs/api.md ("TES 1.1 fields", "Service info") and docs/configuration.md ("Service info").

Verification

Run locally on JDK 8 (eclipse-temurin:8-jdk container) with Maven 3.10.0, the wrapper's version:

  • mvn -B spotless:check checkstyle:check clean verify: BUILD SUCCESS. Unit tests: 11962 run, 0 failures. Integration tests: 84 run, 0 failures.
  • mkdocs build --strict (Python 3.13, docs/requirements.txt): built with no warnings.
  • New tests:
    • IgnoredBackendParametersTest
    • TesServiceImplSystemLogsTest (views FULL and BASIC)
    • TesServiceImplCreateTest: parameters removed before conversion, annotation, warning without values, retry
    • TesKubernetesConverterTest#fromK8sToTask_dropsStoredBackendParameters
    • ServiceInfoServiceTest#getServiceInfo_backendParameters: loads a file with the key, reports [], warns
    • ServiceInfoApiControllerTest#getServiceInfo_listsNoBackendParameters

CI on 1f363a0: all checks passed (CI passed, Lint, Test, Docs, Smoke test, Scan image, CodeQL, codecov project and patch, Sourcery). The 30 open Trivy alerts listed for this PR are image dependency findings that dev already has (Spring 5.3, Bouncy Castle 1.70 and others); this PR changes no dependencies.

Declined review findings

  • Upgrade and release notes (quality, medium): there is no section for the next version yet, and feat: accept the task fields of TES 1.1 #133 added none either. The release-prep PR should cover all TES 1.1 items together. Items for it:
    • backend_parameters are no longer stored or returned.
    • A warning appears in system_logs.
    • Service info has tesResources_backend_parameters; operators should keep it at [].
  • Warning for tasks of earlier versions, built from their stored keys (adversarial, low): the missing warning is intentional and documented. Old tasks no longer return the parameters, which is what TES asks for.
  • Cap or document the size of the ignored-backend-parameters annotation (quality, low): it holds only the keys, and json-input no longer holds them, so the job's annotations are never larger than before.
  • Warn only once when a service info file lists keys (adversarial, low): a warning repeated hourly on reload is acceptable for a misconfiguration.
  • Guard task.getLogs().get(0) (quality, low): the basic conversion always adds that log, and the line above uses it the same way.

Fixed after the reviews:

  • HTML escaping of keys removed
  • warning moved after the taskmaster log, not before it
  • warning when service info lists keys
  • docs split into sub-bullets and rewrapped
  • tests tidied, comments fixed

Sourcery threads (all answered and resolved):

  • Service info advertised keys from the file: fixed, it always reports [] (adf8671).
  • Annotation size: declined, the annotations are never larger than on dev, as the keys move out of json-input.
  • No warning when creating owned resources fails: declined, the job is deleted and no task exists; a failed deletion is already logged as an error.

Open questions

None.

Closes #145

🤖 Generated with Claude Code

https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV

uniqueg and others added 3 commits November 12, 2026 08:15
TES 1.1 says that backends neither store nor return unsupported
backend_parameters keys and log a warning about them. TESK supports
none: remove them from the task before it is stored (annotation and
ConfigMap), note their keys in the annotation
ignored-backend-parameters of the taskmaster's job, log a warning and
return it in logs[0].system_logs with the view FULL. Stored tasks of
earlier versions don't return them either.

Service info gets tesResources_backend_parameters, which the YAML file
can now set (SnakeYAML maps the key to the Java property); the
built-in file sets it to [].

Closes #145

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Keep HTML characters in the quoted keys, put the warning after the
taskmaster's log in system_logs, warn if a service info file lists
backend parameters, and restructure the docs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
@sourcery-ai

sourcery-ai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Data structures

Add TES resource accessors for backend parameters and strictness, and include both fields in value semantics.

  • src/main/java/uk/ac/ebi/tsc/tesk/tes/model/TesResources.java L149-188 (+3 small edits)

Implementation

Remove unsupported parameters, preserve their sorted keys in taskmaster-job metadata, and derive the warning used for logs.

  • src/main/java/uk/ac/ebi/tsc/tesk/k8s/constant/Constants.java L50-55
  • src/main/java/uk/ac/ebi/tsc/tesk/k8s/convert/IgnoredBackendParameters.java L1-72
  • src/main/java/uk/ac/ebi/tsc/tesk/k8s/convert/TesKubernetesConverter.java L476-478
  • src/main/java/uk/ac/ebi/tsc/tesk/tes/service/TesServiceImpl.java L99-105 (+4 small edits)

Map the TES service-info YAML property and normalize the reported supported-key list to empty, warning when configuration lists unsupported keys.

  • src/main/java/uk/ac/ebi/tsc/tesk/tes/service/ServiceInfoService.java L55-64, L78-86 (+2 small edits)

Documentation

Document how TESK drops unsupported backend parameters, reports ignored keys, and advertises its empty supported-key list.

  • docs/api.md L78-90, L213-222
  • docs/configuration.md L62-68

Tests

Test removal, key annotation and warning formatting for ignored backend parameters.

  • src/test/java/uk/ac/ebi/tsc/tesk/k8s/convert/IgnoredBackendParametersTest.java L1-105

Test that legacy tasks do not return previously stored backend parameters.

  • src/test/java/uk/ac/ebi/tsc/tesk/k8s/convert/TesKubernetesConverterTest.java L538-559

Test that the service-info API returns an empty supported backend-parameter list.

  • src/test/java/uk/ac/ebi/tsc/tesk/tes/api/ServiceInfoApiControllerTest.java L47-55

Test service-info YAML parsing, warnings, normalization, and model value semantics.

  • src/test/java/uk/ac/ebi/tsc/tesk/tes/service/ServiceInfoServiceTest.java L11-14, L48-77 (+3 small edits)
  • src/test/resources/service-info-backend-parameters.yaml L1-4

Test that creation strips parameters, records their keys, warns without values, and retains the annotation across retries.

  • src/test/java/uk/ac/ebi/tsc/tesk/tes/service/TesServiceImplCreateTest.java L25-36, L41, L341-392

Test FULL-view system-log ordering and ensure BASIC view omits the warning.

  • src/test/java/uk/ac/ebi/tsc/tesk/tes/service/TesServiceImplSystemLogsTest.java L1-108

Other changes

Files not grouped.

  • src/main/java/uk/ac/ebi/tsc/tesk/tes/model/TesServiceInfo.java L62-65, L323-344 (+3 small edits)
  • src/main/resources/service-info.yaml L18-19
  • src/test/java/uk/ac/ebi/tsc/tesk/tes/model/TesResourcesTest.java L4-11, L66-87

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 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.52%. Comparing base (59e0462) to head (1f363a0).

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #147      +/-   ##
==========================================
+ Coverage   70.49%   72.52%   +2.02%     
==========================================
  Files          67       68       +1     
  Lines        2827     2883      +56     
  Branches      312      318       +6     
==========================================
+ Hits         1993     2091      +98     
+ Misses        690      651      -39     
+ Partials      144      141       -3     

☔ 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 12, 2026 08:08
@sourcery-ai

sourcery-ai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Linked issues

Checked at commit 1f363a0

#145 feat: drop unsupported backend_parameters · 4 of 4 met

# Requirement Status Notes
1 Remove backend_parameters before storing tasks or returning them ✅ Met Creation removes the parameters before conversion; reads also remove parameters persisted by earlier versions.
2 Log a warning naming ignored keys and include it in logs[0].system_logs for view FULL ✅ Met The keys are recorded on the taskmaster job, used in the creation warning, and appended after the taskmaster log for FULL views.
3 Add tesResources_backend_parameters to service info, set the built-in value to [], and test loading a file with the key ✅ Met The YAML key is mapped to the Java property, service info normalizes it to an empty list, and a test loads a file listing keys.
4 Update docs/api.md sections TES 1.1 fields and Service info ✅ Met Both sections document the unsupported parameters and the service-info field.

@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 3 issues

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

## Individual Comments

### Comment 1
<location path="src/main/java/uk/ac/ebi/tsc/tesk/tes/service/TesServiceImpl.java" line_range="81-82" />
<code_context>
                 }

                 V1Job taskMasterJob = this.converter.fromTesTaskToK8sJob(task, user);
+                IgnoredBackendParameters.annotate(
+                        taskMasterJob.getMetadata(), ignoredBackendParameters);
                 V1ConfigMap taskMasterConfigMap =
                         this.converter.fromTesTaskToK8sConfigMap(task, user, taskMasterJob);
</code_context>
<issue_to_address>
**Large key lists reject task creation**

When a task is near Kubernetes' annotation-size limit and the added serialized key list pushes its Job annotations over that limit, the ignored-key annotation duplicates backend-parameter keys that were removed from `json-input`; when the resulting Job annotations exceed Kubernetes' annotation-size limit, `createJob` is rejected and the caller sees task creation fail. The ConfigMap dry run does not validate the Job annotations, and there is no size guard before `createJob`.

Account for the added annotation when validating the Job, or avoid duplicating keys in annotations when they would exceed Kubernetes' limit.
</issue_to_address>

### Comment 2
<location path="src/main/java/uk/ac/ebi/tsc/tesk/tes/service/ServiceInfoService.java" line_range="55-57" />
<code_context>
         Yaml yaml = new Yaml(new OffsetDateTimePropertyConstructor());
         try (InputStream is = resourceFile.getInputStream()) {
             serviceInfo = yaml.loadAs(is, TesServiceInfo.class);
+            List<String> backendParameters = serviceInfo.getTesResourcesBackendParameters();
+            if (backendParameters != null && !backendParameters.isEmpty()) {
+                log.warn(
+                        "Service info lists tesResources_backend_parameters, but TESK supports"
+                                + " none and ignores them in tasks; set it to []");
</code_context>
<issue_to_address>
**Unsupported keys appear supported**

When the service-info YAML lists one or more backend parameter keys, `loadYaml` retains the list after logging a warning, and `getServiceInfo` returns it unchanged, so `/service-info` advertises keys that task creation ignores and clients can rely on unsupported parameters.

Clear the backend-parameter list before returning the service info, or omit it from the response.

Also at `src/main/java/uk/ac/ebi/tsc/tesk/tes/model/TesServiceInfo.java:62-64`.
</issue_to_address>

### Comment 3
<location path="src/main/java/uk/ac/ebi/tsc/tesk/tes/service/TesServiceImpl.java" line_range="99-104" />
<code_context>
                 }
                 V1Job createdJob = this.kubernetesClientWrapper.createJob(taskMasterJob);
                 this.createOwnedResources(taskMasterConfigMap, imagePullSecrets, createdJob);
+                // only for tasks that exist: a failed create leaves no task to warn about
+                if (!ignoredBackendParameters.isEmpty()) {
+                    logger.warn(
+                            "Task {}: {}",
+                            createdJob.getMetadata().getName(),
+                            IgnoredBackendParameters.message(ignoredBackendParameters));
+                }
                 return this.converter.fromK8sJobToTesCreateTaskResponse(createdJob);
</code_context>
<issue_to_address>
**Failed tasks lack creation warnings**

When owned ConfigMap or Secret creation fails after the taskmaster job is created, `createOwnedResources` throws before `logger.warn` runs, so the creation warning is absent even when the taskmaster job is left behind.

Log the ignored-key warning on the failure path whenever the taskmaster job has already been created.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 3 findings to address first, and task creation removes the submitted backend-parameter map before it is persisted, so those values cannot be recovered from tasks created while this change is live. Reverting restores future behavior but does not restore values already omitted from existing tasks.

Blocking findings: src/main/java/uk/ac/ebi/tsc/tesk/tes/service/TesServiceImpl.java:82, src/main/java/uk/ac/ebi/tsc/tesk/tes/service/ServiceInfoService.java:57, src/main/java/uk/ac/ebi/tsc/tesk/tes/service/TesServiceImpl.java:104


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

uniqueg and others added 2 commits November 12, 2026 09:20
Service info reports tesResources_backend_parameters as [] whatever
the YAML file lists, as TESK supports none (Sourcery review).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Codecov's patch target is 100%: cover the accessors and equality of
the backend parameters in TesResources and TesServiceInfo.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
@uniqueg
uniqueg merged commit f2f3728 into dev Nov 12, 2026
34 checks passed
@uniqueg
uniqueg deleted the feat/145-drop-backend-parameters branch November 12, 2026 10:13
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.

feat: drop unsupported backend_parameters

1 participant