infrahub-server 1.1.5__py3-none-any.whl → 1.1.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
infrahub/api/oidc.py CHANGED
@@ -210,6 +210,7 @@ async def _get_id_token_groups(
210
210
  algorithms=oidc_config.id_token_signing_alg_values_supported,
211
211
  audience=client_id,
212
212
  issuer=str(oidc_config.issuer),
213
+ options={"verify_signature": False, "verify_aud": False, "verify_iss": False},
213
214
  )
214
215
 
215
216
  return decoded_token.get("groups", [])
@@ -4,7 +4,12 @@ from infrahub import config
4
4
  from infrahub.core import registry
5
5
  from infrahub.core.branch import Branch
6
6
  from infrahub.core.diff.query_parser import DiffQueryParser
7
- from infrahub.core.query.diff import DiffAllPathsQuery, DiffCalculationQuery, DiffFieldPathsQuery, DiffNodePathsQuery
7
+ from infrahub.core.query.diff import (
8
+ DiffCalculationQuery,
9
+ DiffFieldPathsQuery,
10
+ DiffNodePathsQuery,
11
+ DiffPropertyPathsQuery,
12
+ )
8
13
  from infrahub.core.timestamp import Timestamp
9
14
  from infrahub.database import InfrahubDatabase
10
15
  from infrahub.log import get_logger
@@ -86,6 +91,7 @@ class DiffCalculator:
86
91
  )
87
92
  node_limit = int(config.SETTINGS.database.query_size_limit / 10)
88
93
  fields_limit = int(config.SETTINGS.database.query_size_limit / 3)
94
+ properties_limit = int(config.SETTINGS.database.query_size_limit)
89
95
 
90
96
  calculation_request = DiffCalculationRequest(
91
97
  base_branch=base_branch,
@@ -113,21 +119,14 @@ class DiffCalculator:
113
119
  )
114
120
  log.info("Diff field-level calculation queries for branch complete")
115
121
 
116
- branch_diff_query = await DiffAllPathsQuery.init(
117
- db=self.db,
118
- branch=diff_branch,
119
- base_branch=base_branch,
120
- diff_branch_from_time=diff_branch_from_time,
121
- diff_from=from_time,
122
- diff_to=to_time,
122
+ log.info("Beginning diff property-level calculation queries for branch")
123
+ await self._run_diff_calculation_query(
124
+ diff_parser=diff_parser,
125
+ query_class=DiffPropertyPathsQuery,
126
+ calculation_request=calculation_request,
127
+ limit=properties_limit,
123
128
  )
124
- log.info("Beginning diff calculation query for branch")
125
- await branch_diff_query.execute(db=self.db)
126
- log.info("Diff calculation query for branch complete")
127
- log.info("Reading results of query for branch")
128
- for query_result in branch_diff_query.get_results():
129
- diff_parser.read_result(query_result=query_result)
130
- log.info("Results of query for branch read")
129
+ log.info("Diff property-level calculation queries for branch complete")
131
130
 
132
131
  if base_branch.name != diff_branch.name:
133
132
  current_node_field_specifiers = diff_parser.get_current_node_field_specifiers()
@@ -160,32 +159,15 @@ class DiffCalculator:
160
159
  )
161
160
  log.info("Diff field-level calculation queries for base complete")
162
161
 
163
- # Temporary until next change
164
- current_node_field_specifier_tuples: list[tuple[str, str]] = []
165
- new_node_field_specifier_tuples: list[tuple[str, str]] = []
166
- for node_uuid, field_names in current_node_field_specifiers.items():
167
- current_node_field_specifier_tuples.extend((node_uuid, field_name) for field_name in field_names)
168
- for node_uuid, field_names in new_node_field_specifiers.items():
169
- new_node_field_specifier_tuples.extend((node_uuid, field_name) for field_name in field_names)
170
-
171
- base_diff_query = await DiffAllPathsQuery.init(
172
- db=self.db,
173
- branch=base_branch,
174
- base_branch=base_branch,
175
- diff_branch_from_time=diff_branch_from_time,
176
- diff_from=from_time,
177
- diff_to=to_time,
178
- current_node_field_specifiers=current_node_field_specifier_tuples,
179
- new_node_field_specifiers=new_node_field_specifier_tuples,
162
+ log.info("Beginning diff property-level calculation queries for base")
163
+ await self._run_diff_calculation_query(
164
+ diff_parser=diff_parser,
165
+ query_class=DiffPropertyPathsQuery,
166
+ calculation_request=calculation_request,
167
+ limit=properties_limit,
180
168
  )
169
+ log.info("Diff property-level calculation queries for base complete")
181
170
 
182
- log.info("Beginning diff calculation query for base")
183
- await base_diff_query.execute(db=self.db)
184
- log.info("Diff calculation query for base complete")
185
- log.info("Reading results of query for base")
186
- for query_result in base_diff_query.get_results():
187
- diff_parser.read_result(query_result=query_result)
188
- log.info("Results of query for branch read")
189
171
  log.info("Parsing calculated diff")
190
172
  diff_parser.parse(include_unchanged=include_unchanged)
191
173
  log.info("Calculated diff parsed")
@@ -116,7 +116,7 @@ class IpamDiffParser:
116
116
  rels = await node_from_db.ip_namespace.get_relationships(db=self.db) # type: ignore[attr-defined]
117
117
  if rels:
118
118
  cnd.namespace_id = rels[0].get_peer_id()
119
- if cnd.ip_value and cnd.namespace_id:
119
+ if cnd.ip_value and cnd.namespace_id and cnd.node_uuid in uuids_missing_data:
120
120
  uuids_missing_data.remove(cnd.node_uuid)
121
121
 
122
122
  async def _add_missing_values(
@@ -294,10 +294,6 @@ class DiffMergeSerializer:
294
294
  actions_and_peers = self._get_actions_and_peers(relationship_diff=relationship_diff)
295
295
  added_peer_ids = [peer_id for action, peer_id in actions_and_peers if action is DiffAction.ADDED]
296
296
  removed_peer_ids = [peer_id for action, peer_id in actions_and_peers if action is DiffAction.REMOVED]
297
- if not added_peer_ids:
298
- added_peer_ids = [relationship_diff.peer_id]
299
- if not removed_peer_ids:
300
- removed_peer_ids = [relationship_diff.peer_id]
301
297
  for action, peer_id in actions_and_peers:
302
298
  if (
303
299
  peer_id
@@ -314,6 +310,7 @@ class DiffMergeSerializer:
314
310
  relationship_diff_properties=relationship_diff.properties,
315
311
  added_peer_ids=added_peer_ids,
316
312
  removed_peer_ids=removed_peer_ids,
313
+ unchanged_peer_id=relationship_diff.peer_id,
317
314
  )
318
315
  return relationship_dicts, relationship_property_dicts
319
316
 
@@ -324,9 +321,14 @@ class DiffMergeSerializer:
324
321
  relationship_diff_properties: set[EnrichedDiffProperty],
325
322
  added_peer_ids: list[str],
326
323
  removed_peer_ids: list[str],
324
+ unchanged_peer_id: str,
327
325
  ) -> list[RelationshipPropertyMergeDict]:
328
- added_property_dicts = self._get_default_property_merge_dicts(action=DiffAction.ADDED)
329
- removed_property_dicts = self._get_default_property_merge_dicts(action=DiffAction.REMOVED)
326
+ added_property_dicts = {}
327
+ removed_property_dicts = {}
328
+ if added_peer_ids:
329
+ added_property_dicts = self._get_default_property_merge_dicts(action=DiffAction.ADDED)
330
+ if removed_peer_ids:
331
+ removed_property_dicts = self._get_default_property_merge_dicts(action=DiffAction.REMOVED)
330
332
  for property_diff in relationship_diff_properties:
331
333
  if property_diff.property_type is DatabaseEdgeType.IS_RELATED:
332
334
  # handled above
@@ -348,10 +350,15 @@ class DiffMergeSerializer:
348
350
  elif action is DiffAction.REMOVED:
349
351
  removed_property_dicts[property_diff.property_type] = property_dict
350
352
  relationship_property_dicts = []
353
+ peers_and_property_dicts: list[tuple[str, dict[DatabaseEdgeType, PropertyMergeDict]]] = []
351
354
  if added_property_dicts:
352
- peers_and_property_dicts = [(peer_id, added_property_dicts) for peer_id in added_peer_ids]
355
+ peers_and_property_dicts += [
356
+ (peer_id, added_property_dicts) for peer_id in (added_peer_ids or [unchanged_peer_id])
357
+ ]
353
358
  if removed_property_dicts:
354
- peers_and_property_dicts += [(peer_id, removed_property_dicts) for peer_id in removed_peer_ids]
359
+ peers_and_property_dicts += [
360
+ (peer_id, removed_property_dicts) for peer_id in (removed_peer_ids or [unchanged_peer_id])
361
+ ]
355
362
  for peer_id, property_dicts in peers_and_property_dicts:
356
363
  if (
357
364
  peer_id
@@ -17,8 +17,6 @@ QUERY_MATCH_NODES = """
17
17
  AND ($to_time IS NULL OR diff_root.to_time <= $to_time)
18
18
  AND ($tracking_id IS NULL OR diff_root.tracking_id = $tracking_id)
19
19
  AND ($diff_ids IS NULL OR diff_root.uuid IN $diff_ids)
20
- WITH diff_root
21
- ORDER BY diff_root.base_branch, diff_root.diff_branch, diff_root.from_time, diff_root.to_time
22
20
  // get all the nodes attached to the diffs
23
21
  OPTIONAL MATCH (diff_root)-[:DIFF_HAS_NODE]->(diff_node:DiffNode)
24
22
  """
@@ -79,26 +77,21 @@ class EnrichedDiffGetQuery(Query):
79
77
  self.add_to_query(query=query_filters)
80
78
 
81
79
  query_2 = """
82
- // group by diff node uuid for pagination
83
- WITH diff_node.uuid AS diff_node_uuid, diff_node.kind AS diff_node_kind, collect([diff_root, diff_node]) AS node_root_tuples
84
- // order by kind and latest label for each diff_node uuid
85
- CALL {
86
- WITH node_root_tuples
87
- UNWIND node_root_tuples AS nrt
88
- WITH nrt[0] AS diff_root, nrt[1] AS diff_node
89
- ORDER BY diff_root.from_time DESC
90
- RETURN diff_node.label AS latest_node_label
91
- LIMIT 1
92
- }
93
- WITH diff_node_kind, node_root_tuples, latest_node_label
94
- ORDER BY diff_node_kind, latest_node_label
80
+ WITH diff_root, diff_node
81
+ ORDER BY diff_root.base_branch, diff_root.diff_branch, diff_root.from_time, diff_root.to_time, diff_node.uuid
82
+ // -------------------------------------
83
+ // Limit number of results
84
+ // -------------------------------------
95
85
  SKIP COALESCE($offset, 0)
96
86
  LIMIT $limit
97
- UNWIND node_root_tuples AS nrt
98
- WITH nrt[0] AS diff_root, nrt[1] AS diff_node
99
- WITH diff_root, diff_node
87
+ // -------------------------------------
88
+ // Check if more data after this limited group
89
+ // -------------------------------------
90
+ WITH collect([diff_root, diff_node]) AS limited_results
91
+ WITH limited_results, size(limited_results) = $limit AS has_more_data
92
+ UNWIND limited_results AS one_result
93
+ WITH one_result[0] AS diff_root, one_result[1] AS diff_node, has_more_data
100
94
  // if depth limit, make sure not to exceed it when traversing linked nodes
101
- WITH diff_root, diff_node
102
95
  // -------------------------------------
103
96
  // Retrieve Parents
104
97
  // -------------------------------------
@@ -109,12 +102,12 @@ class EnrichedDiffGetQuery(Query):
109
102
  ORDER BY size(nodes(parents_path)) DESC
110
103
  LIMIT 1
111
104
  }
112
- WITH diff_root, diff_node, parents_path
105
+ WITH diff_root, diff_node, has_more_data, parents_path
113
106
  // -------------------------------------
114
107
  // Retrieve conflicts
115
108
  // -------------------------------------
116
109
  OPTIONAL MATCH (diff_node)-[:DIFF_HAS_CONFLICT]->(diff_node_conflict:DiffConflict)
117
- WITH diff_root, diff_node, parents_path, diff_node_conflict
110
+ WITH diff_root, diff_node, has_more_data, parents_path, diff_node_conflict
118
111
  // -------------------------------------
119
112
  // Retrieve Attributes
120
113
  // -------------------------------------
@@ -128,7 +121,7 @@ class EnrichedDiffGetQuery(Query):
128
121
  RETURN diff_attribute, diff_attr_property, diff_attr_property_conflict
129
122
  ORDER BY diff_attribute.name, diff_attr_property.property_type
130
123
  }
131
- WITH diff_root, diff_node, parents_path, diff_node_conflict, collect([diff_attribute, diff_attr_property, diff_attr_property_conflict]) as diff_attributes
124
+ WITH diff_root, diff_node, has_more_data, parents_path, diff_node_conflict, collect([diff_attribute, diff_attr_property, diff_attr_property_conflict]) as diff_attributes
132
125
  // -------------------------------------
133
126
  // Retrieve Relationships
134
127
  // -------------------------------------
@@ -150,6 +143,7 @@ class EnrichedDiffGetQuery(Query):
150
143
  WITH
151
144
  diff_root,
152
145
  diff_node,
146
+ has_more_data,
153
147
  parents_path,
154
148
  diff_node_conflict,
155
149
  diff_attributes,
@@ -161,6 +155,7 @@ class EnrichedDiffGetQuery(Query):
161
155
  self.return_labels = [
162
156
  "diff_root",
163
157
  "diff_node",
158
+ "has_more_data",
164
159
  "parents_path",
165
160
  "diff_node_conflict",
166
161
  "diff_attributes",
@@ -1,5 +1,3 @@
1
- from typing import Iterable
2
-
3
1
  from neo4j.graph import Node as Neo4jNode
4
2
  from neo4j.graph import Path as Neo4jPath
5
3
 
@@ -30,37 +28,47 @@ class EnrichedDiffDeserializer:
30
28
  self._diff_node_rel_group_map: dict[tuple[str, str, str], EnrichedDiffRelationship] = {}
31
29
  self._diff_node_rel_element_map: dict[tuple[str, str, str, str], EnrichedDiffSingleRelationship] = {}
32
30
  self._diff_prop_map: dict[tuple[str, str, str, str] | tuple[str, str, str, str, str], EnrichedDiffProperty] = {}
31
+ # {EnrichedDiffRoot: [(node_uuid, parents_path: Neo4jPath), ...]}
32
+ self._parents_path_map: dict[EnrichedDiffRoot, list[tuple[str, Neo4jPath]]] = {}
33
33
 
34
- def _initialize(self) -> None:
34
+ def initialize(self) -> None:
35
35
  self._diff_root_map = {}
36
36
  self._diff_node_map = {}
37
37
  self._diff_node_attr_map = {}
38
38
  self._diff_node_rel_group_map = {}
39
39
  self._diff_node_rel_element_map = {}
40
40
  self._diff_prop_map = {}
41
+ self._parents_path_map = {}
41
42
 
42
- async def deserialize(
43
- self, database_results: Iterable[QueryResult], include_parents: bool
44
- ) -> list[EnrichedDiffRoot]:
45
- self._initialize()
46
- results = list(database_results)
47
- for result in results:
48
- enriched_root = self._deserialize_diff_root(root_node=result.get_node("diff_root"))
49
- node_node = result.get(label="diff_node")
50
- if not isinstance(node_node, Neo4jNode):
51
- continue
52
- enriched_node = self._deserialize_diff_node(node_node=node_node, enriched_root=enriched_root)
53
- node_conflict_node = result.get(label="diff_node_conflict")
54
- if isinstance(node_conflict_node, Neo4jNode) and not enriched_node.conflict:
55
- conflict = self.deserialize_conflict(diff_conflict_node=node_conflict_node)
56
- enriched_node.conflict = conflict
57
- self._deserialize_attributes(result=result, enriched_root=enriched_root, enriched_node=enriched_node)
58
- self._deserialize_relationships(result=result, enriched_root=enriched_root, enriched_node=enriched_node)
43
+ def _track_parents_path(self, enriched_root: EnrichedDiffRoot, node_uuid: str, parents_path: Neo4jPath) -> None:
44
+ if enriched_root not in self._parents_path_map:
45
+ self._parents_path_map[enriched_root] = []
46
+ self._parents_path_map[enriched_root].append((node_uuid, parents_path))
47
+
48
+ async def read_result(self, result: QueryResult, include_parents: bool) -> None:
49
+ enriched_root = self._deserialize_diff_root(root_node=result.get_node("diff_root"))
50
+ node_node = result.get(label="diff_node")
51
+ if not isinstance(node_node, Neo4jNode):
52
+ return
53
+ enriched_node = self._deserialize_diff_node(node_node=node_node, enriched_root=enriched_root)
59
54
 
60
55
  if include_parents:
61
- for result in results:
62
- enriched_root = self._deserialize_diff_root(root_node=result.get_node("diff_root"))
63
- self._deserialize_parents(result=result, enriched_root=enriched_root)
56
+ parents_path = result.get("parents_path")
57
+ if parents_path and isinstance(parents_path, Neo4jPath):
58
+ self._track_parents_path(
59
+ enriched_root=enriched_root, node_uuid=enriched_node.uuid, parents_path=parents_path
60
+ )
61
+
62
+ node_conflict_node = result.get(label="diff_node_conflict")
63
+ if isinstance(node_conflict_node, Neo4jNode) and not enriched_node.conflict:
64
+ conflict = self.deserialize_conflict(diff_conflict_node=node_conflict_node)
65
+ enriched_node.conflict = conflict
66
+ self._deserialize_attributes(result=result, enriched_root=enriched_root, enriched_node=enriched_node)
67
+ self._deserialize_relationships(result=result, enriched_root=enriched_root, enriched_node=enriched_node)
68
+
69
+ async def deserialize(self, include_parents: bool = True) -> list[EnrichedDiffRoot]:
70
+ if include_parents:
71
+ self._deserialize_parents()
64
72
 
65
73
  return list(self._diff_root_map.values())
66
74
 
@@ -117,30 +125,26 @@ class EnrichedDiffDeserializer:
117
125
  conflict = self.deserialize_conflict(diff_conflict_node=property_conflict)
118
126
  element_property.conflict = conflict
119
127
 
120
- def _deserialize_parents(self, result: QueryResult, enriched_root: EnrichedDiffRoot) -> None:
121
- parents_path = result.get("parents_path")
122
- if not parents_path or not isinstance(parents_path, Neo4jPath):
123
- return
124
-
125
- node_uuid = result.get(label="diff_node").get("uuid")
126
-
127
- # Remove the node itself from the path
128
- parents_path = parents_path.nodes[1:] # type: ignore[union-attr]
129
-
130
- # TODO Ensure the list is even
131
- current_node_uuid = node_uuid
132
- for rel, parent in zip(parents_path[::2], parents_path[1::2]):
133
- enriched_root.add_parent(
134
- node_id=current_node_uuid,
135
- parent_id=parent.get("uuid"),
136
- parent_kind=parent.get("kind"),
137
- parent_label=parent.get("label"),
138
- parent_rel_name=rel.get("name"),
139
- parent_rel_identifier=rel.get("identifier"),
140
- parent_rel_cardinality=RelationshipCardinality(rel.get("cardinality")),
141
- parent_rel_label=rel.get("label"),
142
- )
143
- current_node_uuid = parent.get("uuid")
128
+ def _deserialize_parents(self) -> None:
129
+ for enriched_root, node_path_tuples in self._parents_path_map.items():
130
+ for node_uuid, parents_path in node_path_tuples:
131
+ # Remove the node itself from the path
132
+ parents_path_slice = parents_path.nodes[1:]
133
+
134
+ # TODO Ensure the list is even
135
+ current_node_uuid = node_uuid
136
+ for rel, parent in zip(parents_path_slice[::2], parents_path_slice[1::2]):
137
+ enriched_root.add_parent(
138
+ node_id=current_node_uuid,
139
+ parent_id=parent.get("uuid"),
140
+ parent_kind=parent.get("kind"),
141
+ parent_label=parent.get("label"),
142
+ parent_rel_name=rel.get("name"),
143
+ parent_rel_identifier=rel.get("identifier"),
144
+ parent_rel_cardinality=RelationshipCardinality(rel.get("cardinality")),
145
+ parent_rel_label=rel.get("label"),
146
+ )
147
+ current_node_uuid = parent.get("uuid")
144
148
 
145
149
  @classmethod
146
150
  def _get_str_or_none_property_value(cls, node: Neo4jNode, property_name: str) -> str | None:
@@ -47,6 +47,49 @@ class DiffRepository:
47
47
  self.db = db
48
48
  self.deserializer = deserializer
49
49
 
50
+ async def _run_get_diff_query(
51
+ self,
52
+ base_branch_name: str,
53
+ diff_branch_names: list[str],
54
+ limit: int,
55
+ from_time: Timestamp | None = None,
56
+ to_time: Timestamp | None = None,
57
+ filters: EnrichedDiffQueryFilters | None = None,
58
+ offset: int = 0,
59
+ include_parents: bool = True,
60
+ max_depth: int | None = None,
61
+ tracking_id: TrackingId | None = None,
62
+ diff_ids: list[str] | None = None,
63
+ ) -> list[EnrichedDiffRoot]:
64
+ self.deserializer.initialize()
65
+ has_more_data = True
66
+ while has_more_data:
67
+ get_query = await EnrichedDiffGetQuery.init(
68
+ db=self.db,
69
+ base_branch_name=base_branch_name,
70
+ diff_branch_names=diff_branch_names,
71
+ from_time=from_time,
72
+ to_time=to_time,
73
+ filters=filters,
74
+ max_depth=max_depth,
75
+ limit=limit,
76
+ offset=offset,
77
+ tracking_id=tracking_id,
78
+ diff_ids=diff_ids,
79
+ )
80
+ log.info(f"Beginning enriched diff get query {limit=}, {offset=}")
81
+ await get_query.execute(db=self.db)
82
+ log.info("Enriched diff get query complete")
83
+ last_result = None
84
+ for query_result in get_query.get_results():
85
+ await self.deserializer.read_result(result=query_result, include_parents=include_parents)
86
+ last_result = query_result
87
+ has_more_data = False
88
+ if last_result:
89
+ has_more_data = last_result.get_as_type("has_more_data", bool)
90
+ offset += limit
91
+ return await self.deserializer.deserialize()
92
+
50
93
  async def get(
51
94
  self,
52
95
  base_branch_name: str,
@@ -62,23 +105,20 @@ class DiffRepository:
62
105
  include_empty: bool = False,
63
106
  ) -> list[EnrichedDiffRoot]:
64
107
  final_max_depth = config.SETTINGS.database.max_depth_search_hierarchy
65
- query = await EnrichedDiffGetQuery.init(
66
- db=self.db,
108
+ limit = limit or int(config.SETTINGS.database.query_size_limit / 10)
109
+ diff_roots = await self._run_get_diff_query(
67
110
  base_branch_name=base_branch_name,
68
111
  diff_branch_names=diff_branch_names,
69
112
  from_time=from_time,
70
113
  to_time=to_time,
71
114
  filters=EnrichedDiffQueryFilters(**dict(filters or {})),
115
+ include_parents=include_parents,
72
116
  max_depth=final_max_depth,
73
117
  limit=limit,
74
- offset=offset,
118
+ offset=offset or 0,
75
119
  tracking_id=tracking_id,
76
120
  diff_ids=diff_ids,
77
121
  )
78
- await query.execute(db=self.db)
79
- diff_roots = await self.deserializer.deserialize(
80
- database_results=query.get_results(), include_parents=include_parents
81
- )
82
122
  if not include_empty:
83
123
  diff_roots = [dr for dr in diff_roots if len(dr.nodes) > 0]
84
124
  return diff_roots
@@ -91,30 +131,23 @@ class DiffRepository:
91
131
  to_time: Timestamp,
92
132
  ) -> list[EnrichedDiffs]:
93
133
  max_depth = config.SETTINGS.database.max_depth_search_hierarchy
94
- query = await EnrichedDiffGetQuery.init(
95
- db=self.db,
134
+ limit = int(config.SETTINGS.database.query_size_limit / 10)
135
+ diff_branch_roots = await self._run_get_diff_query(
96
136
  base_branch_name=base_branch_name,
97
137
  diff_branch_names=[diff_branch_name],
98
138
  from_time=from_time,
99
139
  to_time=to_time,
100
140
  max_depth=max_depth,
101
- )
102
- await query.execute(db=self.db)
103
- diff_branch_roots = await self.deserializer.deserialize(
104
- database_results=query.get_results(), include_parents=True
141
+ limit=limit,
105
142
  )
106
143
  diffs_by_uuid = {dbr.uuid: dbr for dbr in diff_branch_roots}
107
- base_partner_query = await EnrichedDiffGetQuery.init(
108
- db=self.db,
144
+ base_branch_roots = await self._run_get_diff_query(
109
145
  base_branch_name=base_branch_name,
110
146
  diff_branch_names=[base_branch_name],
111
147
  max_depth=max_depth,
148
+ limit=limit,
112
149
  diff_ids=[d.partner_uuid for d in diffs_by_uuid.values()],
113
150
  )
114
- await base_partner_query.execute(db=self.db)
115
- base_branch_roots = await self.deserializer.deserialize(
116
- database_results=base_partner_query.get_results(), include_parents=True
117
- )
118
151
  diffs_by_uuid.update({bbr.uuid: bbr for bbr in base_branch_roots})
119
152
  return [
120
153
  EnrichedDiffs(