fix(relay): stop multi-channel HTTP query from narrowing to one UUID - #5307
fix(relay): stop multi-channel HTTP query from narrowing to one UUID#5307BradGroux wants to merge 1 commit into
Conversation
|
This is the third recurring review + rebase pass for the open BradGroux PRs on What this PR doesFixes a relay bug where The implementation iterates the tag values, tracks the first UUID found, and returns Correctness
Rebase resultAlready based on current main (
No code changes were made — this was a review + rebase pass only. |
c3c0836 to
a63a022
Compare
|
Portfolio review update (2026-08-09) I rechecked the relay query narrowing behavior against current I rebased the branch onto |
a63a022 to
36b2858
Compare
|
Portfolio rebase and review update (2026-08-11) Rebased onto Still needed: The multi- Verification: |
|
Confirming this from a self-hosted relay, with two pieces of evidence I have not seen in the other threads on this bug. The relay already documents the behaviour this PR restores
"h" => {
// Single #h is pushed as channel_id; multi-#h is not.
if tag_values.len() > 1 {
return false;
}
}
fn extract_channel_id_from_filter(filter: &Filter) -> Option<uuid::Uuid> {
for (tag_key, tag_values) in filter.generic_tags.iter() {
...
if let Ok(id) = val.parse::<uuid::Uuid>() {
return Some(id);So the COUNT path correctly refuses to push multi- Three other call sites already implement the guard this PR adds, which is why I read it as a missing guard rather than a design question:
That last one is worth highlighting: the project has already written the correct multi- Reproduction on real dataSelf-hosted relay, one account,
Five workflows across three channels. Desktop's The batching itself is correct and documented in One honest caveat on this fixReturning Not a blocker for this PR, which is a correct minimal fix and strictly better than the status quo. Flagging it so the follow-up is on the record: pushing the requested set into DuplicatesThis is reported in #2385 (oldest), #4419, #4659, #4804 and #5053, with #4446 and #5339 as alternative fixes. Consolidating on #2385 plus this PR would probably make the state of it easier to see. |
|
Thanks for the thorough confirmation and the real-world reproduction — this is the best evidence on this bug I've seen in any of the threads. Verified against current
|
36b2858 to
51a7417
Compare
|
Rebased onto latest main (4b35706, the 0.5.10 release). No conflicts — Reviewed for accuracy and continued relevance:
The PR is mergeable and ready for review. |
51a7417 to
e7a79cc
Compare
|
Portfolio rebase and review update (2026-08-13) Rebased onto Still neededYes. The multi-channel HTTP query narrowing fix is not superseded. Two other open PRs from other contributors still target the same bug — #4446 (client-side workaround sending N single- The LIMIT caveat documented in the previous review still applies: returning Verification
|
A POST /query filter with multiple #h values silently returned events from only the lexicographically smallest channel UUID, ignoring all others. The single-filter extract_channel_id_from_filter returned the first parseable UUID from the BTreeSet-ordered #h values, which pinned the SQL to a single channel. The multi-filter variant extract_channel_id_from_filters already had the correct guard — return None when more than one distinct channel appears — but the HTTP bridge path used the single-filter variant without that guard. When extract_channel_id_from_filter returns None, apply_access_scope_to_query replaces the single-channel pin with the caller's full accessible-channel IN-list, and the existing per-event post-check keeps results correct. Closes block#5053. Co-authored-by: Brad Groux <brad@digitalmeld.com> Signed-off-by: Brad Groux <brad@digitalmeld.com>
e7a79cc to
ab4ec58
Compare
Rebase review — 2026-08-15Rebased onto current Still-needed assessmentChecked all 41 new commits for overlap. None supersede this PR. The PR remains the correct fix for its subject area. Verification
|
Summary
A
POST /queryfilter with multiple#hvalues silently returned events from only the lexicographically smallest channel UUID, ignoring all other listed channels. The desktop Workflows screen issues exactly this shape — one filter with all member-channel IDs — so workflows in any channel other than the smallest UUID were invisible.The single-filter
extract_channel_id_from_filterreturned the first parseable UUID from theBTreeSet-ordered#hvalues, which pinned the SQL tochannel_id = <that uuid>. The multi-filter variantextract_channel_id_from_filtersalready had the correct guard — returnNonewhen more than one distinct channel appears — but the HTTP bridge path (build_event_query_from_filter) used the single-filter variant without that guard.The fix gives
extract_channel_id_from_filterthe same multi-channel semantics as the plural variant: returnNonewhen the filter carries more than one distinct channel UUID.apply_access_scope_to_querythen replaces the single-channel pin with the caller's full accessible-channelIN-list, and the existing per-event post-check (filters_match+ accessible-channel check) keeps results correct.Related issue
Fixes #5053.
Testing
None), no channel tag (returnsNone), and duplicate same channel (returns the channel).buzz-relaylibrary test suite: 863 passed, 8 failed (allPoolTimedOut— database-dependent media/admin tests that fail identically on cleanmainwithout a Postgres connection).cargo fmt --checkandcargo clippy -- -D warningspassed forbuzz-relay.