Skip to content

Conversation

@Newbie012
Copy link
Collaborator

@Newbie012 Newbie012 commented Jun 23, 2025

Summary by CodeRabbit

  • New Features
    • Updated to use the latest versions of key dependencies, which now utilize WebAssembly (WASM) for SQL parsing instead of native binaries.
  • Bug Fixes
    • Improved compatibility and reliability by removing reliance on native binary SQL parsers.
  • Documentation
    • Simplified and clarified the "Prerequisites" sections in the documentation and updated roadmap references from v4 to v5.
  • Refactor
    • Streamlined the SQL parsing process by centralizing and updating how queries are parsed across the codebase.
  • Chores
    • Updated dependency versions for improved stability and future compatibility.

@changeset-bot
Copy link

changeset-bot bot commented Jun 23, 2025

🦋 Changeset detected

Latest commit: 55ded03

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 17 packages
Name Type
@ts-safeql/eslint-plugin Major
@ts-safeql/generate Major
@ts-safeql-demos/basic-flat-config Patch
@ts-safeql-demos/basic-migrations-raw Patch
@ts-safeql-demos/basic-transform-type Patch
@ts-safeql-demos/basic Patch
@ts-safeql-demos/big-project Patch
@ts-safeql-demos/config-file-flat-config Patch
@ts-safeql-demos/from-config-file Patch
@ts-safeql-demos/multi-connections Patch
@ts-safeql-demos/playground Patch
@ts-safeql-demos/postgresjs-custom-types Patch
@ts-safeql-demos/postgresjs-demo Patch
@ts-safeql-demos/vercel-postgres Patch
@ts-safeql/shared Major
@ts-safeql/sql-ast Major
@ts-safeql/test-utils Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jun 23, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
safeql ⬜️ Ignored (Inspect) Visit Preview Jun 23, 2025 4:12pm

@coderabbitai
Copy link

coderabbitai bot commented Jun 23, 2025

Walkthrough

This update migrates the SafeQL project to use WebAssembly (WASM) builds of the libpg-query library instead of native binaries. The change affects both the ESLint plugin and code generation packages, removing direct SQL parsing dependencies from the ESLint rule, updating interfaces, and simplifying setup documentation to reflect the new prerequisites.

Changes

File(s) Change Summary
.changeset/forty-meals-behave.md Documents breaking changes: SafeQL now uses WASM builds of libpg-query and updates major dependencies.
README.md, docs/guide/getting-started.md Simplified prerequisites by removing node-gyp references and list formatting.
docs/blog/safeql-v5-roadmap.md Updated all references from "v4" to "v5" for roadmap and branding consistency.
packages/eslint-plugin/package.json, packages/generate/package.json Updated libpg-query dependency version from ^16.3.0 to ^17.5.2.
packages/eslint-plugin/src/rules/check-sql.rule.ts Removed native SQL parsing logic and related helper; now directly calls codegen without explicit parsing step.
packages/eslint-plugin/src/workers/check-sql.worker.ts Removed pgParsed property from params and related code; reordered imports.
packages/eslint-plugin/src/workers/index.ts Removed parseSync worker and related import/export definitions.
packages/eslint-plugin/src/workers/parse-sync.worker.ts Deleted file; previously handled synchronous SQL parsing with libpg-query.
packages/generate/src/generate.ts Centralized SQL parsing within the generate function; removed pgParsed from params interface.
packages/generate/src/generate.test.ts, packages/generate/src/utils/get-nonnullable-columns.test.ts, packages/generate/src/utils/get-relations-with-joins.test.ts Switched from parseQuery to parser.parse for SQL parsing in tests and utility pipelines.
packages/eslint-plugin/build.config.ts Removed build entry for deleted parse-sync.worker.ts file.

Sequence Diagram(s)

sequenceDiagram
    participant ESLintRule as ESLint Rule
    participant Codegen as Codegen (generateSyncE)
    participant WASMParser as WASM libpg-query

    ESLintRule->>Codegen: generateSyncE(query, ...)
    Codegen->>WASMParser: parser.parse(query.text)
    WASMParser-->>Codegen: Parsed AST
    Codegen-->>ESLintRule: Generation Result
Loading
sequenceDiagram
    participant User as User
    participant SafeQL as SafeQL Package
    participant WASMParser as WASM libpg-query

    User->>SafeQL: Provide SQL Query
    SafeQL->>WASMParser: parser.parse(query)
    WASMParser-->>SafeQL: Parsed AST
    SafeQL-->>User: Result (analysis, codegen, etc.)
Loading

Poem

A hop and a leap, SafeQL takes flight,
From native to WASM, our queries are light.
No more node-gyp, setup is clean,
Parsing in-browser, fast and serene.
Version five shines with a digital gleam—
The future of SQL, swift as a dream!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 14e6b0d and 55ded03.

📒 Files selected for processing (1)
  • packages/generate/src/generate.test.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/generate/src/generate.test.ts
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
docs/blog/safeql-v5-roadmap.md (1)

122-122: Reduce repetitive sentence starts in closing paragraph
The closing lines begin multiple sentences with “I”/“I’m.” Consider varying sentence openings for better flow (e.g., start one sentence with “Excited” or “Looking forward”).

.changeset/forty-meals-behave.md (1)

6-6: Fix typos in changeset documentation.

The changeset correctly documents the breaking change, but contains typos that should be corrected for professional documentation.

Apply this diff to fix the typos:

-BREAKING: SafeQL now requires the latest minore releases of `libpg-query` which use WASM builds instead of native binaries. This change imporves compatibility across different platforms and eliminates native compilation issues.
+BREAKING: SafeQL now requires the latest minor releases of `libpg-query` which use WASM builds instead of native binaries. This change improves compatibility across different platforms and eliminates native compilation issues.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4c28ed0 and 9c5e3bb.

⛔ Files ignored due to path filters (3)
  • docs/public/safeql-v4-roadmap.jpg is excluded by !**/*.jpg
  • docs/public/safeql-v5-roadmap.jpg is excluded by !**/*.jpg
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (14)
  • .changeset/forty-meals-behave.md (1 hunks)
  • README.md (1 hunks)
  • docs/blog/safeql-v5-roadmap.md (4 hunks)
  • docs/guide/getting-started.md (1 hunks)
  • packages/eslint-plugin/package.json (1 hunks)
  • packages/eslint-plugin/src/rules/check-sql.rule.ts (2 hunks)
  • packages/eslint-plugin/src/workers/check-sql.worker.ts (1 hunks)
  • packages/eslint-plugin/src/workers/index.ts (0 hunks)
  • packages/eslint-plugin/src/workers/parse-sync.worker.ts (0 hunks)
  • packages/generate/package.json (1 hunks)
  • packages/generate/src/generate.test.ts (2 hunks)
  • packages/generate/src/generate.ts (2 hunks)
  • packages/generate/src/utils/get-nonnullable-columns.test.ts (1 hunks)
  • packages/generate/src/utils/get-relations-with-joins.test.ts (1 hunks)
💤 Files with no reviewable changes (2)
  • packages/eslint-plugin/src/workers/parse-sync.worker.ts
  • packages/eslint-plugin/src/workers/index.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/generate/src/generate.test.ts (1)
packages/shared/src/errors.ts (1)
  • InternalError (132-167)
🪛 LanguageTool
docs/blog/safeql-v5-roadmap.md

[style] ~122-~122: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...the library more flexible and powerful. I'm looking forward to hearing your feedb...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

🔇 Additional comments (19)
README.md (1)

36-36: Simplified Prerequisites Aligns with WASM Migration
The removal of native build requirements and consolidation into a single ESLint setup step correctly reflects the shift to the WASM-based libpg-query.

docs/guide/getting-started.md (1)

9-9: Streamlined Prerequisites Section
Converting the numbered list into a concise sentence improves readability and maintains consistency with the README.

docs/blog/safeql-v5-roadmap.md (8)

2-2: Document title updated to v5
The title correctly reflects the new major version.


16-16: OG meta title reflects v5
The Open Graph title has been updated accordingly.


19-19: Verify OG image availability
You’ve updated the OG image URL to the v5 roadmap. Please confirm that https://safeql.dev/safeql-v5-roadmap.jpg is live and accessible to avoid broken social previews.


22-22: OG URL updated to v5 blog path
The Open Graph URL now points to the v5 roadmap. Ensure this matches your deployed route.


25-25: OG description updated for v5
The metadata description aligns with the updated version.


31-31: Heading updated to v5
The top-level heading reflects the new major release.


35-35: Inline image reference updated
The embedded image path has been changed for v5. Verify that /safeql-v5-roadmap.jpg is correctly placed in the static assets.


51-51: Deprecation note points to v5 config file
The prose correctly signals deprecation of ESLint-based config in favor of safeql.config.ts for v5.

packages/generate/package.json (1)

37-37: LGTM: Dependency update aligns with WASM migration.

The update to libpg-query v17.5.2 correctly reflects the migration from native binaries to WASM builds as documented in the PR objectives.

packages/eslint-plugin/package.json (1)

54-54: LGTM: Consistent dependency update across packages.

The libpg-query version update to v17.5.2 is consistent with the generate package, ensuring compatibility across the SafeQL ecosystem.

packages/generate/src/utils/get-nonnullable-columns.test.ts (1)

82-82: LGTM: API change correctly implements new parser interface.

The change from parser.parseQuery to parser.parse aligns with the libpg-query v17 WASM-based API.

packages/generate/src/generate.test.ts (2)

7-7: LGTM: Import style correctly updated for WASM API.

The change from named import to default import aligns with the libpg-query v17 WASM-based API structure.


171-171: LGTM: Parser API usage correctly updated.

The change from parseQuery to parser.parse properly implements the new WASM-based parsing interface.

packages/generate/src/utils/get-relations-with-joins.test.ts (1)

119-119: LGTM! Parser method updated correctly.

The change from parser.parseQuery to parser.parse aligns with the new libpg-query API and is consistent with similar changes across the codebase.

packages/eslint-plugin/src/workers/check-sql.worker.ts (1)

25-36: Good architectural improvement - parsing centralized in generate package.

The removal of pgParsed from the worker interface and the corresponding import cleanup aligns well with centralizing SQL parsing within the generate package. This simplifies the worker's responsibilities and reduces coupling.

packages/generate/src/generate.ts (1)

25-25: Excellent centralization of SQL parsing logic.

Moving the parsing responsibility into the generate function is a clean architectural improvement. The async parsing with await parser.parse(query.text) properly handles the WASM-based parser implementation.

Also applies to: 263-265

packages/eslint-plugin/src/rules/check-sql.rule.ts (1)

179-181: Clean removal of SQL parsing from the ESLint rule.

The simplified call to generateSyncE without pre-parsing aligns perfectly with the architectural change to centralize parsing in the generate package. This reduces the rule's complexity and responsibilities.

@Newbie012 Newbie012 closed this Jun 23, 2025
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.

2 participants