Repository navigation
feat: ship the routing plugins in the image - #381
Conversation
Install the routing plugins of foca-plugins (release train 0.1.0: tes.routing.distance and generic.routing.random 0.1.1), pinned with hashes in uv.lock, and make distance routing with random order as the fallback the default pipeline again, as in 0.3.0. The distance plugin uses the DB-IP and Nominatim lookups of 0.3.0 (provider: dbip), as the offline provider needs a GeoIP database that the image doesn't have. The test overlay keeps FOCA's ordered failover for the other tests; new tests cover the default pipeline with the installed plugins. Docs, chart values comments and the upgrade guide are updated. Closes #379 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep FOCA's ordered failover in config.dev.yaml, so that local setups send nothing to third parties; correct the chart schema, the smoke config comment and the values example; warn that settings merge with the base config (provider stays dbip unless set to offline). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideThe image now ships pinned foca-plugins routing dependencies and explicitly restores the 0.3.0-style distance-then-random default, while documenting its DB-IP/Nominatim data-transfer implications and providing offline or ordered-failover alternatives. Test and development overlays remain deterministic and network-free, with focused integration tests validating installation, configuration, plugin loading, and fallback behavior. Sequence diagram for distance routing with random fallbacksequenceDiagram
participant Task as Task
participant Pipeline as PluginPipeline
participant Distance as tes.routing.distance
participant DBIP as DBIP
participant Nominatim as Nominatim
participant Random as generic.routing.random
participant TES as TESBackend
Task->>Pipeline: process_task
Pipeline->>Distance: process_task
Distance->>DBIP: locate
Distance->>Nominatim: geocode
alt distance routing succeeds
Distance-->>Pipeline: selected backend
else distance routing does not apply
Pipeline->>Random: process_task
Random-->>Pipeline: selected backend
end
Pipeline->>TES: forward_task
Flow diagram for network-free routing alternativesflowchart TD
Start["Task routing"] --> Choice{"Avoid third-party lookups?"}
Choice -->|"No"| DBIP["tes.routing.distance\nprovider: dbip"]
DBIP --> External["DB-IP and Nominatim"]
Choice -->|"Offline"| Offline["tes.routing.distance\nprovider: offline"]
Offline --> GeoIP["GeoIP database in derived image"]
Choice -->|"Ordered failover"| Ordered["foca.routing.ordered"]
External --> Backend["TES backend"]
GeoIP --> Backend
Ordered --> Backend
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #381 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 23 23
Lines 2217 2217
=========================================
Hits 2217 2217 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've found 4 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="pro_tes/config.yaml" line_range="355" />
<code_context>
+ tes.routing.distance:
+ distribution: foca-plugin-tes-routing-distance
+ config:
+ provider: dbip
+ generic.routing.random:
+ distribution: foca-plugin-generic-routing-random
</code_context>
<issue_to_address>
**Input locations leave the gateway**
When an authenticated user submits a task with a publicly resolvable input host, the default distance lookup sends the input host’s public IP to DB-IP and its resulting location to Nominatim, revealing where the user stores data to third parties before the task is forwarded.
Make third-party lookups an explicit opt-in, or use offline lookup or ordered routing by default.
</issue_to_address>
### Comment 2
<location path="pyproject.toml" line_range="121" />
<code_context>
+ # `tes.routing.distance` and `generic.routing.random`. The release train
+ # pins each plugin to an exact version, which `uv.lock` records with
+ # hashes; Dependabot bumps the train
+ "foca-plugins[generic-routing,tes-routing]==0.1.0",
"gunicorn>=26.2.0,<27",
"py-tes>=1.1,<2",
</code_context>
<issue_to_address>
**Image ignores the dependency lock**
When a dependency release satisfying the image's pip requirements differs from the version resolved in `uv.lock`, the Docker build obtains requirements from `pyproject.toml` and installs them with pip, without reading `uv.lock` or checking its hashes. A newly published compatible transitive dependency can therefore enter the image despite CI testing the locked versions, leaving the shipped routing plugins with a different or incompatible dependency set.
Build the image dependencies from the lock with hash verification, or otherwise ensure the image's dependency resolution matches the versions tested in CI.
</issue_to_address>
### Comment 3
<location path="docs/plugins.md" line_range="123" />
<code_context>
+
+ As the former middlewares of proTES did, the default settings
+ locate the hosts of task inputs and the TES instances with DB-IP and
+ Nominatim (`provider: dbip`): **the public IP addresses of the hosts of
+ inputs** (which may show where users keep their data) go to
+ `api.db-ip.com`, and the city, region and country of those addresses to
</code_context>
<issue_to_address>
**Backend addresses are omitted from warning**
When a deployment has publicly addressed TES backends, the default distance routing also geolocates TES instances, so their public IP addresses are sent to DB-IP and their locations to Nominatim. The warning and base-config comment disclose only input-host data, leaving operators' privacy notices incomplete about this routine transfer of backend infrastructure addresses.
Explicitly disclose that public TES backend addresses are also looked up by the third-party providers in the warning and configuration comments.
Also at `pro_tes/config.yaml:347`.
</issue_to_address>
### Comment 4
<location path="pro_tes/config.yaml" line_range="361-362" />
<code_context>
- id: route
alternatives:
+ - plugin: org.example.plugin
- plugin: tes.routing.distance
- - plugin: foca.routing.ordered
+ - plugin: generic.routing.random
```
</code_context>
<issue_to_address>
**API docs promise ordered routing**
When a reader relies on the API task-creation description to predict which TES instance receives a task, the default pipeline now tries distance routing and then random order, so `docs/api.md`'s description that TES instances are tried “by default, those of `custom.tes.backends`, in order” gives API users the wrong routing behavior.
Update `docs/api.md` to describe the default distance routing with random fallback, and note that ordered failover requires an explicit pipeline.
</issue_to_address>Linked issues
#379 feat: ship the routing plugins in the image · 4 of 4 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Install the released routing plugins in the image, pinned and hash-checked in uv.lock. | ✅ Met | The image installs project dependencies; pyproject.toml adds the foca-plugins routing extras at 0.1.0, and uv.lock records the 0.1.1 plugin distributions with hashes. |
| 2 | Make distance routing with random fallback the default again, as in 0.3.0. | ✅ Met | The base config sets tes.routing.distance followed by generic.routing.random and configures the distance plugin with provider: dbip. |
| 3 | Add tests for the default configuration. | ✅ Met | The new tests check the pipeline, plugin availability and installation, app loading, and random fallback when distance routing cannot place a task. |
| 4 | Update the configuration reference and upgrade guide. | ✅ Met | docs/configuration.md and the routing sections of docs/upgrading.md describe the new default. |
Sourcery assessment
Needs a human reviewer. 4 findings to address first, and the default distance-routing plugin sends public IP addresses of task-input hosts to DB-IP and Nominatim, potentially revealing where users keep their data. Reverting stops future lookups but cannot retract addresses already disclosed.
Blocking findings: pro_tes/config.yaml:355, pyproject.toml:121, docs/plugins.md:123, pro_tes/config.yaml:362
Say that TES instances without a configured location are looked up too, and that the default is no longer the configured order. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
foca-plugins[generic-routing,tes-routing]==0.1.0is a dependency (plugins 0.1.1), pinned with hashes inuv.lock(CI:uv sync --locked; Dependabot updatespyproject.tomland the lock together).tes.routing.distance) with random order as the fallback (generic.routing.random), as in 0.3.0. Per-task pipelines stay off.provider: dbip(DB-IP and Nominatim), which is what 0.3.0 did; the plugin's default, offline, needs a GeoIP database that the image can't contain. Docs warn about the data transfers and show the offline and ordered-failover alternatives.config.dev.yamland the smoke overlay keep FOCA's ordered failover (no network, nothing sent to third parties); the test overlay does too, so the other tests don't depend on the plugins.tests/ga4gh/tes/test_default_routing.py(default pipeline and pins, plugins installed and loaded by the app, tasks fall back to random without network);with_pluginskeeps the routing plugins next to fake plugins; the base config'spluginsis validated with the doc examples.Closes #379
Verification
coverage run -m pytest(mongomock): 1160 passed, 177 skipped, coverage 100%.ruff check,ruff format --check,mypy,ast-grep scan: clean.mkdocs build --strict: OK.tests/test_chart.py(needs helm; skipped), pre-commit hooks other than ruff (hook repos can't be fetched in the sandbox), Docker smoke tests, MongoDB run. CI covers them.Review
Adversarial and quality reviewer round 1; fixed: stale chart schema description, smoke config comment, values example, merge note (
providerstaysdbipunless set), dev config, doc references.Declined review findings:
fake_plugin_entry_points(FOCA's fixture takes no extra entry points; the helper is covered by the 470 plugin tests).Second round skipped: the fixes changed docs, comments and config only, no logic.
Open questions
None. Note for the maintainer: the default sends public addresses of input hosts to DB-IP and Nominatim, as 0.3.0 did.
🤖 Generated with Claude Code
Summary by Sourcery
Bundle the foca-plugins routing plugins and restore distance-based routing with random fallback as the default behavior.
New Features:
Enhancements:
Build:
Deployment:
Documentation:
Tests: