Activity [beta] broken switch/case arrows when using kill/detach

0 votes
asked Sep 9, 2021 in Bug by Hrk (120 points)

I'm trying to use the new Activity [beta] syntax to render a workflow starting from one point and branching to multiple endings. Since the endings are separate and different, I'm using the kill/detach to ... "kill" the workflow.

However, case arrows disappear except for the outer ones (if there are e.g. 4 cases, only case 1 and 4 have the arrow). This is not how I expect the "detach" to work. Is this intended or a bug?

Rendered chart

Example file (weirdly enough, the forum editor reports an error of maximum 8.000 characters even though the example is only 1.800 characters).

commented Sep 9, 2021 by The-Lu (64,340 points)

Yes, it is a bug.

Here is a minimal example, (from 3 cases, we observe the defect)

@startuml
switch (test?)
case ( A )
  :Text 1;
kill
case ( B ) 
  :Text 2;
kill
case ( C )
  :Text 3;
kill
case ( D )
  :Text 4;
kill
endswitch
@enduml

@PlantUML team: Could you have a look?
The lines B and C are missing...

See also this comment:

commented Sep 9, 2021 by Hrk (120 points)
Thank you, sorry for the duplicate if it was already known.
commented Sep 9, 2021 by The-Lu (64,340 points)

No problem, wink

Now, we have a minimal example, for PlantUML team testing...

commented Sep 17, 2021 by Hrk (120 points)
I gave a look at the source code. I am amazed that this project completely lacks developer documentation  and source code comments. This means the learning curve is very steep and the palatability for new developers to help is below zero. This was really unexpected and is making me rethinking my choice of using this project.

Meanwhile I think if I should abandon this ship, I tried some debugging and the issue seems to be at the very least in the methods getFirst() and getLast() of class net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.FtileSwitchWithManyLinks

With the above example, getFirst() returns 4, getLast() returns -1. If the kill/detach-es are removed, getFirst() returns 0 and getLast() returns 3 (which makes sense, albeit this is just guesswork due to no comments whatsoever explaining what the code is doing).

Digging deeper, getFirst() and getLast() depend on the method FtileGeometry.hasPointOut().

I hope this can help the dev team to spot the issue, I'm currently unable to dig deeper due to missing knowledge of the codebase and the absence of helpful comments.

1 Answer

0 votes
answered Sep 20, 2021 by plantuml (295,000 points)

Yes, we know that the code is lacking documentation and comments.

However, you did a great job because you were really close to the solution and your debug really helps us.

Here is the correction:
https://github.com/plantuml/plantuml/commit/d0fe54026da6593ffa2b699db8a3836dcfdeff3a

The fact is that we really confuse ourself with ingoing and outgoing arrows, so we have refactored FtileSwitchWithManyLinks::addLinks so that it should be easier to read and to understand.

So thanks again for your report and for your debug, and sorry about the documentation.

commented Sep 20, 2021 by Hrk (120 points)
Thank you very much! I really appreciated the quick solution.

If I may, is there a reason for the lack of comments in the source code? Meaning: is it deliberate for some reasons I don't know (I'm quite new to this project) or is it just a strange coincidence? Maybe the coding happens elsewhere and then the code gets stripped of comments before going on github? The version/tag related commits (example: "Import 1.2021.8") are especially weird having thousands of lines changed. My first attempt to pinpoint the broken feature was running a git branch over the initial support for kill-detach in the Activity Diagram and it got me to a ~5.000 line commit :-(
commented Oct 3, 2021 by The-Lu (64,340 points)

This is now corrected on V1.2021.11 (2 Oct, 2021).

Thank to PlantUML team,
Regards,
Th.

...