From 5ff459dc3ee19d4d807b9361f3ff6f147e165831 Mon Sep 17 00:00:00 2001 From: Eti Ijeoma Date: Mon, 13 Oct 2025 22:26:32 +0100 Subject: [PATCH 1/9] feature(psl): Support ignore directives on values in enums Signed-off-by: Eti Ijeoma --- psl/parser-database/src/attributes.rs | 8 +++-- psl/parser-database/src/types.rs | 2 ++ psl/parser-database/src/walkers/enum.rs | 7 ++++ psl/psl/Cargo.toml | 1 + psl/psl/tests/attributes/ignore_negative.rs | 21 ++++++++++++ psl/psl/tests/attributes/ignore_positive.rs | 18 ++++++++++ psl/psl/tests/common/asserts.rs | 33 +++++++++++++++++++ .../src/ast_builders/datamodel_ast_builder.rs | 3 ++ .../src/datamodel/enumerator.rs | 19 +++++++++++ 9 files changed, 110 insertions(+), 2 deletions(-) diff --git a/psl/parser-database/src/attributes.rs b/psl/parser-database/src/attributes.rs index 98c1f8b6ad42..eccb2d5617a1 100644 --- a/psl/parser-database/src/attributes.rs +++ b/psl/parser-database/src/attributes.rs @@ -98,11 +98,15 @@ fn resolve_enum_attributes<'db>(enum_id: crate::EnumId, ast_enum: &'db ast::Enum } ctx.validate_visited_arguments(); } + + // @ignore + if ctx.visit_optional_single_attr("ignore") { + enum_attributes.ignored_values.insert(value_id); + ctx.validate_visited_arguments(); + } ctx.validate_visited_attributes(); } - // Now validate the enum attributes. - ctx.visit_attributes(enum_id); // @@map diff --git a/psl/parser-database/src/types.rs b/psl/parser-database/src/types.rs index cf5980e3a912..c1b9cdc3ca7e 100644 --- a/psl/parser-database/src/types.rs +++ b/psl/parser-database/src/types.rs @@ -695,6 +695,8 @@ pub(super) struct EnumAttributes { pub(super) mapped_name: Option, /// @map on enum values. pub(super) mapped_values: HashMap, + /// @ignore on enum values. + pub(super) ignored_values: std::collections::HashSet, /// ```ignore /// @@schema("public") /// ^^^^^^^^ diff --git a/psl/parser-database/src/walkers/enum.rs b/psl/parser-database/src/walkers/enum.rs index 455bea664ea4..37fa7ec13b21 100644 --- a/psl/parser-database/src/walkers/enum.rs +++ b/psl/parser-database/src/walkers/enum.rs @@ -122,4 +122,11 @@ impl<'db> EnumValueWalker<'db> { .get(&(self.id.1)) .map(|id| &self.db[*id]) } + + /// True if the enum value is ignored. + pub fn is_ignored(self) -> bool { + self.db.types.enum_attributes[&self.id.0] + .ignored_values + .contains(&self.id.1) + } } diff --git a/psl/psl/Cargo.toml b/psl/psl/Cargo.toml index d61422ddef12..8539b8e5eb14 100644 --- a/psl/psl/Cargo.toml +++ b/psl/psl/Cargo.toml @@ -16,6 +16,7 @@ all = ["postgresql", "sqlite", "mysql", "cockroachdb", "mssql", "mongodb"] psl-core.workspace = true [dev-dependencies] +psl-core = { workspace = true, features = ["postgresql", "sqlite", "mysql", "cockroachdb", "mssql", "mongodb"] } base64.workspace = true dissimilar.workspace = true expect-test.workspace = true diff --git a/psl/psl/tests/attributes/ignore_negative.rs b/psl/psl/tests/attributes/ignore_negative.rs index a560c103836b..c02ce0a64612 100644 --- a/psl/psl/tests/attributes/ignore_negative.rs +++ b/psl/psl/tests/attributes/ignore_negative.rs @@ -236,3 +236,24 @@ fn disallow_ignore_on_ignored_model() { expectation.assert_eq(&error) } + +// #[test] +// fn disallow_ignore_on_ignored_enum_value() { + +// let dml = indoc! {r#" +// enum SupportedCarType { +// COUPE @ignore +// } +// "#}; + +// let error = parse_unwrap_err(dml); +// let expectation = expect![[r#" +// error: Error parsing attribute "@ignore": Enum values on an already ignored Enum do not need an `@ignore` annotation. +// --> schema.prisma:2 +//  |  +//  1 |  enum SupportedCarType { +//  2 |  COUPE @ignore +//  |  +// "#]]; +// expectation.assert_eq(&error); +// } diff --git a/psl/psl/tests/attributes/ignore_positive.rs b/psl/psl/tests/attributes/ignore_positive.rs index 588d6b29c5eb..a1ac96cc1fd6 100644 --- a/psl/psl/tests/attributes/ignore_positive.rs +++ b/psl/psl/tests/attributes/ignore_positive.rs @@ -302,3 +302,21 @@ fn allow_ignore_on_relation_fields_on_valid_models() { .assert_has_relation_field("rel_e") .assert_ignored(true); } + +#[test] +fn allow_ignore_on_enum_values() { + let dml = r#" + enum SupportedCarTypes { + COUPE @ignore + SEDAN + VAN + } + "#; + + let datamodel = parse_schema(dml); + let enum_walker = datamodel.assert_has_enum("SupportedCarTypes"); + + enum_walker.assert_has_value("COUPE").assert_ignored(true); + enum_walker.assert_has_value("SEDAN").assert_ignored(false); + enum_walker.assert_has_value("VAN").assert_ignored(false); +} diff --git a/psl/psl/tests/common/asserts.rs b/psl/psl/tests/common/asserts.rs index 9d4564e38361..e9a98c6f8311 100644 --- a/psl/psl/tests/common/asserts.rs +++ b/psl/psl/tests/common/asserts.rs @@ -14,6 +14,7 @@ use psl::schema_ast::ast::{self, FieldArity}; pub(crate) trait DatamodelAssert<'a> { fn assert_has_model(&'a self, name: &str) -> walkers::ModelWalker<'a>; fn assert_has_type(&'a self, name: &str) -> walkers::CompositeTypeWalker<'a>; + fn assert_has_enum(&'a self, name: &str) -> walkers::EnumWalker<'a>; } pub(crate) trait WarningAsserts { @@ -135,6 +136,14 @@ impl<'a> DatamodelAssert<'a> for psl::ValidatedSchema { .find(|m| m.name() == name) .expect("Type {name} not found") } + + #[track_caller] + fn assert_has_enum(&'a self, name: &str) -> walkers::EnumWalker<'a> { + self.db + .walk_enums() + .find(|e| e.name() == name) + .expect("Enum {name} not found") + } } impl RelationFieldAssert for walkers::RelationFieldWalker<'_> { @@ -736,3 +745,27 @@ impl IndexAssert for walkers::PrimaryKeyWalker<'_> { unreachable!("Primary key cannot define the index type."); } } +pub(crate) trait EnumAssert<'a> { + fn assert_has_value(&'a self, name: &str) -> walkers::EnumValueWalker<'a>; +} + +impl<'a> EnumAssert<'a> for walkers::EnumWalker<'a> { + #[track_caller] + fn assert_has_value(&'a self, name: &str) -> walkers::EnumValueWalker<'a> { + self.values() + .find(|v| v.name() == name) + .expect("Enum value {name} not found") + } +} + +pub(crate) trait EnumValueAssert { + fn assert_ignored(&self, ignored: bool) -> &Self; +} + +impl EnumValueAssert for walkers::EnumValueWalker<'_> { + #[track_caller] + fn assert_ignored(&self, ignored: bool) -> &Self { + assert_eq!(self.is_ignored(), ignored); + self + } +} diff --git a/query-compiler/dmmf/src/ast_builders/datamodel_ast_builder.rs b/query-compiler/dmmf/src/ast_builders/datamodel_ast_builder.rs index f0eb945e76da..f6abe438388d 100644 --- a/query-compiler/dmmf/src/ast_builders/datamodel_ast_builder.rs +++ b/query-compiler/dmmf/src/ast_builders/datamodel_ast_builder.rs @@ -48,6 +48,9 @@ fn enum_to_dmmf(en: walkers::EnumWalker<'_>) -> Enum { }; for enum_value in en.values() { + if enum_value.is_ignored() { + continue; + } enm.values.push(enum_value_to_dmmf(enum_value)); } diff --git a/schema-engine/datamodel-renderer/src/datamodel/enumerator.rs b/schema-engine/datamodel-renderer/src/datamodel/enumerator.rs index 8a517fc612d8..ea788d184728 100644 --- a/schema-engine/datamodel-renderer/src/datamodel/enumerator.rs +++ b/schema-engine/datamodel-renderer/src/datamodel/enumerator.rs @@ -9,6 +9,7 @@ pub struct EnumVariant<'a> { comment_out: bool, map: Option>, documentation: Option>, + ignore: Option>, } impl<'a> EnumVariant<'a> { @@ -26,6 +27,7 @@ impl<'a> EnumVariant<'a> { comment_out: false, map: None, documentation: None, + ignore: None, } } @@ -55,6 +57,18 @@ impl<'a> EnumVariant<'a> { self.comment_out = true; } + /// Ignores the variant. + /// + /// ```ignore + /// enum Foo { + /// Bar @ignore + /// ^^^^^ this + /// } + /// ``` + pub fn ignore(&mut self) { + self.ignore = Some(FieldAttribute::new(Function::new("ignore"))); + } + /// Documentation of a variant. /// /// ```ignore @@ -91,6 +105,11 @@ impl fmt::Display for EnumVariant<'_> { map.fmt(f)?; } + if let Some(ref ignore) = self.ignore { + f.write_str(" ")?; + ignore.fmt(f)?; + } + Ok(()) } } From 034f331783ccdbde51cf706caae5dcbc8156d412 Mon Sep 17 00:00:00 2001 From: Eti Ijeoma Date: Mon, 13 Oct 2025 23:13:07 +0100 Subject: [PATCH 2/9] remove commented test Signed-off-by: Eti Ijeoma --- psl/psl/tests/attributes/ignore_negative.rs | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/psl/psl/tests/attributes/ignore_negative.rs b/psl/psl/tests/attributes/ignore_negative.rs index c02ce0a64612..a560c103836b 100644 --- a/psl/psl/tests/attributes/ignore_negative.rs +++ b/psl/psl/tests/attributes/ignore_negative.rs @@ -236,24 +236,3 @@ fn disallow_ignore_on_ignored_model() { expectation.assert_eq(&error) } - -// #[test] -// fn disallow_ignore_on_ignored_enum_value() { - -// let dml = indoc! {r#" -// enum SupportedCarType { -// COUPE @ignore -// } -// "#}; - -// let error = parse_unwrap_err(dml); -// let expectation = expect![[r#" -// error: Error parsing attribute "@ignore": Enum values on an already ignored Enum do not need an `@ignore` annotation. -// --> schema.prisma:2 -//  |  -//  1 |  enum SupportedCarType { -//  2 |  COUPE @ignore -//  |  -// "#]]; -// expectation.assert_eq(&error); -// } From 2f78759ddf9b8e6af93c737dc37f9bdcbad64e25 Mon Sep 17 00:00:00 2001 From: Eti Ijeoma Date: Mon, 26 Jan 2026 13:46:09 +0100 Subject: [PATCH 3/9] pull latest changes Signed-off-by: Eti Ijeoma --- .github/workflows/on-push-to-main.yml | 21 ++- .../workflows/publish-query-compiler-wasm.yml | 2 +- .github/workflows/wasm-size.yml | 130 +++++---------- AGENTS.md | 10 +- Cargo.lock | 46 +++--- Makefile | 72 +++------ README.md | 6 +- .../create_post_empty.expected.json | 153 +++++++++++++++--- .../core/src/query_document/parser.rs | 21 +-- .../query-tests-setup/src/lib.rs | 24 ++- .../query-tests-setup/src/runner/mod.rs | 5 +- 11 files changed, 254 insertions(+), 236 deletions(-) diff --git a/.github/workflows/on-push-to-main.yml b/.github/workflows/on-push-to-main.yml index 0b4e26e4f586..2ea4325ff352 100644 --- a/.github/workflows/on-push-to-main.yml +++ b/.github/workflows/on-push-to-main.yml @@ -22,20 +22,18 @@ jobs: - uses: ./.github/workflows/include/rust-wasm-setup - - name: Build Wasm modules + - name: Build WASM modules env: WASM_BUILD_PROFILE: release PKG_DIR: query-compiler/query-compiler-wasm/pkg TARGET_DIR: target/query-compiler-wasm run: | - make build-qc-gz + make build-qc-wasm-gz mkdir -p $TARGET_DIR for provider in "postgresql" "mysql" "sqlite" "sqlserver" "cockroachdb"; do - for build in "fast" "small"; do - cp $PKG_DIR/$provider/query_compiler_${build}_bg.wasm $TARGET_DIR/query-compiler-$build-$provider.wasm - cp $PKG_DIR/${provider}_${build}.gz $TARGET_DIR/query-compiler-$build-$provider.wasm.gz - done + cp $PKG_DIR/$provider/query_compiler_bg.wasm $TARGET_DIR/query-compiler-$provider.wasm + cp $PKG_DIR/$provider.gz $TARGET_DIR/query-compiler-$provider.wasm.gz done - name: Check out gh-pages branch @@ -46,7 +44,16 @@ jobs: - name: Update engines size run: | files=( - target/query-compiler-wasm/query-compiler-{fast,small}-{postgresql,mysql,sqlite,sqlserver,cockroachdb}.{wasm,wasm.gz} + target/query-compiler-wasm/query-compiler-postgresql.wasm.gz + target/query-compiler-wasm/query-compiler-postgresql.wasm + target/query-compiler-wasm/query-compiler-mysql.wasm.gz + target/query-compiler-wasm/query-compiler-mysql.wasm + target/query-compiler-wasm/query-compiler-sqlite.wasm.gz + target/query-compiler-wasm/query-compiler-sqlite.wasm + target/query-compiler-wasm/query-compiler-sqlserver.wasm.gz + target/query-compiler-wasm/query-compiler-sqlserver.wasm + target/query-compiler-wasm/query-compiler-cockroachdb.wasm.gz + target/query-compiler-wasm/query-compiler-cockroachdb.wasm ) DATE_TIME="$(date -u --iso-8601=seconds)" diff --git a/.github/workflows/publish-query-compiler-wasm.yml b/.github/workflows/publish-query-compiler-wasm.yml index dd51aafeb405..fcbf2c590f60 100644 --- a/.github/workflows/publish-query-compiler-wasm.yml +++ b/.github/workflows/publish-query-compiler-wasm.yml @@ -38,7 +38,7 @@ jobs: - name: Build @prisma/query-compiler-wasm run: make build-qc-wasm-fast build-qc-wasm-small env: - QE_WASM_VERSION: ${{ github.event.inputs.packageVersion }} + QC_WASM_VERSION: ${{ github.event.inputs.packageVersion }} - name: Install Node.js uses: actions/setup-node@v4 diff --git a/.github/workflows/wasm-size.yml b/.github/workflows/wasm-size.yml index 7b764075a818..212451305d40 100644 --- a/.github/workflows/wasm-size.yml +++ b/.github/workflows/wasm-size.yml @@ -18,27 +18,16 @@ jobs: name: calculate module sizes (pr) runs-on: ubuntu-latest outputs: - postgresql_fast_qc_size: ${{ steps.measure-qc.outputs.postgresql_fast_qc_size }} - postgresql_fast_qc_size_gz: ${{ steps.measure-qc.outputs.postgresql_fast_qc_size_gz }} - mysql_fast_qc_size: ${{ steps.measure-qc.outputs.mysql_fast_qc_size }} - mysql_fast_qc_size_gz: ${{ steps.measure-qc.outputs.mysql_fast_qc_size_gz }} - sqlite_fast_qc_size: ${{ steps.measure-qc.outputs.sqlite_fast_qc_size }} - sqlite_fast_qc_size_gz: ${{ steps.measure-qc.outputs.sqlite_fast_qc_size_gz }} - sqlserver_fast_qc_size: ${{ steps.measure-qc.outputs.sqlserver_fast_qc_size }} - sqlserver_fast_qc_size_gz: ${{ steps.measure-qc.outputs.sqlserver_fast_qc_size_gz }} - cockroachdb_fast_qc_size: ${{ steps.measure-qc.outputs.cockroachdb_fast_qc_size }} - cockroachdb_fast_qc_size_gz: ${{ steps.measure-qc.outputs.cockroachdb_fast_qc_size_gz }} - - postgresql_small_qc_size: ${{ steps.measure-qc.outputs.postgresql_small_qc_size }} - postgresql_small_qc_size_gz: ${{ steps.measure-qc.outputs.postgresql_small_qc_size_gz }} - mysql_small_qc_size: ${{ steps.measure-qc.outputs.mysql_small_qc_size }} - mysql_small_qc_size_gz: ${{ steps.measure-qc.outputs.mysql_small_qc_size_gz }} - sqlite_small_qc_size: ${{ steps.measure-qc.outputs.sqlite_small_qc_size }} - sqlite_small_qc_size_gz: ${{ steps.measure-qc.outputs.sqlite_small_qc_size_gz }} - sqlserver_small_qc_size: ${{ steps.measure-qc.outputs.sqlserver_small_qc_size }} - sqlserver_small_qc_size_gz: ${{ steps.measure-qc.outputs.sqlserver_small_qc_size_gz }} - cockroachdb_small_qc_size: ${{ steps.measure-qc.outputs.cockroachdb_small_qc_size }} - cockroachdb_small_qc_size_gz: ${{ steps.measure-qc.outputs.cockroachdb_small_qc_size_gz }} + postgresql_qc_size: ${{ steps.measure-qc.outputs.postgresql_qc_size }} + postgresql_qc_size_gz: ${{ steps.measure-qc.outputs.postgresql_qc_size_gz }} + mysql_qc_size: ${{ steps.measure-qc.outputs.mysql_qc_size }} + mysql_qc_size_gz: ${{ steps.measure-qc.outputs.mysql_qc_size_gz }} + sqlite_qc_size: ${{ steps.measure-qc.outputs.sqlite_qc_size }} + sqlite_qc_size_gz: ${{ steps.measure-qc.outputs.sqlite_qc_size_gz }} + sqlserver_qc_size: ${{ steps.measure-qc.outputs.sqlserver_qc_size }} + sqlserver_qc_size_gz: ${{ steps.measure-qc.outputs.sqlserver_qc_size_gz }} + cockroachdb_qc_size: ${{ steps.measure-qc.outputs.cockroachdb_qc_size }} + cockroachdb_qc_size_gz: ${{ steps.measure-qc.outputs.cockroachdb_qc_size_gz }} steps: - name: Checkout PR branch uses: actions/checkout@v4 @@ -55,27 +44,16 @@ jobs: name: calculate module sizes (base branch) runs-on: ubuntu-latest outputs: - postgresql_fast_qc_size: ${{ steps.measure-qc.outputs.postgresql_fast_qc_size }} - postgresql_fast_qc_size_gz: ${{ steps.measure-qc.outputs.postgresql_fast_qc_size_gz }} - mysql_fast_qc_size: ${{ steps.measure-qc.outputs.mysql_fast_qc_size }} - mysql_fast_qc_size_gz: ${{ steps.measure-qc.outputs.mysql_fast_qc_size_gz }} - sqlite_fast_qc_size: ${{ steps.measure-qc.outputs.sqlite_fast_qc_size }} - sqlite_fast_qc_size_gz: ${{ steps.measure-qc.outputs.sqlite_fast_qc_size_gz }} - sqlserver_fast_qc_size: ${{ steps.measure-qc.outputs.sqlserver_fast_qc_size }} - sqlserver_fast_qc_size_gz: ${{ steps.measure-qc.outputs.sqlserver_fast_qc_size_gz }} - cockroachdb_fast_qc_size: ${{ steps.measure-qc.outputs.cockroachdb_fast_qc_size }} - cockroachdb_fast_qc_size_gz: ${{ steps.measure-qc.outputs.cockroachdb_fast_qc_size_gz }} - - postgresql_small_qc_size: ${{ steps.measure-qc.outputs.postgresql_small_qc_size }} - postgresql_small_qc_size_gz: ${{ steps.measure-qc.outputs.postgresql_small_qc_size_gz }} - mysql_small_qc_size: ${{ steps.measure-qc.outputs.mysql_small_qc_size }} - mysql_small_qc_size_gz: ${{ steps.measure-qc.outputs.mysql_small_qc_size_gz }} - sqlite_small_qc_size: ${{ steps.measure-qc.outputs.sqlite_small_qc_size }} - sqlite_small_qc_size_gz: ${{ steps.measure-qc.outputs.sqlite_small_qc_size_gz }} - sqlserver_small_qc_size: ${{ steps.measure-qc.outputs.sqlserver_small_qc_size }} - sqlserver_small_qc_size_gz: ${{ steps.measure-qc.outputs.sqlserver_small_qc_size_gz }} - cockroachdb_small_qc_size: ${{ steps.measure-qc.outputs.cockroachdb_small_qc_size }} - cockroachdb_small_qc_size_gz: ${{ steps.measure-qc.outputs.cockroachdb_small_qc_size_gz }} + postgresql_qc_size: ${{ steps.measure-qc.outputs.postgresql_qc_size }} + postgresql_qc_size_gz: ${{ steps.measure-qc.outputs.postgresql_qc_size_gz }} + mysql_qc_size: ${{ steps.measure-qc.outputs.mysql_qc_size }} + mysql_qc_size_gz: ${{ steps.measure-qc.outputs.mysql_qc_size_gz }} + sqlite_qc_size: ${{ steps.measure-qc.outputs.sqlite_qc_size }} + sqlite_qc_size_gz: ${{ steps.measure-qc.outputs.sqlite_qc_size_gz }} + sqlserver_qc_size: ${{ steps.measure-qc.outputs.sqlserver_qc_size }} + sqlserver_qc_size_gz: ${{ steps.measure-qc.outputs.sqlserver_qc_size_gz }} + cockroachdb_qc_size: ${{ steps.measure-qc.outputs.cockroachdb_qc_size }} + cockroachdb_qc_size_gz: ${{ steps.measure-qc.outputs.cockroachdb_qc_size_gz }} steps: - name: Checkout base branch uses: actions/checkout@v4 @@ -119,30 +97,20 @@ jobs: echo "${provider}_diff=$diff" >> $GITHUB_OUTPUT } - compute_diff "postgresql_fast_qc" "${{ needs.base-wasm-size.outputs.postgresql_fast_qc_size }}" "${{ needs.pr-wasm-size.outputs.postgresql_fast_qc_size }}" - compute_diff "postgresql_fast_qc_gz" "${{ needs.base-wasm-size.outputs.postgresql_fast_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.postgresql_fast_qc_size_gz }}" - compute_diff "postgresql_small_qc" "${{ needs.base-wasm-size.outputs.postgresql_small_qc_size }}" "${{ needs.pr-wasm-size.outputs.postgresql_small_qc_size }}" - compute_diff "postgresql_small_qc_gz" "${{ needs.base-wasm-size.outputs.postgresql_small_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.postgresql_small_qc_size_gz }}" + compute_diff "postgresql_qc" "${{ needs.base-wasm-size.outputs.postgresql_qc_size }}" "${{ needs.pr-wasm-size.outputs.postgresql_qc_size }}" + compute_diff "postgresql_qc_gz" "${{ needs.base-wasm-size.outputs.postgresql_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.postgresql_qc_size_gz }}" - compute_diff "mysql_fast_qc" "${{ needs.base-wasm-size.outputs.mysql_fast_qc_size }}" "${{ needs.pr-wasm-size.outputs.mysql_fast_qc_size }}" - compute_diff "mysql_fast_qc_gz" "${{ needs.base-wasm-size.outputs.mysql_fast_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.mysql_fast_qc_size_gz }}" - compute_diff "mysql_small_qc" "${{ needs.base-wasm-size.outputs.mysql_small_qc_size }}" "${{ needs.pr-wasm-size.outputs.mysql_small_qc_size }}" - compute_diff "mysql_small_qc_gz" "${{ needs.base-wasm-size.outputs.mysql_small_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.mysql_small_qc_size_gz }}" + compute_diff "mysql_qc" "${{ needs.base-wasm-size.outputs.mysql_qc_size }}" "${{ needs.pr-wasm-size.outputs.mysql_qc_size }}" + compute_diff "mysql_qc_gz" "${{ needs.base-wasm-size.outputs.mysql_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.mysql_qc_size_gz }}" - compute_diff "sqlite_fast_qc" "${{ needs.base-wasm-size.outputs.sqlite_fast_qc_size }}" "${{ needs.pr-wasm-size.outputs.sqlite_fast_qc_size }}" - compute_diff "sqlite_fast_qc_gz" "${{ needs.base-wasm-size.outputs.sqlite_fast_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.sqlite_fast_qc_size_gz }}" - compute_diff "sqlite_small_qc" "${{ needs.base-wasm-size.outputs.sqlite_small_qc_size }}" "${{ needs.pr-wasm-size.outputs.sqlite_small_qc_size }}" - compute_diff "sqlite_small_qc_gz" "${{ needs.base-wasm-size.outputs.sqlite_small_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.sqlite_small_qc_size_gz }}" + compute_diff "sqlite_qc" "${{ needs.base-wasm-size.outputs.sqlite_qc_size }}" "${{ needs.pr-wasm-size.outputs.sqlite_qc_size }}" + compute_diff "sqlite_qc_gz" "${{ needs.base-wasm-size.outputs.sqlite_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.sqlite_qc_size_gz }}" - compute_diff "sqlserver_fast_qc" "${{ needs.base-wasm-size.outputs.sqlserver_fast_qc_size }}" "${{ needs.pr-wasm-size.outputs.sqlserver_fast_qc_size }}" - compute_diff "sqlserver_fast_qc_gz" "${{ needs.base-wasm-size.outputs.sqlserver_fast_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.sqlserver_fast_qc_size_gz }}" - compute_diff "sqlserver_small_qc" "${{ needs.base-wasm-size.outputs.sqlserver_small_qc_size }}" "${{ needs.pr-wasm-size.outputs.sqlserver_small_qc_size }}" - compute_diff "sqlserver_small_qc_gz" "${{ needs.base-wasm-size.outputs.sqlserver_small_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.sqlserver_small_qc_size_gz }}" + compute_diff "sqlserver_qc" "${{ needs.base-wasm-size.outputs.sqlserver_qc_size }}" "${{ needs.pr-wasm-size.outputs.sqlserver_qc_size }}" + compute_diff "sqlserver_qc_gz" "${{ needs.base-wasm-size.outputs.sqlserver_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.sqlserver_qc_size_gz }}" - compute_diff "cockroachdb_fast_qc" "${{ needs.base-wasm-size.outputs.cockroachdb_fast_qc_size }}" "${{ needs.pr-wasm-size.outputs.cockroachdb_fast_qc_size }}" - compute_diff "cockroachdb_fast_qc_gz" "${{ needs.base-wasm-size.outputs.cockroachdb_fast_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.cockroachdb_fast_qc_size_gz }}" - compute_diff "cockroachdb_small_qc" "${{ needs.base-wasm-size.outputs.cockroachdb_small_qc_size }}" "${{ needs.pr-wasm-size.outputs.cockroachdb_small_qc_size }}" - compute_diff "cockroachdb_small_qc_gz" "${{ needs.base-wasm-size.outputs.cockroachdb_small_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.cockroachdb_small_qc_size_gz }}" + compute_diff "cockroachdb_qc" "${{ needs.base-wasm-size.outputs.cockroachdb_qc_size }}" "${{ needs.pr-wasm-size.outputs.cockroachdb_qc_size }}" + compute_diff "cockroachdb_qc_gz" "${{ needs.base-wasm-size.outputs.cockroachdb_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.cockroachdb_qc_size_gz }}" - name: Find past report comment uses: peter-evans/find-comment@v3 @@ -161,28 +129,18 @@ jobs: issue-number: ${{ github.event.pull_request.number }} body: | - ### Wasm Query Compiler File Size - - | Engine | This PR | Base branch | Diff | - |------------------------------------|---------------------------------------------------------|-----------------------------------------------------------|-----------------------------------------------------------| - | Postgres | ${{ steps.compute.outputs.postgresql_fast_qc_pr }} | ${{ steps.compute.outputs.postgresql_fast_qc_base }} | ${{ steps.compute.outputs.postgresql_fast_qc_diff }} | - | Postgres (gzip) | ${{ steps.compute.outputs.postgresql_fast_qc_gz_pr }} | ${{ steps.compute.outputs.postgresql_fast_qc_gz_base }} | ${{ steps.compute.outputs.postgresql_fast_qc_gz_diff }} | - | Postgres (size-optimized) | ${{ steps.compute.outputs.postgresql_small_qc_pr }} | ${{ steps.compute.outputs.postgresql_small_qc_base }} | ${{ steps.compute.outputs.postgresql_small_qc_diff }} | - | Postgres (size-optimized, gzip) | ${{ steps.compute.outputs.postgresql_small_qc_gz_pr }} | ${{ steps.compute.outputs.postgresql_small_qc_gz_base }} | ${{ steps.compute.outputs.postgresql_small_qc_gz_diff }} | - | Mysql | ${{ steps.compute.outputs.mysql_fast_qc_pr }} | ${{ steps.compute.outputs.mysql_fast_qc_base }} | ${{ steps.compute.outputs.mysql_fast_qc_diff }} | - | Mysql (gzip) | ${{ steps.compute.outputs.mysql_fast_qc_gz_pr }} | ${{ steps.compute.outputs.mysql_fast_qc_gz_base }} | ${{ steps.compute.outputs.mysql_fast_qc_gz_diff }} | - | Mysql (size-optimized) | ${{ steps.compute.outputs.mysql_small_qc_pr }} | ${{ steps.compute.outputs.mysql_small_qc_base }} | ${{ steps.compute.outputs.mysql_small_qc_diff }} | - | Mysql (size-optimized, gzip) | ${{ steps.compute.outputs.mysql_small_qc_gz_pr }} | ${{ steps.compute.outputs.mysql_small_qc_gz_base }} | ${{ steps.compute.outputs.mysql_small_qc_gz_diff }} | - | Sqlite | ${{ steps.compute.outputs.sqlite_fast_qc_pr }} | ${{ steps.compute.outputs.sqlite_fast_qc_base }} | ${{ steps.compute.outputs.sqlite_fast_qc_diff }} | - | Sqlite (gzip) | ${{ steps.compute.outputs.sqlite_fast_qc_gz_pr }} | ${{ steps.compute.outputs.sqlite_fast_qc_gz_base }} | ${{ steps.compute.outputs.sqlite_fast_qc_gz_diff }} | - | Sqlite (size-optimized) | ${{ steps.compute.outputs.sqlite_small_qc_pr }} | ${{ steps.compute.outputs.sqlite_small_qc_base }} | ${{ steps.compute.outputs.sqlite_small_qc_diff }} | - | Sqlite (size-optimized, gzip) | ${{ steps.compute.outputs.sqlite_small_qc_gz_pr }} | ${{ steps.compute.outputs.sqlite_small_qc_gz_base }} | ${{ steps.compute.outputs.sqlite_small_qc_gz_diff }} | - | SQL Server | ${{ steps.compute.outputs.sqlserver_fast_qc_pr }} | ${{ steps.compute.outputs.sqlserver_fast_qc_base }} | ${{ steps.compute.outputs.sqlserver_fast_qc_diff }} | - | SQL Server (gzip) | ${{ steps.compute.outputs.sqlserver_fast_qc_gz_pr }} | ${{ steps.compute.outputs.sqlserver_fast_qc_gz_base }} | ${{ steps.compute.outputs.sqlserver_fast_qc_gz_diff }} | - | SQL Server (size-optimized) | ${{ steps.compute.outputs.sqlserver_small_qc_pr }} | ${{ steps.compute.outputs.sqlserver_small_qc_base }} | ${{ steps.compute.outputs.sqlserver_small_qc_diff }} | - | SQL Server (size-optimized, gzip) | ${{ steps.compute.outputs.sqlserver_small_qc_gz_pr }} | ${{ steps.compute.outputs.sqlserver_small_qc_gz_base }} | ${{ steps.compute.outputs.sqlserver_small_qc_gz_diff }} | - | CockroachDB | ${{ steps.compute.outputs.cockroachdb_fast_qc_pr }} | ${{ steps.compute.outputs.cockroachdb_fast_qc_base }} | ${{ steps.compute.outputs.cockroachdb_fast_qc_diff }} | - | CockroachDB (gzip) | ${{ steps.compute.outputs.cockroachdb_fast_qc_gz_pr }} | ${{ steps.compute.outputs.cockroachdb_fast_qc_gz_base }} | ${{ steps.compute.outputs.cockroachdb_fast_qc_gz_diff }} | - | CockroachDB (size-optimized) | ${{ steps.compute.outputs.cockroachdb_small_qc_pr }} | ${{ steps.compute.outputs.cockroachdb_small_qc_base }} | ${{ steps.compute.outputs.cockroachdb_small_qc_diff }} | - | CockroachDB (size-optimized, gzip) | ${{ steps.compute.outputs.cockroachdb_small_qc_gz_pr }} | ${{ steps.compute.outputs.cockroachdb_small_qc_gz_base }} | ${{ steps.compute.outputs.cockroachdb_small_qc_gz_diff }} | + ### WASM Query Compiler File Size + + | Engine | This PR | Base branch | Diff | + |--------------------|-----------------------------------------------------|-----------------------------------------------------|-----------------------------------------------------| + | Postgres | ${{ steps.compute.outputs.postgresql_qc_pr }} | ${{ steps.compute.outputs.postgresql_qc_base }} | ${{ steps.compute.outputs.postgresql_qc_diff }} | + | Postgres (gzip) | ${{ steps.compute.outputs.postgresql_qc_gz_pr }} | ${{ steps.compute.outputs.postgresql_qc_gz_base }} | ${{ steps.compute.outputs.postgresql_qc_gz_diff }} | + | Mysql | ${{ steps.compute.outputs.mysql_qc_pr }} | ${{ steps.compute.outputs.mysql_qc_base }} | ${{ steps.compute.outputs.mysql_qc_diff }} | + | Mysql (gzip) | ${{ steps.compute.outputs.mysql_qc_gz_pr }} | ${{ steps.compute.outputs.mysql_qc_gz_base }} | ${{ steps.compute.outputs.mysql_qc_gz_diff }} | + | Sqlite | ${{ steps.compute.outputs.sqlite_qc_pr }} | ${{ steps.compute.outputs.sqlite_qc_base }} | ${{ steps.compute.outputs.sqlite_qc_diff }} | + | Sqlite (gzip) | ${{ steps.compute.outputs.sqlite_qc_gz_pr }} | ${{ steps.compute.outputs.sqlite_qc_gz_base }} | ${{ steps.compute.outputs.sqlite_qc_gz_diff }} | + | SQL Server | ${{ steps.compute.outputs.sqlserver_qc_pr }} | ${{ steps.compute.outputs.sqlserver_qc_base }} | ${{ steps.compute.outputs.sqlserver_qc_diff }} | + | SQL Server (gzip) | ${{ steps.compute.outputs.sqlserver_qc_gz_pr }} | ${{ steps.compute.outputs.sqlserver_qc_gz_base }} | ${{ steps.compute.outputs.sqlserver_qc_gz_diff }} | + | CockroachDB | ${{ steps.compute.outputs.cockroachdb_qc_pr }} | ${{ steps.compute.outputs.cockroachdb_qc_base }} | ${{ steps.compute.outputs.cockroachdb_qc_diff }} | + | CockroachDB (gzip) | ${{ steps.compute.outputs.cockroachdb_qc_gz_pr }} | ${{ steps.compute.outputs.cockroachdb_qc_gz_base }} | ${{ steps.compute.outputs.cockroachdb_qc_gz_diff }} | edit-mode: replace diff --git a/AGENTS.md b/AGENTS.md index c89f04ad082c..ad11a1905c84 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -3,7 +3,8 @@ ## 1. Big Picture - This repo hosts the **Prisma Engines**: PSL (schema parser/validator), schema-engine (migrate, introspect), query components (query compiler, driver adapters, compatibility harnesses), and utilities shared with Prisma Client. - Prisma 7 roadmap status: - - `url`, `directUrl` and `shadowDatabaseUrl` are **invalid** in PSL. + - `directUrl` and `shadowDatabaseUrl` are **invalid** in PSL. + - `url` remains temporarily while downstream tooling finishes migrating to external datasource overrides; removal is tracked separately. - CLI/tests override connection info via schema-engine CLI (`--datasource`) or shared `TestApi::new_engine_with_connection_strings`. - Reference commit: `34b5a692b7bd79939a9a2c3ef97d816e749cda2f` (driver adapter override plumbing). - Prisma has removed the **native Rust query engine** in favor of the **Query Compiler (QC)** architecture: @@ -21,7 +22,7 @@ Key directories: - `prisma-fmt/` – Language server & formatter entry point (tests rely on `expect!` snapshots). - `schema-engine/sql-migration-tests` / `sql-introspection-tests` – Heavy integration suites (require DBs). - `query-engine/` – Unused MongoDB connector crate left for future reference and the connector test kit (integration tests exercise QC through the driver adapter executor here). -- `query-compiler/` – Query planner + associated Wasm, playground, and the new `core-tests` crate. +- `query-compiler/` – Query planner + associated WASM, playground, and the new `core-tests` crate. - `libs/` – Shared libraries (value types, driver adapters, test setup). - `driver-adapters/` – Rust-side adapter utilities for the new query interpreter. @@ -100,7 +101,7 @@ Supporting infra: 7. **Connector test kit (driver adapters + QC)** ```bash - make dev-pg-qc # or another dev-*-qc helper; builds QC Wasm + driver adapters and writes .test_config + make dev-pg-qc # or another dev-*-qc helper; builds QC WASM + driver adapters and writes .test_config cargo test -p query-engine-tests -- --nocapture ``` Set `DRIVER_ADAPTER=` (see Makefile) when you want to run against a specific adapter target. See `query-engine/connector-test-kit-rs/README.md` for env vars and adapter-specific notes. @@ -143,7 +144,7 @@ Ensure diffs make sense and rerun without `UPDATE_EXPECT` to confirm. `rg "directUrl"`, `rg "shadowDatabaseUrl"` - Build schema-engine CLI: `cargo build -p schema-engine-cli` -- Build query compiler Wasm: +- Build query compiler WASM: `make build-qc-wasm` - Build driver adapters kit for QC: `make build-driver-adapters-kit-qc` @@ -175,4 +176,3 @@ Prefer using Makefile targets that take care of setting up the environment corre --- **When modifying anything involving diagnostics or fixtures:** run relevant tests, refresh expectations, and ensure Git diffs are readable (no accidental CRLF/encoding swaps). Keep this file updated whenever we discover new traps.*** -s, and ensure Git diffs are readable (no accidental CRLF/encoding swaps). Keep this file updated whenever we discover new traps.*** diff --git a/Cargo.lock b/Cargo.lock index 28915bb0cf9a..5de15bd9b11b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -655,7 +655,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" dependencies = [ "lazy_static", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -664,7 +664,7 @@ version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fde0e0ec90c9dfb3b4b1a0891a7dcd0e2bffde2f7efed5fe7c9bb00e5bfb915e" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2620,7 +2620,7 @@ version = "0.1.0" dependencies = [ "mongodb", "percent-encoding", - "thiserror 2.0.17", + "thiserror 2.0.12", ] [[package]] @@ -2661,7 +2661,7 @@ dependencies = [ "serde", "serde_json", "telemetry", - "thiserror 2.0.17", + "thiserror 2.0.12", "tokio", "tracing", "tracing-futures", @@ -3120,7 +3120,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1db05f56d34358a8b1066f67cbb203ee3e7ed2ba674a6263a1d5ec6db2204323" dependencies = [ "memchr", - "thiserror 2.0.17", + "thiserror 2.0.12", "ucd-trie", ] @@ -3561,7 +3561,7 @@ dependencies = [ "serde_json", "sqlformat", "telemetry", - "thiserror 2.0.17", + "thiserror 2.0.12", "tiberius", "tokio", "tokio-postgres", @@ -3623,7 +3623,7 @@ dependencies = [ "serde", "serde_json", "sql-query-builder", - "thiserror 2.0.17", + "thiserror 2.0.12", ] [[package]] @@ -3677,7 +3677,7 @@ dependencies = [ "serde", "serde_json", "telemetry", - "thiserror 2.0.17", + "thiserror 2.0.12", "user-facing-errors", "uuid", ] @@ -3699,7 +3699,7 @@ dependencies = [ "serde", "serde_json", "smallvec", - "thiserror 2.0.17", + "thiserror 2.0.12", "tokio", "tracing", "user-facing-errors", @@ -3745,7 +3745,7 @@ dependencies = [ "itertools 0.13.0", "prisma-value", "psl", - "thiserror 2.0.17", + "thiserror 2.0.12", ] [[package]] @@ -3793,7 +3793,7 @@ dependencies = [ "serde_json", "strip-ansi-escapes", "telemetry", - "thiserror 2.0.17", + "thiserror 2.0.12", "tokio", "tracing", "tracing-error", @@ -4068,7 +4068,7 @@ dependencies = [ "query-structure", "serde", "serde_json", - "thiserror 2.0.17", + "thiserror 2.0.12", "tracing", "user-facing-errors", ] @@ -4373,7 +4373,7 @@ dependencies = [ "serde", "serde_json", "sql-schema-connector", - "thiserror 2.0.17", + "thiserror 2.0.12", "tokio", "tracing", "tracing-futures", @@ -4912,7 +4912,7 @@ dependencies = [ "once_cell", "percent-encoding", "smallvec", - "thiserror 2.0.17", + "thiserror 2.0.12", "tracing", "url", ] @@ -5091,7 +5091,7 @@ dependencies = [ "rand 0.8.5", "serde", "serde_json", - "thiserror 2.0.17", + "thiserror 2.0.12", "tokio", "tracing", "tracing-subscriber", @@ -5170,11 +5170,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.17" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ - "thiserror-impl 2.0.17", + "thiserror-impl 2.0.12", ] [[package]] @@ -5190,9 +5190,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.17" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", @@ -5402,9 +5402,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.17" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2efa149fe76073d6e8fd97ef4f4eca7b67f599660115591483572e406e165594" +checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df" dependencies = [ "bytes", "futures-core", @@ -5579,7 +5579,7 @@ dependencies = [ "native-tls", "rand 0.8.5", "sha1", - "thiserror 2.0.17", + "thiserror 2.0.12", "utf-8", ] diff --git a/Makefile b/Makefile index 0292137b38c5..c2ec66fafe4c 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ CONFIG_FILE = .test_config DEV_SCHEMA_FILE = dev_datamodel.prisma PRISMA_BRANCH ?= main ENGINE_SIZE_OUTPUT ?= /dev/stdout -QE_WASM_VERSION ?= 0.0.0 +QC_WASM_VERSION ?= 0.0.0 SCHEMA_WASM_VERSION ?= 0.0.0 LIBRARY_EXT := $(shell \ @@ -58,20 +58,16 @@ build-se-wasm: cd schema-engine/schema-engine-wasm && \ ./build.sh $(SCHEMA_ENGINE_WASM_VERSION) schema-engine/schema-engine-wasm/pkg -build-qc-wasm-%: +build-qc-wasm: cd query-compiler/query-compiler-wasm && \ - ./build.sh $(QE_WASM_VERSION) query-compiler/query-compiler-wasm/pkg $* + ./build.sh $(QC_WASM_VERSION) query-compiler/query-compiler-wasm/pkg -build-qc-wasm: build-qc-wasm-fast build-qc-wasm-small - -build-qc-gz-%: build-qc-wasm-% - @cd query-compiler/query-compiler-wasm/pkg && \ +build-qc-wasm-gz: build-qc-wasm + @cd query-compiler/query-compiler-wasm/pkg && \ for provider in postgresql mysql sqlite sqlserver cockroachdb; do \ - gzip -knc $$provider/query_compiler_$*_bg.wasm > $${provider}_$*.gz; \ + gzip -knc $$provider/query_compiler_bg.wasm > $$provider.gz; \ done; -build-qc-gz: build-qc-gz-fast build-qc-gz-small - build-schema-wasm: @printf '%s\n' "🛠️ Building the Rust crate" cargo build --profile $(PROFILE) --target=wasm32-unknown-unknown -p prisma-schema-build @@ -139,34 +135,6 @@ check-schema-wasm-package: build-schema-wasm NODE=$(shell which node) \ ./prisma-schema-wasm/scripts/check.sh -###################### -# Benchmark commands # -###################### - -# Run query compiler benchmarks -bench-qc: - cargo bench -p query-compiler --profile profiling - -# Run query graph building benchmarks -bench-qc-graph: - cargo bench -p core-tests --profile profiling --bench query_graph_bench - -# Run schema building benchmarks -bench-schema: - cargo bench -p schema --profile profiling --bench schema_builder_bench - -# Save benchmark baseline (usage: make bench-baseline NAME=main) -bench-qc-baseline: - cargo bench -p query-compiler --profile profiling -- --save-baseline $(NAME) - -# Compare against baseline (usage: make bench-compare NAME=main) -bench-qc-compare: - cargo bench -p query-compiler --profile profiling -- --baseline $(NAME) - -# Run profile_query example for profiling -profile-qc: - cargo run -p query-compiler --example profile_query --profile profiling - ########################### # Database setup commands # ########################### @@ -182,17 +150,17 @@ start-sqlite: dev-sqlite: cp $(CONFIG_PATH)/sqlite $(CONFIG_FILE) -dev-libsql-qc: build-qc-wasm-fast build-driver-adapters-kit-qc +dev-libsql-qc: build-qc-wasm build-driver-adapters-kit-qc cp $(CONFIG_PATH)/libsql-qc $(CONFIG_FILE) test-libsql-qc: dev-libsql-qc test-qe-st -dev-better-sqlite3-qc: build-qc-wasm-fast build-driver-adapters-kit-qc +dev-better-sqlite3-qc: build-qc-wasm build-driver-adapters-kit-qc cp $(CONFIG_PATH)/better-sqlite3-qc $(CONFIG_FILE) test-better-sqlite3-qc: dev-better-sqlite3-qc test-qe-st -dev-d1-qc: build-qc-wasm-fast build-driver-adapters-kit-qc +dev-d1-qc: build-qc-wasm build-driver-adapters-kit-qc cp $(CONFIG_PATH)/d1-qc $(CONFIG_FILE) test-d1-qc: dev-d1-qc test-qe-st @@ -209,7 +177,7 @@ start-postgres13: dev-postgres13: start-postgres13 cp $(CONFIG_PATH)/postgres13 $(CONFIG_FILE) -dev-pg-qc: start-postgres13 build-qc-wasm-fast build-driver-adapters-kit-qc +dev-pg-qc: start-postgres13 build-qc-wasm build-driver-adapters-kit-qc cp $(CONFIG_PATH)/pg-qc $(CONFIG_FILE) dev-pg-qc-join: @@ -229,7 +197,7 @@ test-pg-qc-query: start-pg-bench: docker compose -f libs/driver-adapters/executor/bench/docker-compose.yml up --wait -d --remove-orphans postgres -dev-pg-cockroachdb-qc: start-cockroach_23_1 build-qc-wasm-fast build-driver-adapters-kit-qc +dev-pg-cockroachdb-qc: start-cockroach_23_1 build-qc-wasm build-driver-adapters-kit-qc cp $(CONFIG_PATH)/pg-cockroachdb-qc $(CONFIG_FILE) dev-pg-cockroachdb-qc-join: @@ -251,7 +219,7 @@ bench-pg-js: setup-pg-bench run-bench start-neon: docker compose -f docker-compose.yml up --wait -d --remove-orphans neon-proxy -dev-neon-qc: start-neon build-qc-wasm-fast build-driver-adapters-kit-qc +dev-neon-qc: start-neon build-qc-wasm build-driver-adapters-kit-qc cp $(CONFIG_PATH)/neon-qc $(CONFIG_FILE) dev-neon-qc-join: @@ -361,7 +329,7 @@ start-mssql_edge: dev-mssql_edge: start-mssql_edge cp $(CONFIG_PATH)/sqlserver2019 $(CONFIG_FILE) -dev-mssql-qc: start-mssql_2022 build-qc-wasm-fast build-driver-adapters-kit-qc +dev-mssql-qc: start-mssql_2022 build-qc-wasm build-driver-adapters-kit-qc cp $(CONFIG_PATH)/sqlserver-qc $(CONFIG_FILE) test-mssql-qc: dev-mssql-qc test-qe @@ -413,17 +381,17 @@ dev-vitess_8_0: start-vitess_8_0 start-planetscale: docker compose -f docker-compose.yml up -d --remove-orphans planetscale-proxy -dev-planetscale-qc: start-planetscale build-qc-wasm-fast build-driver-adapters-kit-qc +dev-planetscale-qc: start-planetscale build-qc-wasm build-driver-adapters-kit-qc cp $(CONFIG_PATH)/planetscale-qc $(CONFIG_FILE) test-planetscale-qc: dev-planetscale-qc test-qe-st -dev-mariadb-mysql-qc: start-mysql_8 build-qc-wasm-fast build-driver-adapters-kit-qc +dev-mariadb-mysql-qc: start-mysql_8 build-qc-wasm build-driver-adapters-kit-qc cp $(CONFIG_PATH)/mariadb-mysql-qc $(CONFIG_FILE) test-mariadb-mysql-qc: dev-mariadb-mysql-qc test-qe-st -dev-mariadb-qc: start-mysql_mariadb build-qc-wasm-fast build-driver-adapters-kit-qc +dev-mariadb-qc: start-mysql_mariadb build-qc-wasm build-driver-adapters-kit-qc cp $(CONFIG_PATH)/mariadb-qc $(CONFIG_FILE) test-mariadb-qc: dev-mariadb-qc test-qe-st @@ -432,13 +400,11 @@ test-mariadb-qc: dev-mariadb-qc test-qe-st # Local dev commands # ###################### -measure-qc-wasm: measure-qc-wasm-fast measure-qc-wasm-small - -measure-qc-wasm-%: build-qc-gz-% +measure-qc-wasm: build-qc-wasm-gz @cd query-compiler/query-compiler-wasm/pkg; \ for provider in postgresql mysql sqlite sqlserver cockroachdb; do \ - echo "$${provider}_$*_qc_size=$$(cat $$provider/query_compiler_$*_bg.wasm | wc -c | tr -d ' ')" >> $(ENGINE_SIZE_OUTPUT); \ - echo "$${provider}_$*_qc_size_gz=$$(cat $${provider}_$*.gz | wc -c | tr -d ' ')" >> $(ENGINE_SIZE_OUTPUT); \ + echo "$${provider}_qc_size=$$(cat $$provider/query_compiler_bg.wasm | wc -c | tr -d ' ')" >> $(ENGINE_SIZE_OUTPUT); \ + echo "$${provider}_qc_size_gz=$$(cat $$provider.gz | wc -c | tr -d ' ')" >> $(ENGINE_SIZE_OUTPUT); \ done; install-driver-adapters-kit-deps: build-driver-adapters diff --git a/README.md b/README.md index 35debcd69d04..9974dda00917 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ the repository root in the `target/debug` (without `--release`) or `target/relea | Schema Engine | `./target/[debug\|release]/schema-engine` | | Prisma Format | `./target/[debug\|release]/prisma-fmt` | -The query compiler is a library crate. To produce the Wasm bundles that power the JS runtime, use +The query compiler is a library crate. To produce the WASM bundles that power the JS runtime, use `make build-qc-wasm`. Driver adapters are compiled via `make build-driver-adapters-kit-qc`. ## Prisma Schema Language @@ -128,7 +128,7 @@ The engine uses: ## Prisma format -Prisma format can format prisma schema files. It also comes as a Wasm module via +Prisma format can format prisma schema files. It also comes as a WASM module via a node package. You can read more [here](./prisma-schema-wasm/README.md). ## Debugging @@ -188,7 +188,7 @@ exclusions used in the Makefile when invoking `cargo test --workspace --all-feat **Setup:** -Use the `dev-*-qc` helpers to spin up a database (when needed), build the query-compiler Wasm, build +Use the `dev-*-qc` helpers to spin up a database (when needed), build the query-compiler WASM, build the driver adapters, and write the `.test_config` consumed by the connector test kit: - `make dev-pg-qc` diff --git a/query-compiler/core-tests/tests/query_validation_tests/create_post_empty.expected.json b/query-compiler/core-tests/tests/query_validation_tests/create_post_empty.expected.json index abae2b6ec8ee..d75329db10dc 100644 --- a/query-compiler/core-tests/tests/query_validation_tests/create_post_empty.expected.json +++ b/query-compiler/core-tests/tests/query_validation_tests/create_post_empty.expected.json @@ -1,42 +1,143 @@ { "is_panic": false, - "message": "Unable to match input value to any allowed input type for the field. Parse errors: [`data.published`: A value is required but not set, `data.published`: A value is required but not set]", + "message": "`data`: A value is required but not set", "meta": { - "kind": "Union", - "errors": [ + "kind": "RequiredArgumentMissing", + "inputTypes": [ { - "kind": "RequiredArgumentMissing", - "inputTypes": [ + "kind": "object", + "name": "PostCreateInput", + "fields": [ { - "kind": "scalar", - "name": "Boolean" + "name": "id", + "typeNames": [ + "String" + ], + "required": false + }, + { + "name": "createdAt", + "typeNames": [ + "DateTime" + ], + "required": false + }, + { + "name": "updatedAt", + "typeNames": [ + "DateTime" + ], + "required": false + }, + { + "name": "published", + "typeNames": [ + "Boolean" + ], + "required": true + }, + { + "name": "title", + "typeNames": [ + "String" + ], + "required": true + }, + { + "name": "content", + "typeNames": [ + "String", + "Null" + ], + "required": false + }, + { + "name": "author", + "typeNames": [ + "UserCreateNestedOneWithoutPostsInput" + ], + "required": false + }, + { + "name": "Like", + "typeNames": [ + "LikeCreateNestedManyWithoutPostInput" + ], + "required": false } - ], - "argumentPath": [ - "data", - "published" - ], - "selectionPath": [ - "createOnePost" ] }, { - "kind": "RequiredArgumentMissing", - "inputTypes": [ + "kind": "object", + "name": "PostUncheckedCreateInput", + "fields": [ + { + "name": "id", + "typeNames": [ + "String" + ], + "required": false + }, + { + "name": "createdAt", + "typeNames": [ + "DateTime" + ], + "required": false + }, + { + "name": "updatedAt", + "typeNames": [ + "DateTime" + ], + "required": false + }, + { + "name": "published", + "typeNames": [ + "Boolean" + ], + "required": true + }, + { + "name": "title", + "typeNames": [ + "String" + ], + "required": true + }, + { + "name": "content", + "typeNames": [ + "String", + "Null" + ], + "required": false + }, + { + "name": "authorId", + "typeNames": [ + "String", + "Null" + ], + "required": false + }, { - "kind": "scalar", - "name": "Boolean" + "name": "Like", + "typeNames": [ + "LikeUncheckedCreateNestedManyWithoutPostInput" + ], + "required": false } - ], - "argumentPath": [ - "data", - "published" - ], - "selectionPath": [ - "createOnePost" ] } + ], + "argumentPath": [ + "data" + ], + "selectionPath": [ + "createOnePost" ] }, - "error_code": "P2009" + "error_code": "P2012" } \ No newline at end of file diff --git a/query-compiler/core/src/query_document/parser.rs b/query-compiler/core/src/query_document/parser.rs index ec02fa0afa61..a29d2a73ba90 100644 --- a/query-compiler/core/src/query_document/parser.rs +++ b/query-compiler/core/src/query_document/parser.rs @@ -4,7 +4,7 @@ use bigdecimal::{BigDecimal, ToPrimitive}; use chrono::prelude::*; use core::fmt; use indexmap::{IndexMap, IndexSet}; -use query_structure::{DefaultKind, PrismaValue}; +use query_structure::PrismaValue; use std::{borrow::Cow, convert::TryFrom, rc::Rc, str::FromStr}; use user_facing_errors::query_engine::validation::ValidationError; use uuid::Uuid; @@ -182,19 +182,18 @@ impl QueryDocumentParser { .iter() .filter_map(|input_field| { // Match schema argument field to an argument field in the incoming document. - let selection_arg = given_arguments + let selection_arg: Option<(String, ArgumentValue)> = given_arguments .iter() .find(|given_argument| given_argument.0 == input_field.name) - .map(|(_, value)| value) .cloned(); let argument_path = argument_path.add(input_field.name.clone().into_owned()); - let validate_other_required_args = || { + let validate_other_required_args = |name: &str| { for req_name in input_field.requires_other_fields() { if !given_arguments.iter().any(|(name, _)| name == req_name) { let Some(req_field) = schema_field.arguments().iter().find(|f| f.name == *req_name) else { - panic!("argument {} requires unknown argument {req_name}", input_field.name) + panic!("argument {name} requires unknown argument {req_name}") }; return Err(ValidationError::conditionally_required_argument_missing( &selection_path.segments(), @@ -208,16 +207,10 @@ impl QueryDocumentParser { }; // If optional and not present ignore the field. - // If present or has a default, process the value. + // If present, parse normally. // If not present but required, throw a validation error. - match selection_arg.or_else(|| { - input_field - .default_value - .as_ref() - .and_then(DefaultKind::get) - .map(ArgumentValue::from) - }) { - Some(value) => Some(validate_other_required_args().and_then(|_| { + match selection_arg { + Some((name, value)) => Some(validate_other_required_args(&name).and_then(|_| { self.parse_input_value( selection_path.clone(), argument_path, diff --git a/query-engine/connector-test-kit-rs/query-tests-setup/src/lib.rs b/query-engine/connector-test-kit-rs/query-tests-setup/src/lib.rs index 557997b12b2b..2c89c6fab25c 100644 --- a/query-engine/connector-test-kit-rs/query-tests-setup/src/lib.rs +++ b/query-engine/connector-test-kit-rs/query-tests-setup/src/lib.rs @@ -43,16 +43,11 @@ pub static ENGINE_PROTOCOL: LazyLock = LazyLock::new(|| std::env::var("PRISMA_ENGINE_PROTOCOL").unwrap_or_else(|_| "graphql".to_owned())); /// Teardown of a test setup. -async fn teardown_project( - url: &str, - datamodel: &RenderedDatamodel, - db_schemas: &[&str], - schema_id: usize, -) -> TestResult<()> { +async fn teardown_project(datamodel: &RenderedDatamodel, db_schemas: &[&str], schema_id: usize) -> TestResult<()> { let params = serde_json::json!({ "schemaId": schema_id }); executor_process_request::("teardown", params).await?; - Ok(qe_setup::teardown(url, &datamodel.schema, db_schemas).await?) + Ok(qe_setup::teardown(&datamodel.url, &datamodel.schema, db_schemas).await?) } /// Helper method to allow a sync shell function to run the async test blocks. @@ -181,15 +176,15 @@ fn run_relation_link_test_impl( continue; } - let url = connection_string(&version, &test_db_name, false, None); - let datamodel = render_test_datamodel(template, &[], None, &[], &[]); + let datamodel = render_test_datamodel(&test_db_name, template, &[], None, Default::default(), Default::default(), None); + let (connector_tag, version) = CONFIG.test_connector().unwrap(); let (log_capture, log_tx) = TestLogCapture::new(); run_with_tokio( async move { println!("Used datamodel:\n {}", datamodel.schema.yellow()); let override_local_max_bind_values = None; - let runner = Runner::load(&url, &datamodel, &[], version, connector, override_local_max_bind_values, log_capture) + let runner = Runner::load(&datamodel, &[], version, connector_tag, override_local_max_bind_values, log_capture) .await .unwrap(); @@ -199,7 +194,7 @@ fn run_relation_link_test_impl( )) .await.unwrap(); - teardown_project(&url, &datamodel, &[], runner.schema_id()) + teardown_project(&datamodel, Default::default(), runner.schema_id()) .await .unwrap(); @@ -308,15 +303,15 @@ fn run_connector_test_impl( return; } - let url = connection_string(&version, test_database_name, !db_schemas.is_empty(), None); - let template = handler(); let datamodel = crate::render_test_datamodel( + test_database_name, template, excluded_features, referential_override, db_schemas, db_extensions, + None, ); let (connector_tag, version) = CONFIG.test_connector().unwrap(); @@ -326,7 +321,6 @@ fn run_connector_test_impl( println!("Used datamodel:\n {}", datamodel.schema.yellow()); let override_local_max_bind_values = None; let runner = Runner::load( - &url, &datamodel, db_schemas, version, @@ -350,7 +344,7 @@ fn run_connector_test_impl( panic!("💥 Test failed due to an error (see above)"); } - crate::teardown_project(&url, &datamodel, db_schemas, schema_id) + crate::teardown_project(&datamodel, db_schemas, schema_id) .await .unwrap(); }); diff --git a/query-engine/connector-test-kit-rs/query-tests-setup/src/runner/mod.rs b/query-engine/connector-test-kit-rs/query-tests-setup/src/runner/mod.rs index db3d67453eff..b0815569e8a8 100644 --- a/query-engine/connector-test-kit-rs/query-tests-setup/src/runner/mod.rs +++ b/query-engine/connector-test-kit-rs/query-tests-setup/src/runner/mod.rs @@ -207,7 +207,6 @@ impl Runner { } pub async fn load( - url: &str, datamodel: &RenderedDatamodel, db_schemas: &[&str], connector_version: ConnectorVersion, @@ -220,7 +219,7 @@ impl Runner { let executor = ExternalExecutor::new(); - let external_initializer = executor.init(&datamodel.schema, url); + let external_initializer = executor.init(&datamodel.schema, &datamodel.url); let init_external_result = qe_setup::setup_external( crate::CONFIG.with_driver_adapter().adapter, @@ -261,7 +260,7 @@ impl Runner { executor, query_schema: Arc::new(query_schema), connector_tag, - connection_url: url.to_owned(), + connection_url: datamodel.url.clone(), current_tx_id: None, protocol, log_capture, From d07d39a1ef418f5559e3d6cc3c781afb7de0d709 Mon Sep 17 00:00:00 2001 From: "Oleksii (Alexey) Orlenko" Date: Sun, 9 Nov 2025 12:19:27 +0100 Subject: [PATCH 4/9] feat(psl)!: remove the `url` property from `datasource` blocks (#5683) Remove the `url` property from `datasource` blocks in PSL, refactor the code to handle URLs separately and update the tests. Ref: https://linear.app/prisma-company/issue/TML-1545/remove-url-datasource-attribute-from-psl /prisma-branch next --- .../query-tests-setup/src/lib.rs | 24 ++++++++++++------- .../query-tests-setup/src/runner/mod.rs | 5 ++-- .../sql-introspection-tests/src/test_api.rs | 3 ++- .../tests/errors/error_tests.rs | 22 +++++++++-------- 4 files changed, 32 insertions(+), 22 deletions(-) diff --git a/query-engine/connector-test-kit-rs/query-tests-setup/src/lib.rs b/query-engine/connector-test-kit-rs/query-tests-setup/src/lib.rs index 2c89c6fab25c..557997b12b2b 100644 --- a/query-engine/connector-test-kit-rs/query-tests-setup/src/lib.rs +++ b/query-engine/connector-test-kit-rs/query-tests-setup/src/lib.rs @@ -43,11 +43,16 @@ pub static ENGINE_PROTOCOL: LazyLock = LazyLock::new(|| std::env::var("PRISMA_ENGINE_PROTOCOL").unwrap_or_else(|_| "graphql".to_owned())); /// Teardown of a test setup. -async fn teardown_project(datamodel: &RenderedDatamodel, db_schemas: &[&str], schema_id: usize) -> TestResult<()> { +async fn teardown_project( + url: &str, + datamodel: &RenderedDatamodel, + db_schemas: &[&str], + schema_id: usize, +) -> TestResult<()> { let params = serde_json::json!({ "schemaId": schema_id }); executor_process_request::("teardown", params).await?; - Ok(qe_setup::teardown(&datamodel.url, &datamodel.schema, db_schemas).await?) + Ok(qe_setup::teardown(url, &datamodel.schema, db_schemas).await?) } /// Helper method to allow a sync shell function to run the async test blocks. @@ -176,15 +181,15 @@ fn run_relation_link_test_impl( continue; } - let datamodel = render_test_datamodel(&test_db_name, template, &[], None, Default::default(), Default::default(), None); - let (connector_tag, version) = CONFIG.test_connector().unwrap(); + let url = connection_string(&version, &test_db_name, false, None); + let datamodel = render_test_datamodel(template, &[], None, &[], &[]); let (log_capture, log_tx) = TestLogCapture::new(); run_with_tokio( async move { println!("Used datamodel:\n {}", datamodel.schema.yellow()); let override_local_max_bind_values = None; - let runner = Runner::load(&datamodel, &[], version, connector_tag, override_local_max_bind_values, log_capture) + let runner = Runner::load(&url, &datamodel, &[], version, connector, override_local_max_bind_values, log_capture) .await .unwrap(); @@ -194,7 +199,7 @@ fn run_relation_link_test_impl( )) .await.unwrap(); - teardown_project(&datamodel, Default::default(), runner.schema_id()) + teardown_project(&url, &datamodel, &[], runner.schema_id()) .await .unwrap(); @@ -303,15 +308,15 @@ fn run_connector_test_impl( return; } + let url = connection_string(&version, test_database_name, !db_schemas.is_empty(), None); + let template = handler(); let datamodel = crate::render_test_datamodel( - test_database_name, template, excluded_features, referential_override, db_schemas, db_extensions, - None, ); let (connector_tag, version) = CONFIG.test_connector().unwrap(); @@ -321,6 +326,7 @@ fn run_connector_test_impl( println!("Used datamodel:\n {}", datamodel.schema.yellow()); let override_local_max_bind_values = None; let runner = Runner::load( + &url, &datamodel, db_schemas, version, @@ -344,7 +350,7 @@ fn run_connector_test_impl( panic!("💥 Test failed due to an error (see above)"); } - crate::teardown_project(&datamodel, db_schemas, schema_id) + crate::teardown_project(&url, &datamodel, db_schemas, schema_id) .await .unwrap(); }); diff --git a/query-engine/connector-test-kit-rs/query-tests-setup/src/runner/mod.rs b/query-engine/connector-test-kit-rs/query-tests-setup/src/runner/mod.rs index b0815569e8a8..db3d67453eff 100644 --- a/query-engine/connector-test-kit-rs/query-tests-setup/src/runner/mod.rs +++ b/query-engine/connector-test-kit-rs/query-tests-setup/src/runner/mod.rs @@ -207,6 +207,7 @@ impl Runner { } pub async fn load( + url: &str, datamodel: &RenderedDatamodel, db_schemas: &[&str], connector_version: ConnectorVersion, @@ -219,7 +220,7 @@ impl Runner { let executor = ExternalExecutor::new(); - let external_initializer = executor.init(&datamodel.schema, &datamodel.url); + let external_initializer = executor.init(&datamodel.schema, url); let init_external_result = qe_setup::setup_external( crate::CONFIG.with_driver_adapter().adapter, @@ -260,7 +261,7 @@ impl Runner { executor, query_schema: Arc::new(query_schema), connector_tag, - connection_url: datamodel.url.clone(), + connection_url: url.to_owned(), current_tx_id: None, protocol, log_capture, diff --git a/schema-engine/sql-introspection-tests/src/test_api.rs b/schema-engine/sql-introspection-tests/src/test_api.rs index 494b975d04ab..b1ca7f78975a 100644 --- a/schema-engine/sql-introspection-tests/src/test_api.rs +++ b/schema-engine/sql-introspection-tests/src/test_api.rs @@ -381,7 +381,8 @@ impl TestApi { let provider = &self.args.provider(); let datasource_block = format!( r#"datasource db {{ - provider = "{provider}"{namespaces}{relation_mode} + provider = "{provider}" + {namespaces}{relation_mode} }}"#, ); datasource_block diff --git a/schema-engine/sql-migration-tests/tests/errors/error_tests.rs b/schema-engine/sql-migration-tests/tests/errors/error_tests.rs index 4956875dca98..a3accc6d1c6f 100644 --- a/schema-engine/sql-migration-tests/tests/errors/error_tests.rs +++ b/schema-engine/sql-migration-tests/tests/errors/error_tests.rs @@ -472,20 +472,22 @@ async fn connection_string_problems_give_a_nice_error() { let json_error = serde_json::to_value(error.to_user_facing()).unwrap(); let details = match provider { - "sqlserver" => indoc!( - "Error parsing connection string: Conversion error: invalid digit found in string in database URL. - Please refer to the documentation in https://pris.ly/d/config-url + "sqlserver" => { + indoc!( + "Error parsing connection string: Conversion error: invalid digit found in string in database URL. + Please refer to the documentation in https://www.prisma.io/docs/reference/database-reference/connection-urls for constructing a correct connection string. In some cases, certain characters must be escaped. Please check the string for any illegal characters.", - ) - .replace('\n', " "), - _ => indoc!( - "invalid port number in database URL. - Please refer to the documentation in https://pris.ly/d/config-url + ).replace('\n', " ") + }, + _ => { + indoc!( + "invalid port number in database URL. + Please refer to the documentation in https://www.prisma.io/docs/reference/database-reference/connection-urls for constructing a correct connection string. In some cases, certain characters must be escaped. Please check the string for any illegal characters.", - ) - .replace('\n', " "), + ).replace('\n', " ") + } }; let expected = json!({ From ad072b5ef158b2f2701820606adeb8fa48a09299 Mon Sep 17 00:00:00 2001 From: Eti Ijeoma Date: Mon, 13 Oct 2025 22:26:32 +0100 Subject: [PATCH 5/9] feature(psl): Support ignore directives on values in enums Signed-off-by: Eti Ijeoma --- psl/psl/tests/attributes/ignore_negative.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/psl/psl/tests/attributes/ignore_negative.rs b/psl/psl/tests/attributes/ignore_negative.rs index a560c103836b..c02ce0a64612 100644 --- a/psl/psl/tests/attributes/ignore_negative.rs +++ b/psl/psl/tests/attributes/ignore_negative.rs @@ -236,3 +236,24 @@ fn disallow_ignore_on_ignored_model() { expectation.assert_eq(&error) } + +// #[test] +// fn disallow_ignore_on_ignored_enum_value() { + +// let dml = indoc! {r#" +// enum SupportedCarType { +// COUPE @ignore +// } +// "#}; + +// let error = parse_unwrap_err(dml); +// let expectation = expect![[r#" +// error: Error parsing attribute "@ignore": Enum values on an already ignored Enum do not need an `@ignore` annotation. +// --> schema.prisma:2 +//  |  +//  1 |  enum SupportedCarType { +//  2 |  COUPE @ignore +//  |  +// "#]]; +// expectation.assert_eq(&error); +// } From 9b338a27df756193d5baf963e6ebad869b8266c2 Mon Sep 17 00:00:00 2001 From: Eti Ijeoma Date: Mon, 26 Jan 2026 13:22:15 +0100 Subject: [PATCH 6/9] pull latest changes Signed-off-by: Eti Ijeoma --- .../query-engine-c-abi/include/query_engine.h | 163 ++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 query-engine/query-engine-c-abi/include/query_engine.h diff --git a/query-engine/query-engine-c-abi/include/query_engine.h b/query-engine/query-engine-c-abi/include/query_engine.h new file mode 100644 index 000000000000..32881db721b6 --- /dev/null +++ b/query-engine/query-engine-c-abi/include/query_engine.h @@ -0,0 +1,163 @@ +#ifndef query_engine_h +#define query_engine_h + +/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */ + +#include +#include +#include +#include + +#ifdef __cplusplus +namespace prisma { +#endif // __cplusplus + +/** + * This struct holds an instance of the prisma query engine + * You can instanciate as many as you want + */ +typedef struct QueryEngine QueryEngine; + +typedef struct ConstructorOptionsNative { + const char *config_dir; +} ConstructorOptionsNative; + +/** + * Parameters defining the construction of an engine. + * Unlike the Node version, this doesn't support the GraphQL protocol for talking with the prisma/client, since it is + * deprecated and going forward everything should be done via JSON rpc. + */ +typedef struct ConstructorOptions { + const char *id; + const char *datamodel; + const char *base_path; + const char *log_level; + bool log_queries; + bool enable_tracing; + const char *datasource_overrides; + const char *env; + bool ignore_env_var_errors; + struct ConstructorOptionsNative native; + void (*log_callback)(const char*, const char*); +} ConstructorOptions; + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +extern const int32_t PRISMA_OK; + +extern const int32_t PRISMA_UNKNOWN_ERROR; + +extern const int32_t PRISMA_MISSING_POINTER; + +/** + * # Safety + * The calling context needs to pass a valid pointer that will store the reference + * The calling context also need to clear the pointer of the error string if it is not null + */ +int prisma_create(struct ConstructorOptions options, + struct QueryEngine **qe_ptr, + char **error_string_ptr); + +/** + * # Safety + * + * The calling context needs to pass a valid pointer that will store the reference to the error string + * The calling context also need to clear the pointer of the error string if it is not null + */ +int prisma_connect(struct QueryEngine *qe, + const char *trace, + const char *request_id, + char **error_string_ptr); + +/** + * # Safety + * + * The calling context needs to pass a valid pointer that will store the reference to the error string + * The calling context also need to clear the pointer of the error string if it is not null + */ +const char *prisma_query(struct QueryEngine *qe, + const char *body_str, + const char *header_str, + const char *tx_id_str, + const char *request_id, + char **error_string_ptr); + +/** + * # Safety + * + * The calling context needs to pass a valid pointer that will store the reference to the error string + * The calling context also need to clear the pointer of the error string if it is not null + */ +const char *prisma_start_transaction(struct QueryEngine *qe, + const char *options_str, + const char *header_str, + const char *request_id); + +/** + * # Safety + * + * The calling context needs to pass a valid pointer that will store the reference to the error string + */ +const char *prisma_commit_transaction(struct QueryEngine *qe, + const char *tx_id_str, + const char *header_str, + const char *request_id); + +/** + * # Safety + * + * The calling context needs to pass a valid pointer that will store the reference to the error string + */ +const char *prisma_rollback_transaction(struct QueryEngine *qe, + const char *tx_id_str, + const char *header_str, + const char *request_id); + +/** + * # Safety + * + * The calling context needs to pass a valid pointer that will store the reference to the error string + */ +int prisma_disconnect(struct QueryEngine *qe, + const char *header_str, + const char *request_id); + +/** + * Returns the trace data for a given request ID as a JSON string. + * If the request is not found, it will return null. + * + * # Safety + * + * The caller must pass a pointer to a location to store the pointer to the error string in. + * If it is not null, the caller is responsible for deallocating the string. + */ +const char *prisma_trace(struct QueryEngine *qe, const char *request_id, char **error_string_ptr); + +/** + * # Safety + * + * The calling context needs to pass a valid pointer that will store the reference to the error string + * The calling context also need to clear the pointer of the error string if it is not null + */ +int prisma_apply_pending_migrations(struct QueryEngine *qe, + const char *migration_folder_path, + char **error_string_ptr); + +/** + * # Safety + * + * Will destroy the pointer to the query engine + */ +int prisma_destroy(struct QueryEngine *qe); + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +#ifdef __cplusplus +} // namespace prisma +#endif // __cplusplus + +#endif /* query_engine_h */ From abdd099ea93bc31ea61cd3638fc24f422a7778b7 Mon Sep 17 00:00:00 2001 From: Eti Ijeoma Date: Mon, 26 Jan 2026 15:10:17 +0100 Subject: [PATCH 7/9] pull latest changes Signed-off-by: Eti Ijeoma --- .github/workflows/on-push-to-main.yml | 21 +-- .../workflows/publish-query-compiler-wasm.yml | 2 +- AGENTS.md | 10 +- Cargo.lock | 46 ++--- Makefile | 72 ++++++-- README.md | 6 +- .../core/src/query_document/parser.rs | 2 +- .../query-engine-c-abi/include/query_engine.h | 163 ------------------ .../sql-introspection-tests/src/test_api.rs | 3 +- .../tests/errors/error_tests.rs | 22 ++- 10 files changed, 104 insertions(+), 243 deletions(-) delete mode 100644 query-engine/query-engine-c-abi/include/query_engine.h diff --git a/.github/workflows/on-push-to-main.yml b/.github/workflows/on-push-to-main.yml index 2ea4325ff352..0b4e26e4f586 100644 --- a/.github/workflows/on-push-to-main.yml +++ b/.github/workflows/on-push-to-main.yml @@ -22,18 +22,20 @@ jobs: - uses: ./.github/workflows/include/rust-wasm-setup - - name: Build WASM modules + - name: Build Wasm modules env: WASM_BUILD_PROFILE: release PKG_DIR: query-compiler/query-compiler-wasm/pkg TARGET_DIR: target/query-compiler-wasm run: | - make build-qc-wasm-gz + make build-qc-gz mkdir -p $TARGET_DIR for provider in "postgresql" "mysql" "sqlite" "sqlserver" "cockroachdb"; do - cp $PKG_DIR/$provider/query_compiler_bg.wasm $TARGET_DIR/query-compiler-$provider.wasm - cp $PKG_DIR/$provider.gz $TARGET_DIR/query-compiler-$provider.wasm.gz + for build in "fast" "small"; do + cp $PKG_DIR/$provider/query_compiler_${build}_bg.wasm $TARGET_DIR/query-compiler-$build-$provider.wasm + cp $PKG_DIR/${provider}_${build}.gz $TARGET_DIR/query-compiler-$build-$provider.wasm.gz + done done - name: Check out gh-pages branch @@ -44,16 +46,7 @@ jobs: - name: Update engines size run: | files=( - target/query-compiler-wasm/query-compiler-postgresql.wasm.gz - target/query-compiler-wasm/query-compiler-postgresql.wasm - target/query-compiler-wasm/query-compiler-mysql.wasm.gz - target/query-compiler-wasm/query-compiler-mysql.wasm - target/query-compiler-wasm/query-compiler-sqlite.wasm.gz - target/query-compiler-wasm/query-compiler-sqlite.wasm - target/query-compiler-wasm/query-compiler-sqlserver.wasm.gz - target/query-compiler-wasm/query-compiler-sqlserver.wasm - target/query-compiler-wasm/query-compiler-cockroachdb.wasm.gz - target/query-compiler-wasm/query-compiler-cockroachdb.wasm + target/query-compiler-wasm/query-compiler-{fast,small}-{postgresql,mysql,sqlite,sqlserver,cockroachdb}.{wasm,wasm.gz} ) DATE_TIME="$(date -u --iso-8601=seconds)" diff --git a/.github/workflows/publish-query-compiler-wasm.yml b/.github/workflows/publish-query-compiler-wasm.yml index fcbf2c590f60..dd51aafeb405 100644 --- a/.github/workflows/publish-query-compiler-wasm.yml +++ b/.github/workflows/publish-query-compiler-wasm.yml @@ -38,7 +38,7 @@ jobs: - name: Build @prisma/query-compiler-wasm run: make build-qc-wasm-fast build-qc-wasm-small env: - QC_WASM_VERSION: ${{ github.event.inputs.packageVersion }} + QE_WASM_VERSION: ${{ github.event.inputs.packageVersion }} - name: Install Node.js uses: actions/setup-node@v4 diff --git a/AGENTS.md b/AGENTS.md index ad11a1905c84..c89f04ad082c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -3,8 +3,7 @@ ## 1. Big Picture - This repo hosts the **Prisma Engines**: PSL (schema parser/validator), schema-engine (migrate, introspect), query components (query compiler, driver adapters, compatibility harnesses), and utilities shared with Prisma Client. - Prisma 7 roadmap status: - - `directUrl` and `shadowDatabaseUrl` are **invalid** in PSL. - - `url` remains temporarily while downstream tooling finishes migrating to external datasource overrides; removal is tracked separately. + - `url`, `directUrl` and `shadowDatabaseUrl` are **invalid** in PSL. - CLI/tests override connection info via schema-engine CLI (`--datasource`) or shared `TestApi::new_engine_with_connection_strings`. - Reference commit: `34b5a692b7bd79939a9a2c3ef97d816e749cda2f` (driver adapter override plumbing). - Prisma has removed the **native Rust query engine** in favor of the **Query Compiler (QC)** architecture: @@ -22,7 +21,7 @@ Key directories: - `prisma-fmt/` – Language server & formatter entry point (tests rely on `expect!` snapshots). - `schema-engine/sql-migration-tests` / `sql-introspection-tests` – Heavy integration suites (require DBs). - `query-engine/` – Unused MongoDB connector crate left for future reference and the connector test kit (integration tests exercise QC through the driver adapter executor here). -- `query-compiler/` – Query planner + associated WASM, playground, and the new `core-tests` crate. +- `query-compiler/` – Query planner + associated Wasm, playground, and the new `core-tests` crate. - `libs/` – Shared libraries (value types, driver adapters, test setup). - `driver-adapters/` – Rust-side adapter utilities for the new query interpreter. @@ -101,7 +100,7 @@ Supporting infra: 7. **Connector test kit (driver adapters + QC)** ```bash - make dev-pg-qc # or another dev-*-qc helper; builds QC WASM + driver adapters and writes .test_config + make dev-pg-qc # or another dev-*-qc helper; builds QC Wasm + driver adapters and writes .test_config cargo test -p query-engine-tests -- --nocapture ``` Set `DRIVER_ADAPTER=` (see Makefile) when you want to run against a specific adapter target. See `query-engine/connector-test-kit-rs/README.md` for env vars and adapter-specific notes. @@ -144,7 +143,7 @@ Ensure diffs make sense and rerun without `UPDATE_EXPECT` to confirm. `rg "directUrl"`, `rg "shadowDatabaseUrl"` - Build schema-engine CLI: `cargo build -p schema-engine-cli` -- Build query compiler WASM: +- Build query compiler Wasm: `make build-qc-wasm` - Build driver adapters kit for QC: `make build-driver-adapters-kit-qc` @@ -176,3 +175,4 @@ Prefer using Makefile targets that take care of setting up the environment corre --- **When modifying anything involving diagnostics or fixtures:** run relevant tests, refresh expectations, and ensure Git diffs are readable (no accidental CRLF/encoding swaps). Keep this file updated whenever we discover new traps.*** +s, and ensure Git diffs are readable (no accidental CRLF/encoding swaps). Keep this file updated whenever we discover new traps.*** diff --git a/Cargo.lock b/Cargo.lock index 5de15bd9b11b..28915bb0cf9a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -655,7 +655,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" dependencies = [ "lazy_static", - "windows-sys 0.52.0", + "windows-sys 0.48.0", ] [[package]] @@ -664,7 +664,7 @@ version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fde0e0ec90c9dfb3b4b1a0891a7dcd0e2bffde2f7efed5fe7c9bb00e5bfb915e" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.48.0", ] [[package]] @@ -2620,7 +2620,7 @@ version = "0.1.0" dependencies = [ "mongodb", "percent-encoding", - "thiserror 2.0.12", + "thiserror 2.0.17", ] [[package]] @@ -2661,7 +2661,7 @@ dependencies = [ "serde", "serde_json", "telemetry", - "thiserror 2.0.12", + "thiserror 2.0.17", "tokio", "tracing", "tracing-futures", @@ -3120,7 +3120,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1db05f56d34358a8b1066f67cbb203ee3e7ed2ba674a6263a1d5ec6db2204323" dependencies = [ "memchr", - "thiserror 2.0.12", + "thiserror 2.0.17", "ucd-trie", ] @@ -3561,7 +3561,7 @@ dependencies = [ "serde_json", "sqlformat", "telemetry", - "thiserror 2.0.12", + "thiserror 2.0.17", "tiberius", "tokio", "tokio-postgres", @@ -3623,7 +3623,7 @@ dependencies = [ "serde", "serde_json", "sql-query-builder", - "thiserror 2.0.12", + "thiserror 2.0.17", ] [[package]] @@ -3677,7 +3677,7 @@ dependencies = [ "serde", "serde_json", "telemetry", - "thiserror 2.0.12", + "thiserror 2.0.17", "user-facing-errors", "uuid", ] @@ -3699,7 +3699,7 @@ dependencies = [ "serde", "serde_json", "smallvec", - "thiserror 2.0.12", + "thiserror 2.0.17", "tokio", "tracing", "user-facing-errors", @@ -3745,7 +3745,7 @@ dependencies = [ "itertools 0.13.0", "prisma-value", "psl", - "thiserror 2.0.12", + "thiserror 2.0.17", ] [[package]] @@ -3793,7 +3793,7 @@ dependencies = [ "serde_json", "strip-ansi-escapes", "telemetry", - "thiserror 2.0.12", + "thiserror 2.0.17", "tokio", "tracing", "tracing-error", @@ -4068,7 +4068,7 @@ dependencies = [ "query-structure", "serde", "serde_json", - "thiserror 2.0.12", + "thiserror 2.0.17", "tracing", "user-facing-errors", ] @@ -4373,7 +4373,7 @@ dependencies = [ "serde", "serde_json", "sql-schema-connector", - "thiserror 2.0.12", + "thiserror 2.0.17", "tokio", "tracing", "tracing-futures", @@ -4912,7 +4912,7 @@ dependencies = [ "once_cell", "percent-encoding", "smallvec", - "thiserror 2.0.12", + "thiserror 2.0.17", "tracing", "url", ] @@ -5091,7 +5091,7 @@ dependencies = [ "rand 0.8.5", "serde", "serde_json", - "thiserror 2.0.12", + "thiserror 2.0.17", "tokio", "tracing", "tracing-subscriber", @@ -5170,11 +5170,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.12" +version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" dependencies = [ - "thiserror-impl 2.0.12", + "thiserror-impl 2.0.17", ] [[package]] @@ -5190,9 +5190,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.12" +version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2", "quote", @@ -5402,9 +5402,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.15" +version = "0.7.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df" +checksum = "2efa149fe76073d6e8fd97ef4f4eca7b67f599660115591483572e406e165594" dependencies = [ "bytes", "futures-core", @@ -5579,7 +5579,7 @@ dependencies = [ "native-tls", "rand 0.8.5", "sha1", - "thiserror 2.0.12", + "thiserror 2.0.17", "utf-8", ] diff --git a/Makefile b/Makefile index c2ec66fafe4c..0292137b38c5 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ CONFIG_FILE = .test_config DEV_SCHEMA_FILE = dev_datamodel.prisma PRISMA_BRANCH ?= main ENGINE_SIZE_OUTPUT ?= /dev/stdout -QC_WASM_VERSION ?= 0.0.0 +QE_WASM_VERSION ?= 0.0.0 SCHEMA_WASM_VERSION ?= 0.0.0 LIBRARY_EXT := $(shell \ @@ -58,16 +58,20 @@ build-se-wasm: cd schema-engine/schema-engine-wasm && \ ./build.sh $(SCHEMA_ENGINE_WASM_VERSION) schema-engine/schema-engine-wasm/pkg -build-qc-wasm: +build-qc-wasm-%: cd query-compiler/query-compiler-wasm && \ - ./build.sh $(QC_WASM_VERSION) query-compiler/query-compiler-wasm/pkg + ./build.sh $(QE_WASM_VERSION) query-compiler/query-compiler-wasm/pkg $* -build-qc-wasm-gz: build-qc-wasm - @cd query-compiler/query-compiler-wasm/pkg && \ +build-qc-wasm: build-qc-wasm-fast build-qc-wasm-small + +build-qc-gz-%: build-qc-wasm-% + @cd query-compiler/query-compiler-wasm/pkg && \ for provider in postgresql mysql sqlite sqlserver cockroachdb; do \ - gzip -knc $$provider/query_compiler_bg.wasm > $$provider.gz; \ + gzip -knc $$provider/query_compiler_$*_bg.wasm > $${provider}_$*.gz; \ done; +build-qc-gz: build-qc-gz-fast build-qc-gz-small + build-schema-wasm: @printf '%s\n' "🛠️ Building the Rust crate" cargo build --profile $(PROFILE) --target=wasm32-unknown-unknown -p prisma-schema-build @@ -135,6 +139,34 @@ check-schema-wasm-package: build-schema-wasm NODE=$(shell which node) \ ./prisma-schema-wasm/scripts/check.sh +###################### +# Benchmark commands # +###################### + +# Run query compiler benchmarks +bench-qc: + cargo bench -p query-compiler --profile profiling + +# Run query graph building benchmarks +bench-qc-graph: + cargo bench -p core-tests --profile profiling --bench query_graph_bench + +# Run schema building benchmarks +bench-schema: + cargo bench -p schema --profile profiling --bench schema_builder_bench + +# Save benchmark baseline (usage: make bench-baseline NAME=main) +bench-qc-baseline: + cargo bench -p query-compiler --profile profiling -- --save-baseline $(NAME) + +# Compare against baseline (usage: make bench-compare NAME=main) +bench-qc-compare: + cargo bench -p query-compiler --profile profiling -- --baseline $(NAME) + +# Run profile_query example for profiling +profile-qc: + cargo run -p query-compiler --example profile_query --profile profiling + ########################### # Database setup commands # ########################### @@ -150,17 +182,17 @@ start-sqlite: dev-sqlite: cp $(CONFIG_PATH)/sqlite $(CONFIG_FILE) -dev-libsql-qc: build-qc-wasm build-driver-adapters-kit-qc +dev-libsql-qc: build-qc-wasm-fast build-driver-adapters-kit-qc cp $(CONFIG_PATH)/libsql-qc $(CONFIG_FILE) test-libsql-qc: dev-libsql-qc test-qe-st -dev-better-sqlite3-qc: build-qc-wasm build-driver-adapters-kit-qc +dev-better-sqlite3-qc: build-qc-wasm-fast build-driver-adapters-kit-qc cp $(CONFIG_PATH)/better-sqlite3-qc $(CONFIG_FILE) test-better-sqlite3-qc: dev-better-sqlite3-qc test-qe-st -dev-d1-qc: build-qc-wasm build-driver-adapters-kit-qc +dev-d1-qc: build-qc-wasm-fast build-driver-adapters-kit-qc cp $(CONFIG_PATH)/d1-qc $(CONFIG_FILE) test-d1-qc: dev-d1-qc test-qe-st @@ -177,7 +209,7 @@ start-postgres13: dev-postgres13: start-postgres13 cp $(CONFIG_PATH)/postgres13 $(CONFIG_FILE) -dev-pg-qc: start-postgres13 build-qc-wasm build-driver-adapters-kit-qc +dev-pg-qc: start-postgres13 build-qc-wasm-fast build-driver-adapters-kit-qc cp $(CONFIG_PATH)/pg-qc $(CONFIG_FILE) dev-pg-qc-join: @@ -197,7 +229,7 @@ test-pg-qc-query: start-pg-bench: docker compose -f libs/driver-adapters/executor/bench/docker-compose.yml up --wait -d --remove-orphans postgres -dev-pg-cockroachdb-qc: start-cockroach_23_1 build-qc-wasm build-driver-adapters-kit-qc +dev-pg-cockroachdb-qc: start-cockroach_23_1 build-qc-wasm-fast build-driver-adapters-kit-qc cp $(CONFIG_PATH)/pg-cockroachdb-qc $(CONFIG_FILE) dev-pg-cockroachdb-qc-join: @@ -219,7 +251,7 @@ bench-pg-js: setup-pg-bench run-bench start-neon: docker compose -f docker-compose.yml up --wait -d --remove-orphans neon-proxy -dev-neon-qc: start-neon build-qc-wasm build-driver-adapters-kit-qc +dev-neon-qc: start-neon build-qc-wasm-fast build-driver-adapters-kit-qc cp $(CONFIG_PATH)/neon-qc $(CONFIG_FILE) dev-neon-qc-join: @@ -329,7 +361,7 @@ start-mssql_edge: dev-mssql_edge: start-mssql_edge cp $(CONFIG_PATH)/sqlserver2019 $(CONFIG_FILE) -dev-mssql-qc: start-mssql_2022 build-qc-wasm build-driver-adapters-kit-qc +dev-mssql-qc: start-mssql_2022 build-qc-wasm-fast build-driver-adapters-kit-qc cp $(CONFIG_PATH)/sqlserver-qc $(CONFIG_FILE) test-mssql-qc: dev-mssql-qc test-qe @@ -381,17 +413,17 @@ dev-vitess_8_0: start-vitess_8_0 start-planetscale: docker compose -f docker-compose.yml up -d --remove-orphans planetscale-proxy -dev-planetscale-qc: start-planetscale build-qc-wasm build-driver-adapters-kit-qc +dev-planetscale-qc: start-planetscale build-qc-wasm-fast build-driver-adapters-kit-qc cp $(CONFIG_PATH)/planetscale-qc $(CONFIG_FILE) test-planetscale-qc: dev-planetscale-qc test-qe-st -dev-mariadb-mysql-qc: start-mysql_8 build-qc-wasm build-driver-adapters-kit-qc +dev-mariadb-mysql-qc: start-mysql_8 build-qc-wasm-fast build-driver-adapters-kit-qc cp $(CONFIG_PATH)/mariadb-mysql-qc $(CONFIG_FILE) test-mariadb-mysql-qc: dev-mariadb-mysql-qc test-qe-st -dev-mariadb-qc: start-mysql_mariadb build-qc-wasm build-driver-adapters-kit-qc +dev-mariadb-qc: start-mysql_mariadb build-qc-wasm-fast build-driver-adapters-kit-qc cp $(CONFIG_PATH)/mariadb-qc $(CONFIG_FILE) test-mariadb-qc: dev-mariadb-qc test-qe-st @@ -400,11 +432,13 @@ test-mariadb-qc: dev-mariadb-qc test-qe-st # Local dev commands # ###################### -measure-qc-wasm: build-qc-wasm-gz +measure-qc-wasm: measure-qc-wasm-fast measure-qc-wasm-small + +measure-qc-wasm-%: build-qc-gz-% @cd query-compiler/query-compiler-wasm/pkg; \ for provider in postgresql mysql sqlite sqlserver cockroachdb; do \ - echo "$${provider}_qc_size=$$(cat $$provider/query_compiler_bg.wasm | wc -c | tr -d ' ')" >> $(ENGINE_SIZE_OUTPUT); \ - echo "$${provider}_qc_size_gz=$$(cat $$provider.gz | wc -c | tr -d ' ')" >> $(ENGINE_SIZE_OUTPUT); \ + echo "$${provider}_$*_qc_size=$$(cat $$provider/query_compiler_$*_bg.wasm | wc -c | tr -d ' ')" >> $(ENGINE_SIZE_OUTPUT); \ + echo "$${provider}_$*_qc_size_gz=$$(cat $${provider}_$*.gz | wc -c | tr -d ' ')" >> $(ENGINE_SIZE_OUTPUT); \ done; install-driver-adapters-kit-deps: build-driver-adapters diff --git a/README.md b/README.md index 9974dda00917..35debcd69d04 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ the repository root in the `target/debug` (without `--release`) or `target/relea | Schema Engine | `./target/[debug\|release]/schema-engine` | | Prisma Format | `./target/[debug\|release]/prisma-fmt` | -The query compiler is a library crate. To produce the WASM bundles that power the JS runtime, use +The query compiler is a library crate. To produce the Wasm bundles that power the JS runtime, use `make build-qc-wasm`. Driver adapters are compiled via `make build-driver-adapters-kit-qc`. ## Prisma Schema Language @@ -128,7 +128,7 @@ The engine uses: ## Prisma format -Prisma format can format prisma schema files. It also comes as a WASM module via +Prisma format can format prisma schema files. It also comes as a Wasm module via a node package. You can read more [here](./prisma-schema-wasm/README.md). ## Debugging @@ -188,7 +188,7 @@ exclusions used in the Makefile when invoking `cargo test --workspace --all-feat **Setup:** -Use the `dev-*-qc` helpers to spin up a database (when needed), build the query-compiler WASM, build +Use the `dev-*-qc` helpers to spin up a database (when needed), build the query-compiler Wasm, build the driver adapters, and write the `.test_config` consumed by the connector test kit: - `make dev-pg-qc` diff --git a/query-compiler/core/src/query_document/parser.rs b/query-compiler/core/src/query_document/parser.rs index a29d2a73ba90..7045c8d094b6 100644 --- a/query-compiler/core/src/query_document/parser.rs +++ b/query-compiler/core/src/query_document/parser.rs @@ -207,7 +207,7 @@ impl QueryDocumentParser { }; // If optional and not present ignore the field. - // If present, parse normally. + // If present or has a default, process the value. // If not present but required, throw a validation error. match selection_arg { Some((name, value)) => Some(validate_other_required_args(&name).and_then(|_| { diff --git a/query-engine/query-engine-c-abi/include/query_engine.h b/query-engine/query-engine-c-abi/include/query_engine.h deleted file mode 100644 index 32881db721b6..000000000000 --- a/query-engine/query-engine-c-abi/include/query_engine.h +++ /dev/null @@ -1,163 +0,0 @@ -#ifndef query_engine_h -#define query_engine_h - -/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */ - -#include -#include -#include -#include - -#ifdef __cplusplus -namespace prisma { -#endif // __cplusplus - -/** - * This struct holds an instance of the prisma query engine - * You can instanciate as many as you want - */ -typedef struct QueryEngine QueryEngine; - -typedef struct ConstructorOptionsNative { - const char *config_dir; -} ConstructorOptionsNative; - -/** - * Parameters defining the construction of an engine. - * Unlike the Node version, this doesn't support the GraphQL protocol for talking with the prisma/client, since it is - * deprecated and going forward everything should be done via JSON rpc. - */ -typedef struct ConstructorOptions { - const char *id; - const char *datamodel; - const char *base_path; - const char *log_level; - bool log_queries; - bool enable_tracing; - const char *datasource_overrides; - const char *env; - bool ignore_env_var_errors; - struct ConstructorOptionsNative native; - void (*log_callback)(const char*, const char*); -} ConstructorOptions; - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -extern const int32_t PRISMA_OK; - -extern const int32_t PRISMA_UNKNOWN_ERROR; - -extern const int32_t PRISMA_MISSING_POINTER; - -/** - * # Safety - * The calling context needs to pass a valid pointer that will store the reference - * The calling context also need to clear the pointer of the error string if it is not null - */ -int prisma_create(struct ConstructorOptions options, - struct QueryEngine **qe_ptr, - char **error_string_ptr); - -/** - * # Safety - * - * The calling context needs to pass a valid pointer that will store the reference to the error string - * The calling context also need to clear the pointer of the error string if it is not null - */ -int prisma_connect(struct QueryEngine *qe, - const char *trace, - const char *request_id, - char **error_string_ptr); - -/** - * # Safety - * - * The calling context needs to pass a valid pointer that will store the reference to the error string - * The calling context also need to clear the pointer of the error string if it is not null - */ -const char *prisma_query(struct QueryEngine *qe, - const char *body_str, - const char *header_str, - const char *tx_id_str, - const char *request_id, - char **error_string_ptr); - -/** - * # Safety - * - * The calling context needs to pass a valid pointer that will store the reference to the error string - * The calling context also need to clear the pointer of the error string if it is not null - */ -const char *prisma_start_transaction(struct QueryEngine *qe, - const char *options_str, - const char *header_str, - const char *request_id); - -/** - * # Safety - * - * The calling context needs to pass a valid pointer that will store the reference to the error string - */ -const char *prisma_commit_transaction(struct QueryEngine *qe, - const char *tx_id_str, - const char *header_str, - const char *request_id); - -/** - * # Safety - * - * The calling context needs to pass a valid pointer that will store the reference to the error string - */ -const char *prisma_rollback_transaction(struct QueryEngine *qe, - const char *tx_id_str, - const char *header_str, - const char *request_id); - -/** - * # Safety - * - * The calling context needs to pass a valid pointer that will store the reference to the error string - */ -int prisma_disconnect(struct QueryEngine *qe, - const char *header_str, - const char *request_id); - -/** - * Returns the trace data for a given request ID as a JSON string. - * If the request is not found, it will return null. - * - * # Safety - * - * The caller must pass a pointer to a location to store the pointer to the error string in. - * If it is not null, the caller is responsible for deallocating the string. - */ -const char *prisma_trace(struct QueryEngine *qe, const char *request_id, char **error_string_ptr); - -/** - * # Safety - * - * The calling context needs to pass a valid pointer that will store the reference to the error string - * The calling context also need to clear the pointer of the error string if it is not null - */ -int prisma_apply_pending_migrations(struct QueryEngine *qe, - const char *migration_folder_path, - char **error_string_ptr); - -/** - * # Safety - * - * Will destroy the pointer to the query engine - */ -int prisma_destroy(struct QueryEngine *qe); - -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus - -#ifdef __cplusplus -} // namespace prisma -#endif // __cplusplus - -#endif /* query_engine_h */ diff --git a/schema-engine/sql-introspection-tests/src/test_api.rs b/schema-engine/sql-introspection-tests/src/test_api.rs index b1ca7f78975a..494b975d04ab 100644 --- a/schema-engine/sql-introspection-tests/src/test_api.rs +++ b/schema-engine/sql-introspection-tests/src/test_api.rs @@ -381,8 +381,7 @@ impl TestApi { let provider = &self.args.provider(); let datasource_block = format!( r#"datasource db {{ - provider = "{provider}" - {namespaces}{relation_mode} + provider = "{provider}"{namespaces}{relation_mode} }}"#, ); datasource_block diff --git a/schema-engine/sql-migration-tests/tests/errors/error_tests.rs b/schema-engine/sql-migration-tests/tests/errors/error_tests.rs index a3accc6d1c6f..4956875dca98 100644 --- a/schema-engine/sql-migration-tests/tests/errors/error_tests.rs +++ b/schema-engine/sql-migration-tests/tests/errors/error_tests.rs @@ -472,22 +472,20 @@ async fn connection_string_problems_give_a_nice_error() { let json_error = serde_json::to_value(error.to_user_facing()).unwrap(); let details = match provider { - "sqlserver" => { - indoc!( - "Error parsing connection string: Conversion error: invalid digit found in string in database URL. - Please refer to the documentation in https://www.prisma.io/docs/reference/database-reference/connection-urls + "sqlserver" => indoc!( + "Error parsing connection string: Conversion error: invalid digit found in string in database URL. + Please refer to the documentation in https://pris.ly/d/config-url for constructing a correct connection string. In some cases, certain characters must be escaped. Please check the string for any illegal characters.", - ).replace('\n', " ") - }, - _ => { - indoc!( - "invalid port number in database URL. - Please refer to the documentation in https://www.prisma.io/docs/reference/database-reference/connection-urls + ) + .replace('\n', " "), + _ => indoc!( + "invalid port number in database URL. + Please refer to the documentation in https://pris.ly/d/config-url for constructing a correct connection string. In some cases, certain characters must be escaped. Please check the string for any illegal characters.", - ).replace('\n', " ") - } + ) + .replace('\n', " "), }; let expected = json!({ From 41ac5eefe13f05b4f2a246c32fe753ebd07f504f Mon Sep 17 00:00:00 2001 From: Eti Ijeoma Date: Mon, 26 Jan 2026 15:12:19 +0100 Subject: [PATCH 8/9] pull latest changes Signed-off-by: Eti Ijeoma --- .github/workflows/wasm-size.yml | 130 +++++++++++++++++++++----------- 1 file changed, 86 insertions(+), 44 deletions(-) diff --git a/.github/workflows/wasm-size.yml b/.github/workflows/wasm-size.yml index 212451305d40..7b764075a818 100644 --- a/.github/workflows/wasm-size.yml +++ b/.github/workflows/wasm-size.yml @@ -18,16 +18,27 @@ jobs: name: calculate module sizes (pr) runs-on: ubuntu-latest outputs: - postgresql_qc_size: ${{ steps.measure-qc.outputs.postgresql_qc_size }} - postgresql_qc_size_gz: ${{ steps.measure-qc.outputs.postgresql_qc_size_gz }} - mysql_qc_size: ${{ steps.measure-qc.outputs.mysql_qc_size }} - mysql_qc_size_gz: ${{ steps.measure-qc.outputs.mysql_qc_size_gz }} - sqlite_qc_size: ${{ steps.measure-qc.outputs.sqlite_qc_size }} - sqlite_qc_size_gz: ${{ steps.measure-qc.outputs.sqlite_qc_size_gz }} - sqlserver_qc_size: ${{ steps.measure-qc.outputs.sqlserver_qc_size }} - sqlserver_qc_size_gz: ${{ steps.measure-qc.outputs.sqlserver_qc_size_gz }} - cockroachdb_qc_size: ${{ steps.measure-qc.outputs.cockroachdb_qc_size }} - cockroachdb_qc_size_gz: ${{ steps.measure-qc.outputs.cockroachdb_qc_size_gz }} + postgresql_fast_qc_size: ${{ steps.measure-qc.outputs.postgresql_fast_qc_size }} + postgresql_fast_qc_size_gz: ${{ steps.measure-qc.outputs.postgresql_fast_qc_size_gz }} + mysql_fast_qc_size: ${{ steps.measure-qc.outputs.mysql_fast_qc_size }} + mysql_fast_qc_size_gz: ${{ steps.measure-qc.outputs.mysql_fast_qc_size_gz }} + sqlite_fast_qc_size: ${{ steps.measure-qc.outputs.sqlite_fast_qc_size }} + sqlite_fast_qc_size_gz: ${{ steps.measure-qc.outputs.sqlite_fast_qc_size_gz }} + sqlserver_fast_qc_size: ${{ steps.measure-qc.outputs.sqlserver_fast_qc_size }} + sqlserver_fast_qc_size_gz: ${{ steps.measure-qc.outputs.sqlserver_fast_qc_size_gz }} + cockroachdb_fast_qc_size: ${{ steps.measure-qc.outputs.cockroachdb_fast_qc_size }} + cockroachdb_fast_qc_size_gz: ${{ steps.measure-qc.outputs.cockroachdb_fast_qc_size_gz }} + + postgresql_small_qc_size: ${{ steps.measure-qc.outputs.postgresql_small_qc_size }} + postgresql_small_qc_size_gz: ${{ steps.measure-qc.outputs.postgresql_small_qc_size_gz }} + mysql_small_qc_size: ${{ steps.measure-qc.outputs.mysql_small_qc_size }} + mysql_small_qc_size_gz: ${{ steps.measure-qc.outputs.mysql_small_qc_size_gz }} + sqlite_small_qc_size: ${{ steps.measure-qc.outputs.sqlite_small_qc_size }} + sqlite_small_qc_size_gz: ${{ steps.measure-qc.outputs.sqlite_small_qc_size_gz }} + sqlserver_small_qc_size: ${{ steps.measure-qc.outputs.sqlserver_small_qc_size }} + sqlserver_small_qc_size_gz: ${{ steps.measure-qc.outputs.sqlserver_small_qc_size_gz }} + cockroachdb_small_qc_size: ${{ steps.measure-qc.outputs.cockroachdb_small_qc_size }} + cockroachdb_small_qc_size_gz: ${{ steps.measure-qc.outputs.cockroachdb_small_qc_size_gz }} steps: - name: Checkout PR branch uses: actions/checkout@v4 @@ -44,16 +55,27 @@ jobs: name: calculate module sizes (base branch) runs-on: ubuntu-latest outputs: - postgresql_qc_size: ${{ steps.measure-qc.outputs.postgresql_qc_size }} - postgresql_qc_size_gz: ${{ steps.measure-qc.outputs.postgresql_qc_size_gz }} - mysql_qc_size: ${{ steps.measure-qc.outputs.mysql_qc_size }} - mysql_qc_size_gz: ${{ steps.measure-qc.outputs.mysql_qc_size_gz }} - sqlite_qc_size: ${{ steps.measure-qc.outputs.sqlite_qc_size }} - sqlite_qc_size_gz: ${{ steps.measure-qc.outputs.sqlite_qc_size_gz }} - sqlserver_qc_size: ${{ steps.measure-qc.outputs.sqlserver_qc_size }} - sqlserver_qc_size_gz: ${{ steps.measure-qc.outputs.sqlserver_qc_size_gz }} - cockroachdb_qc_size: ${{ steps.measure-qc.outputs.cockroachdb_qc_size }} - cockroachdb_qc_size_gz: ${{ steps.measure-qc.outputs.cockroachdb_qc_size_gz }} + postgresql_fast_qc_size: ${{ steps.measure-qc.outputs.postgresql_fast_qc_size }} + postgresql_fast_qc_size_gz: ${{ steps.measure-qc.outputs.postgresql_fast_qc_size_gz }} + mysql_fast_qc_size: ${{ steps.measure-qc.outputs.mysql_fast_qc_size }} + mysql_fast_qc_size_gz: ${{ steps.measure-qc.outputs.mysql_fast_qc_size_gz }} + sqlite_fast_qc_size: ${{ steps.measure-qc.outputs.sqlite_fast_qc_size }} + sqlite_fast_qc_size_gz: ${{ steps.measure-qc.outputs.sqlite_fast_qc_size_gz }} + sqlserver_fast_qc_size: ${{ steps.measure-qc.outputs.sqlserver_fast_qc_size }} + sqlserver_fast_qc_size_gz: ${{ steps.measure-qc.outputs.sqlserver_fast_qc_size_gz }} + cockroachdb_fast_qc_size: ${{ steps.measure-qc.outputs.cockroachdb_fast_qc_size }} + cockroachdb_fast_qc_size_gz: ${{ steps.measure-qc.outputs.cockroachdb_fast_qc_size_gz }} + + postgresql_small_qc_size: ${{ steps.measure-qc.outputs.postgresql_small_qc_size }} + postgresql_small_qc_size_gz: ${{ steps.measure-qc.outputs.postgresql_small_qc_size_gz }} + mysql_small_qc_size: ${{ steps.measure-qc.outputs.mysql_small_qc_size }} + mysql_small_qc_size_gz: ${{ steps.measure-qc.outputs.mysql_small_qc_size_gz }} + sqlite_small_qc_size: ${{ steps.measure-qc.outputs.sqlite_small_qc_size }} + sqlite_small_qc_size_gz: ${{ steps.measure-qc.outputs.sqlite_small_qc_size_gz }} + sqlserver_small_qc_size: ${{ steps.measure-qc.outputs.sqlserver_small_qc_size }} + sqlserver_small_qc_size_gz: ${{ steps.measure-qc.outputs.sqlserver_small_qc_size_gz }} + cockroachdb_small_qc_size: ${{ steps.measure-qc.outputs.cockroachdb_small_qc_size }} + cockroachdb_small_qc_size_gz: ${{ steps.measure-qc.outputs.cockroachdb_small_qc_size_gz }} steps: - name: Checkout base branch uses: actions/checkout@v4 @@ -97,20 +119,30 @@ jobs: echo "${provider}_diff=$diff" >> $GITHUB_OUTPUT } - compute_diff "postgresql_qc" "${{ needs.base-wasm-size.outputs.postgresql_qc_size }}" "${{ needs.pr-wasm-size.outputs.postgresql_qc_size }}" - compute_diff "postgresql_qc_gz" "${{ needs.base-wasm-size.outputs.postgresql_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.postgresql_qc_size_gz }}" + compute_diff "postgresql_fast_qc" "${{ needs.base-wasm-size.outputs.postgresql_fast_qc_size }}" "${{ needs.pr-wasm-size.outputs.postgresql_fast_qc_size }}" + compute_diff "postgresql_fast_qc_gz" "${{ needs.base-wasm-size.outputs.postgresql_fast_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.postgresql_fast_qc_size_gz }}" + compute_diff "postgresql_small_qc" "${{ needs.base-wasm-size.outputs.postgresql_small_qc_size }}" "${{ needs.pr-wasm-size.outputs.postgresql_small_qc_size }}" + compute_diff "postgresql_small_qc_gz" "${{ needs.base-wasm-size.outputs.postgresql_small_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.postgresql_small_qc_size_gz }}" - compute_diff "mysql_qc" "${{ needs.base-wasm-size.outputs.mysql_qc_size }}" "${{ needs.pr-wasm-size.outputs.mysql_qc_size }}" - compute_diff "mysql_qc_gz" "${{ needs.base-wasm-size.outputs.mysql_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.mysql_qc_size_gz }}" + compute_diff "mysql_fast_qc" "${{ needs.base-wasm-size.outputs.mysql_fast_qc_size }}" "${{ needs.pr-wasm-size.outputs.mysql_fast_qc_size }}" + compute_diff "mysql_fast_qc_gz" "${{ needs.base-wasm-size.outputs.mysql_fast_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.mysql_fast_qc_size_gz }}" + compute_diff "mysql_small_qc" "${{ needs.base-wasm-size.outputs.mysql_small_qc_size }}" "${{ needs.pr-wasm-size.outputs.mysql_small_qc_size }}" + compute_diff "mysql_small_qc_gz" "${{ needs.base-wasm-size.outputs.mysql_small_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.mysql_small_qc_size_gz }}" - compute_diff "sqlite_qc" "${{ needs.base-wasm-size.outputs.sqlite_qc_size }}" "${{ needs.pr-wasm-size.outputs.sqlite_qc_size }}" - compute_diff "sqlite_qc_gz" "${{ needs.base-wasm-size.outputs.sqlite_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.sqlite_qc_size_gz }}" + compute_diff "sqlite_fast_qc" "${{ needs.base-wasm-size.outputs.sqlite_fast_qc_size }}" "${{ needs.pr-wasm-size.outputs.sqlite_fast_qc_size }}" + compute_diff "sqlite_fast_qc_gz" "${{ needs.base-wasm-size.outputs.sqlite_fast_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.sqlite_fast_qc_size_gz }}" + compute_diff "sqlite_small_qc" "${{ needs.base-wasm-size.outputs.sqlite_small_qc_size }}" "${{ needs.pr-wasm-size.outputs.sqlite_small_qc_size }}" + compute_diff "sqlite_small_qc_gz" "${{ needs.base-wasm-size.outputs.sqlite_small_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.sqlite_small_qc_size_gz }}" - compute_diff "sqlserver_qc" "${{ needs.base-wasm-size.outputs.sqlserver_qc_size }}" "${{ needs.pr-wasm-size.outputs.sqlserver_qc_size }}" - compute_diff "sqlserver_qc_gz" "${{ needs.base-wasm-size.outputs.sqlserver_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.sqlserver_qc_size_gz }}" + compute_diff "sqlserver_fast_qc" "${{ needs.base-wasm-size.outputs.sqlserver_fast_qc_size }}" "${{ needs.pr-wasm-size.outputs.sqlserver_fast_qc_size }}" + compute_diff "sqlserver_fast_qc_gz" "${{ needs.base-wasm-size.outputs.sqlserver_fast_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.sqlserver_fast_qc_size_gz }}" + compute_diff "sqlserver_small_qc" "${{ needs.base-wasm-size.outputs.sqlserver_small_qc_size }}" "${{ needs.pr-wasm-size.outputs.sqlserver_small_qc_size }}" + compute_diff "sqlserver_small_qc_gz" "${{ needs.base-wasm-size.outputs.sqlserver_small_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.sqlserver_small_qc_size_gz }}" - compute_diff "cockroachdb_qc" "${{ needs.base-wasm-size.outputs.cockroachdb_qc_size }}" "${{ needs.pr-wasm-size.outputs.cockroachdb_qc_size }}" - compute_diff "cockroachdb_qc_gz" "${{ needs.base-wasm-size.outputs.cockroachdb_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.cockroachdb_qc_size_gz }}" + compute_diff "cockroachdb_fast_qc" "${{ needs.base-wasm-size.outputs.cockroachdb_fast_qc_size }}" "${{ needs.pr-wasm-size.outputs.cockroachdb_fast_qc_size }}" + compute_diff "cockroachdb_fast_qc_gz" "${{ needs.base-wasm-size.outputs.cockroachdb_fast_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.cockroachdb_fast_qc_size_gz }}" + compute_diff "cockroachdb_small_qc" "${{ needs.base-wasm-size.outputs.cockroachdb_small_qc_size }}" "${{ needs.pr-wasm-size.outputs.cockroachdb_small_qc_size }}" + compute_diff "cockroachdb_small_qc_gz" "${{ needs.base-wasm-size.outputs.cockroachdb_small_qc_size_gz }}" "${{ needs.pr-wasm-size.outputs.cockroachdb_small_qc_size_gz }}" - name: Find past report comment uses: peter-evans/find-comment@v3 @@ -129,18 +161,28 @@ jobs: issue-number: ${{ github.event.pull_request.number }} body: | - ### WASM Query Compiler File Size - - | Engine | This PR | Base branch | Diff | - |--------------------|-----------------------------------------------------|-----------------------------------------------------|-----------------------------------------------------| - | Postgres | ${{ steps.compute.outputs.postgresql_qc_pr }} | ${{ steps.compute.outputs.postgresql_qc_base }} | ${{ steps.compute.outputs.postgresql_qc_diff }} | - | Postgres (gzip) | ${{ steps.compute.outputs.postgresql_qc_gz_pr }} | ${{ steps.compute.outputs.postgresql_qc_gz_base }} | ${{ steps.compute.outputs.postgresql_qc_gz_diff }} | - | Mysql | ${{ steps.compute.outputs.mysql_qc_pr }} | ${{ steps.compute.outputs.mysql_qc_base }} | ${{ steps.compute.outputs.mysql_qc_diff }} | - | Mysql (gzip) | ${{ steps.compute.outputs.mysql_qc_gz_pr }} | ${{ steps.compute.outputs.mysql_qc_gz_base }} | ${{ steps.compute.outputs.mysql_qc_gz_diff }} | - | Sqlite | ${{ steps.compute.outputs.sqlite_qc_pr }} | ${{ steps.compute.outputs.sqlite_qc_base }} | ${{ steps.compute.outputs.sqlite_qc_diff }} | - | Sqlite (gzip) | ${{ steps.compute.outputs.sqlite_qc_gz_pr }} | ${{ steps.compute.outputs.sqlite_qc_gz_base }} | ${{ steps.compute.outputs.sqlite_qc_gz_diff }} | - | SQL Server | ${{ steps.compute.outputs.sqlserver_qc_pr }} | ${{ steps.compute.outputs.sqlserver_qc_base }} | ${{ steps.compute.outputs.sqlserver_qc_diff }} | - | SQL Server (gzip) | ${{ steps.compute.outputs.sqlserver_qc_gz_pr }} | ${{ steps.compute.outputs.sqlserver_qc_gz_base }} | ${{ steps.compute.outputs.sqlserver_qc_gz_diff }} | - | CockroachDB | ${{ steps.compute.outputs.cockroachdb_qc_pr }} | ${{ steps.compute.outputs.cockroachdb_qc_base }} | ${{ steps.compute.outputs.cockroachdb_qc_diff }} | - | CockroachDB (gzip) | ${{ steps.compute.outputs.cockroachdb_qc_gz_pr }} | ${{ steps.compute.outputs.cockroachdb_qc_gz_base }} | ${{ steps.compute.outputs.cockroachdb_qc_gz_diff }} | + ### Wasm Query Compiler File Size + + | Engine | This PR | Base branch | Diff | + |------------------------------------|---------------------------------------------------------|-----------------------------------------------------------|-----------------------------------------------------------| + | Postgres | ${{ steps.compute.outputs.postgresql_fast_qc_pr }} | ${{ steps.compute.outputs.postgresql_fast_qc_base }} | ${{ steps.compute.outputs.postgresql_fast_qc_diff }} | + | Postgres (gzip) | ${{ steps.compute.outputs.postgresql_fast_qc_gz_pr }} | ${{ steps.compute.outputs.postgresql_fast_qc_gz_base }} | ${{ steps.compute.outputs.postgresql_fast_qc_gz_diff }} | + | Postgres (size-optimized) | ${{ steps.compute.outputs.postgresql_small_qc_pr }} | ${{ steps.compute.outputs.postgresql_small_qc_base }} | ${{ steps.compute.outputs.postgresql_small_qc_diff }} | + | Postgres (size-optimized, gzip) | ${{ steps.compute.outputs.postgresql_small_qc_gz_pr }} | ${{ steps.compute.outputs.postgresql_small_qc_gz_base }} | ${{ steps.compute.outputs.postgresql_small_qc_gz_diff }} | + | Mysql | ${{ steps.compute.outputs.mysql_fast_qc_pr }} | ${{ steps.compute.outputs.mysql_fast_qc_base }} | ${{ steps.compute.outputs.mysql_fast_qc_diff }} | + | Mysql (gzip) | ${{ steps.compute.outputs.mysql_fast_qc_gz_pr }} | ${{ steps.compute.outputs.mysql_fast_qc_gz_base }} | ${{ steps.compute.outputs.mysql_fast_qc_gz_diff }} | + | Mysql (size-optimized) | ${{ steps.compute.outputs.mysql_small_qc_pr }} | ${{ steps.compute.outputs.mysql_small_qc_base }} | ${{ steps.compute.outputs.mysql_small_qc_diff }} | + | Mysql (size-optimized, gzip) | ${{ steps.compute.outputs.mysql_small_qc_gz_pr }} | ${{ steps.compute.outputs.mysql_small_qc_gz_base }} | ${{ steps.compute.outputs.mysql_small_qc_gz_diff }} | + | Sqlite | ${{ steps.compute.outputs.sqlite_fast_qc_pr }} | ${{ steps.compute.outputs.sqlite_fast_qc_base }} | ${{ steps.compute.outputs.sqlite_fast_qc_diff }} | + | Sqlite (gzip) | ${{ steps.compute.outputs.sqlite_fast_qc_gz_pr }} | ${{ steps.compute.outputs.sqlite_fast_qc_gz_base }} | ${{ steps.compute.outputs.sqlite_fast_qc_gz_diff }} | + | Sqlite (size-optimized) | ${{ steps.compute.outputs.sqlite_small_qc_pr }} | ${{ steps.compute.outputs.sqlite_small_qc_base }} | ${{ steps.compute.outputs.sqlite_small_qc_diff }} | + | Sqlite (size-optimized, gzip) | ${{ steps.compute.outputs.sqlite_small_qc_gz_pr }} | ${{ steps.compute.outputs.sqlite_small_qc_gz_base }} | ${{ steps.compute.outputs.sqlite_small_qc_gz_diff }} | + | SQL Server | ${{ steps.compute.outputs.sqlserver_fast_qc_pr }} | ${{ steps.compute.outputs.sqlserver_fast_qc_base }} | ${{ steps.compute.outputs.sqlserver_fast_qc_diff }} | + | SQL Server (gzip) | ${{ steps.compute.outputs.sqlserver_fast_qc_gz_pr }} | ${{ steps.compute.outputs.sqlserver_fast_qc_gz_base }} | ${{ steps.compute.outputs.sqlserver_fast_qc_gz_diff }} | + | SQL Server (size-optimized) | ${{ steps.compute.outputs.sqlserver_small_qc_pr }} | ${{ steps.compute.outputs.sqlserver_small_qc_base }} | ${{ steps.compute.outputs.sqlserver_small_qc_diff }} | + | SQL Server (size-optimized, gzip) | ${{ steps.compute.outputs.sqlserver_small_qc_gz_pr }} | ${{ steps.compute.outputs.sqlserver_small_qc_gz_base }} | ${{ steps.compute.outputs.sqlserver_small_qc_gz_diff }} | + | CockroachDB | ${{ steps.compute.outputs.cockroachdb_fast_qc_pr }} | ${{ steps.compute.outputs.cockroachdb_fast_qc_base }} | ${{ steps.compute.outputs.cockroachdb_fast_qc_diff }} | + | CockroachDB (gzip) | ${{ steps.compute.outputs.cockroachdb_fast_qc_gz_pr }} | ${{ steps.compute.outputs.cockroachdb_fast_qc_gz_base }} | ${{ steps.compute.outputs.cockroachdb_fast_qc_gz_diff }} | + | CockroachDB (size-optimized) | ${{ steps.compute.outputs.cockroachdb_small_qc_pr }} | ${{ steps.compute.outputs.cockroachdb_small_qc_base }} | ${{ steps.compute.outputs.cockroachdb_small_qc_diff }} | + | CockroachDB (size-optimized, gzip) | ${{ steps.compute.outputs.cockroachdb_small_qc_gz_pr }} | ${{ steps.compute.outputs.cockroachdb_small_qc_gz_base }} | ${{ steps.compute.outputs.cockroachdb_small_qc_gz_diff }} | edit-mode: replace From b6d36b2a70e9e17b2058a81ef2917daa5e93c538 Mon Sep 17 00:00:00 2001 From: Eti Ijeoma Date: Mon, 26 Jan 2026 15:32:50 +0100 Subject: [PATCH 9/9] remove ignore enum from neggative test --- psl/psl/tests/attributes/ignore_negative.rs | 21 --- .../create_post_empty.expected.json | 153 +++--------------- 2 files changed, 26 insertions(+), 148 deletions(-) diff --git a/psl/psl/tests/attributes/ignore_negative.rs b/psl/psl/tests/attributes/ignore_negative.rs index c02ce0a64612..a560c103836b 100644 --- a/psl/psl/tests/attributes/ignore_negative.rs +++ b/psl/psl/tests/attributes/ignore_negative.rs @@ -236,24 +236,3 @@ fn disallow_ignore_on_ignored_model() { expectation.assert_eq(&error) } - -// #[test] -// fn disallow_ignore_on_ignored_enum_value() { - -// let dml = indoc! {r#" -// enum SupportedCarType { -// COUPE @ignore -// } -// "#}; - -// let error = parse_unwrap_err(dml); -// let expectation = expect![[r#" -// error: Error parsing attribute "@ignore": Enum values on an already ignored Enum do not need an `@ignore` annotation. -// --> schema.prisma:2 -//  |  -//  1 |  enum SupportedCarType { -//  2 |  COUPE @ignore -//  |  -// "#]]; -// expectation.assert_eq(&error); -// } diff --git a/query-compiler/core-tests/tests/query_validation_tests/create_post_empty.expected.json b/query-compiler/core-tests/tests/query_validation_tests/create_post_empty.expected.json index d75329db10dc..abae2b6ec8ee 100644 --- a/query-compiler/core-tests/tests/query_validation_tests/create_post_empty.expected.json +++ b/query-compiler/core-tests/tests/query_validation_tests/create_post_empty.expected.json @@ -1,143 +1,42 @@ { "is_panic": false, - "message": "`data`: A value is required but not set", + "message": "Unable to match input value to any allowed input type for the field. Parse errors: [`data.published`: A value is required but not set, `data.published`: A value is required but not set]", "meta": { - "kind": "RequiredArgumentMissing", - "inputTypes": [ + "kind": "Union", + "errors": [ { - "kind": "object", - "name": "PostCreateInput", - "fields": [ + "kind": "RequiredArgumentMissing", + "inputTypes": [ { - "name": "id", - "typeNames": [ - "String" - ], - "required": false - }, - { - "name": "createdAt", - "typeNames": [ - "DateTime" - ], - "required": false - }, - { - "name": "updatedAt", - "typeNames": [ - "DateTime" - ], - "required": false - }, - { - "name": "published", - "typeNames": [ - "Boolean" - ], - "required": true - }, - { - "name": "title", - "typeNames": [ - "String" - ], - "required": true - }, - { - "name": "content", - "typeNames": [ - "String", - "Null" - ], - "required": false - }, - { - "name": "author", - "typeNames": [ - "UserCreateNestedOneWithoutPostsInput" - ], - "required": false - }, - { - "name": "Like", - "typeNames": [ - "LikeCreateNestedManyWithoutPostInput" - ], - "required": false + "kind": "scalar", + "name": "Boolean" } + ], + "argumentPath": [ + "data", + "published" + ], + "selectionPath": [ + "createOnePost" ] }, { - "kind": "object", - "name": "PostUncheckedCreateInput", - "fields": [ - { - "name": "id", - "typeNames": [ - "String" - ], - "required": false - }, - { - "name": "createdAt", - "typeNames": [ - "DateTime" - ], - "required": false - }, - { - "name": "updatedAt", - "typeNames": [ - "DateTime" - ], - "required": false - }, - { - "name": "published", - "typeNames": [ - "Boolean" - ], - "required": true - }, - { - "name": "title", - "typeNames": [ - "String" - ], - "required": true - }, - { - "name": "content", - "typeNames": [ - "String", - "Null" - ], - "required": false - }, - { - "name": "authorId", - "typeNames": [ - "String", - "Null" - ], - "required": false - }, + "kind": "RequiredArgumentMissing", + "inputTypes": [ { - "name": "Like", - "typeNames": [ - "LikeUncheckedCreateNestedManyWithoutPostInput" - ], - "required": false + "kind": "scalar", + "name": "Boolean" } + ], + "argumentPath": [ + "data", + "published" + ], + "selectionPath": [ + "createOnePost" ] } - ], - "argumentPath": [ - "data" - ], - "selectionPath": [ - "createOnePost" ] }, - "error_code": "P2012" + "error_code": "P2009" } \ No newline at end of file