Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix(quaint/DA): handle JSON parsing engines side so that we can correctly handle i64s #4883

Merged
merged 9 commits into from
May 24, 2024
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
Copy link
Member

Choose a reason for hiding this comment

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

Note for posteriority: temprarily disabled, as we can't run benchmarks against older version of WASM engine without using driver adapters too: https://github.com/prisma/team-orm/issues/1152

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
Loading