test(grammar): satisfiability accept/reject fixtures#530
Merged
Conversation
This was referenced Jun 27, 2026
Add a satisfiability checker that runs each node pattern against the grammar's ordered structure and rejects patterns no concrete tree can ever match: a child the parent never admits, an order the grammar never produces, a strict anchor the grammar erases. The check is a Thompson-style automaton over admissibility facts (`satisfiability/`), wired as a compile pass in `compiler/query/stages.rs`. A step budget (`compiler/limits.rs`) and a reference-recursion ceiling keep pathological grammars terminating. Two new diagnostics report the outcomes: `UnsatisfiablePattern` and `QueryTooComplex`. Emit/typegen fixtures whose authored queries were grammar-impossible are corrected to satisfiable forms so they keep testing emission and types.
Golden fixtures pinning the satisfiability checker across every construct: alternations, anchors, fields, nodes, quantifiers, definitions. Each impossible pattern carries its rejection diagnostic; each valid counterpart compiles to bytecode, so the accept/reject boundary is fixed in place. JavaScript only; cross-language cases land with multi-language support.
zharinov
force-pushed
the
gv/03-satisfiability
branch
from
June 27, 2026 19:44
86f12ae to
2c5e968
Compare
zharinov
force-pushed
the
gv/04-satisfiability-fixtures
branch
from
June 27, 2026 19:44
8ab241a to
735d546
Compare
zharinov
enabled auto-merge (squash)
June 28, 2026 18:02
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.
Summary
Why
Locks the accept/reject boundary in place so it cannot move without a visible fixture diff.
Notes
JavaScript only. Cross-language cases land with multi-language support.