Skip to content

feat: ship the routing plugins in the image - #381

Merged
uniqueg merged 3 commits into
devfrom
feat/379-routing-plugins
Nov 1, 2026
Merged

uniqueg merged 3 commits into
devfrom
feat/379-routing-plugins

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Summary

  • The image ships the routing plugins of foca-plugins: foca-plugins[generic-routing,tes-routing]==0.1.0 is a dependency (plugins 0.1.1), pinned with hashes in uv.lock (CI: uv sync --locked; Dependabot updates pyproject.toml and the lock together).
  • The default pipeline is distance routing (tes.routing.distance) with random order as the fallback (generic.routing.random), as in 0.3.0. Per-task pipelines stay off.
  • The distance plugin is set to 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.yaml and 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: 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_plugins keeps the routing plugins next to fake plugins; the base config's plugins is validated with the doc examples.
  • Docs: README, index, configuration, plugins, plugin images, upgrade guide (Routing), chart README, values, values schema.

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.
  • Not run locally: 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 (provider stays dbip unless set), dev config, doc references.

Declined review findings:

  • Single patch point for fake_plugin_entry_points (FOCA's fixture takes no extra entry points; the helper is covered by the 470 plugin tests).
  • A stubbed successful distance decision: the plugin's own tests (foca-plugins) cover it; here the tests cover the wiring and the fallback.
  • Doc versions of the plugins: concrete versions stay in the upgrade notes only.
  • Rate limits cited in the docs come from the plugin's README (verified).

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:

  • Ship the foca-plugins distance and random routing plugins in the proTES image and use them in the default task-routing pipeline.

Enhancements:

  • Preserve ordered failover in development, smoke, and general test overlays to avoid third-party lookups and keep tests network-independent.
  • Document the default routing behavior, third-party data sharing, offline configuration, and ordered-failover alternative across application and deployment guidance.

Build:

  • Add the pinned foca-plugins routing release train and lock its dependencies with hashes.

Deployment:

  • Update Helm and image documentation and examples for the bundled routing plugins and their offline or ordered-routing alternatives.

Documentation:

  • Update user, API, configuration, plugin-image, routing, and upgrade documentation to reflect the bundled distance-first routing defaults and privacy implications.

Tests:

  • Add coverage verifying the default pipeline, plugin availability and installation, application loading, and random fallback behavior without network access.
  • Validate plugin configuration examples from the base and smoke configurations.

uniqueg and others added 2 commits November 1, 2026 17:51
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]>
@sourcery-ai

sourcery-ai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

The 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 fallback

sequenceDiagram
    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
Loading

Flow diagram for network-free routing alternatives

flowchart 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
Loading

File-Level Changes

Change Details Files
Bundle the foca-plugins routing release train in the image and make distance routing with random fallback the explicit default pipeline.
  • Add the pinned foca-plugins[generic-routing,tes-routing] dependency and lock its transitive packages with hashes.
  • Configure tes.routing.distance with provider: dbip followed by generic.routing.random, while keeping per-task pipelines disabled.
  • Document the default network/data-sharing behavior and alternatives for offline or ordered-failover routing.
pyproject.toml
uv.lock
pro_tes/config.yaml
README.md
docs/configuration.md
docs/index.md
docs/plugins.md
docs/plugin-images.md
docs/upgrading.md
deployment/README.md
deployment/values.yaml
deployment/values.schema.json
Preserve network-independent ordered failover in development, smoke, and general test environments.
  • Override the default routing pipeline with foca.routing.ordered in local and test overlays.
  • Update comments to explain that these overlays avoid third-party lookups and network access.
config.dev.yaml
tests/config_overlay.yaml
tests/smoke/config.yaml
Add integration coverage proving the bundled plugins are configured, installed, loaded, and used through the default pipeline.
  • Verify pipeline order, plugin distributions, dbip configuration, installed entry points, and disabled client pipelines.
  • Run fallback-routing requests without network access and assert forwarding through the random plugin.
  • Retain routing plugin entry points alongside fake plugins and validate base configuration examples.
tests/ga4gh/tes/test_default_routing.py
tests/ga4gh/tes/conftest.py
tests/test_config_examples.py

Possibly linked issues


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

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

Copy link
Copy Markdown

Documentation build overview

📚 proTES | 🛠️ Build #35562379 | 📁 Comparing 9eefa78 against latest (f56f0ca)

  🔍 Preview build  

7 files changed · ± 7 modified

± Modified

@uniqueg
uniqueg marked this pull request as ready for review November 1, 2026 17:15
@codecov

codecov Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codecov Report

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

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.
📢 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.

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


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

Comment thread pro_tes/config.yaml Resolved
Comment thread pyproject.toml Resolved
Comment thread docs/plugins.md Resolved
Comment thread pro_tes/config.yaml Resolved
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]>
@uniqueg
uniqueg merged commit 4887bc0 into dev Nov 1, 2026
32 checks passed
@uniqueg
uniqueg deleted the feat/379-routing-plugins branch November 1, 2026 17:24
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: ship the routing plugins in the image

1 participant