Skip to content

Commit b7bac04

Browse files
authored
Merge pull request #6491 from opsmill/stable
Merge stable into develop
2 parents 32e6f5c + c4f1b8a commit b7bac04

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

backend/infrahub/core/diff/query_parser.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,11 @@ def get_current_node_field_specifiers(self) -> NodeFieldSpecifierMap:
526526
return self._current_node_field_specifiers
527527

528528
def read_result(self, query_result: QueryResult) -> None:
529-
path = query_result.get_path(label="diff_path")
529+
try:
530+
path = query_result.get_path(label="diff_path")
531+
except ValueError:
532+
# the path was null, so nothing to read
533+
return
530534
database_path = DatabasePath.from_cypher_path(cypher_path=path)
531535
self._parse_path(database_path=database_path)
532536
self._current_node_field_specifiers = None

backend/infrahub/core/query/diff.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,13 @@ def __init__(
199199
diff_rel_paths = [], item IN [penultimate_path, peer_path] |
200200
CASE WHEN item IS NULL THEN diff_rel_paths ELSE diff_rel_paths + [item] END
201201
) AS diff_rel_paths, has_more_data
202+
// ------------------------
203+
// make sure we still include has_more_data if diff_rel_paths is empty
204+
// ------------------------
205+
WITH CASE
206+
WHEN diff_rel_paths = [] THEN [NULL]
207+
ELSE diff_rel_paths
208+
END AS diff_rel_paths, has_more_data
202209
"""
203210

204211
def get_previous_base_path_query(self, db: InfrahubDatabase) -> str:

backend/infrahub/graphql/mutations/proposed_change.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ async def mutate(
225225

226226
async with graphql_context.db.start_session() as db:
227227
proposed_change.state.value = ProposedChangeState.MERGING.value
228-
proposed_change.save(db=db)
228+
await proposed_change.save(db=db)
229229

230230
if wait_until_completion:
231231
await graphql_context.service.workflow.execute_workflow(

changelog/+diff_batch_bug.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix a problem in the logic to calculate a diff that could cause it to quit too early under certain unlikely circumstances

0 commit comments

Comments
 (0)