-
Notifications
You must be signed in to change notification settings - Fork 726
feat: improve member query (CM-764) #3583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
7a3d08b to
f2e6d80
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is being reviewed by Cursor Bugbot
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| })) | ||
| }) | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Data Exposure: Attributes Unfiltered
The refactoring removed attribute filtering logic that previously limited returned attributes to avatarUrl, isBot, isTeamMember, and jobTitle. Now all attributes in m.attributes are returned unfiltered. This unintentional behavior change could expose unexpected data or break consumers expecting the filtered subset.
f37ad7d to
92e3cb0
Compare
Query Optimization — Extracted Builder & Smarter Execution Paths
Summary
queryMembersAdvancedto delegate SQL construction to a newqueryBuildermodule.Key Changes
buildQuery— main data query supporting multiple optimized paths.buildCountQuery— lightweight query for counting members, without unnecessary joins.member_searchandmember_orgsCTEs only when required.ORDER BYfields with sensible defaults.Execution Paths in
buildQuery1️⃣ Direct ID Path (
useDirectIdPath)filterStringpinsm.idto a single value or a small list (≤ ~100)memberSegmentsAgg (msa)members, optionalmember_orgs/memberEnrichments)2️⃣ ActivityCount-Optimized Path
activityCount(or no explicitorderBy)me.*top_membersCTE selecting best members bymsa."activityCount"(with oversampling)3️⃣ Generic Fallback Path
me.*filters, no aggregates, etc.)Count Query
buildCountQuerygenerates a minimalCOUNT(DISTINCT m.id)query.msa,member_orgs, ormember_searchwhen relevant).Why This Matters
msa(indexed) and filters externally to keep pages filled.Note
Extracts a query builder and data processors, adding optimized execution paths and streamlined search/filter/order logic for member queries with parallelized related-data loading.
queryMembersAdvancedto usebuildSearchCTE,buildQuery, andbuildCountQueryfrommembers/queryBuilderwith defaultorderBy=activityCount_DESC.QUERY_FILTER_COLUMN_MAP; tweaksactivityCountmapping tomsa."activityCount".moveAffiliationsBetweenMembers.members/dataProcessorwithsortActiveOrganizations,fetchOrganizationData(orgs + LFX), andfetchSegmentData; used to assemblemember.organizationsandmember.segments.members/base.ts; drops unused imports; streamlines enums/column arrays.Written by Cursor Bugbot for commit c65997d. This will update automatically on new commits. Configure here.