Skip to content

brig-index: Don't fail when a user doc fails to build#4839

Merged
akshaymankar merged 12 commits intodevelopfrom
better-brig-index
Apr 21, 2026
Merged

brig-index: Don't fail when a user doc fails to build#4839
akshaymankar merged 12 commits intodevelopfrom
better-brig-index

Conversation

@akshaymankar
Copy link
Copy Markdown
Member

@akshaymankar akshaymankar commented Nov 5, 2025

https://wearezeta.atlassian.net/browse/WPB-21555

Checklist

  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Nov 5, 2025
Copy link
Copy Markdown
Contributor

@fisx fisx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM so far.

syncAllUsersWithVersion interpreter mkVersion =
runConduit $
zipSources (CL.sourceList [1 ..]) (paginateWithStateC (getIndexUsersPaginated pageSize))
zipSources (CL.sourceList [1 ..]) (paginateWithStateC (interpreter . getIndexUsersPaginated pageSize))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hehe, nice hack. makes sense to me!

(why is this not how we want to do things? :-))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function is aware of all the transitive dependencies of the interpreters of the effects it depends on. This makes substituting them basically impossible. So all the polysemy things we do here are pointless.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I manged to resolve this by adding Member constraints :)

@jschaul jschaul marked this pull request as ready for review November 10, 2025 12:08
@jschaul jschaul requested a review from a team as a code owner November 10, 2025 12:08
This removes the need for having postgres. This commit doesn't remove the
requirement of postgres from various commands because this might be needed again
soon as the work for migrating user data to postgres is underway.
@akshaymankar akshaymankar requested review from a team as code owners April 16, 2026 13:05
Copy link
Copy Markdown
Contributor

@battermann battermann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval proforma

I am not sure if it is good to skip potentially many valid users, when there is a http call failure? but this might be the trade off that we have to pay, if we want performance and resilience at the same time?


roles :: Map UserId (Either SomeException (WithWritetime Role)) <-
fmap (Map.fromList . concat) . pooledForConcurrentlyN 16 (Map.toList teams) $ \(t, us) -> do
eithMembers <- try $ interpreter $ (.members) <$> selectTeamMemberInfos t (fmap (.userId) us)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if selectTeamMemberInfos fails, this will skip a whole chunk of users (all of the team users that are on the requested page) even though some of them might be valid. is this desired?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not really desirable, I guess we could just get details of each user one by one as a fallback. Let me try that.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made something slightly cleverer, when there is a failure, the new code splits the users in half and makes two calls. If there is only one invalid user, it should get there in O(log n), I think.

@akshaymankar akshaymankar requested a review from battermann April 16, 2026 14:39
@akshaymankar akshaymankar merged commit 5aa77be into develop Apr 21, 2026
10 checks passed
@akshaymankar akshaymankar deleted the better-brig-index branch April 21, 2026 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants