nkuprins opened a new pull request, #18410:
URL: https://github.com/apache/dolphinscheduler/pull/18410

   ## Was this PR generated or assisted by AI?
   
   YES - the bug was found using AI-assisted static analysis, and the fix and 
regression test were AI-assisted. I verified everything myself: I confirmed the 
failure by running the new test against unmodified `dev` (fails), reviewed the 
logic, and confirmed the fix (passes) with the full `dolphinscheduler-common` 
suite green.
   
   ## Purpose of the pull request
   
   Closes #18409. `DAG.isLegalAddEdge` bounds its cycle-check BFS with a 
node-count budget (`--verticesCount > 0`) instead of tracking visited nodes. On 
graphs where paths converge, a node is enqueued once per incoming edge, 
exhausting the budget before the BFS reaches `fromNode`, so a cycle-creating 
edge is wrongly judged legal and inserted. This replaces the budget with a 
visited-set - the correct BFS termination condition - which cannot be defeated 
by path convergence and also avoids redundant re-enqueueing on dense graphs.
   
   ## Brief change log
   
   - `common/graph/DAG.java`: track visited nodes in `isLegalAddEdge` instead 
of a decrementing `verticesCount` budget; add `HashSet` import.
   - `common/graph/DAGTest.java`: add `testCycleWithConvergingPaths`, a 
fan-shaped graph asserting the cycle-creating back-edge is rejected and no 
cycle is introduced.
   
   ## Verify this pull request
   
   This change added tests and can be verified as follows:
   - `testCycleWithConvergingPaths` fails on current `dev` (`addEdge` returns 
`true` for a cycle-creating edge) and passes with the fix.
   - Full `dolphinscheduler-common` suite passes (139 tests, 0 failures) on JDK 
8.
   - Spotless format check passes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to