-
Notifications
You must be signed in to change notification settings - Fork 249
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
chore: extract query-compiler and query-compiler-wasm #5129
Conversation
CodSpeed Performance ReportMerging #5129 will not alter performanceComparing Summary
|
#[cfg(not(target_arch = "wasm32"))] | ||
mod arch { | ||
// This crate only works in a Wasm environment. | ||
// This conditional compilation block is here to make commands like | ||
// `cargo clippy --all-features` happy, as `clippy` doesn't support the | ||
// `--exclude` option (see: https://github.com/rust-lang/rust-clippy/issues/9555). | ||
// | ||
// This crate can still be inspected by `clippy` via: | ||
// `cargo clippy --all-features -p schema-engine-wasm --target wasm32-unknown-unknown` | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked into this today, and I believe this shouldn't be necessary if we use a cargo feature instead of target_arch
logic to conditionally apply the tsify
derive macro to the structs driver-adapters
crate exports.
let schema = Arc::new(psl::parse_without_validation(datamodel.into(), CONNECTOR_REGISTRY)); | ||
let schema = Arc::new(schema::build(schema, true)); | ||
|
||
tracing::info!(git_hash = env!("GIT_HASH"), "Starting query-compiler-wasm"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to be able to send the tracing events to JS but let's ignore it in this PR.
pub fn compile( | ||
&self, | ||
request: String, | ||
_human_readable: bool, // ignored on wasm to not compile it in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove the argument completely.
url, | ||
schema, | ||
}: InitQueryCompilerParams) { | ||
const adapter = await driverAdapterManager.connect({ url }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Random thought: maybe we should put all of the client engine internals (QueryInterpreter
, TransactionManager
etc) into a new package, maybe even with some facade around them that ClientEngine
class in @prisma/client
would also use if necessary. Then we could easily import that package here to be able to run the engine tests.
@jacek-prisma there are some
https://github.com/prisma/prisma-engines/actions/runs/12814975691/job/35732637858?pr=5129 |
@aqrln this is the base branch failing ( |
ah gotcha |
@@ -354,50 +354,6 @@ impl QueryEngine { | |||
.await | |||
} | |||
|
|||
#[napi] | |||
pub async fn compile(&self, request: String, human_readable: bool) -> napi::Result<String> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, could we keep this method for now until we migrate the client side to use the new library?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, will add it back
…nd remove cfg target wasm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
.github/workflows/formatting.yml
Outdated
env: | ||
RUSTFLAGS: "-Dwarnings" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove this now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
Extracts a query compiler crate and adds a new query-compiler-wasm crate that exposes a minimal WASM API for interacting with the compiler.