test(referral): add edge case tests for cycle detection - #69
Merged
merlik787-droi merged 1 commit intoJul 22, 2026
Conversation
Add tests for cycle detection edge cases:
- test_direct_two_hop_cycle_should_fail: A->B->A direct cycle
- test_cycle_beyond_max_depth_not_detected: documents depth-limit behavior
The referral contract already has comprehensive cycle detection:
- Self-referral prevention ('Cannot refer yourself')
- Ancestor walk with configurable max_chain_depth
- Existing tests for 5-node cycles and deep chains
These tests verify edge cases and document the depth-limit limitation.
Implements Issue Riddlrealm#20
usmanimamu17-create
force-pushed
the
fix/issue-20-self-referral-cycle-detection
branch
from
July 22, 2026 10:20
a4c3d00 to
5aea95e
Compare
3 tasks
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
Add edge case tests for referral cycle detection to improve coverage and document depth-limit behavior.
Changes
test_direct_two_hop_cycle_should_fail: Verifies A?B?A direct cycle is rejectedtest_cycle_beyond_max_depth_not_detected: Documents that cycles beyondmax_chain_depthare not detected (expected depth-limit behavior)Existing Implementation
The referral contract already has comprehensive cycle detection:
Cannot refer yourself)max_chain_depthThese tests verify edge cases and document the depth-limit limitation.
Closes #20