Skip to content

Federation: Opensearch integration, federation init optimization, and P2P testing set-up - #331

Open
klpoland wants to merge 20 commits into
masterfrom
feature-kpoland-federation-opensearch-integration
Open

Federation: Opensearch integration, federation init optimization, and P2P testing set-up#331
klpoland wants to merge 20 commits into
masterfrom
feature-kpoland-federation-opensearch-integration

Conversation

@klpoland

@klpoland klpoland commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

In this PR:

  • OpenSearch:
    - Federation indices schema specification
    - Common Opensearch client and query methods (move out of gateway)
  • Federation Sync:
    - peer-to-peer test config
    - more just recipes for local deployment and testing
    - troubleshooting and bug-fixing fed init
    - GitHub actions to run pre-commit hooks and tests on federation app
  • Gateway:
    - Federated search
    - Integrate peer datasets into web UI views for public datasets (home and published search)
    - Clean up old, unused code

Note

Medium Risk
Changes federation indexing, peer identity (FQDN), and Docker build context for gateway/federation images—incorrect deploy or site_name mismatch could break sync or search, but scope is mostly shared libraries and test/ops tooling with regression tests added.

Overview
Introduces common/sds-opensearch-query (sds-opensearch-query) with shared OpenSearch client, fed-* index mappings/writes, query helpers, and Redis federation channel naming. Federation sync and gateway both depend on it; federation consolidates indexing/listing into fed_index, ensures fed-* indices on startup, and drops the separate fed_search module.

Federation identity and sync behavior now treat OpenSearch site_name and webhook allowlists as peer FQDNs (not short [site].name), with bootstrap/backfill and Redis payloads aligned. Site-hello backfill runs in the background with retries on peer list-* calls; peer HTTP goes through peer_http. Federated doc schemas allow extra gateway fields and search_props on captures.

Build/CI: repo-root .dockerignore, gateway/federation Docker/Compose build context: .., new federation-checks workflow (prek + pytest), and gateway workflow image build context update.

Local/remote P2P testing: compose.peer.local.yaml, compose.peer.remote.yaml, deploy/seed/verify scripts, README and peer-remote docs; compose env shifts toward federation-shared.env + gateway OpenSearch env instead of federation-only sync env files.

Reviewed by Cursor Bugbot for commit 6d9a703. Bugbot is set up for automated code reviews on this repo. Configure here.

@klpoland klpoland changed the title Feature-kpoland-federation-opensearch-integration Federation: Opensearch integration, federation init optimization, and P2P testing set-up Aug 4, 2026
@klpoland klpoland self-assigned this Aug 4, 2026
@klpoland klpoland added documentation Improvements or additions to documentation feature New feature or request ci/cd GH actions, tests, builds, packaging, etc refactoring General code improvements federation Federation related work (sync service, document storage, peer configuration, etc.) labels Aug 4, 2026
@klpoland
klpoland requested a review from lucaspar August 5, 2026 16:49
@klpoland
klpoland marked this pull request as ready for review August 5, 2026 16:49
Comment thread federation/scripts/verify_federation_live.py
Comment thread federation/scripts/verify_federation_live.py
Comment thread federation/scripts/verify_federation_live.py
Comment thread common/sds_opensearch_query/client.py
Comment thread federation/sds_federation/services/bootstrap.py Outdated
Comment thread common/sds_opensearch_query/mapping.py Outdated
Comment thread gateway/.envs/example/django.env Outdated
Comment thread common/pyproject.toml
Comment thread federation/scripts/verify_federation_live.py
Comment thread .github/workflows/fed-code-quality.yaml
Comment thread federation/tests/test_regression_opensearch_indices.py
Comment thread common/sds_opensearch_query/mapping.py
Comment thread federation/scripts/verify_federation_live.py
Comment thread gateway/sds_gateway/users/views/datasets.py
Comment thread gateway/sds_gateway/api_methods/federation/search_helpers.py
Comment thread common/uv.lock
@klpoland
klpoland force-pushed the feature-kpoland-federation-opensearch-integration branch from 8a67d90 to c9abc50 Compare August 13, 2026 13:58
Comment thread .github/workflows/fed-code-quality.yaml
Comment thread .github/workflows/fed-code-quality.yaml
Comment thread federation/sds_federation/main.py Outdated
Comment thread .github/workflows/gwy-code-quality.yaml

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6d9a703. Configure here.

"verify_certs": verify_certs,
"ssl_show_warn": False,
"connection_class": RequestsHttpConnection,
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty OpenSearch auth always sent

High Severity

build_opensearch_client always sets http_auth via HTTPBasicAuth, even when user and password are empty. Federation previously constructed the client with no auth. Peer compose sets blank OpenSearch credentials with security disabled, so requests now send an empty Basic Authorization header and can fail against unauthenticated OpenSearch.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6d9a703. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/cd GH actions, tests, builds, packaging, etc documentation Improvements or additions to documentation feature New feature or request federation Federation related work (sync service, document storage, peer configuration, etc.) refactoring General code improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant