Skip to content

fix(relay): stop multi-channel HTTP query from narrowing to one UUID - #6648

Open
BradGroux wants to merge 1 commit into
block:mainfrom
BradGroux:fix/relay-multi-h-query-narrowing
Open

fix(relay): stop multi-channel HTTP query from narrowing to one UUID#6648
BradGroux wants to merge 1 commit into
block:mainfrom
BradGroux:fix/relay-multi-h-query-narrowing

Conversation

@BradGroux

Copy link
Copy Markdown
Contributor

Note: This is a replacement for PR #5307, which was accidentally closed when branches were force-pushed after a commit identity rewrite. The changes are identical, rebased onto the latest main.

Summary

A POST /query filter with multiple #h values 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_filter returned the first parseable UUID from the BTreeSet-ordered #h values, which pinned the SQL to channel_id = <that uuid>. 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 (build_event_query_from_filter) used the single-filter variant without that guard.

The fix gives extract_channel_id_from_filter the same multi-channel semantics as the plural variant: return None when the filter carries more than one distinct channel UUID. apply_access_scope_to_query then replaces the single-channel pin with the caller's full accessible-channel IN-list, and the existing per-event post-check (filters_match + accessible-channel check) keeps results correct.

Related issue

Fixes #5053.

Testing

  • 4 new unit tests covering the single-filter extraction: single channel, multiple distinct channels (returns None), no channel tag (returns None), and duplicate same channel (returns the channel).
  • Full buzz-relay library test suite: 863 passed, 8 failed (all PoolTimedOut — database-dependent media/admin tests that fail identically on clean main without a Postgres connection).
  • cargo fmt --check and cargo clippy -- -D warnings passed for buzz-relay.

@BradGroux

Copy link
Copy Markdown
Contributor Author

This is a replacement for #5307, which was accidentally closed when branches were force-pushed after a commit identity rewrite. Prior review comments and feedback are preserved on the old PR:

#5307

@BradGroux
BradGroux force-pushed the fix/relay-multi-h-query-narrowing branch from 6c709a2 to 100b333 Compare August 25, 2026 19:16
@BradGroux

Copy link
Copy Markdown
Contributor Author

Rebased onto the latest main (was 36 commits behind). The branch applied cleanly. extract_channel_id_from_filter still returns the first UUID from a multi-channel #h filter instead of returning None on current main, so this fix is still needed.

No review comments on this PR. CI will verify the build and test gate.

@BradGroux
BradGroux force-pushed the fix/relay-multi-h-query-narrowing branch from 100b333 to 6028d2f Compare August 29, 2026 16:15
@github-actions

github-actions Bot commented Aug 29, 2026

Copy link
Copy Markdown

🔐 Codex Security Review

Status: review required for the current range.

The current range is f038cbbb0d4092a72ffd93f17916f84d2b39bb43...f35e8b46e3df680ceef35872a183d464a2ec6b35.
A new review must complete for this exact range. When manual authorization
is required, a Block organization member must comment exactly
@buzz-security-review f35e8b46e3df680ceef35872a183d464a2ec6b35 to authorize a new review.
Any previous review applies only to its recorded range.

@BradGroux

Copy link
Copy Markdown
Contributor Author

Rebased onto the latest main (was 62 commits behind at f249710, now at 00e61ea). The branch applies cleanly with all tests passing.

Still-needed assessment: No upstream commits in the 62-commit window address the same issue. This PR remains needed.

Review requests: buzz-oss-team review request is active from the previous pass.

@BradGroux
BradGroux force-pushed the fix/relay-multi-h-query-narrowing branch from 6028d2f to c7a74d7 Compare September 2, 2026 17:30
@BradGroux

Copy link
Copy Markdown
Contributor Author

Rebased onto current block:main (2af9773d6) — 38 new commits since the last rebase pass (Aug 29, 00e61eafa). Rebased cleanly with no conflicts.

Still needed: Checked all 38 new upstream commits for overlap with this PR's topic. None of the upstream changes address the issue this PR fixes. The PR remains relevant.

Verification:

  • Branch is 0 commits behind block:main, mergeable on GitHub
  • All commits authored as Brad Groux (3053586+BradGroux noreply)
  • DCO signoff preserved on all commits

@BradGroux
BradGroux force-pushed the fix/relay-multi-h-query-narrowing branch from c7a74d7 to a81a1b4 Compare September 3, 2026 17:18
@BradGroux

Copy link
Copy Markdown
Contributor Author

Rebase and review — 2026-09-03

Base commit: 752cbfc03 (latest main)
Mergeable: Yes
Conflicts: None — rebased cleanly.

Accuracy review: Multi-channel HTTP query still narrows to one UUID.
Continued relevance: Still needed.

@BradGroux
BradGroux force-pushed the fix/relay-multi-h-query-narrowing branch from a81a1b4 to 8bc9120 Compare September 3, 2026 17:46
@BradGroux

Copy link
Copy Markdown
Contributor Author

Rebase and review update — Sep 3, 2026

Rebased onto latest main (88687876f). No conflicts — the new main commit (88687876f) added relay lifecycle logging in buzz-relay/src/main.rs and buzz-relay/src/lifecycle.rs, but does not touch the multi-channel HTTP query path in api/bridge.rs.

Accuracy review: Main's multi-channel HTTP query still narrows to a single UUID when multiple channel IDs are requested. The PR's fix to stop the query from collapsing to one channel is still needed.

Mergeable status: Confirmed MERGEABLE on GitHub after force-push.

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>
Signed-off-by: Brad Groux <bradgroux@hotmail.com>
Signed-off-by: Brad Groux <3053586+BradGroux@users.noreply.github.com>
@BradGroux

Copy link
Copy Markdown
Contributor Author

Rebase pass — Sep 5, 2025

Rebased onto current upstream main (f038cbbb0). Main moved 62 commits since the Sep 2 rebase pass (2af9773d6).

Rebase result

Rebased cleanly onto current main. No conflicts.

Still-needed assessment

Checked all 62 new main commits for overlap with this PR's topic. None obsoleted:

Verification

  • PR confirmed MERGEABLE on GitHub
  • All commits authored as Brad Groux (3053586+BradGroux noreply)
  • DCO signoff preserved on all commits
  • Review requests to buzz-oss-team still active from the Aug 24 recovery pass

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.

HTTP bridge /query with multiple #h values silently narrows to the lexicographically smallest channel UUID — Workflows screen shows "No workflows yet"

1 participant