structurizr / dsl

Structurizr DSL
https://docs.structurizr.com/dsl
Apache License 2.0
1.41k stars 266 forks source link

impliedrelationship bug #342

Closed eric-panier-opalrt closed 11 months ago

eric-panier-opalrt commented 11 months ago

Description

Hi Simon,

It seems there is a not expected error when we just change the order of two relations in a dsl file. Please check Steps to reproduce. This is a small example of a bug we get often in our bigger project.

Thanks. Best regards. Eric PANIER OPAL-RT TECHNOLOGIES

Steps to reproduce

  1. Load workspace.dsl generates the following error: workspace.dsl: A relationship between "SoftwareSystem://SYSTEM_A" and "SoftwareSystem://system_b" already exists at line 1 of /usr/local/structurizr/workspaces/../systems/intersystem_relations.dsl: system_a -> system_b "RELATION_SEND_CMDS" "TECHNO_HTTP" at line 5 of /usr/local/structurizr/workspaces/../systems/systems.dsl: !include intersystem_relations.dsl at line 3 of /usr/local/structurizr/workspaces/myworkspace.dsl: !include ../systems/systems.dsl at line 1 of /usr/local/structurizr/workspace.dsl: !include workspaces/myworkspace.dsl

  2. change the order of the two lines of the file systems\system_a\intercontainer_relations.dsl

  3. Load workspace.dsl then it works correctly relation_bug_project.zip

Screenshot

No response

Code sample

No response

Configuration

structurizr Lite docker bd8d97bd4f58f3cdc90d90dbd0601bece27c53497ded1db061a206698b042585

Severity

Major

Priority

High

Resolution

I have no budget and there's no rush, please fix this for free

More information

No response

simonbrowndotje commented 11 months ago

This looks like it's behaving as expected ... it's easier to understand what's happening with implied relationships when you simplify the workspace down to a single file:

workspace {

    model {
        system_b = softwareSystem "system_b" {
            container_b1 = container "container_b1"
            container_b2 = container "container_b2"
            container_b3 = container "container_b3"
        }

        system_a = softwareSystem "SYSTEM_A" {
            container_a1 = container "container_a1" {
                component_a1 = component "component_a1_NAME"
            }

            container_a2 = container "container_a2" {
                component_a2 = component "component_a2__NAME"
            }

            component_a2 -> container_b3 "RELATION_SEND_CMDS" "TECHNO_GRPC"
            component_a1 -> container_b3 "RELATION_SEND_AND_GET_DATA" "TECHNO_GRPC"
        }

        system_a -> system_b "RELATION_SEND_CMDS" "TECHNO_HTTP"
        system_a -> container_b1 "Gets data from" "TECHNO_HTTP"
        system_a -> container_b2 "Executes with arguments" "TECHNO_FILESYSTEM"
    }

}
eric-panier-opalrt commented 11 months ago

Thank you very much for your responsiveness. Let me take time to understand. Because I did not catch the order of relation declaration was important between component_a2 -> component_b3 and component_a1 -> component_b3 and how the implied relationship strategy works.