Repository navigation
build: move to FOCA 0.20, without pip - #407
Conversation
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]>
Reviewer's GuideThis 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 sendingsequenceDiagram
participant ProTES
participant DiscoveredTES1
participant DiscoveredTES2
ProTES->>DiscoveredTES1: _request()
DiscoveredTES1-->>ProTES: RequestNotSent
ProTES->>DiscoveredTES2: _request()
DiscoveredTES2-->>ProTES: response
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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]>
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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
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]>
Closes #399
Closes #336
Summary
build: move to FOCA 0.20 #399:
foca>=0.20.0,<0.21,foca-plugins[...]==0.2.0, base imageelixircloud/foca:0.20.0-py3.13by 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.
PLUGINSandexamples/plugin-image/Dockerfileinstall 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.shneeded pip in the image, so it now runsuv pip compilein the image, with uv extracted from the pinned image.download.shis 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 fortls_errorandInvalidRequest | InvalidRequestURLgo, 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 usestr(), and pass.urllib3: the floor rises to 2.2, as
read_limited(fromdev, fix: serve the backend's logs in the view FULL #419) usesHTTPResponse.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 throughdescribe_validation_error.Identity provider's URLs: those messages are shown, so they no longer quote the URLs, and
split_server_urlrefuses user info, as FOCA does for backends: anhttpsURL with credentials passed validation and then appeared in token errors and logs. Noted indocs/upgrading.md.Funnel: comments said it reports its own version; 0.11.14 reports
type.version: "".devis 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 checkandruff format --checkat the hooks' version: clean.uv lock --check: passes.pip-auditon the lock (runtime, and with all extras): no known vulnerabilities.Not run locally:
pre-commit run --all-filesas a whole (gitleaksandactionlintcan'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.shpins the smoke plugin as expected,download.shgets 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 runhas 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
--platformthrough the scripts: documented as not working, as the extracted uv has the host's architecture.The CI check for installers passing if
findis missing:command -vand the import check still cover it, as in FOCA's script.check_version_labelsquotingentry.urland the label (reported as medium): FOCA refuses backend URLs with user info before it runs, and a label is no secret.BackendAuthErrormessages quoting the issuer:split_server_urlnow 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.mdhas 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:
Bug Fixes:
Enhancements:
Build:
CI:
Documentation:
Tests:
Chores: