AmpersandTarski / Ampersand

Build database applications faster than anyone else, and keep your data pollution free as a bonus.
http://ampersandtarski.github.io/
GNU General Public License v3.0
40 stars 8 forks source link

An automatic rule produces a yellow violation #1436

Open stefjoosten opened 10 months ago

stefjoosten commented 10 months ago

What happened

I got a yellow error message:

image

I traced it back to the following code fragment:

ENFORCE realization[CommunicationNetwork*ApplicationInterface] >: realization;I[ApplicationComponent];serving

I have checked that the relations mentioned in this rule exists:

RELATION realization[CommunicationNetwork*ApplicationComponent]
RELATION realization[CommunicationNetwork*ApplicationInterface]
RELATION serving[ApplicationComponent*ApplicationInterface]

The type checker accepted this rule, hence code was generated and the error could occur.

What I expected

  1. I expected this rule would not produce a (yellow) runtime error because it is an enforcement rule. However, it did (see screenshot above).
  2. I expected this error to appear in the prototype log. However, there wasn't a shred of it...

Version of Ampersand that was used

The example used Ampersandtarski/prototype-framework:v1.17 as a base container.

hanjoosten commented 10 months ago

Could you supply a reproducer?

stefjoosten commented 10 months ago

Analysis

It is not the ENFORCE syntax. I tried:

ROLE ExecEngine MAINTAINS serving
RULE serving : realization;I[ApplicationComponent];serving
               |- realization[CommunicationNetwork*ApplicationInterface]
VIOLATION (TXT "{EX} InsPair;realization;CommunicationNetwork;", SRC I, TXT ";ApplicationInterface;", TGT I)

with exactly the same result. However, now I did get the following log output:

EXECENGINE.INFO: InsPair(realization,Platform,id-3111baed624645bd87068eda7e1a28de,ApplicationComponent,id-65b1bbb7d0d44a76bb29bff324254216) [] {"request_id":"ea323ae053"}

Notice how the code has stealthily changed the type of the relation realization[CommunicationNetwork*ApplicationInterface] into realization[CommunicationNetwork*ApplicationComponent]. The concept ApplicationComponent is sandwiched between two other concepts

CLASSIFY ApplicationInterface ISA ApplicationComponent
CLASSIFY ApplicationComponent, ApplicationInterface ISA ArchiObject

I can sense a diagnosis coming up. I need to run some more tests to validate my hypothesis.