Skip to content

refactor(lapis): add abstract SaneQL serialization layer#1760

Merged
fengelniederhammer merged 3 commits into
mainfrom
1754-refactorlapis-saneql-object-layer
Jul 7, 2026
Merged

refactor(lapis): add abstract SaneQL serialization layer#1760
fengelniederhammer merged 3 commits into
mainfrom
1754-refactorlapis-saneql-object-layer

Conversation

@fengelniederhammer

Copy link
Copy Markdown
Contributor

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

  • All necessary documentation has been adapted.
  • All necessary changes are explained in the llms.txt.
  • The implemented feature is covered by an appropriate test.

@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lapis Ready Ready Preview, Comment Jul 7, 2026 8:02am

Request Review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 single render() responsibility and dedicated unit tests.
  • Moved serialization logic into SiloQuery.toSaneQl(), SiloFilterExpression.toSaneQl(), and SiloAction.toSaneQlSteps() (mapping to AST, then render).
  • Removed the monolithic SiloQuerySaneQlSerializer and updated call sites/tests to use toSaneQl().

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.

Comment thread lapis/src/main/kotlin/org/genspectrum/lapis/silo/SaneQlAst.kt Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@fengelniederhammer fengelniederhammer merged commit 30be83a into main Jul 7, 2026
9 checks passed
@fengelniederhammer fengelniederhammer deleted the 1754-refactorlapis-saneql-object-layer branch July 7, 2026 08:37
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.

refactor(lapis): SaneQL object layer

3 participants