feat(support): include classic ref-code relationships in recommendation network graph#3897
Closed
Blume1977 wants to merge 1 commit into
Closed
feat(support): include classic ref-code relationships in recommendation network graph#3897Blume1977 wants to merge 1 commit into
Blume1977 wants to merge 1 commit into
Conversation
…on network graph The compliance recommendation network graph and panel only read the Recommendation table, so classic ref-code relationships (user.usedRef -> user.ref) were invisible even though they drive AML (InvalidKycStatusRefUser) and ref rewards. Traverse usedRef in both directions during the graph BFS, emit deduplicated ref-code edges (recommendation wins for shared pairs), expose the referrer userData id on user support info, and index user.usedRef for the reverse lookup.
|
This was referenced Jun 18, 2026
Collaborator
|
Superseded by #3948, which consolidates this work into a single PR per repo (per maintainer request). #3948 contains the classic ref-code edges from here plus the recommendation-graph edge-cap fix, the lazy 1-hop neighbor expansion (replacing the full-network load), and 100% unit-test coverage of the new endpoints/helpers. Closing in favor of #3948. |
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.
Problem
The compliance recommendation network graph (
getRecommendationGraph) and the recommendation panel read only theRecommendationtable. The classic ref-code relationship (user.usedRef→user.ref) is invisible there, even though it:InvalidKycStatusRefUseris evaluated againstgetRefUser(user.usedRef)), andThis is not an edge case: ~14,997 userDatas have a real
usedRef, of which ~92% have noRecommendationrow. A user onboarded via a ref code therefore appears as an isolated node in the network even when AML flags the referral.Concrete example
userData 330009 used ref code
171-364(owner: userData 321067,kycStatus = Check) → AML flaggedInvalidKycStatusRefUser, but the network graph showed 330009 isolated. The referrer 321067 itself reaches 47 ref-code children but only 13 show up in the graph today (recommendation rows only).Change
user.usedRefin both directions during the graph BFS (up viagetRefUsersByRefs, down via newgetUsersByUsedRefs).kind: UsedRefand therefCode; dedupe against recommendation edges per directed userData pair (confirmed recommendations also writeusedRef, so recommendation wins to avoid double edges).MAX_NODES = 500safety cap; full expansion within it.refUserDataIdon user support info so the panel can link to the referrer.user.usedRef(migration) for the reverse lookup.Verification
Validated against production data via the debug endpoint:
Notes
kind,refCode,refUserDataId;method/type/createdmade optional). Frontend counterpart: feat(compliance): show ref-code referrer in recommendation panel and network graph services#1122 (pair PR).support.servicetest harness (the original graph feature shipped without one); relied on live data verification.PR Completeness
user.usedRef)