Skip to content

build: move to FOCA 0.20, without pip - #407

Merged
uniqueg merged 11 commits into
devfrom
build/foca-0.20
Nov 4, 2026
Merged

uniqueg merged 11 commits into
devfrom
build/foca-0.20

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Closes #399
Closes #336

Summary

  • build: move to FOCA 0.20 #399: foca>=0.20.0,<0.21, foca-plugins[...]==0.2.0, base image elixircloud/foca:0.20.0-py3.13 by digest, the smoke plugin's cap, docs and upgrade notes.

  • build: drop pip by adopting the FOCA image without it #336: the image has no pip. PLUGINS and examples/plugin-image/Dockerfile install with uv mounted from a pinned stage; all 8 pip-vendored entries leave .trivyignore.yaml; a new CI step in the smoke test checks that the image has no installer.

  • Recipe: resolve.sh needed pip in the image, so it now runs uv pip compile in the image, with uv extracted from the pinned image. download.sh is new, as uv has no download command: it runs a pinned pip from uv's temporary environment, for that one command. Dependabot now watches the recipe's uv pin too.

  • backends.py: FOCA 0.20 reports errors as not sent only before sending started, so the special cases for tls_error and InvalidRequest | InvalidRequestURL go, as the FOCA pre-release review recommended. Discovered TES instances now fail over on these; configured ones behave as before.

  • FOCA's migration guide: failure records are keyed by run ID (docs/operations.md), and caveats about redirect bodies are gone. No code in proTES reads a validation error's __cause__ type: the two tests that read it use str(), and pass.

  • urllib3: the floor rises to 2.2, as read_limited (from dev, fix: serve the backend's logs in the view FULL #419) uses HTTPResponse.read1, which 2.1.0 doesn't have yet.

  • Config errors: FOCA 0.20 hides a validator's message if it quotes the input as a whole, so check_api_path's two messages no longer quote it. It is proTES's only validator of this kind: the others are model validators, whose input is no string, and checked through describe_validation_error.

  • Identity provider's URLs: those messages are shown, so they no longer quote the URLs, and split_server_url refuses user info, as FOCA does for backends: an https URL with credentials passed validation and then appeared in token errors and logs. Noted in docs/upgrading.md.

  • Funnel: comments said it reports its own version; 0.11.14 reports type.version: "". dev is merged (test: run against Funnel and TESP-API in CI #426, docs: add notes on TES implementations #428), never rebased.

One PR for both issues, as asked: the new base image alone breaks every pip step.

How it was verified

Locally, at the head of this branch, with the committed lock (foca 0.20.0, foca-plugins 0.2.0, both plugins 0.1.2, urllib3 2.8.0; written with uv 0.13.6, the project's version):

  • coverage run -m pytest, with Helm 3.22.1 and the chart dependency checked: 1606 passed, 11 skipped, 100%.
  • mypy pro_tes tests scripts: clean. ruff check and ruff format --check at the hooks' version: clean. uv lock --check: passes.
  • The regression tests of the validators fail on the old messages.
  • pip-audit on the lock (runtime, and with all extras): no known vulnerabilities.

Not run locally: pre-commit run --all-files as a whole (gitleaks and actionlint can't be installed in the sandbox; CI's lint job runs them); MongoDB 7.0, the image build, the smoke test, the integration test and the image scan (CI).

Recipe, earlier on this branch, with Docker against elixircloud/foca:0.20.0-py3.13: resolve.sh pins the smoke plugin as expected, download.sh gets the same file, a wrong hash fails the build with uv's message, the image builds, runs as user 1000 and has no pip or uv.

CI at 1f893d7: gate, lint, tests (mongomock, MongoDB 7.0), chart, docs, image build, smoke test and image scan pass. Integration (not in the gate) passes: tasks that finish, fail and are canceled on Funnel 0.11.14 and on TESP-API 0.2.0 with Pulsar, with this image.

Declined review findings

  • Hash for pip in download.sh: uv tool run has no hash mode; the version is pinned, and pip checks the wheels' hashes, which the image build checks again.

  • Test that the uv pins of the two Dockerfiles are equal: the recipe only uses its own, and Dependabot bumps both.

  • Passing --platform through the scripts: documented as not working, as the extracted uv has the host's architecture.

  • The CI check for installers passing if find is missing: command -v and the import check still cover it, as in FOCA's script.

  • check_version_labels quoting entry.url and the label (reported as medium): FOCA refuses backend URLs with user info before it runs, and a label is no secret.

  • BackendAuthError messages quoting the issuer: split_server_url now refuses user info in it, so the leak is gone.

  • Index of the entry in the error of an invalid api_path: the setting and the reason are named, and lists of backends are short.

  • A sentence in the docs that errors leave out values: docs/upgrading.md has it, for this version.

  • Secrets in a query string of the identity provider's URLs: no regression, and OAuth endpoints don't take them there.

Open questions

None.

🤖 Generated with Claude Code

Summary by Sourcery

Upgrade proTES to FOCA 0.20 and remove pip from runtime images while preserving plugin installation, dependency resolution, and deployment workflows.

New Features:

  • Add a pip-free plugin image workflow that resolves and downloads plugin dependencies with pinned uv tooling.
  • Upgrade the application and plugin stack to FOCA 0.20 and support its updated backend, validation, identity-provider, and provenance behavior.

Bug Fixes:

  • Allow discovered TES backends to fail over when FOCA confirms TLS or request failures occurred before sending.
  • Prevent identity-provider credentials and other sensitive URL inputs from appearing in validation and authentication errors.
  • Handle Funnel responses that report an empty TES version.

Enhancements:

  • Raise the urllib3 minimum version to support response streaming requirements.
  • Update deployment, API, configuration, plugin-image, and upgrade documentation for the new FOCA release and installer-free images.

Build:

  • Replace pip-based image and plugin installs with uv-mounted build stages and pinned pip downloads, leaving no installer in runtime images.

CI:

  • Add smoke-test and image checks that verify runtime images contain neither pip nor uv.
  • Extend Dependabot coverage and automated tests for the updated image recipe and dependency scripts.

Documentation:

  • Document FOCA 0.20 migration impacts, including plugin re-resolution, failed-run identifiers, failover semantics, validation behavior, and identity-provider URL restrictions.

Tests:

  • Update backend and validation regression tests for FOCA 0.20 behavior and add coverage for the installer-free plugin-image recipe.

Chores:

  • Remove Trivy exceptions for vulnerabilities that were only present in pip-vendored packages.

Raise the pins to foca 0.20 and foca-plugins 0.2.0, and move to the
FOCA 0.20.0 base image, which has no pip.

Install what the image adds with uv, mounted from a stage pinned by
digest: the build argument PLUGINS and the recipe for plugin images,
whose resolve.sh now runs uv pip compile in the image and whose new
download.sh runs a pinned pip from uv's temporary environment. Remove
the entries for packages vendored by pip from .trivyignore.yaml, and
check in the smoke test that the image has no installer.

FOCA now reports errors as not sent only before sending started, so
drop the special cases for TLS errors and invalid requests: discovered
TES instances fail over in these cases.

uv.lock is left as it is: it can't resolve until foca-plugins 0.2.0 is
on PyPI.

Closes #399
Closes #336

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg uniqueg added type: maintenance Related to general repository maintenance type: security Related to security labels Nov 3, 2026
@sourcery-ai

sourcery-ai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

This PR upgrades proTES to FOCA 0.20 and moves all image and plugin installation workflows away from runtime pip by mounting digest-pinned uv only during builds and using a pinned temporary pip for wheel downloads. It also adapts backend failover, validation, identity-provider URL handling, failed-run documentation, Funnel compatibility, CI scanning, and regression tests to the new FOCA behavior.

Sequence diagram for discovered TES failover before sending

sequenceDiagram
    participant ProTES
    participant DiscoveredTES1
    participant DiscoveredTES2

    ProTES->>DiscoveredTES1: _request()
    DiscoveredTES1-->>ProTES: RequestNotSent
    ProTES->>DiscoveredTES2: _request()
    DiscoveredTES2-->>ProTES: response
Loading

File-Level Changes

Change Details Files
Upgrade the application and deployment artifacts to FOCA 0.20 and its plugin release train.
  • Raise FOCA and foca-plugins constraints and refresh the lockfile and pinned base image.
  • Update urllib3 compatibility, Funnel version handling, plugin smoke dependencies, and deployment/API documentation.
  • Document FOCA 0.20 migration effects for failed-run identifiers, failover, validation, identity-provider URLs, plugin stores, and dependencies.
Dockerfile
pyproject.toml
uv.lock
deployment/README.md
deployment/values.yaml
docs/api.md
docs/configuration.md
docs/development.md
docs/operations.md
docs/upgrading.md
tests/smoke/plugin/pyproject.toml
tests/ga4gh/tes/test_backend_versions.py
tests/integration/config.yaml
Remove pip from runtime images while preserving plugin installation through pinned, ephemeral uv tooling.
  • Mount uv from a digest-pinned stage for local PLUGINS installs and derived plugin-image builds instead of copying an installer into the final image.
  • Replace plugin resolution with uv pip compile and add a download script that invokes a pinned pip only within uv's temporary environment.
  • Retire pip-vendored vulnerability exceptions and add tests and CI checks confirming images contain neither pip nor uv.
Dockerfile
examples/plugin-image/Dockerfile
examples/plugin-image/common.sh
examples/plugin-image/resolve.sh
examples/plugin-image/download.sh
.trivyignore.yaml
.github/workflows/ci.yml
.github/dependabot.yml
docs/plugin-images.md
tests/test_image_build.py
tests/test_plugin_image_scripts.py
tests/smoke/plugins.sh
Align backend failover and URL-validation behavior with FOCA 0.20 semantics and security guarantees.
  • Treat FOCA RequestNotSent TLS and invalid-request errors as retryable for discovered backends while preserving unknown outcomes for RequestMaybeSent errors and configured-backend behavior.
  • Reject identity-provider URLs containing user information and remove sensitive or FOCA-suppressed input values from validation errors.
  • Update backend regression coverage for pre-send/post-send failures, discovery errors, API paths, and credential leakage.
pro_tes/ga4gh/tes/backends.py
pro_tes/config_models.py
tests/ga4gh/tes/test_backend_list.py
tests/ga4gh/tes/test_backends.py

Possibly linked issues

  • build: move to FOCA 0.20 #399: The PR implements the FOCA 0.20 upgrade, including dependency pins, base image, compatibility changes, tests, and operator upgrade notes.

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

uniqueg and others added 9 commits November 4, 2026 08:23
Brings in the review fixes #410, #412, #417, #419, #420, #421.

The only conflict is in the module docstring of
`pro_tes/ga4gh/tes/backends.py`: keeps this branch's removal of the
FOCA 0.19 caveat about redirects, and the sentence of #419 about tasks
in the view `FULL`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`read_limited` uses `HTTPResponse.read1`, which urllib3 has since 2.2.0
(not in the 2.1.0 wheel). `uv.lock` stays unchanged: it has 2.8.0, which
FOCA 0.20 requires anyway, and is updated with foca-plugins 0.2.0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
foca-plugins 0.2.0 and its plugins 0.1.2 are on PyPI, so the lock can
resolve.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
FOCA 0.20 replaces a validator's message with "invalid value" if it
quotes the input as a whole, so the two messages of `check_api_path`
lost their reason. Messages of model validators aren't hidden, so those
of the identity provider's URLs showed credentials in the URL; they
name the setting instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Funnel 0.11.14 reports an empty `type.version`, not its own version.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The lock was written with an older uv than the project requires, which
lowered its `revision` from 5 to 3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
An https URL with credentials passed validation and then appeared in
token errors and logs. FOCA refuses user info for backends already, so
the issuer, the token endpoint and discovered endpoints do the same.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The error for a refused discovered token endpoint named only the URL
scheme, also when the scheme was fine. Covers the discovered endpoint,
and http and empty user info, in tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@read-the-docs-community

read-the-docs-community Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

@codecov

codecov Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #407   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           24        24           
  Lines         2680      2679    -1     
=========================================
- Hits          2680      2679    -1     

☔ 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 4, 2026 21:56

@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="tests/test_image_build.py" line_range="389" />
<code_context>
+        "pkg:pypi/[email protected]",
+    }
+    for entry in ignored["vulnerabilities"] or []:
+        assert not vendored & set(entry.get("purls", [])), entry
</code_context>
<issue_to_address>
**Broad vulnerability ignores go undetected**

When a pip-vendored CVE is reintroduced in `.trivyignore.yaml` without `purls`, `test_trivyignore_without_pip_entries` checks only `purls` at line 389, so an entry for a pip-vendored CVE without `purls` has an empty intersection and passes; Trivy then ignores that vulnerability for all packages.

Also assert that the removed pip-vendored vulnerability IDs are absent.
</issue_to_address>

### Comment 2
<location path="tests/test_plugin_image_scripts.py" line_range="43-44" />
<code_context>
+        "  create*) echo container ;;\n"
+        '  cp*) touch "${@: -1}" ;;\n'
+        "  rm*) ;;\n"
+        f"  *\\ pip\\ compile*) cat {path}/compiled; exit {rc} ;;\n"
+        "  run*) echo pkg-from-image==1.0; echo other==2.0 ;;\n"
+        "esac\n"
+    )
</code_context>
<issue_to_address>
**Script tests accept incomplete commands**

When `resolve.sh` stops passing the plugin input or constraints, or `download.sh` stops passing `/work/plugins.txt` to pip, `test_resolve_pins` still gets the canned `COMPILED` output because `_docker` ignores the compile arguments, while `test_download`'s fake succeeds for any `run` command and its assertions never require the requirements path; both tests pass although resolution or downloading is broken.

Make the fake Docker validate the required compile and download arguments before returning canned output.

Also at `tests/test_plugin_image_scripts.py:139-143`.
</issue_to_address>

Linked issues

#336 build: drop pip by adopting the FOCA image without it · 6 of 6 met

# Requirement Status Notes
1 Use the FOCA release image without pip ✅ Met The Dockerfile now uses the pinned elixircloud/foca:0.20.0-py3.13 image.
2 Install packages with uv from the pinned stage, without copying uv into the final image ✅ Met The app build, local PLUGINS install, and derived plugin-image recipe mount uv from a pinned stage; the plugin-image install is hash-checked and offline.
3 Remove pip-vendored package entries from .trivyignore.yaml ✅ Met The vulnerability list is empty, and a test checks that the pip-vendored entries are absent.
4 Update the docs that describe the image build ✅ Met The development and plugin-image docs describe the pip-free image and the uv-based workflow.
5 The final image contains no pip ✅ Met CI checks the built image for pip and uv; the PR reports that CI passed.
6 The image scan passes ✅ Met The PR reports that the CI image scan passed.

#399 build: move to FOCA 0.20 · 4 of 4 met

# Requirement Status Notes
1 Raise the FOCA and foca-plugins pins and update uv.lock ✅ Met pyproject.toml pins FOCA 0.20 and foca-plugins 0.2.0; uv.lock contains FOCA 0.20.0, foca-plugins 0.2.0, and the corresponding plugin releases.
2 Bump the base image tag and digest ✅ Met The Dockerfile uses the pinned FOCA 0.20.0 image.
3 Follow FOCA's upgrade notes and document what operators need for the 0.5.0 upgrade ✅ Met docs/upgrading.md names FOCA 0.20.0 and documents the migration impacts, including pip removal, plugins, failed-run records, failover, and identity-provider URLs.
4 Run on FOCA 0.20.0 with the image, lock, tests, and smoke test ✅ Met The change updates the base image and lock and includes the associated tests; the PR reports the image build, tests, and smoke test passing in CI.

Sourcery assessment

Needs a human reviewer. 2 findings to address first, the security scan did not finish, and if FOCA classifies a request as not sent when a TES backend actually received it, proTES may retry against another backend and create a duplicate task. Reverting restores the prior failover behavior, but any task already created by a retry cannot be undone by the revert.

Blocking findings: tests/test_image_build.py:389, tests/test_plugin_image_scripts.py:44


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

Comment thread tests/test_image_build.py Resolved
Comment thread tests/test_plugin_image_scripts.py Resolved
An entry without `purls` for a vulnerability vendored by pip would have
passed the check of `.trivyignore.yaml`, and the tests of the recipe
didn't require its scripts to pass the plugins, the constraints and the
requirements on. From Sourcery's review.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg
uniqueg merged commit 91e6958 into dev Nov 4, 2026
18 checks passed
@uniqueg
uniqueg deleted the build/foca-0.20 branch November 4, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: maintenance Related to general repository maintenance type: security Related to security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build: move to FOCA 0.20 build: drop pip by adopting the FOCA image without it

1 participant