Skip to content

test: search reflects publish/unpublish (DataSpaceBackend#193) - #104

Merged
saqibmanan merged 3 commits into
CIfrom
test-sync/DataSpaceBackend-pr193
Sep 18, 2026
Merged

saqibmanan merged 3 commits into
CIfrom
test-sync/DataSpaceBackend-pr193

Conversation

@saqibmanan

@saqibmanan saqibmanan commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Covers CivicDataLab/DataSpaceBackend#193 (merge 89cb9e4). Base: CI, the branch whose workflows run.

What changed (from the diff): search results are cached for an hour under a version key that publishing bumps. Before #193 the bump ran before the Elasticsearch write, and the write wasn't refreshed, so a search right after publish or unpublish re-cached the old results for the full hour. #193 moved invalidation after a refreshed write, and stopped the version key from expiring.

Tests, one per marker:

Marker Test Runs in
smoke test_sitemap_datasets_count_matches_backend (existing, read-only) now also marked smoke dev smoke stage, PR gate, prod
functional test_published_dataset_is_searchable: publish → findable, unpublish → gone (polls up to 20s) dev functional stage, PR gate
regression test_search_reflects_publish_without_waiting: query cached first, then read immediately after publish and after unpublish, no wait PR gate

The sitemap check is what caught #193 on a prod deploy, but it was readonly-only, so it never ran on dev or in the PR gate. The two new tests write (they publish), so they live in tests/api/functional and never run on prod.

Search membership is checked by filtering on the automated-test tag, not a text query: title search runs a fuzzy term query against 4-gram tokens, so a long unique title never matches (and KHOJ finds 0 while khoj finds 2).

Proof against dev, retries off:

  • green: 2 passed (functional + regression); sitemap 1 passed
  • red, with each assertion flipped: 2 failed; sitemap window flipped: 1 failed
  • reverted: green again

Not covered: the version key's no-expiry fix. Proving it needs a >300s wait against a shared cache, which doesn't belong in CI.

It was readonly-only, so it ran on prod deploys but never on dev deploys or in the
PR gate. It is the check that caught DataSpaceBackend#193 (stale search totals)
on a prod deploy; with smoke it catches the same regression on dev first.
Covers the publish/unpublish -> search path from DataSpaceBackend#193. Filters
search on the automated-test tag because title search is a fuzzy term query
against 4-gram tokens and cannot match a long unique title.
Regression for DataSpaceBackend#193: the query is cached before publishing, then
read immediately after publish and after unpublish with no wait. Stale cache
invalidation or an unrefreshed index write fails it.
@saqibmanan
saqibmanan force-pushed the test-sync/DataSpaceBackend-pr193 branch from 9a07430 to 8ce3679 Compare September 18, 2026 09:09
@saqibmanan saqibmanan changed the title test: search reflects publish/unpublish without waiting (DataSpaceBackend#193) test: search reflects publish/unpublish (DataSpaceBackend#193) Sep 18, 2026
@saqibmanan
saqibmanan marked this pull request as ready for review September 18, 2026 11:33
@saqibmanan
saqibmanan merged commit 2a2bcc4 into CI Sep 18, 2026
2 of 3 checks passed
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.

1 participant