refactor(gfql/cypher): consume WHERE directly from MatchClause (remove flatten seam)#1693
Merged
Merged
Conversation
87b94da to
db96812
Compare
0c1ca54 to
3b9087c
Compare
db96812 to
5b692fe
Compare
3b9087c to
642c6ea
Compare
47a793e to
a1c0d28
Compare
642c6ea to
79c922d
Compare
a1c0d28 to
151e9c3
Compare
79c922d to
2e17158
Compare
…e flatten seam) The grammar bundles a trailing WHERE onto its MATCH clause. The transformer previously split it back out into a synthetic standalone WhereClause item and let the legacy clause-sequence assembler re-attach it — a temporary seam that kept the Earley→LALR switch (#1682) byte-identical without touching the gnarliest transformer method. Now the assembler consumes MatchClause.where directly: - primary MATCH keeps its WHERE on the clause (and it becomes the query's top-level `where`, last-clause-wins for per-clause scoping) — the grammar already set it, so this is a pure deletion of the split/re-attach round-trip; - a post-WITH re-entry MATCH's WHERE moves into `reentry_wheres` with the clause carrying none (the one case that still needs a split). The now-unreachable standalone-WhereClause branches in both query_body and graph_constructor are removed. Net −23 lines. Pure internal refactor, NO behavior change (closes #1687). Verified: - old-vs-new production AST differential over a 1,989-query repo corpus: 1989/1989 byte-identical, 0 AST diffs, 0 language diffs; - grammar invariants (zero conflicts / strict / semantic-ambiguity-zero) + full-repo LALR≡Earley differential pass; - full cypher suite on dgx-spark: 1737 passed / 0 failed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2e17158 to
d8b2bbf
Compare
Contributor
Author
|
red b/c unrelated EXISTS work |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1687. Follow-up cleanup to the LALR parser (#1682).
Context
The grammar bundles a trailing
WHEREonto itsMATCHclause (that's what made the WITH..WHERE attachment unambiguous). To keep the Earley→LALR switch byte-identical, the transformer took a shortcut: it splitMatchClause.whereback out into a synthetic standaloneWhereClauseitem and let the pre-existing clause-assembler re-attach it — so the gnarliest ~230-line method ran untouched. #1682 flagged that seam as a scoped follow-up.Change
The assembler now consumes
MatchClause.wheredirectly:WHEREon the clause (and it becomes the query's top-levelwhere, last-clause-wins soMATCH … WHERE … OPTIONAL MATCH … WHERE …scopes each predicate) — the grammar already set it, so this is a pure deletion of the split-then-reattach round-trip;WHEREmoves intoreentry_whereswith the clause carrying none (the one case that genuinely needs a split).The now-unreachable standalone-
WhereClausebranches in bothquery_bodyandgraph_constructorare removed (the grammar can't emit a standalone WHERE item). Net −23 lines.Pure refactor — no behavior change
strict=True/ semantic-ambiguity-zero / rule-coverage) + full-repo LALR≡Earley differential: pass.Base
Stacked on
test/gfql-viz-pipeline-acceptance(the tip of the #1675→#1681 grammar stack) rather than master, so it works against the final grammar (post-EXISTS/searchAny) and rebases along with the stack. Confirmed the zero-conflict invariants still hold on the tip after those grammar additions.🤖 Generated with Claude Code
https://claude.ai/code/session_01W5vkD2ZCyv3bmecBYoYYQy