Skip to content

Unified: Add a debug query to view the AST as a graph. - #22474

Merged
aschackmull merged 1 commit into
github:mainfrom
aschackmull:unified/debug-ast
Sep 1, 2026
Merged

Unified: Add a debug query to view the AST as a graph.#22474
aschackmull merged 1 commit into
github:mainfrom
aschackmull:unified/debug-ast

Conversation

@aschackmull

Copy link
Copy Markdown
Contributor

I find this quite useful, and easier to inspect than the regular AST viewer.

Copilot AI balanced review requested due to automatic review settings September 1, 2026 07:33
@aschackmull
aschackmull requested a review from a team as a code owner September 1, 2026 07:33
@aschackmull aschackmull added the no-change-note-required This PR does not need a change note label Sep 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The edge relation reverses parent-child direction and may reference filtered-out nodes.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 1 Medium severity

New issues introduced by this change (1)
Severity Finding
Medium severity unified/​ql/​lib/​codeql/​unified/​internal/​dev/​debugAst.ql — The edge relation is reversed and can reference nodes omitted by nodes: pred is bound to a…
What changed in this PR

Adds a developer query for visualizing Unified AST nodes as a graph.

Changes:

  • Filters AST nodes by source location.
  • Adds customizable node and edge labels.
File Description
unified/​ql/​lib/​codeql/​unified/​internal/​dev/​debugAst.ql Implements the AST debug graph query.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +45 to +49
relevant(succ) and
exists(int i |
pred = getChild(succ, i) and
val = i + " " + concat(string t | t = etag(pred, succ) | t, ", ")
)
@aschackmull
aschackmull merged commit 8e5e63b into github:main Sep 1, 2026
15 checks passed
@aschackmull
aschackmull deleted the unified/debug-ast branch September 1, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-change-note-required This PR does not need a change note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants