fix(typologies): keep fraud rings on disjoint account ranges#14
Open
akhilesharora wants to merge 1 commit into
Open
fix(typologies): keep fraud rings on disjoint account ranges#14akhilesharora wants to merge 1 commit into
akhilesharora wants to merge 1 commit into
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
3 tasks
162d38d to
0bfc003
Compare
Each fraud ring picked a contiguous account block without excluding accounts used by earlier rings, so two rings could share accounts: they merged into one non-cycle component and their involved_accounts labels overlapped. Draw all the accounts the rings need up front from one pool of distinct ids, then hand each ring its own slice. Raise when the rings need more accounts than exist instead of silently emitting fewer, which also drops the old fallback that referenced accounts past num_accounts at tiny scale.
bb89ca2 to
2fd4aad
Compare
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.
Summary
Fraud rings were placed on contiguous account ranges with no check against accounts already used by earlier rings, so ranges overlapped and rings that share an account merge into one non-cycle component with ambiguous per-ring labels. This tracks the accounts used so far and retries until a ring's range is disjoint; if no disjoint range is left it stops adding rings rather than emitting an overlapping one.
Type of change
feat- new featurefix- bug fixdocs- documentation onlytest- adding or updating testsrefactor- code refactoring (no feature/fix)ci- CI/CD changeschore- maintenanceLinked issues
Closes #13
Checklist
pytest tests/ -v --cov=gen_fraud_graph)ruff check . && black --check . && mypy src/)ruff checkandblack --checkpass on the changed files; the new test brings the suite to 43 passed at 98.33% coverage.mypycould not run in my environment (the installed numpy stubs use 3.12+typesyntax that the local mypy rejected under Python 3.14); it is unaffected by this change and runs in CI. CHANGELOG updated; no README change needed (behaviour-only). CLA: I will sign when the bot prompts.Notes for reviewers
max_account_id < depth + 1fallback (single ring at the smallest scales) is unchanged.test_rings_use_disjoint_accountsasserts disjointinvolved_accounts; it fails on the pre-fix code and passes after.