Skip to content

M2-PR3: LogicalPlan verifier (structural invariants) #1127

@lmeyerov

Description

@lmeyerov

M2-PR3: LogicalPlan verifier (structural invariants)

Parent: #1139

Objective

Add M2 structural verifier coverage for LogicalPlan and wire invariant checks into planner outputs.

Deliverables

  • Add graphistry/compute/gfql/ir/verifier.py with:
    • verify(plan: LogicalPlan) -> list[CompilerError]
  • Implement core invariants from milestone spec:
    • dangling reference detection
    • output schema consistency checks
    • predicate scope checks (especially PatternMatch)
    • optional-arm nullability contract checks
    • op_id uniqueness checks
  • Add focused positive/negative verifier tests.

Acceptance Criteria

  • Verifier catches intentionally malformed fixtures with stable error classes/messages.
  • Scope checks validate true variable visibility, not placeholder/non-empty-string checks.
  • Verification traversal is cycle-safe for malformed plans (no unbounded recursion).
  • Verifier passes on planner-emitted plans for covered query shapes.
  • CI green.

Non-goals

  • No cost-based optimization logic.
  • No physical planning/executor routing.

References

  • plans/compiler-refactor/milestone-M2.md (verify(plan) section)
  • plans/compiler-refactor/research-tracks/d4-verifier.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions