tursodatabase / tursodatabase/libsql-js

Statement.run() with object parameter panics

Open
#114 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug good first issue help wanted
Dominant language
JavaScript
Stars
335
Forks
48
Avg merge
3d 2h
Merged PRs (30d)
3

Description

The following additional test case that calls Statement.run() with an object (not array) parameter:

diff --git a/integration-tests/tests/sync.test.js b/integration-tests/tests/sync.test.js
index 06d96b8..327010a 100644
--- a/integration-tests/tests/sync.test.js
+++ b/integration-tests/tests/sync.test.js
@@ -48,6 +48,9 @@ test.serial("Statement.run() [positional]", async (t) => {
   const info = stmt.run(["Carol", "carol@example.net"]);
   t.is(info.changes, 1);
   t.is(info.lastInsertRowid, 3);
+  const info2 = stmt.run("Dave", "dave@example.org");
+  t.is(info2.changes, 1);
+  t.is(info2.lastInsertRowid, 4);
 });

Panics:

thread '<unnamed>' panicked at src/statement.rs:345:62:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
sh: line 1: 96349 Abort trap: 6           LIBSQL_JS_DEV=1 PROVIDER=libsql ava tests/sync.test.js

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the additional case in integration-tests/tests/sync.test.js and reproduce the panic from Statement.run(). Inspect src/statement.rs around line 345 to trace the failing parameter handling. Done means the object or positional-parameter case no longer panics and the added changes and lastInsertRowid assertions pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, rust
Domain
api, database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
57/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.