Skip to content

build: move to FOCA 0.23.0 - #523

Merged
uniqueg merged 4 commits into
devfrom
build/foca-0.23.0
Nov 26, 2026
Merged

uniqueg merged 4 commits into
devfrom
build/foca-0.23.0

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Summary

Moves proTES to FOCA 0.23.0, on the base image elixircloud/foca:0.23.0-py3.13@sha256:a3b53a07399a1e6c8d9ea192f6b6cd6b16db18d10cf10d29aa4cd4d2faec5057 (fixes the libzstd1 finding CVE-2026-124851 of the 0.22.0 image that turns Scan image red), with the release train foca-plugins 0.4.0 (D-435: no temporary apt fix).

  • Subjects are now namespaced by issuer, also with a single issuer. Single-issuer deployments keep bare subjects with the issuer's namespace: "" (D-455, per D-286). 0.7.0 has no data migration. A test pins that this keeps owners bare.
  • run.route() gets the TES instances that can't run a task as known, so FOCA 0.23 doesn't refuse a pin to one of them as unknown; such a pin gets proTES's 400 naming the fields again. An allow of unknown identifiers now gets 400 invalid-backends.
  • The chart takes plugins.available.<id>.store.maxNamespaceSize.
  • proTES's own checks of API paths and audiences are dropped, because FOCA's ServiceEntry now makes them. The existing tests still cover them.
  • Docs: upgrade notes for 0.7.0 ("FOCA 0.23", including the distance plugin 0.2.0: store cache, per-caller DB-IP lookup budget, key secret), task owners, issuers, client choices, the plugin store and the request size limit.

Closes #522

Verification

  • pytest with coverage on the final lock (FOCA 0.23.0, foca-plugins 0.4.0): 2222 passed, 11 skipped, 100% coverage.
  • mkdocs build --strict: OK. pre-commit (ruff, mypy, semgrep, actionlint, gitleaks): OK.
  • CI: all checks passed (run 45733654532), including Scan image (the libzstd1 finding is gone), the smoke test, integration tests and the release dry run's Scan release image; no open code scanning alerts. Integration (TESK), Push image, Publish image and Release image skip on pull requests, as intended.

Declined review findings

  • Limits and accounting assertions in test_owner_stored_bare (quality reviewer): both key on the stored user_id, which the test pins.
  • Move NEEDS_11 to the package conftest (quality reviewer): a cleanup; the module already imports helpers from test_plugins the same way.
  • Merge the plugin-store bullet into the earlier store notes (quality reviewer): the store exists since an earlier release, so the 0.23 limit is an upgrade note of its own.
  • Always call run.route() when backends exist, so unknown identifiers get invalid-backends even if no instance can run the task (adversarial, low): this behaviour is older than this PR. The docs now say what happens.
  • No test for a pin to an instance whose TES version is unconfirmed (503; adversarial, low): this path is unchanged and was checked by reading the code. The docs now name it.

Open questions

None.

🤖 Generated with Claude Code

https://claude.ai/code/session_011FSoqN5w1v5t1QRTKU7ad5

Summary by Sourcery

Upgrade proTES to FOCA 0.23.0 and its plugin release train while aligning owner identity, backend selection, plugin storage, deployment configuration, and upgrade documentation with the new platform behavior.

New Features:

  • Namespace task owners by issuer while preserving bare subjects when an issuer explicitly uses an empty namespace.
  • Add configurable per-namespace plugin store size limits to the deployment chart.
  • Improve backend choice handling by distinguishing unknown identifiers from known but ineligible TES instances.

Bug Fixes:

  • Resolve the image security finding associated with the previous FOCA base image.
  • Prevent FOCA from rejecting pins to known TES instances that cannot run a task as unknown backend choices.

Enhancements:

  • Adopt FOCA 0.23.0 and foca-plugins 0.4.0, including updated validation behavior for API paths, audiences, and request authentication.
  • Update distance routing behavior to use shared plugin-store caching and per-caller lookup limits.
  • Add upgrade guidance for issuer namespacing, plugin store limits, backend choices, request limits, and related FOCA 0.23 changes.

Build:

  • Update the application and smoke-test dependencies and container base image to FOCA 0.23.0 with foca-plugins 0.4.0.

Deployment:

  • Expose the new plugin namespace size setting through the Helm chart and schema.

Documentation:

  • Document FOCA 0.23 behavior, issuer-namespaced owners, plugin store limits, backend selection outcomes, and routing plugin changes.

Tests:

  • Update coverage for issuer-namespaced owners, bare-subject compatibility, and backend selection error handling.

uniqueg and others added 4 commits November 26, 2026 00:48
Base image elixircloud/foca:0.23.0-py3.13 (fixes the libzstd1 finding
CVE-2026-124851 of the 0.22.0 image). Adapt to FOCA 0.23:

- subjects are namespaced by issuer also with one issuer; tests use the
  stored form, and a test pins that `namespace: ""` keeps owners bare,
  the upgrade path of single-issuer deployments (D-455)
- an `allow` of unknown identifiers gets 400 (invalid-backends)
- the chart takes plugins.available.<id>.store.maxNamespaceSize
- drop the checks of API paths and audiences that FOCA's ServiceEntry
  now makes

Docs: upgrade notes for 0.7.0, owners, issuers, client choices, store.

Closes #522

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011FSoqN5w1v5t1QRTKU7ad5
Pass the TES instances that cannot run a task as known to run.route(),
so that FOCA 0.23 does not refuse a pin to one of them as unknown
(invalid-backends); proTES answers with the fields that no chosen
instance supports again. Review fixes of the docs: body limit vs token
check, store namespaces per distribution, admin scripts; test and
formatting fixes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011FSoqN5w1v5t1QRTKU7ad5
foca>=0.23.0,<0.24 and the release train foca-plugins 0.4.0 (random
and distance plugins 0.2.0), locked. Upgrade notes for the distance
plugin 0.2.0 (store cache, per-caller lookup budget, key secret).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011FSoqN5w1v5t1QRTKU7ad5
@uniqueg uniqueg added this to the v0.7.0 milestone Nov 26, 2026
@uniqueg uniqueg self-assigned this Nov 26, 2026
@sourcery-ai

sourcery-ai Bot commented Nov 26, 2026

Copy link
Copy Markdown

Reviewer's Guide

Uses of the API

Pass known but ineligible TES instances to FOCA routing so pins to them reach proTES's existing unsupported-version error path instead of being rejected as unknown.

  • pro_tes/ga4gh/tes/task_runs.py L486-491

Implementation

Rely on FOCA 0.23's ServiceEntry validation for API paths and audience constraints while retaining proTES-specific checks.

  • pro_tes/config_models.py L399-403, L518-524 (+4 small edits)

Configuration

Upgrade the base image and Python dependencies to FOCA 0.23 and the foca-plugins 0.4.0 release train.

  • Dockerfile L15
  • pyproject.toml L116, L122
  • uv.lock L2-1899 (10 small edits)

Expose FOCA's namespace-size store setting in the Helm chart's key conversion and schema, and document it in the values file.

  • deployment/templates/_helpers.tpl L91
  • deployment/values.schema.json L823-827
  • deployment/values.yaml L167-171

Documentation

Update deployment guidance and API examples to identify FOCA 0.23 and its reported plugin version.

  • deployment/README.md L253
  • docs/api.md L144, L152

Explain issuer-based subject namespacing and the resulting task-owner representation.

  • docs/access-control.md L187-191
  • docs/operations.md L92-94, L118

Document the changed store limits, request-body authentication order, plugin behavior, and FOCA 0.23 upgrade actions.

  • docs/configuration.md L541-547, L920-923
  • docs/plugins.md L155-158, L248-256
  • docs/upgrading.md L15-90

Update the supported FOCA range in plugin-image guidance.

  • docs/plugin-images.md L178

Tests

Update tests and fixtures for issuer-namespaced subjects, including coverage that an empty namespace preserves bare owners.

  • tests/conftest.py L75-76, L91-106
  • tests/ga4gh/tes/test_access_control.py L202-206, L308-346 (+3 small edits)
  • tests/ga4gh/tes/test_plugins.py L32, L207
  • tests/limits/test_endpoint.py L16-23, L82

Cover the changed distinction between unknown and ineligible backend pins, and account for the FOCA 0.23 plugin-schema keys.

  • tests/ga4gh/tes/test_client_choices.py L33, L211-217, L223-265
  • tests/smoke/plugin/pyproject.toml L17
  • tests/test_chart.py L1662-1663, L1676-1678

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

@read-the-docs-community

Copy link
Copy Markdown

@codecov

codecov Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (2ed5e4a) to head (3a51d80).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #523   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           37        37           
  Lines         3544      3537    -7     
=========================================
- Hits          3544      3537    -7     

☔ 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 26, 2026 01:17
@sourcery-ai

sourcery-ai Bot commented Nov 26, 2026

Copy link
Copy Markdown

Linked issues

Checked at commit 3a51d80

#522 build: move to FOCA 0.23.0 · 5 of 7 met

# Requirement Status Notes
1 Move to FOCA 0.23.0 on the pinned base image, update the dependency range, and lock it. ✅ Met The Dockerfile, pyproject.toml, and lockfile are updated for FOCA 0.23.0.
2 Keep subjects bare for single-issuer deployments with namespace: "", document the upgrade path, avoid a data migration, and set it in the Rahti values. 🟡 Partly met The upgrade notes explain the opt-out and lack of a migration, and a test covers bare owners; no Rahti values setting appears in the change.
3 Return 400 (invalid-backends) for pins to unknown TES instances, with tests and documentation. ✅ Met The routing change distinguishes unknown identifiers from known but ineligible instances, and tests and upgrade notes cover the behavior.
4 Add the chart's FOCA plugin keys attachments, max_count, and max_namespace_size. 🟡 Partly met The chart adds max_namespace_size/maxNamespaceSize, but attachments is explicitly excluded in the chart test and max_count is not added.
5 Add upgrade notes for the FOCA 0.23 changes. ✅ Met The notes cover the changed subject format, pin behavior, request-body handling, plugin store, and plugin release.
6 Use the foca-plugins release that supports FOCA 0.23. ✅ Met The dependency is updated to foca-plugins 0.4.0.
7 Do not use a temporary apt fix. ✅ Met The change upgrades the base image rather than adding an apt workaround.

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

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

## Individual Comments

### Comment 1
<location path="pyproject.toml" line_range="116" />
<code_context>
     # FOCA minors are bumped by hand, together with the base image in the
     # `Dockerfile` (`.github/dependabot.yml`).
-    "foca>=0.22.0,<0.23",
+    "foca>=0.23.0,<0.24",
     # The routing plugins in the image: `generic.routing.random` (default
     # pipeline, `pro_tes/config.yaml`) and `tes.routing.distance` (opt-in,
</code_context>
<issue_to_address>
**Upgrade resets per-user task quotas**

When a single-issuer deployment has existing tasks and configured task limits, then upgrades without setting the issuer’s `namespace: ""`, `get_owner()` now returns the issuer-namespaced subject, while `check_task_limits()` counts stored tasks by exact `user_id`; existing tasks still have bare subjects, so they are omitted from the user’s quota and that user can exceed configured limits.

Preserve or migrate existing owner identifiers before applying the new namespace by default, or provide an explicit upgrade step that retains their quota counts.
</issue_to_address>

### Comment 2
<location path="deployment/templates/_helpers.tpl" line_range="91" />
<code_context>
   "recordFailed" "record_failed"
   "secretHeaders" "secret_headers"
   "maxEntrySize" "max_entry_size"
+  "maxNamespaceSize" "max_namespace_size"
   "maxTtl" "max_ttl"
 ) -}}
</code_context>
<issue_to_address>
**Missing chart plugin keys**

The issue asks the chart to add `attachments`, `max_count`, and `max_namespace_size`. This change adds only `max_namespace_size`; the chart test explicitly excludes `attachments`, and `max_count` is not added.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 2 findings to address first, and FOCA now namespaces authenticated subjects by issuer by default, changing the identity used for task ownership and related access checks. Existing single-issuer task owners remain stored under bare subjects, so users may lose access to those tasks and usage may be split; reverting alone does not reconcile records created with the new subjects.

Blocking findings: pyproject.toml:116, deployment/templates/_helpers.tpl:91


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

Comment thread pyproject.toml Resolved
Comment thread deployment/templates/_helpers.tpl Resolved
@uniqueg
uniqueg merged commit a6be3a4 into dev Nov 26, 2026
73 checks passed
@uniqueg
uniqueg deleted the build/foca-0.23.0 branch November 26, 2026 01:35
uniqueg added a commit that referenced this pull request Nov 26, 2026
Release notes: the FOCA 0.23 move (#522, #523: breaking changes,
security, maintenance) and the service clients (#517, #521, D-451);
citation date 2026-11-26.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011FSoqN5w1v5t1QRTKU7ad5
uniqueg added a commit that referenced this pull request Nov 26, 2026
The version check of the release branch flags "proTES 0.7.0" in the
upgrading guide (added by #523); the section heading names the release.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011FSoqN5w1v5t1QRTKU7ad5
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: move to FOCA 0.23.0

1 participant