Skip to content

fix: make third-party lookups opt-in - #385

Merged
uniqueg merged 3 commits into
devfrom
fix/384-opt-in-lookups
Nov 1, 2026
Merged

uniqueg merged 3 commits into
devfrom
fix/384-opt-in-lookups

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Summary

Closes #384

Third-party location lookups are now an opt-in. The default pipeline is generic.routing.random only. tes.routing.distance stays installed in the image but is not enabled.

Why random and not distance routing: tes.routing.distance can only locate the hosts of inputs through a provider. dbip sends their public addresses to DB-IP and Nominatim, and offline needs a GeoIP database that the image doesn't contain (it is the plugin's default provider and fails without database). Configured backend locations alone are not enough, because the inputs need locating too. So no distance default exists without lookups.

Release notes (draft)

Breaking changes / Security: proTES no longer sends data to third parties by default. The default routing is random order; 0.4.0 routed by distance to the input data and looked up the public IP addresses of the hosts of inputs at DB-IP and Nominatim. To restore the behavior of 0.4.0, enable tes.routing.distance with provider: dbip and put it before generic.routing.random in plugins.pipeline (also in the Helm chart values), or use provider: offline with a GeoIP database of your own to keep the data in the gateway. See the upgrade guide, "To version 0.4.1" (#384).

Changes

  • pro_tes/config.yaml: only generic.routing.random available and in the pipeline.
  • Helm chart: values.yaml, values.schema.json and deployment/README.md describe the new default and the opt-in (no template changes: empty values are left out).
  • Docs: plugins.md (opt-in, offline, ordered, privacy note on what leaves the deployment), upgrading.md ("To version 0.4.1", how to restore 0.4.0), configuration.md, plugin-images.md, index.md, api.md, README, config.dev.yaml.
  • Tests: default pipeline and available plugins, no lookups by default (a DB-IP lookup and getaddrinfo fail the test), opt-in loads the plugin, opt-in makes the lookup; doc examples are validated merged into the base config.

Verification

  • pytest -W ignore::DeprecationWarning (all except tests/test_chart.py and 2 chart-render tests in test_config_examples.py): 1166 passed. Coverage 100%.
  • mypy pro_tes tests: clean. ruff check and ruff format (0.17.3): clean. mkdocs build --strict: OK.
  • Not run locally: the chart tests and helm lint (Helm is not installed in the agent environment; they need helm dependency build), and the pre-commit hooks other than ruff (no network for hook repos). CI runs them.

Lane

Regular lane (default behavior, security). adversarial-reviewer and quality-reviewer ran in parallel. Fixed: stale default in docs/api.md, a stale bullet in the 0.4.0 upgrade notes, a stale comment and plugin set in tests/ga4gh/tes/conftest.py.

Declined review findings

  • Release notes and changelog entry for 0.4.1: belong to the release-prep PR (version is set there).
  • Pointer in docs/releases/0.4.0.md (historical notes): left as is.
  • Deriving the test's OPT_IN from the doc example: the docs examples are already schema-validated; kept the explicit copy.

Open questions

None.

🤖 Generated with Claude Code

Summary by Sourcery

Make third-party location lookups opt-in by defaulting proTES to random routing and documenting the migration path for distance-based routing.

Bug Fixes:

  • Prevent third-party location lookups from occurring unless explicitly enabled by the administrator.

Enhancements:

  • Change the default routing pipeline to random routing while retaining distance routing as an opt-in option with DB-IP/Nominatim or an administrator-provided offline GeoIP database.
  • Update deployment configuration, Helm values, documentation, and upgrade guidance to describe the privacy-preserving default and how to restore distance-based routing.
  • Expand coverage to verify default routing performs no address or hostname lookups and that the opt-in configuration enables them.

uniqueg and others added 2 commits November 1, 2026 21:39
The default pipeline of 0.4.0 routed by distance with provider dbip,
which sends the public addresses of the hosts of task inputs to DB-IP
and Nominatim without the admin choosing it. Distance routing can't
locate inputs without a lookup service or a GeoIP database, so the
default is random routing only; tes.routing.distance stays installed
and is enabled explicitly in the config or the chart values.

Document the opt-in, what leaves the deployment, and how to restore
the behavior of 0.4.0 in the upgrade guide.

Closes #384

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Update the API flow description, the 0.4.0 upgrade bullet and the
comment of the test helper that still named the old default.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@uniqueg uniqueg added this to the v0.4.1 milestone Nov 1, 2026
@sourcery-ai

sourcery-ai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

The PR makes random routing the privacy-preserving default, leaving distance routing installed but explicitly opt-in, and aligns Helm configuration, documentation, upgrade guidance, and integration tests with that behavior. Reviewers should verify the default/overlay merge semantics, that no lookup path remains reachable without opt-in, and that the documented DB-IP and offline configurations correctly restore the intended routing behavior.

Sequence diagram for privacy-preserving default routing

sequenceDiagram
    participant Client
    participant Gateway
    participant Random as generic.routing.random
    participant TES
    participant Lookup as Third-party lookup services

    Client->>Gateway: POST /tasks
    Gateway->>Random: route task
    Random->>TES: forward task
    TES-->>Gateway: task response
    Gateway-->>Client: response
    Note over Gateway,Lookup: No lookup request is made by default
Loading

Sequence diagram for opt-in distance routing

sequenceDiagram
    participant Client
    participant Gateway
    participant Distance as tes.routing.distance
    participant Lookup as DB-IP and Nominatim
    participant Random as generic.routing.random
    participant TES

    Client->>Gateway: POST /tasks
    Gateway->>Distance: route task
    Distance->>Lookup: locate input host addresses
    Lookup-->>Distance: locations
    Distance->>TES: forward to nearest instance
    TES-->>Gateway: task response
    Gateway-->>Client: response
    alt lookup or distance routing fails
        Distance->>Random: route fallback
        Random->>TES: forward task
    end
Loading

Flow diagram for opt-in task routing

flowchart TD
    Start[New task] --> Default[generic.routing.random]
    Default --> TES[Select TES instance]
    Start --> OptIn{Distance routing enabled?}
    OptIn -->|No| Default
    OptIn -->|Yes| Distance[tes.routing.distance]
    Distance --> Fallback[generic.routing.random]
    Fallback --> TES
Loading

File-Level Changes

Change Details Files
Changed the base routing configuration so third-party location lookups are disabled by default.
  • Enabled only generic.routing.random in the default pipeline.
  • Kept tes.routing.distance installed but removed it from the available/default plugin configuration.
  • Updated dependency and test comments to distinguish installed plugins from enabled plugins.
pro_tes/config.yaml
pyproject.toml
tests/ga4gh/tes/conftest.py
Added explicit configuration paths for distance routing with either external or offline location providers.
  • Documented the required plugin availability and ordered pipeline entries for opt-in distance routing.
  • Described DB-IP/Nominatim data sharing and the offline GeoIP database alternative.
  • Added the Helm values and schema guidance for restoring distance routing.
deployment/README.md
deployment/values.yaml
deployment/values.schema.json
docs/plugins.md
docs/plugin-images.md
docs/configuration.md
config.dev.yaml
Updated user-facing behavior, privacy, and upgrade documentation for the new default.
  • Changed product and API descriptions to state that random routing is the default and sends no data to third parties.
  • Added 0.4.1 upgrade instructions for restoring the 0.4.0 behavior.
  • Clarified the privacy scope of DB-IP and Nominatim lookups and the distinction between installed and enabled plugins.
README.md
docs/index.md
docs/api.md
docs/upgrading.md
Expanded integration coverage to verify that lookups are absent by default and occur only after opt-in.
  • Blocked address and hostname lookup functions in default-routing tests, including for public input URLs.
  • Verified the default pipeline and available plugin set.
  • Added opt-in tests confirming distance plugin loading and DB-IP lookup execution.
  • Validated plugin documentation examples after merging them with the base configuration.
tests/ga4gh/tes/test_default_routing.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 #35565636 | 📁 Comparing c6021f0 against latest (ed1c90c)

  🔍 Preview build  

7 files changed · ± 7 modified

± Modified

@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 (ed1c90c) to head (c6021f0).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #385   +/-   ##
=========================================
  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.

@uniqueg
uniqueg marked this pull request as ready for review November 1, 2026 20:55

@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="pro_tes/config.yaml" line_range="362" />
<code_context>
+  pipeline:
+    - id: route
+      alternatives:
+        - plugin: tes.routing.distance
+        - plugin: generic.routing.random
 ```
</code_context>
<issue_to_address>
**Lookups continue during rollout**

When a rolling upgrade leaves 0.4.0 pods serving requests alongside 0.4.1 pods, old 0.4.0 pods keep running their distance-routing default and send input-host IP addresses to DB-IP and Nominatim for requests routed to them, so the deployment continues disclosing addresses during the upgrade.

Document that lookups can continue until old pods stop serving traffic, or use a rollout procedure that drains the old pods before the privacy change is considered complete.
</issue_to_address>

### Comment 2
<location path="README.md" line_range="28" />
<code_context>
-routing plugins of foca-plugins, which the image contains); other plugins
-serve access control, request processing or validation, or the selection of
+there and tracks its state. By default, tasks go to a random TES instance,
+for load balancing, without sending data to third parties; plugins (e.g.,
+the routing plugins of foca-plugins, which the image contains) route tasks to
+the TES instance closest to their input data (an opt-in, as it uses lookup
</code_context>
<issue_to_address>
**Task data still reaches external TES**

When a deployment configures a TES backend operated by a third party, the statements that random routing sends “no data to third parties” imply that task data stays within the deployment, but `TaskRuns._run_pipeline` still forwards each task to a configured TES backend. Operators may therefore route sensitive tasks to an external TES believing no data leaves the deployment.

Narrow the claim to say that random routing makes no third-party location lookups, while clarifying that tasks are still forwarded to the configured TES backend.

Also at `docs/index.md:49`, `docs/plugins.md:95`, `deployment/values.yaml:109`.
</issue_to_address>

Linked issues

#384 fix: make third-party location lookups opt-in · 4 of 4 met

# Requirement Status Notes
1 Default to routing without third-party lookups; use random routing if distance routing cannot work without lookups. ✅ Met The base config makes only generic.routing.random available and uses it as the pipeline; tests cover tasks with and without public input addresses and fail on address or hostname lookups.
2 Let operators explicitly enable DB-IP/Nominatim lookups in configuration and chart values, and document what data leaves the deployment. ✅ Met The docs and chart README show how to enable tes.routing.distance with provider: dbip and describe the addresses sent to DB-IP and Nominatim; they also document the offline provider.
3 Test the default for no outgoing lookups and test the opt-in. ✅ Met Tests assert that default routing makes no lookups and that the opt-in loads distance routing and performs the expected lookup.
4 Document the changed default and how to restore 0.4.0 behavior in the upgrade guide. ✅ Met The 0.4.1 upgrade section explains the changed default and provides configuration and Helm guidance for restoring distance routing.

Sourcery assessment

Approval pending. 2 findings to address first.

Blocking findings: pro_tes/config.yaml:362, README.md:28


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

Comment thread pro_tes/config.yaml Resolved
Comment thread README.md Resolved
Say that the default makes no third-party location lookups instead of
that no data goes to third parties (tasks still reach the configured
TES instances), and note that 0.4.0 pods keep looking up addresses
during a rolling upgrade (Sourcery review).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

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

Sourcery assessment

Approved.

@uniqueg
uniqueg merged commit 763f50d into dev Nov 1, 2026
30 checks passed
@uniqueg
uniqueg deleted the fix/384-opt-in-lookups branch November 1, 2026 21:06
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.

fix: make third-party location lookups opt-in

1 participant