GNS-Science / nshm-toshi-api

An extensible API where task metadata, and important input and output files relating to data-intensive science processes are retained. Custom task schemas can be defined to support their meta-data needs.
GNU Affero General Public License v3.0
0 stars 0 forks source link

FIX: Predecessors Invalid Record error #179

Open benjamineac opened 2 years ago

benjamineac commented 2 years ago

Current behaviour: When querying Scaled Solution/Time Dependent Solution in TEST environment relay returns error eg:

Warning: RelayResponseNormalizer: Invalid record RmlsZToxMDAwNjk=. Expected __typename to be consistent, but the record was assigned conflicting types Predecessor and File. The GraphQL server likely violated the globally unique id requirement by returning the same id for different objects.

https://relay.dev/docs/debugging/inconsistent-typename-error/

Haven't noticed any impact on TUI client but have had issues in the past with this specific error so could lead to problems in future.

Example query:

  nodes(id_in: [
    "QXV0b21hdGlvblRhc2s6MTAxMTUx",
    "QXV0b21hdGlvblRhc2s6MTAxMTUy"
  ]
) {
    result {
      edges {
        node {
          __typename
          ... on AutomationTask {
            created
            task_type
            id
            files {
              edges {
                node {
                  file {
                    __typename
                    ... on ScaledInversionSolution {
                      id
                      meta {
                        k
                        v
                      }
                      predecessors {
                        __typename
                        pre_id: id
                        relationship
                        depth
                        node {
                          __typename
                          ... on File {
                            file_meta: meta {
                              k
                              v
                            }
                          }
                          ... on InversionSolution {
                            is_meta: meta {
                              k
                              v
                            }
                          }
                          ... on TimeDependentInversionSolution {
                            td_meta: meta {
                              k
                              v
                            }
                          }
                          ... on Node {
                            __isNode: __typename
                            id
                          }
                        }
                        id
                      }
                    }
                    ... on TimeDependentInversionSolution {
                      id
                      meta {
                        k
                        v
                      }
                      predecessors {
                        __typename
                        pre_id: id
                        relationship
                        depth
                        node {
                          __typename
                          ... on File {
                            file_meta: meta {
                              k
                              v
                            }
                          }
                          ... on InversionSolution {
                            is_meta: meta {
                              k
                              v
                            }
                          }
                          ... on TimeDependentInversionSolution {
                            td_meta: meta {
                              k
                              v
                            }
                          }
                          ... on Node {
                            __isNode: __typename
                            id
                          }
                        }
                        id
                      }
                    }
                    ... on Node {
                      __isNode: __typename
                      node_id: id
                      id
                    }
                  }
                }
              }
            }
            inversion_solution {
              id
              file_name
              mfd_table_id
              meta {
                k
                v
              }
              tables {
                table_id
                table_type
              }
            }
          }
          ... on Node {
            __isNode: __typename
            id
          }
        }
      }
    }
  }
}