Skip to content

Conversation

@hmans
Copy link
Owner

@hmans hmans commented Jan 20, 2026

Summary

Fixed incomplete cycle detection that previously allowed cycles to be created using only blocked_by relationships or mixing blocking and blocked_by in ways that created conflicts.

Changes

  • Enhanced cycle detection to check both blocking and blocked_by graph traversals
  • Added validation in CreateBean to verify targets exist and check for immediate cycles
  • Updated AddBlocking to detect cycles via blocked_by relationships and vice versa
  • Added comprehensive test coverage for all cycle detection scenarios

All tests pass.

- Fixed AddBlockedBy to check cycles in both blocking and blocked_by graphs
- Updated AddBlocking to also check blocked_by for cross-relationship cycles
- Added cycle validation to CreateBean when blocked_by is provided
- Added validation that blocking/blocked_by targets exist at creation time
- Updated DetectCycle in beancore to support blocked_by link type
- Added comprehensive tests for cycle detection scenarios:
  - blocked_by-only cycles
  - cross-relationship cycles (blocking ↔ blocked_by)
  - self-reference prevention
  - nonexistent bean validation

Refs: #62
@hmans hmans merged commit 93ea28f into main Jan 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants