fix: cycle detection returns duplicate closing node in reported cycle… - #142
fix: cycle detection returns duplicate closing node in reported cycle…#142Adityakk9031 wants to merge 2 commits into
Conversation
|
@josemontesdeoca have a look please |
|
@Adityakk9031 thank you for tracing the The tests at the revision this PR is based on intentionally treat the cycle array as a closed walk: they expect shapes like Because of that, I don’t think this behavior change should merge as written. If you found a consumer or documented contract that requires the unique-node representation, please point me to it and I’ll reconsider that evidence. I’d like to leave a short opportunity for your reply before I make the close decision. Your investigation still surfaced a real clarity problem: the closed-walk representation should be easier to discover in the documentation. Separately, if you’d ever like to tell me about the OpenProse use case you were exploring when you found this, I’d be interested to hear it. That is optional and has no effect on this review. |
|
Thanks @josemontesdeoca for the clear explanation! That makes complete sense — I see now that the repeating closing node I've updated this PR to preserve the closed walk behavior and added explicit JSDoc comments to |
Summary
visitCycleNodeappendednodeto the returned cycle slice even thoughnodeis already present inpathatexistingIndex— the cycle check fires before the node is pushed ontopath, sopath.slice(existingIndex)already contains the full cycleCycleDetectionResult.cycleto always include the starting node twice (e.g.['A','B','C','A']instead of['A','B','C'])has_cycledetection was unaffected (non-empty array still signals a cycle), but thecyclepayload fed to Forme's acyclicity postcondition was incorrectChange