refactor(lapis): add abstract SaneQL serialization layer#1760
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors the LAPIS Kotlin SILO query serialization path by introducing a small SaneQL AST as an intermediate representation, separating “what to render” (mapping from SiloQuery/SiloFilterExpression/SiloAction) from “how to render” (quoting/escaping/precedence in one place). This aligns with issue #1754 and keeps the SILO client callsite behavior the same while making serialization more testable.
Changes:
- Added a reusable SaneQL AST (
SaneQlAst) with a singlerender()responsibility and dedicated unit tests. - Moved serialization logic into
SiloQuery.toSaneQl(),SiloFilterExpression.toSaneQl(), andSiloAction.toSaneQlSteps()(mapping to AST, then render). - Removed the monolithic
SiloQuerySaneQlSerializerand updated call sites/tests to usetoSaneQl().
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| lapis/src/test/kotlin/org/genspectrum/lapis/silo/SiloQueryToSaneQlTest.kt | Updates serialization tests to use query.toSaneQl() and renames the test class accordingly. |
| lapis/src/test/kotlin/org/genspectrum/lapis/silo/SaneQlAstTest.kt | Adds focused unit tests validating AST rendering (escaping, precedence, steps/pipeline). |
| lapis/src/main/kotlin/org/genspectrum/lapis/silo/SiloQuerySaneQlSerializer.kt | Removes the old monolithic serializer implementation. |
| lapis/src/main/kotlin/org/genspectrum/lapis/silo/SiloQuery.kt | Introduces toSaneQl() and adds AST-mapping methods for actions and filter expressions. |
| lapis/src/main/kotlin/org/genspectrum/lapis/silo/SiloClient.kt | Switches SILO request construction to use query.toSaneQl(). |
| lapis/src/main/kotlin/org/genspectrum/lapis/silo/SaneQlAst.kt | Adds the SaneQL AST types and centralized rendering logic (escaping/precedence/formatting). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fhennig
approved these changes
Jul 7, 2026
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.
resolves #1754
Adds a reusable representation of SaneQL syntax in the code as an intermediate layer between the SILO expression object tree and the SaneQL string.
PR Checklist
llms.txt.