Repository navigation
Client-side MOD-API federation (#415, Project 1) - #472
Merged
Merged
Conversation
Splits #415 into two projects after a design pass: - Project 1 (build-ready): client-side MOD-API federation — query remote SACs at request time, RRF-merge + source-attribute, store nothing. Carries the ESWC live demo (self + AgroPortal peers). Allowlist-only, guarded-transport, partial-failure tolerant. - Project 2 (feasibility/go-no-go): bulk discovery -> existing ingest pipeline (MOD-API harvest + GitHub OWL scan). Finding: the plumbing is trivial (ingest_ontology.delay), the project is the admission gate (dedup/license/quality/capacity). Recommend gated MOD-API harvest; do NOT auto-bulk GitHub (curated review queue instead); resolve #402 + dedup-at-admission first. Docs only; no code. Awaiting approval to plan/build Project 1. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Project 1 (federation): - drop RRF for dedup+append (rrf_merge is 2-arg/same-corpus; local is single SQL page) — remote rows deduped vs local by IRI, returned in a separate federated.results block, never interleaved into Ontology[] - auth first-class (OntoPortal/AgroPortal require an API key -> 401); AgroPortal host moved (lirmm.fr->agroportal.eu) + https->http + needs key - client owns streaming size cap (guard has none) + explicit redirect policy (re-validate each hop, final host must be allowlisted) - federation on first page only; named test coverage; Prerequisites section (second instance + AgroPortal key are owner decisions) Project 2 (bulk ingest feasibility): - add peer-politeness (outbound rate-limit) + provenance/freshness gates - soften admission-time canonical-IRI dedup (unreliable; needs post-parse backstop); label capacity per-onto figure as directional Docs only; no code. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ased) - Project 1: build-ready 7-task TDD plan (config → adapters → client → service → API → frontend → ops), with Global Constraints, Review Focus mapped to tasks, and the demo prerequisites called out as non-blocking. - Project 2: phased program plan (Phase 0 prereqs #402/dedup/license → Phase 1 gate framework (first TDD-able) → Phase 2 MOD-API harvest → Phase 3 evaluate → Phase 4 GitHub review-queue), contingent on go/no-go. Docs only; no code. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Federation is OFF by default. Peers parse defensively from FEDERATION_PEERS_JSON (malformed -> [] with a warning); auth.secret_ref names an env var and no secret is embedded. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…atch RecursionError Task 1 review follow-ups (security-relevant, minor): base_url with embedded userinfo is rejected (keeps "no secrets in parsed config"), invalid ports are rejected, and pathological nested JSON (RecursionError) no longer escapes get_federation_peers()'s never-raise guarantee. +2 tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…-API adapters Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…mbers, dedup, status Literal Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…, timeout search_artefacts / fetch_catalogue over the SSRF-guarded transport, with a manual redirect loop (allowlist + no https->http downgrade to non-allowlisted host), auth sent only to the peer's own host, a streaming response byte cap, and a per-peer timeout. Failures surface as a typed FederationFetchError with a stable reason (unauthorized/timeout/oversize/blocked_redirect/error). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…old + streaming cap Fix round 1 from review: - _check_redirect now refuses ANY https->http downgrade before the allowlist decision, closing a cleartext-secret leak on a 302 from https to http on the peer's own allowlisted host (auth was re-attached because host still matched). - cross-allowlisted-peer test proves A's secret is withheld when a redirect lands on peer B's host (B is actually contacted; the real withhold branch runs). - oversize test now drives a multi-chunk async stream and asserts the transfer is aborted mid-stream, not after buffering the whole body. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…up+append Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… to a cache miss Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ock) Fan-out to MOD-API peers only when federated AND federation_enabled AND offset==0 AND q non-empty; started up-front so it overlaps the local query. Remote rows are returned in a separate 'federated' block, never in ontologies[]. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…de, zero-peer paths list_ontologies is now a thin wrapper over _list_ontologies_local so the in-flight fan-out task is cancelled if the local query raises. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…alogues' section (#415) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…b a11y cue (#415) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…apikey)
Whole-branch review follow-ups:
- adapter landing-URL fallback now mirrors the client's {base_url}{mod_path}
/artefacts construction instead of hardcoding /mod/, so a homepage-less
artefact from a peer whose MOD-API isn't at /mod (e.g. AgroPortal /mod-api)
gets a resolvable source_landing_url. Self peer sets mod_path="/mod".
- client fetch-failure log uses the typed reason / exception class, not the
raw exception str, which for an apikey_param peer could stringify the URL
and leak the key into logs.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes part of #415 (Project 1 of 2). Adds client-side MOD-API federation:
GET /api/v1/ontologies?federated=truequeries configured remote Semantic Artefact Catalogues at request time, dedups their artefacts against the local page by IRI, and returns them in a separatefederatedblock — storing nothing. Carries the ESWC live-demo use case.Design & plan (in this PR)
docs/superpowers/specs/2026-11-24-mod-api-federation-design.md— design (incl. an independent review folded in)docs/superpowers/specs/2026-11-24-bulk-discovery-ingest-feasibility.md— Project 2 feasibility/go-no-go (not built here)docs/superpowers/plans/2026-11-24-mod-api-federation.md— the TDD plan this implementsWhat's included
ontoexplorer/modules/federation/: config +Peermodel, per-peer MOD-API response adapters (handles our real flattened JSON-LD@graph), an SSRF/auth/redirect/size-capped HTTP client, and a concurrent fan-out service (partial-failure tolerant, Redis-cached, dedup+append).GET /api/v1/ontologies?federated=true(onlist_ontologies) returns a separatefederated: {catalogues, results}block — off by default (federation_enabled=False), zero behavior change when inactive, remote rows never interleaved intoontologies[].safeHttp-guarded outbound links.Safety
federatedparam is a boolean; no caller-controlled URL ever reaches outbound);async_guarded_transport()+ per-hop redirect re-validation + any https→http downgrade refused; per-peer secret resolved from env and sent only to the peer host; streaming response size cap;javascript:/data:can't reach an href (backend http(s)-only and frontendsafeHttp).Testing
Not in this PR (owner-gated)
🤖 Generated with Claude Code