Skip to content

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

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

Activity

  1. lmeyerov commented on Apr 11, 2026

    @lmeyerov
    ContributorAuthor

    Parent tracker: #1139.\n\nLane-specific testing expectations for PR3:\n- Structural invariants include true variable-scope checks (not non-empty-string checks).\n- Negative fixtures for dangling refs, duplicate op_id, nullability violations, and malformed optional arms.\n- Cycle-safe verification traversal test (malformed cyclic plan cannot recurse indefinitely).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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