Broken relations persist in graph after a group was deleted

Created on 10 November 2020, over 4 years ago
Updated 12 June 2025, about 2 months ago

Problem/Motivation

When a subgroup has been deleted group_graph still contains a relation with it. That's why loadGroupMapping returns groups that don't exist.

πŸ› Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine dburiak

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ͺπŸ‡ΈSpain akalam

    I'm able to reproduce it with ggroups v1, but looking at the code I suspect it may happen with newer releases as well. I'm looking at following scenario:

    • Create 3 groups: Group 1 (gid: 1), Group 2 (gid: 2), Group 3 (gid: 3)
    • Build the following hierarchy tree: Group 1 > Group 2 > Group 3
    • Open a drush php terminal and execute: \Drupal::service('ggroup.group_graph_storage')->getAncestors(3). You will get the following outoput, which is correct: [3, 2, 1]
    • Remove the group relationship between Group 1 and Group 2
    • Open a new drush php terminal to avoid static cache, and execute the same code: \Drupal::service('ggroup.group_graph_storage')->getAncestors(3). You will get the same outoput: [3, 2, 1], instead of getting [3, 2].

    Taking a look to the database, there's still a row with start_vertex 1 and end_vertex 3, with hop 1. The \Drupal\ggroup\GroupHierarchyManager::removeSubgroup method removes properly the direct relationships from the graph but doesn't clean the entries with hop different from 0

Production build 0.71.5 2024