Skip to content

[AUDIT] Circular dependency detection produces duplicate cycles #135

@rsionnach

Description

@rsionnach

Severity: MEDIUM
File: src/nthlayer/slos/dependencies.py:309-343
Category: Logic error

detect_circular_dependencies creates a fresh visited set for each starting node. Cycle A->B->C->A is detected three times (starting from A, B, and C), producing three duplicate entries. For large graphs with many cycles, this also causes O(V*(V+E)) performance.

Fix: Share visited set across starting nodes and normalize detected cycles (start from lexicographically smallest node) to deduplicate. Or use Tarjan's/Johnson's algorithm.


Beads: trellis-iyhy

Metadata

Metadata

Assignees

No one assigned

    Labels

    auditCodebase audit findingbugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions