Skip to content

Build the RockQL v0.1 compiler foundation - #2

Open
SayanthRock wants to merge 7 commits into
mainfrom
agent/compiler-foundation
Open

Build the RockQL v0.1 compiler foundation#2
SayanthRock wants to merge 7 commits into
mainfrom
agent/compiler-foundation

Conversation

@SayanthRock

@SayanthRock SayanthRock commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

What changed

  • adds a Rust workspace with AST, parser, SQL generator, formatter, and CLI crates
  • implements from, filter, select, derive, sort, and take
  • supports newline and | separated pipelines
  • generates Generic SQL, SQLite, and PostgreSQL output
  • adds line/column parser diagnostics and focused unit tests
  • adds compile, check, format, and ast CLI commands
  • replaces the placeholder README with the RockQL product direction, examples, architecture, boundaries, and roadmap
  • adds examples, MVP language reference, contribution, conduct, and security documentation
  • adds the requested CI, Rust test, web, Android, WebAssembly, release, security, and documentation workflow entry points

Why

The repository only contained a licence and one-line README. This establishes a reviewable, original RockQL compiler core before the playground, visual pipeline, Android application, bindings, and advanced transforms are added.

Developer impact

The core example can now be parsed and compiled through the CLI design:

cargo run -p rockql-cli -- compile examples/employees.rockql --target postgres

The web, Android, and WebAssembly workflows detect whether their components exist and skip cleanly until those directories are implemented.

Validation

  • parser tests cover multiline and pipe-separated syntax plus positioned diagnostics
  • SQL tests cover the primary employee example and boolean/equality normalisation
  • GitHub Actions runs formatting, Clippy, tests, documentation checks, dependency review, and CodeQL

Local Rust execution was not available in the connected environment, so GitHub Actions is the authoritative compile/test validation for this pull request.

Summary by CodeRabbit

  • New Features

    • Introduced the RockQL MVP query language with filtering, selection, derived fields, sorting, and row limits.
    • Added a command-line tool to compile RockQL into SQL, validate queries, format source, and inspect parsed output.
    • Added support for generic SQL, SQLite, and PostgreSQL dialects.
    • Added expression normalization for common operators, boolean values, nulls, and fallback expressions.
  • Documentation

    • Added language reference documentation, usage examples, project guidance, contribution guidelines, and security policies.

@ai-coding-guardrails

Copy link
Copy Markdown

You've hit your review limit for the week, but don't worry you'll get some more next week!

Contact us at hello@zenable.io if you want this rate limit to go away

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds the RockQL Rust workspace and compiler MVP, including AST, parser, formatter, SQL generation, CLI, examples, documentation, and GitHub Actions workflows for validation, builds, releases, and security checks.

Changes

RockQL compiler MVP

Layer / File(s) Summary
Workspace and AST contracts
Cargo.toml, compiler/rockql-ast/*
Defines the Cargo workspace and public AST types for sources, expressions, transforms, spans, and sorting.
Pipeline parser and validation
compiler/rockql-parser/*
Parses newline- and pipe-separated pipelines, validates transforms and identifiers, tracks spans, and reports structured errors.
Formatting and SQL compilation
compiler/rockql-formatter/*, compiler/rockql-sql/*
Formats RockQL queries and compiles transforms into normalized SQL for supported dialects.
CLI command integration
compiler/rockql-cli/*
Adds compile, check, format, and AST commands with file and stdin input handling.
Build, test, release, and security automation
.github/workflows/*, .gitignore, deny.toml
Adds CI, platform builds, releases, documentation checks, security analysis, and advisory configuration.
Project documentation and examples
README.md, docs/*, CONTRIBUTING.md, CODE_OF_CONDUCT.md, SECURITY.md, examples/*
Documents the MVP language, CLI, architecture, project policies, and sample pipelines.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant rockql
  participant rockql-parser
  participant rockql-sql
  User->>rockql: compile input
  rockql->>rockql-parser: parse(source)
  rockql-parser-->>rockql: Query
  rockql->>rockql-sql: compile(Query, Dialect)
  rockql-sql-->>rockql: SQL
  rockql-->>User: print SQL
Loading

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 32.35% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: establishing the RockQL v0.1 compiler foundation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/compiler-foundation

Comment @coderabbitai help to get the list of available commands.

@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@SayanthRock
SayanthRock marked this pull request as ready for review July 25, 2026 22:50
Copilot AI review requested due to automatic review settings July 25, 2026 22:50
@ai-coding-guardrails

Copy link
Copy Markdown

You've hit your review limit for the week, but don't worry you'll get some more next week!

Contact us at hello@zenable.io if you want this rate limit to go away

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b9a2c16046

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread compiler/rockql-sql/src/lib.rs
Comment thread compiler/rockql-sql/src/lib.rs
Comment thread .github/workflows/release.yml
Comment thread compiler/rockql-sql/src/lib.rs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 7

🧹 Nitpick comments (1)
compiler/rockql-formatter/src/lib.rs (1)

1-59: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Formatter logic looks correct; add round-trip tests.

The variant handling correctly matches the parser's brace/expression contracts (e.g. select {...}, bare filter/derive/take). However, this new crate ships with no test module, unlike rockql-sql which added a rockql-parser dev-dependency and unit tests. A formatter's most important property—idempotent round-tripping (format(parse(format(q))) == format(q))—is exactly the kind of thing that should be pinned down with tests now, before more transform kinds are added.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@compiler/rockql-formatter/src/lib.rs` around lines 1 - 59, Add a unit-test
module for the public format function covering representative queries with the
supported Transform variants. Parse the formatted output and assert the
round-trip property format(parse(format(query))) == format(query), including
brace-based select/sort and bare filter/derive/take forms; add the necessary
parser crate as a development dependency following the rockql-sql test setup.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/release.yml:
- Around line 8-9: Update the workflow-level permissions to set contents to read
by default, then add a contents: write permission specifically within the
publish job. Keep the build jobs on read-only access while preserving publish’s
ability to write release contents.
- Around line 29-32: Update the macOS x86_64 matrix entry in the release
workflow to use the active macos-15-intel runner instead of macos-13, while
preserving its target, artifact, and binary values.

In @.github/workflows/security.yml:
- Around line 21-23: Remove continue-on-error: true from the “Review dependency
changes” step using actions/dependency-review-action@v4 so dependency review
failures block the pull request. Keep the action and step configuration
otherwise unchanged.

In `@compiler/rockql-cli/src/main.rs`:
- Around line 69-96: Update the "-" branch in parse so stdin is assigned through
the same duplicate-input validation as the path branch. Preserve "-" as the
stdin input when it is the first positional input, but return "only one input
file may be supplied" when input was already set.

In `@compiler/rockql-parser/src/lib.rs`:
- Around line 330-365: Update split_segments to treat a top-level `|` as a
pipeline delimiter only when it is not paired with an adjacent `|`, preserving
quoted-string and escape handling. Ensure expressions containing the `||`
operator remain within one segment, and add a regression test covering `filter
first_name || last_name = 'Ada'`.

In `@compiler/rockql-sql/src/lib.rs`:
- Around line 96-104: Update the filter-combination logic in the SQL
construction block to wrap every individual filter expression in parentheses
before appending it, while preserving the existing newline and AND joining
behavior. Ensure multiple filters retain their intended grouping when
expressions contain OR or NOT.
- Around line 50-82: Update the transform processing around the Derive, Select,
and Filter branches to handle derived aliases referenced by later selects or
filters. Either reject or warn at compile time for this unsupported pipeline
shape, or preserve derived columns and alias scope by generating the required
subquery/CTE; do not emit a bare alias reference in the projection or WHERE
clause.

---

Nitpick comments:
In `@compiler/rockql-formatter/src/lib.rs`:
- Around line 1-59: Add a unit-test module for the public format function
covering representative queries with the supported Transform variants. Parse the
formatted output and assert the round-trip property format(parse(format(query)))
== format(query), including brace-based select/sort and bare filter/derive/take
forms; add the necessary parser crate as a development dependency following the
rockql-sql test setup.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 18119384-6a4e-4b24-8dd6-d76506eea542

📥 Commits

Reviewing files that changed from the base of the PR and between 73cf1aa and b9a2c16.

📒 Files selected for processing (28)
  • .github/workflows/android-build.yml
  • .github/workflows/ci.yml
  • .github/workflows/docs.yml
  • .github/workflows/release.yml
  • .github/workflows/rust-tests.yml
  • .github/workflows/security.yml
  • .github/workflows/wasm-build.yml
  • .github/workflows/web-build.yml
  • .gitignore
  • CODE_OF_CONDUCT.md
  • CONTRIBUTING.md
  • Cargo.toml
  • README.md
  • SECURITY.md
  • compiler/rockql-ast/Cargo.toml
  • compiler/rockql-ast/src/lib.rs
  • compiler/rockql-cli/Cargo.toml
  • compiler/rockql-cli/src/main.rs
  • compiler/rockql-formatter/Cargo.toml
  • compiler/rockql-formatter/src/lib.rs
  • compiler/rockql-parser/Cargo.toml
  • compiler/rockql-parser/src/lib.rs
  • compiler/rockql-sql/Cargo.toml
  • compiler/rockql-sql/src/lib.rs
  • deny.toml
  • docs/reference/mvp-language.md
  • examples/employees.rockql
  • examples/users.rockql

Comment thread .github/workflows/release.yml
Comment thread .github/workflows/release.yml
Comment thread .github/workflows/security.yml
Comment thread compiler/rockql-cli/src/main.rs
Comment thread compiler/rockql-parser/src/lib.rs
Comment thread compiler/rockql-sql/src/lib.rs
Comment thread compiler/rockql-sql/src/lib.rs
@SayanthRock

Copy link
Copy Markdown
Contributor Author

@copilot please fix the merge conflicts in this pull request.

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.

3 participants