opsmill / infrahub

Infrahub - A new approach to Infrastructure Management
https://opsmill.com/
GNU Affero General Public License v3.0
148 stars 7 forks source link

bug: CYPHER Relationship node property edges can be reversed during delete #3690

Closed ajtmccarty closed 2 weeks ago

ajtmccarty commented 2 weeks ago

Component

API Server / GraphQL

Current Behavior

We expect the IS_VISIBLE and IS_PROTECTED edges in our cypher database to always go from a Node or Relationship node to a Boolean node, but this relationship can be reversed during a delete. For example

(:Relationship)<-[:IS_VISIBLE]-(:Boolean)

Expected Behavior

In our database schema, we should never have an edge pointing from a Boolean to a Node. It might not be causing any issues right now, but it is illegal in our database

Steps to Reproduce

Delete a relationship and then check it out on the database from a unit test

car_main = await NodeManager.get_one(db=db, branch=default_branch, id=car_accord_main.id)
await car_main.owner.update(db=db, data={"id": person_jane_main.id})
await car_main.save(db=db)

on the database

MATCH path = (:Boolean)-[]-(r:Relationship {name: "testcar__testperson"})-[:IS_RELATED]-(n:Node {uuid: ""})

Additional Information

No response