Skip to content

Wesley QIR Phase C #665

Description

@flyingrobots

Migrated from Method backlog

This issue was created from a legacy filesystem backlog card. GitHub Issues are now the live work tracker; repository docs remain Method evidence.

Source backlog: docs/method/backlog/up-next/PLATFORM_wesley-qir-phase-c.md
Original lane: up-next
Original legend: PLATFORM

Original backlog card

Wesley QIR Phase C

Milestone: First Light | Priority: P1 | Repo: Wesley

Wesley-repo work. Extend Wesley's Query IR to compile GraphQL operations into executable SQL query plan ASTs. This builds on the existing E0-E4 foundation.

T-2-1-1: GraphQL operation parser for QIR

User Story: As a Wesley user, I want to write GraphQL operations against my schema and have Wesley parse them into a typed QIR AST so that I can generate SQL query plans automatically.

Requirements:

  • R1: Parse GraphQL query/mutation/subscription operations from .graphql files or inline strings.
  • R2: Resolve field references against the Wesley type catalog (E0-E4 types).
  • R3: Produce a typed QIR AST with resolved field paths, argument types, and return types.
  • R4: Emit parse errors with source locations (line:column) for invalid operations.
  • R5: Support fragment spreads and inline fragments in the initial parser.

Acceptance Criteria:

  • AC1: A simple query { user(id: 1) { name email } } parses to a QIR node tree with resolved types.
  • AC2: Invalid field references produce errors with source location.
  • AC3: Fragment spreads are inlined into the QIR AST.
  • AC4: Unit tests cover at least 5 operation shapes (simple query, nested query, mutation, fragment, variables).

Definition of Done:

  • Code reviewed and merged
  • Tests pass (CI green)
  • Documentation updated (if applicable)

Scope: Repo: Wesley. New qir/ module with parser and AST types. Integration with existing type catalog.
Out of Scope: SQL plan generation (T-2-1-2). Subscription semantics beyond parsing. Runtime execution.

Test Plan:

  • Goldens: Snapshot tests for QIR AST output of 5+ canonical operations.
  • Failures: Malformed GraphQL, unknown fields, type mismatches in arguments.
  • Edges: Empty query body, deeply nested selections (10+ levels), duplicate fragment names.
  • Fuzz/Stress: Fuzz the parser with random GraphQL-like strings (100k iterations).

Blocked By: none
Blocking: T-2-1-2

Est. Hours: 6h
Expected Complexity: ~400 LoC


T-2-1-2: SQL query plan generation from QIR

User Story: As a Wesley user, I want QIR ASTs compiled into SQL query plan ASTs so that I can generate efficient database queries from my GraphQL schema.

Requirements:

  • R1: Transform QIR AST nodes into SQL SELECT/JOIN/WHERE plan nodes.
  • R2: Support basic relational mapping: object types to tables, fields to columns, relations to JOINs.
  • R3: Emit a plan AST (not raw SQL strings) suitable for target-specific SQL rendering.
  • R4: Handle argument-based filtering (WHERE clauses) and nested selection (JOINs).
  • R5: Plan AST must be serializable to JSON for debugging and downstream consumption.

Acceptance Criteria:

  • AC1: A nested query { user(id: 1) { posts { title } } } produces a plan with SELECT + JOIN.
  • AC2: Plan AST serializes to JSON matching a golden snapshot.
  • AC3: Mutation operations produce INSERT/UPDATE/DELETE plan nodes.
  • AC4: Plan generation errors (unmapped types, ambiguous joins) have clear messages.

Definition of Done:

  • Code reviewed and merged
  • Tests pass (CI green)
  • Documentation updated (if applicable)

Scope: Repo: Wesley. qir/planner.ts module. JSON serialization of plan AST.
Out of Scope: Actual SQL string rendering (target-specific). Query optimization. Subscription plans.

Test Plan:

  • Goldens: Snapshot tests for plan AST JSON output of 5+ operations.
  • Failures: Unmapped type, circular relation, missing required argument.
  • Edges: Self-referencing type (recursive query), zero-field selection, aggregate-only query.
  • Fuzz/Stress: Property test: all parseable QIR ASTs produce either a valid plan or a structured error (no crashes).

Blocked By: T-2-1-1
Blocking: none

Est. Hours: 6h
Expected Complexity: ~450 LoC


Activity

  1. coderabbitai commented on Jun 1, 2026

    @coderabbitai
    🔗 Related PRs

    flyingrobots/echo#329 - Stack Witness 0001 fixture-backed jedit walking skeleton [merged]
    flyingrobots/echo#344 - feat(wesley): consume canonical requirements artifacts [merged]
    flyingrobots/echo#365 - feat(wesley): emit query observer host helpers [merged]
    flyingrobots/echo#385 - docs(backlog): two follow-ups from the 2026-05-30 merge session [merged]
    flyingrobots/echo#388 - docs(method): add backlog cards and hook failure note [merged]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  2. coderabbitai commented on Jul 3, 2026

    @coderabbitai
    🔗 Related PRs

    #42 - feat(qir): SQL lowering (MVP) with deterministic output and COALESCE for lists [merged]
    #44 - feat(qir): ops emission (VIEW + SQL function returning jsonb rows) [merged]
    #45 - docs(qir): document lowering + emission (MVP) [merged]
    #324 - feat(security): InputValidator + StandardSanitizer + tests [merged]
    #513 - expand parity fixture coverage [merged]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  3. added
    triage:requestsUnscheduled valid requests that still need a release scheduling decision
    on Jul 5, 2026
  4. flyingrobots commented on Jul 5, 2026

    @flyingrobots
    OwnerAuthor

    Bookkeeping triage: restored the required scheduling-state label triage:requests. This issue remains valid intake, but it is not selected for a named release lane yet.

  5. flyingrobots commented on Jul 6, 2026

    @flyingrobots
    OwnerAuthor

    Roadmap reconsideration after the Rust-native reset:

    Closing this as obsolete as written. It is a migrated Method backlog card for SQL-oriented QIR planning. The issue asks Wesley to compile GraphQL operations into executable SQL plan ASTs with table/column/relation mapping.

    That conflicts with the current domain-empty boundary. Wesley may parse/lower operations and expose structural artifacts, but database/runtime semantics belong in owning targets such as wesley-postgres or another external module. The generic Wesley side should stay focused on operation shape, IR, schema diff, external target protocols, and evidence artifacts.

    If there is still useful work here, it should be re-filed as either:

    • a target-owned SQL planner issue in the owning database repo, or
    • a narrow Wesley structural operation-analysis issue that does not encode database semantics.
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

    legend:PLATFORMPlatform/infrastructure worktriage:requestsUnscheduled valid requests that still need a release scheduling decision

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions