[Feature] Add PostgreSQL search backend and module search-provider contracts #2

Closed
opened 2026-07-29 14:27:57 +02:00 by zemion · 2 comments
Owner

Parent: #1

Scope

Define the first production-capable search contract and self-hosted backend.

  • Core-owned versioned provider DTOs for searchable resource type, stable resource reference, title/summary fields, deep link, tenant/scope, visibility inputs, source revision, and change cursor.
  • Bounded provider-side extraction/backfill and durable delta ingestion without importing module implementations.
  • PostgreSQL full-text ranking plus optional trigram matching, language/config selection, deterministic tie-breaking, and cursor pagination.
  • Query-time principal/tenant filtering and explicit ACL recheck hooks for security-sensitive resources.
  • Index versioning, resumable rebuild, stale-row deletion, module-disable behavior, health/lag diagnostics, and operator-visible failure state.
  • Provider permutation and cross-tenant non-disclosure tests.

This baseline must run without OpenSearch.

Parent: #1 ## Scope Define the first production-capable search contract and self-hosted backend. - Core-owned versioned provider DTOs for searchable resource type, stable resource reference, title/summary fields, deep link, tenant/scope, visibility inputs, source revision, and change cursor. - Bounded provider-side extraction/backfill and durable delta ingestion without importing module implementations. - PostgreSQL full-text ranking plus optional trigram matching, language/config selection, deterministic tie-breaking, and cursor pagination. - Query-time principal/tenant filtering and explicit ACL recheck hooks for security-sensitive resources. - Index versioning, resumable rebuild, stale-row deletion, module-disable behavior, health/lag diagnostics, and operator-visible failure state. - Provider permutation and cross-tenant non-disclosure tests. This baseline must run without OpenSearch.
Author
Owner

Codex State: progress

Summary

  • Pushed PostgreSQL full-text search with a bounded SQLite development fallback, a tenant/ACL-filtered built-in index, optional live-provider aggregation, and core-owned provider/index-writer contracts.
  • Added global and contextual shell search contributions, provider diagnostics, migrations, and cross-tenant/ACL tests.

Changed Files

  • src/govoplan_search/backend/service.py
  • src/govoplan_search/backend/migrations/versions/a1b2c3d4e5f6_v0114_search_baseline.py

Verification

  • 5 module tests and Ruff passed; access+search+tenancy fresh-database smoke passed

Next / Blocked

  • Durable delta/backfill cursors, trigram matching, ACL recheck hooks, rebuild/lag diagnostics, and stable cursor pagination remain before this issue can close.

Suggested status label: status/in-progress

## Codex State: progress ### Summary - Pushed PostgreSQL full-text search with a bounded SQLite development fallback, a tenant/ACL-filtered built-in index, optional live-provider aggregation, and core-owned provider/index-writer contracts. - Added global and contextual shell search contributions, provider diagnostics, migrations, and cross-tenant/ACL tests. ### Changed Files - `src/govoplan_search/backend/service.py` - `src/govoplan_search/backend/migrations/versions/a1b2c3d4e5f6_v0114_search_baseline.py` ### Verification - `5 module tests and Ruff passed; access+search+tenancy fresh-database smoke passed` ### Next / Blocked - Durable delta/backfill cursors, trigram matching, ACL recheck hooks, rebuild/lag diagnostics, and stable cursor pagination remain before this issue can close. Suggested status label: `status/in-progress`
zemion added
status
in-progress
and removed
status
ready
labels 2026-07-29 15:54:01 +02:00
Author
Owner

Implemented and pushed in Core 920e3c9 and Search a156e3d.

The baseline now has versioned source/resource contracts, bounded resumable backfills, source revisions/change cursors, an idempotent persistent delta queue, stale-generation pruning, module-disable reconciliation, per-source health/lag/failure diagnostics, PostgreSQL FTS with optional pg_trgm detection/indexing, a bounded SQLite development fallback, deterministic opaque cursor pagination, and batched query-time authorization rechecks that fail closed. The public result API exposes no pre-authorization total and records source/index/ACL provenance.

Validation: 11 Search tests, Core source-contract and registry tests, both release/dev migration tracks, WebUI production build, Ruff, Xenon, static contract scan, manifest registry scan, dependency-boundary scan, and focused module-permutation tests pass. A live PostgreSQL service was not available in this workspace; PostgreSQL-specific SQL and conditional migration paths are implemented, while deployment-level PostgreSQL testing should remain in CI.

Implemented and pushed in Core 920e3c9 and Search a156e3d. The baseline now has versioned source/resource contracts, bounded resumable backfills, source revisions/change cursors, an idempotent persistent delta queue, stale-generation pruning, module-disable reconciliation, per-source health/lag/failure diagnostics, PostgreSQL FTS with optional pg_trgm detection/indexing, a bounded SQLite development fallback, deterministic opaque cursor pagination, and batched query-time authorization rechecks that fail closed. The public result API exposes no pre-authorization total and records source/index/ACL provenance. Validation: 11 Search tests, Core source-contract and registry tests, both release/dev migration tracks, WebUI production build, Ruff, Xenon, static contract scan, manifest registry scan, dependency-boundary scan, and focused module-permutation tests pass. A live PostgreSQL service was not available in this workspace; PostgreSQL-specific SQL and conditional migration paths are implemented, while deployment-level PostgreSQL testing should remain in CI.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: GovOPlaN/govoplan-search#2