Skip to content

Make QueryBuilder.explain_plan() effective and one-shot at execution time#1319

Merged
SkBlaz merged 2 commits intomasterfrom
copilot/identify-dsl-rough-edges
Mar 29, 2026
Merged

Make QueryBuilder.explain_plan() effective and one-shot at execution time#1319
SkBlaz merged 2 commits intomasterfrom
copilot/identify-dsl-rough-edges

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 29, 2026

dsl rough edges identification surfaced a mismatch between DSL ergonomics and runtime behavior: calling .explain_plan() set an internal flag but did not affect execute() unless explain_plan=True was also passed. This PR aligns builder intent with execution semantics.

  • Runtime behavior alignment (QueryBuilder.execute)

    • execute() now honors _explain_plan_flag by enabling plan capture for the next call.
    • The flag is consumed after use (one-shot), preventing state leakage across subsequent executions.
  • Regression coverage (tests/test_dsl_planner.py)

    • Added a focused test that verifies full lifecycle:
      • .explain_plan() -> first execute() includes result.meta["plan"]
      • second execute() (without re-enabling) does not include plan metadata
      • re-calling .explain_plan() restores plan capture on the same builder instance
q = Q.nodes().compute("degree").explain_plan()
r1 = q.execute(net)                  # includes r1.meta["plan"]
r2 = q.execute(net)                  # no plan metadata
r3 = q.explain_plan().execute(net)   # includes r3.meta["plan"] again

Copilot AI and others added 2 commits March 29, 2026 18:49
@SkBlaz SkBlaz marked this pull request as ready for review March 29, 2026 20:05
@SkBlaz SkBlaz self-requested a review as a code owner March 29, 2026 20:05
@SkBlaz SkBlaz merged commit 495cfb2 into master Mar 29, 2026
33 checks passed
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.

2 participants