Skip to content

Commit

Permalink
Restore #4883 (#4891)
Browse files Browse the repository at this point in the history
* One half of the fix for: prisma/prisma#23926
* Unexcludes pg, neon, and PS for the through_relations::common_types test

* Instead of receiving pre-handled JSON by DAs, we now expect strings and will perform JSON parsing in Quaint.
* Removed special handling for "$__prisma_null" due to the aforementioned

* Temporarily disable wasm-benchmarks due to breaking change in engines <-> DA contract. To be re-enabled and re-evaluated in a follow-up PR per convo with @SevInf

---------

Co-authored-by: Sophie <29753584+Druue@users.noreply.github.com>
  • Loading branch information
Serhii Tatarintsev and Druue authored May 29, 2024
1 parent bca2d36 commit 64bb6b9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/wasm-benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:

- name: Run benchmarks
id: bench
if: false
run: |
make run-bench | tee results.txt
Expand Down Expand Up @@ -122,6 +123,7 @@ jobs:
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Find past report comment
if: false
uses: peter-evans/find-comment@v3
id: findReportComment
with:
Expand All @@ -132,7 +134,9 @@ jobs:
uses: peter-evans/create-or-update-comment@v4
# Only run on branches from our repository
# It avoids an expected failure on forks
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
# if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
if: false

with:
comment-id: ${{ steps.findReportComment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
Expand All @@ -152,7 +156,8 @@ jobs:
edit-mode: replace

- name: Fail workflow if regression detected
if: steps.bench.outputs.status == 'failed'
# if: steps.bench.outputs.status == 'failed'
if: false
run: |
echo "Workflow failed due to benchmark regression."
exit 1
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,7 @@ mod scalar_relations {
schema.to_owned()
}

// TODO: fix https://github.com/prisma/team-orm/issues/684 and unexclude DAs.
// On napi, this currently fails with "P2023":
// `Inconsistent column data: Unexpected conversion failure for field Child.bInt from Number(14324324234324.0) to BigInt`.
#[connector_test(
schema(schema_common),
exclude(Postgres("pg.js", "neon.js"), Vitess("planetscale.js"))
)]
#[connector_test(schema(schema_common))]
async fn common_types(runner: Runner) -> TestResult<()> {
create_common_children(&runner).await?;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ fn coerce_json_relation_to_pv(value: serde_json::Value, rs: &RelationSelection)

Ok(PrismaValue::Object(map))
}
serde_json::Value::String(s) => {
let v = serde_json::from_str(&s)?;

coerce_json_relation_to_pv(v, rs)
}
x => unreachable!("Unexpected value when deserializing JSON relation data: {x:?}"),
}
}
Expand Down
5 changes: 3 additions & 2 deletions query-engine/driver-adapters/src/conversion/js_to_quaint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,9 @@ pub fn js_value_to_quaint(
match json_value {
// DbNull
serde_json::Value::Null => Ok(QuaintValue::null_json()),
// JsonNull
serde_json::Value::String(s) if s == "$__prisma_null" => Ok(QuaintValue::json(serde_json::Value::Null)),
serde_json::Value::String(s) => serde_json::from_str(&s)
.map_err(|_| conversion_error!("Failed to parse incoming json from a driver adapter"))
.map(QuaintValue::json),
json => Ok(QuaintValue::json(json)),
}
}
Expand Down

0 comments on commit 64bb6b9

Please sign in to comment.