Rare interactions between Capella Requirements and P4C

I wanted to raise 2 issues I met with Capella Requirements.

  1. Sometimes, the model would contain “hidden” Capella Modules. By “hidden”, i mean capela modules that cannot be seen by the user, somehow. So we could have 1 single viewable capella module in our model (Viewable in the project explorer), the python script could rely on getting the first element of a list, yet somehow the list of capella modules could be containing another “secret” capella module, which could produce an error. I was able to find a solution to this. I would love to share with you a model that present this unique feature but I don’t know which of my numerous experimental modules contains it.


Even more interesting, this Capella module containing exactly one single requirement yet somehow during my script compilation inside a LOOP that goes throught the content of the capella module, I observed that the variable “I” (iteration) jumped from 0 to 1 without any reason.
With a script like this one:

    for i in range(len(ExistingOP_PVG_Bottom_names)):
        print("ITERATION is:")

ExistingOP_PVG_Bottom_names being the list of requirement under that module.
Executing the script provides this:


We can clearly see the list contains only ONE element.
Somewhere later in the script, i jumps from 0 to 1, without even finithing the first iteration.
You might suspect that one of my codes is using “i” though interacting with it and provoking this action? Well no not really.
My proof:
If I delete the “Test” requirement from that capella module and then create Another one. The problem somehow does not appear again.

Now it never jumps again from 0 to 1.
I had a very hard time debugging it until i tried this. it’s quite a rare thing, I am not sure you can reproduce it but maybe this could help someday for a similar problem, and maybe you could be able to identify where the bug comes from if enough people experiment this issue.

Can you provide a simple Capella project reproducing this issue and open a bug ?
Can you open the error log view and see if something shows up ?

I don’t really see a reason for his behavior…

It was as if the capella model “visible” was not “up to date” with elements that were supposed to be deleted…
So the visible data was correct (only one capella module), but the “hidden” data, still had 1 extra capella module somehow.

I will share it as soon as i meet with this occurrence again.

That what make me think something else might crash and leave the GUI in the desychronized state.