Skip to content

refactor: centralize circular query dependency detection (backport #1032)#1033

Merged
nextchamp-saqib merged 1 commit intoversion-3-hotfixfrom
mergify/bp/version-3-hotfix/pr-1032
Apr 6, 2026
Merged

refactor: centralize circular query dependency detection (backport #1032)#1033
nextchamp-saqib merged 1 commit intoversion-3-hotfixfrom
mergify/bp/version-3-hotfix/pr-1032

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify bot commented Apr 6, 2026

Replaces 4 independent, ad-hoc circular reference guards with a unified approach:

  • New query_utils.py: shared graph utilities — extract_query_deps_from_operations, get_direct_dependencies, transitive_closure, find_cycle
  • Validate on save (InsightsQueryv3.validate): cycles are now caught before being persisted, with a full cycle path in the error message (e.g. "A" → "B" → "A")
  • IbisQueryBuilder.build(): owns the runtime recursion guard (via frappe.local) as a defensive fallback
  • get_source_tables(): rewritten using transitive_closure — drops the recursive visited parameter pattern
  • set_linked_queries(): simplified to a one-liner using extract_query_deps_from_operations
  • getLinkedQueries() (frontend): fixed a latent infinite-loop bug — adds a _visited Set to guard against cycles in already-loaded data
  • getEffectiveOperationsForDrillDown() (frontend): _visitedQueryNames: string[]_visitedQueries: Set<string> for O(1) lookups and consistent style
    This is an automatic backport of pull request refactor: centralize circular query dependency detection #1032 done by Mergify.

@nextchamp-saqib nextchamp-saqib merged commit a9ad980 into version-3-hotfix Apr 6, 2026
3 checks passed
@nextchamp-saqib nextchamp-saqib deleted the mergify/bp/version-3-hotfix/pr-1032 branch April 6, 2026 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant