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 flags/properties not deleted when relationship is deleted #3689

Closed ajtmccarty closed 2 weeks ago

ajtmccarty commented 2 weeks ago

Component

API Server / GraphQL

Current Behavior

When a relationship between two nodes is deleted, we do not properly set the properties of that relationship (IS_VISIBLE, IS_PROTECTED) to deleted. This leads to an inconsistent database state in which both IS_RELATED edges are updated to status=deleted, but IS_VISIBLE and IS_PROTECTED edges are not

Expected Behavior

We should add new status=deleted edges to a given Relationship node when it is deleted

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: "<car_main.id>"})

Additional Information

a little example

(n:Node)-[r1:IS_RELATED]->(r:Relationship)-[r2:IS_RELATED]->(p:Node)
(:Boolean)<-[v:IS_VISIBLE]-(r)-[p:IS_PROTECTED]-(:Boolean)

currently, we set add new status=deleted edges to replace r1 and r2, but not v or p