[WPB-27169] Include collaborators in contact search. - #5515
Draft
fisx wants to merge 8 commits into
Draft
Conversation
…rch (second attempt). (#5488) * Include team collaborators in contact search. * Implement TeamCollaboratorsSubsystem interpreter with BrigAPIAccess. Was previously UserSubsystem, but since it TeamCollaboratorsSubsystem is also used outside of Brig, that is not always available. Further changes: - Support BrigAPIAccess locally in Brig. - Change collaborator field type in UserDoc to collapse `Nothing` and `Just []` (remove the Maybe). * Fix brig-index: do not bump index version in failure case. * Add release notes on required postgres setup steps. --------- Co-authored-by: Gautier DI FOLCO <gautier.difolco@wire.com>
Contributor
Author
it's flaky, but looks related? |
Contributor
Author
|
also the "failing tests" in bf093e1 are not failing. interesting. |
5 tasks
This reverts commit 7aa933b.
The Problem: User accounts can legitimately be in an inconsistent
state, eg., because a team is in the process of being deleted: Team
member entry is already gone, but brig account entry still exists.
This causes `brig-index`'s bulk sync to fail because Galley returns
404 for team-related lookups. (The `try`-wrapped calls produce `Left
SomeException`; `mkUserDoc`, `mkDocVersion` handle this by skipping
the account, `ReindexSameOrNewer` throws.)
Evidence from the logs coinciding with a failing index migration:
```
2026-09-02 13:53:42.640 error
{
"error": "RPCException {"remote" = "galley", "path" = "i/teams/645c4b69-46f1-49a8-be57-35374d0aa947/features/searchVisibilityInbound", "headers" = [("Request-Id","brig-index")],
"cause" = HttpExceptionRequest
Request {
host = "galley"
port = 8080
secure = False
requestHeaders = [("Request-Id","brig-index")]
path = "i/teams/645c4b69-46f1-49a8-be57-35374d0aa947/features/searchVisibilityInbound"
queryString = ""
method = "GET"
proxy = Nothing
rawBody = False
redirectCount = 10
responseTimeout = ResponseTimeoutDefault
requestVersion = HTTP/1.1
proxySecureMode = ProxySecureWithConnect
}
(Response {responseStatus = Status {statusCode = 404,
statusMessage = "Not Found"},
responseVersion = HTTP/1.1,
responseHeaders = [("Transfer-Encoding","chunked"),("Date","Wed, 02 Sep 2026 11:53:35 GMT"),
("traceparent","00-f96c377d85487f15da6832eed1144233-1f618513676d5162-01"),("tracestate",""),("Content-Encoding","gzip"),("Content-Type","application/json"),("Vary","Accept-Encoding")],
responseBody = (),
responseCookieJar = CJ {expose = []},
responseClose' = ResponseClose,
responseOriginalRequest = ...
responseEarlyHints = []}) "{\"code\":404,\"label\":\"no-team\",\"message\":\"Team not found\"}")}",
"userId": "19d790a4-8ac3-4fd9-81a9-ef24af8c8bf9",
"request": "brig-index",
"msgs": [
"E",
"Error ocurred while indexing user"
]
}
```
The solution is graceful degradation: when Galley says "team not
found" (or any Galley error), treat it as "team no longer exists" and
fall back to safe defaults instead of skipping the user entirely.
- **Visibility**: fallback to `SearchableByOwnTeam`. Rationale:
`SearchableByOwnTeam` would be an alternative, but in the unlikely
case that that would be set to "all teams", an account may end up
being searchable even though the specifically were set up not to.
- **Role**: fallback to `Nothing` (user has no role if the team doesn't exist)
- **Collaborations**: already reads from Postgres, unaffected by Galley 404s
The downstream functions `indexUserToDoc` and `indexUserToVersion` already
accept `Maybe Role` / `Maybe (WithWritetime Role)` and handle `Nothing`
gracefully, so no changes needed there.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://wearezeta.atlassian.net/browse/WPB-27169
related:
Checklist
changelog.d