Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid panicking in certain unsupported SQL paths #121

Merged
merged 3 commits into from
Aug 1, 2023
Merged

Conversation

gefjon
Copy link
Contributor

@gefjon gefjon commented Aug 1, 2023

Description of Changes

Prior to this commit, it was possible for certain CLI spacetime sql invocations to crash SpacetimeDB by including unsupported features. This was due to the SQL parser using the todo! macro, where it should have returned a PlanError::Unsupported error.

With this commit, several uses of todo! are rewritten to instead return errors, which are translated appropriately into 400 responses, rather than crashing SpacetimeDB.

API

  • This is a breaking change to the module API
  • This is a breaking change to the ClientAPI
  • This is a breaking change to the SDK API

If the API is breaking, please state below what will break

Prior to this commit, it was possible for certain CLI `spacetime sql` invocations
to crash SpacetimeDB by including unsupported features.
This was due to the SQL parser using the `todo!` macro,
where it should have returned a `PlanError::Unsupported` error.

With this commit, several uses of `todo!` are rewritten
to instead return errors,
which are translated appropriately into 400 responses,
rather than crashing SpacetimeDB.
Copy link
Contributor

@mamcx mamcx left a comment

Choose a reason for hiding this comment

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

LGTM

crates/core/src/vm.rs Show resolved Hide resolved
crates/core/src/vm.rs Show resolved Hide resolved
gefjon and others added 2 commits August 1, 2023 15:08
Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
Signed-off-by: Phoebe Goldman <phoebe@goldman-tribe.org>
Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
Signed-off-by: Phoebe Goldman <phoebe@goldman-tribe.org>
@gefjon gefjon enabled auto-merge (squash) August 1, 2023 19:08
@gefjon gefjon merged commit 3f52f75 into master Aug 1, 2023
4 checks passed
cloutiertyler pushed a commit that referenced this pull request Aug 1, 2023
Prior to this commit, it was possible for certain CLI `spacetime sql` invocations
to crash SpacetimeDB by including unsupported features.
This was due to the SQL parser using the `todo!` macro,
where it should have returned a `PlanError::Unsupported` error.

With this commit, several uses of `todo!` are rewritten
to instead return errors,
which are translated appropriately into 400 responses,
rather than crashing SpacetimeDB.
cloutiertyler pushed a commit that referenced this pull request Aug 1, 2023
Prior to this commit, it was possible for certain CLI `spacetime sql` invocations
to crash SpacetimeDB by including unsupported features.
This was due to the SQL parser using the `todo!` macro,
where it should have returned a `PlanError::Unsupported` error.

With this commit, several uses of `todo!` are rewritten
to instead return errors,
which are translated appropriately into 400 responses,
rather than crashing SpacetimeDB.
cloutiertyler pushed a commit that referenced this pull request Aug 1, 2023
Prior to this commit, it was possible for certain CLI `spacetime sql` invocations
to crash SpacetimeDB by including unsupported features.
This was due to the SQL parser using the `todo!` macro,
where it should have returned a `PlanError::Unsupported` error.

With this commit, several uses of `todo!` are rewritten
to instead return errors,
which are translated appropriately into 400 responses,
rather than crashing SpacetimeDB.
cloutiertyler pushed a commit that referenced this pull request Aug 1, 2023
Prior to this commit, it was possible for certain CLI `spacetime sql` invocations
to crash SpacetimeDB by including unsupported features.
This was due to the SQL parser using the `todo!` macro,
where it should have returned a `PlanError::Unsupported` error.

With this commit, several uses of `todo!` are rewritten
to instead return errors,
which are translated appropriately into 400 responses,
rather than crashing SpacetimeDB.
@cloutiertyler cloutiertyler deleted the phoebe/sql-no-panic branch August 1, 2023 21:54
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