Skip to content

fix(query): refresh namespace-filtered synced queries on deep CRUD (catalog Removed on delete)#295

Open
rbuergi wants to merge 1 commit into
mainfrom
fix/catalog-refresh-on-namespace-crud
Open

fix(query): refresh namespace-filtered synced queries on deep CRUD (catalog Removed on delete)#295
rbuergi wants to merge 1 commit into
mainfrom
fix/catalog-refresh-on-namespace-crud

Conversation

@rbuergi

@rbuergi rbuergi commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Task #10 — the start-page "Open threads" catalog didn't refresh after deleting a thread.

Root

The reactive change-feed relevance filter asks PathMatcher.ShouldNotify(changedPath, BasePath, Scope) — a path check. The catalog queries by namespace (namespace:{owner}/*_Thread, no path:), so BasePath is empty and Scope degrades to "direct children of root". A thread deleted 3 levels deep at {owner}/_Thread/{id} is judged out of scope → no re-query → no Removed → the deleted thread lingers (and new/Done ones don't update either).

Fix (your Service-Broker-style "check in-scope → refresh")

Ask the broadcast CRUD event whether it's in the query's scope by namespace, not just path:

  • PathMatcher.ShouldNotifyForQuery(path, base, scope, namespaces) = ShouldNotify OR the changed node's namespace (path minus last segment) matches a query namespace (wildcard-aware).
  • ParsedQuery.ExtractNamespacePatterns() collects the namespace glob patterns too (ExtractNamespaces stays concrete-only for aggregator routing, which can't route a glob). The parser rewrites the user's * → SQL-LIKE %, so the matcher accepts either.
  • PostgreSqlMeshQuery captures the patterns and uses the new predicate in both the early + live change subscriptions.

PG broadcast events carry only the path (pg_notify sends the key, not the row), so the in-scope test is path/namespace-based; the subsequent re-query applies the content filters (nodeType, status).

Tests

Pure logic → fully unit-tested, no Postgres. QueryChangeRelevanceTest drives Created / Updated / Deleted for an in-scope thread + out-of-scope negatives (non-thread same partition, different partition) + the namespace glob — 10/10 green, -warnaserror clean.

🤖 Generated with Claude Code

…atalog Removed on delete)

The reactive change-feed relevance filter (PostgreSqlMeshQuery) asked PathMatcher.ShouldNotify(
changedPath, BasePath, Scope) — a PATH check. The 'open threads' catalog queries by NAMESPACE
(namespace:{owner}/*_Thread, no path:) → empty BasePath → Scope degraded to 'direct children of
root'. A thread deleted 3 levels deep at {owner}/_Thread/{id} was judged out of scope → no
re-query → the catalog kept showing the deleted thread (and never showed new ones / dropped
Done ones).

Fix — ask the broadcast event if it's in the query's scope by NAMESPACE too, not just path
(the user's Service-Broker-style 'check in-scope → refresh'):
  • PathMatcher.ShouldNotifyForQuery(path, base, scope, namespaces) = ShouldNotify OR the changed
    node's namespace (path minus last segment) matches a query namespace (wildcard-aware).
  • ParsedQuery.ExtractNamespacePatterns() collects namespace Like/glob patterns too (ExtractNamespaces
    stays concrete-only for aggregator routing, which can't route a glob). The parser rewrites the
    user's * → SQL-LIKE %, so the matcher accepts either.
  • PostgreSqlMeshQuery captures the patterns per filter and uses ShouldNotifyForQuery in both the
    early + live change subscriptions.

PG broadcast events carry only the path (pg_notify sends the key, not the row), so the in-scope
test is path/namespace-based; the subsequent re-query applies the content filters (nodeType, status).
Pure logic → fully unit-tested: QueryChangeRelevanceTest drives Created/Updated/Deleted for an
in-scope thread + out-of-scope negatives (10/10). No Postgres needed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Test Results (shard 2)

696 tests  ±0   694 ✅ ±0   1m 51s ⏱️ -9s
  9 suites ±0     2 💤 ±0 
  9 files   ±0     0 ❌ ±0 

Results for commit 96ea17a. ± Comparison against base commit f057e77.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Test Results (shard 1)

1 029 tests  ±0   1 028 ✅ ±0   3m 32s ⏱️ ±0s
    8 suites ±0       1 💤 ±0 
    8 files   ±0       0 ❌ ±0 

Results for commit 96ea17a. ± Comparison against base commit f057e77.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Test Results (shard 5)

866 tests  +133   686 ✅ +132   4m 18s ⏱️ + 1m 41s
  9 suites ±  0   180 💤 +  1 
  9 files   ±  0     0 ❌ ±  0 

Results for commit 96ea17a. ± Comparison against base commit f057e77.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Test Results (shard 3)

798 tests  +10   798 ✅ +10   3m 51s ⏱️ +2s
 10 suites ± 0     0 💤 ± 0 
 10 files   ± 0     0 ❌ ± 0 

Results for commit 96ea17a. ± Comparison against base commit f057e77.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Test Results (shard 0)

631 tests  ±0   631 ✅ ±0   4m 59s ⏱️ +20s
 10 suites ±0     0 💤 ±0 
 10 files   ±0     0 ❌ ±0 

Results for commit 96ea17a. ± Comparison against base commit f057e77.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Test Results (shard 4)

   10 files  ±  0     10 suites  ±0   5m 5s ⏱️ + 1m 39s
1 348 tests +130  1 348 ✅ +130  0 💤 ±0  0 ❌ ±0 
1 387 runs  +159  1 387 ✅ +159  0 💤 ±0  0 ❌ ±0 

Results for commit 96ea17a. ± Comparison against base commit f057e77.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

Test Results

   56 files  ±  0     56 suites  ±0   23m 39s ⏱️ + 3m 33s
5 368 tests +273  5 185 ✅ +272  183 💤 +1  0 ❌ ±0 
5 407 runs  +302  5 224 ✅ +301  183 💤 +1  0 ❌ ±0 

Results for commit 96ea17a. ± Comparison against base commit f057e77.

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