Verified Commit 5b6f3896 authored by Michael Angelo Rivera's avatar Michael Angelo Rivera Committed by GitLab
Browse files

fix(query-engine): serialize graph IDs as strings

parent e0968761
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -255,10 +255,12 @@
        },
        "node_ids": {
          "type": "array",
          "description": "Specific node IDs to filter by",
          "description": "Specific node IDs to filter by. Accepts integers or digit strings.",
          "items": {
            "type": "integer",
            "minimum": 1
            "oneOf": [
              { "type": "integer" },
              { "type": "string", "pattern": "^-?[0-9]+$", "maxLength": 20 }
            ]
          },
          "minItems": 1,
          "maxItems": 500
@@ -295,18 +297,22 @@
    },
    "IdRange": {
      "type": "object",
      "description": "Inclusive ID range filter",
      "description": "Inclusive ID range filter. Endpoints accept integers or digit strings.",
      "required": ["start", "end"],
      "properties": {
        "start": {
          "type": "integer",
          "description": "Start of ID range (inclusive)",
          "minimum": 1
          "oneOf": [
            { "type": "integer" },
            { "type": "string", "pattern": "^-?[0-9]+$", "maxLength": 20 }
          ]
        },
        "end": {
          "type": "integer",
          "description": "End of ID range (inclusive)",
          "minimum": 1
          "oneOf": [
            { "type": "integer" },
            { "type": "string", "pattern": "^-?[0-9]+$", "maxLength": 20 }
          ]
        }
      },
      "additionalProperties": false
+6 −6
Original line number Diff line number Diff line
@@ -41,8 +41,8 @@
          "description": "Entity type name matching the ontology (e.g. User, MergeRequest, Project). Look up in the cached ontology for label_field, domain, and style."
        },
        "id": {
          "type": "integer",
          "description": "Entity primary key. Together with type, forms the composite identity (e.g. User:42). Always included even if not selected."
          "type": "string",
          "description": "Entity primary key, serialized as a string to avoid JavaScript precision loss for Int64 values exceeding 2^53-1. Together with type, forms the composite identity (e.g. User:42). Always included even if not selected."
        }
      },
      "additionalProperties": {
@@ -59,16 +59,16 @@
          "description": "Source node entity type."
        },
        "from_id": {
          "type": "integer",
          "description": "Source node entity ID."
          "type": "string",
          "description": "Source node entity ID, serialized as a string."
        },
        "to": {
          "type": "string",
          "description": "Target node entity type."
        },
        "to_id": {
          "type": "integer",
          "description": "Target node entity ID."
          "type": "string",
          "description": "Target node entity ID, serialized as a string."
        },
        "type": {
          "type": "string",
+4 −1
Original line number Diff line number Diff line
@@ -73,7 +73,10 @@ pub fn edge_count(v: &Value) -> usize {
}

pub fn sorted_node_ids(v: &Value) -> Vec<i64> {
    let mut ids: Vec<i64> = nodes(v).iter().map(|n| n["id"].as_i64().unwrap()).collect();
    let mut ids: Vec<i64> = nodes(v)
        .iter()
        .map(|n| n["id"].as_str().unwrap().parse().unwrap())
        .collect();
    ids.sort();
    ids
}
+6 −4
Original line number Diff line number Diff line
@@ -257,11 +257,13 @@ fn nested_repos_indexed_separately() {

    // Different project IDs (different canonical paths)
    let app_id = nodes_where(&files, "name", "app.py")[0]["id"]
        .as_i64()
        .unwrap();
        .as_str()
        .unwrap()
        .to_string();
    let helper_id = nodes_where(&files, "name", "helper.py")[0]["id"]
        .as_i64()
        .unwrap();
        .as_str()
        .unwrap()
        .to_string();
    assert_ne!(app_id, helper_id);
}

+92 −81

File changed.

Preview size limit exceeded, changes collapsed.

Loading