Skip to content

fix(parser): reject write clauses as unsupported features - #189

Merged
prrao87 merged 1 commit into
mainfrom
fix/reject-write-clauses
Nov 21, 2026
Merged

prrao87 merged 1 commit into
mainfrom
fix/reject-write-clauses

Conversation

@prrao87

@prrao87 prrao87 commented Nov 21, 2026

Copy link
Copy Markdown
Member

Why

lance-csr runs read-only Cypher, but a write clause such as CREATE or SET failed with the same opaque parse error as a typo. Callers couldn't tell "valid Cypher this engine doesn't run" from "invalid Cypher". Closes #183.

What changed

  • When a query fails to parse, the parser now looks for a write clause (CREATE, MERGE, SET, DELETE, DETACH DELETE, REMOVE, FOREACH, LOAD CSV) and, if it finds one, returns GraphError::UnsupportedFeature instead of ParseError. Python raises NotImplementedError and TypeScript a NotImplemented error, through the existing mappings.

  • The message names the clause and where it starts:

    Unsupported Cypher feature: SET (line 1, column 18). lance-csr runs read-only queries.
    
  • Keywords inside strings, comments and backtick-quoted names are ignored, as are words used as a property (p.set), parameter ($delete), label (:Merge) or map key ({remove: 1}). The check only runs after a parse failure, so a query that parses today is never rejected by it.

  • The Cypher and TypeScript guides list the full set of write clauses and say they raise NotImplementedError.

Validation

  • cargo test -p lance-csr: all pass, including new parser tests for each clause, multi-line positions, non-ASCII text before the clause, and keywords in names, literals and comments staying parse errors.
  • cargo clippy -p lance-csr --all-targets -- -D warnings, uvx typos@1.52.0 . and the strict Zensical docs build pass.
  • Python and Node.js tests weren't run locally; the change is in the Rust parser and the error mappings are unchanged. CI pending.

🤖 Generated with Claude Code

A write clause such as CREATE or SET failed with an opaque parse error.
After a parse failure, look for a write clause outside strings, comments
and quoted names and report it as UnsupportedFeature with its position.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Deploying lance-csr with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1fe308a
Status: ✅  Deploy successful!
Preview URL: https://71eab526.lance-csr.pages.dev
Branch Preview URL: https://fix-reject-write-clauses.lance-csr.pages.dev

View logs

@prrao87
prrao87 marked this pull request as ready for review November 21, 2026 20:29
@prrao87
prrao87 merged commit ecd4fea into main Nov 21, 2026
10 checks passed
@prrao87
prrao87 deleted the fix/reject-write-clauses branch November 21, 2026 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reject write clauses with an unsupported-feature error instead of a parse error

1 participant