Skip to content

Releases: wfredricks/polygraph

v0.1.4 \u2014 bridge MERGE + multi-statement support

22 May 16:04
6d7181f

Choose a tag to compare

Cypher bridge grows to unblock the first load-bearing consumer of idempotent anchors: the archetypes-solution-intelligence/contract-loader Solution\u2192Contract relationship.

Added

  • MERGE in the regex bridge. Both shapes are supported:
    • MERGE (n:Label {props}) \u2014 idempotent node match-or-create.
    • MERGE (a)-[:TYPE]->(b) \u2014 idempotent relationship anchor. Two MERGEs of the same edge produce one edge.
  • Multi-statement cypher. Queries with multiple top-level MATCH / CREATE / MERGE clauses (e.g. MATCH (s:\u2026) MATCH (c:\u2026) MERGE (s)-[:R]->(c) RETURN \u2026) are now parsed into a multi-statement plan and executed with a shared variable-binding context. The trailing RETURN clause is lifted onto the wrapper plan so it sees bindings from every sub-statement.
  • Label-less MATCH. Patterns like MATCH (n {contractId: $x, namespace: $ns}) now full-scan and filter by inline properties instead of throwing. Used by contract-loader's wipe pattern MATCH (n {\u2026}) DETACH DELETE n.
  • DETACH DELETE keyword. Accepted by the parser and surfaced via a detach: true flag on the match-delete plan. PolyGraph's deleteNode already cascades; DETACH DELETE and plain DELETE remain semantically equivalent.
  • Differential test vs qengine v0. MATCH (n:Label) RETURN n returns the same node ids from both engines.
  • build-history/PHASE-1D-PROBE-2026-05-22.md \u2014 empirical gap survey that drove this release. Re-runnable via npx tsx scripts/probe-contract-loader-patterns.ts.

Why

Per BUILD-PHASE-1D-PLAN.md: PolyGraph needs to grow up and it does so one limitation fix at a time. The first load-bearing consumer of MERGE is contract-loader's Solution\u2192Contract anchor; the probe surfaced four additional gaps the bridge silently broke (label-less MATCH, DETACH DELETE, multi-statement CREATE+CREATE, multi-statement MATCH+MATCH+MERGE). All five gaps land here.

Out of scope (recorded for posterity)

  • Aggregations, OPTIONAL MATCH, WITH, UNWIND, variable-length paths \u2014 still qengine territory.
  • $param binding \u2014 consumers inline literals today.
  • ORDER BY \u2014 silently accepted by RETURN parser but not executed; punted.

Stats

  • 502 / 502 tests passing (+19 new bridge tests)
  • No new npm dependencies
  • PolyGraph.query(cypher: string): Promise<any[]> signature preserved
  • qengine src/qengine/ untouched