Skip to content

bug(node binding): MATCH ()-[r]->() RETURN count(r) throws "not found" on 0.1.22 binding #406

@ryaker

Description

@ryaker

Summary

The 0.1.22 Node binding regresses on relationship-pattern Cypher queries. Reproducible isolation case below. Node-pattern queries work fine; only relationship-pattern queries fail.

Reproduction (10-line script, fresh node process)

$ cd /Users/ryaker/Dev/KMSmcp  # any KMSmcp checkout with sparrowdb installed
$ node -e "
const sd = require('sparrowdb');
const db = sd.SparrowDB.open('/Users/ryaker/.kms-sparrowdb-v2');
try { console.log('count(n):', db.execute('MATCH (n:Knowledge) RETURN count(n)').rows); } catch (e) { console.log('count(n) ERR:', e.message); }
try { console.log('count(r):', db.execute('MATCH ()-[r]->() RETURN count(r) AS cnt').rows); } catch (e) { console.log('count(r) ERR:', e.message); }
try { console.log('count(r2):', db.execute('MATCH ()-[r]-() RETURN count(r) AS cnt').rows); } catch (e) { console.log('count(r2) ERR:', e.message); }
"

Output:

count(n): [ { 'count(n)': 1013 } ]
count(r) ERR: not found
count(r2) ERR: not found

Error code on the thrown Error object: GenericFailure.

Environment

Impact on KMSmcp

Surfaces in SparrowDBStorage.getStats() and any _getRelationships traversal — KMSmcp's unified_search lost RELATED_TO/ABOUT edge enumeration after the 0.1.22 cutover. KMS service was reporting status: degraded until I added a try/catch workaround in PR #59 that defaults rel count to 0 when the query throws.

Workaround in KMSmcp is a band-aid — the real fix is here. Once shipped, KMSmcp will revert the workaround and use the rel count again.

Suspected scope

  • Whether OPTIONAL MATCH on rels works either
  • Whether MATCH (a)-[r]->(b) WHERE ... RETURN r (i.e., bound endpoints) works
  • Whether the regression is execution-engine or Cypher-parsing

If you want me to run additional Cypher probes against the live DB to narrow the scope, let me know — happy to script an isolation pass.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions