Skip to content

Conversation

@franklinfollis
Copy link

@franklinfollis franklinfollis commented Nov 25, 2025

What does this PR do?

Fixes incorrect documentation for the .run() method return value in the bun:sqlite type definitions, as well as the SQLite docs.

Both Database.run() and Statement.run() return a Changes object with changes and lastInsertRowid properties, not undefined or a Database instance as previously documented.

How did you verify your code works?

This is simply a docs update, no changes to the bun runtime have been made.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 25, 2025

Walkthrough

Documentation and JSDoc updates: Database.run() and Statement.run() are described as returning a Changes object (containing lastInsertRowid and changes) instead of undefined; examples and minor formatting edits were applied.

Changes

Cohort / File(s) Summary
SQLite Runtime Documentation
docs/runtime/sqlite.mdx
Updated Database.run() description and example output to show it returns execution metadata (lastInsertRowid, changes) and adjusted narrative about stepping through rows.
Type Declarations / JSDoc (sqlite)
packages/bun-types/sqlite.d.ts
Revised JSDoc for Database.run and Statement.run to document return of a Changes object; replaced examples that previously showed undefined with examples showing the Changes payload. No public signatures changed.
Type Declarations (wasm) — formatting
packages/bun-types/wasm.d.ts
Reformatted GlobalDescriptor extends clause by inserting a line break in the extends path. No semantic or signature changes.
Tests — formatting
test/js/node/util/node-inspect-tests/parallel/util-inspect.test.js
Minor indentation/formatting adjustment in a test line (no logic changes).

Suggested reviewers

  • alii

Pre-merge checks

✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: fixing documentation for the .run() method's return value in SQLite, which aligns with the PR's primary objective.
Description check ✅ Passed The description covers both required template sections with clear explanations of what was fixed and verification that it's a documentation-only update.

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between dbad3cc and 56f5e72.

📒 Files selected for processing (2)
  • packages/bun-types/wasm.d.ts (1 hunks)
  • test/js/node/util/node-inspect-tests/parallel/util-inspect.test.js (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
test/**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/writing-tests.mdc)

test/**/*.{js,ts,jsx,tsx}: Write tests as JavaScript and TypeScript files using Jest-style APIs (test, describe, expect) and import from bun:test
Use test.each and data-driven tests to reduce boilerplate when testing multiple similar cases

Files:

  • test/js/node/util/node-inspect-tests/parallel/util-inspect.test.js
test/**/*.test.{ts,js,jsx,tsx,mjs,cjs}

📄 CodeRabbit inference engine (test/CLAUDE.md)

test/**/*.test.{ts,js,jsx,tsx,mjs,cjs}: Use bun:test with files that end in *.test.{ts,js,jsx,tsx,mjs,cjs}
Do not write flaky tests. Never wait for time to pass in tests; always wait for the condition to be met instead of using an arbitrary amount of time
Never use hardcoded port numbers in tests. Always use port: 0 to get a random port
Prefer concurrent tests over sequential tests using test.concurrent or describe.concurrent when multiple tests spawn processes or write files, unless it's very difficult to make them concurrent
When spawning Bun processes in tests, use bunExe and bunEnv from harness to ensure the same build of Bun is used and debug logging is silenced
Use -e flag for single-file tests when spawning Bun processes
Use tempDir() from harness to create temporary directories with files for multi-file tests instead of creating files manually
Prefer async/await over callbacks in tests
When callbacks must be used and it's just a single callback, use Promise.withResolvers to create a promise that can be resolved or rejected from a callback
Do not set a timeout on tests. Bun already has timeouts
Use Buffer.alloc(count, fill).toString() instead of 'A'.repeat(count) to create repetitive strings in tests, as ''.repeat is very slow in debug JavaScriptCore builds
Use describe blocks for grouping related tests
Always use await using or using to ensure proper resource cleanup in tests for APIs like Bun.listen, Bun.connect, Bun.spawn, Bun.serve, etc
Always check exit codes and test error scenarios in error tests
Use describe.each() for parameterized tests
Use toMatchSnapshot() for snapshot testing
Use beforeAll(), afterEach(), beforeEach() for setup/teardown in tests
Track resources (servers, clients) in arrays for cleanup in afterEach()

Files:

  • test/js/node/util/node-inspect-tests/parallel/util-inspect.test.js
🧠 Learnings (9)
📓 Common learnings
Learnt from: cirospaciari
Repo: oven-sh/bun PR: 22946
File: test/js/sql/sql.test.ts:195-202
Timestamp: 2025-09-25T22:07:13.851Z
Learning: PR oven-sh/bun#22946: JSON/JSONB result parsing updates (e.g., returning parsed arrays instead of legacy strings) are out of scope for this PR; tests keep current expectations with a TODO. Handle parsing fixes in a separate PR.
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Applies to src/bun.js/bindings/v8/test/v8/v8.test.ts : Add corresponding test cases to test/v8/v8.test.ts using checkSameOutput() function to compare Node.js and Bun output

Applied to files:

  • test/js/node/util/node-inspect-tests/parallel/util-inspect.test.js
📚 Learning: 2025-11-24T18:36:33.069Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:33.069Z
Learning: Applies to test/js/node/**/*.test.{ts,tsx} : For Node.js compatibility tests, use the `test/js/node/` directory

Applied to files:

  • test/js/node/util/node-inspect-tests/parallel/util-inspect.test.js
📚 Learning: 2025-11-24T18:36:59.706Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:59.706Z
Learning: Ensure V8 API tests compare identical C++ code output between Node.js and Bun through the test suite validation process

Applied to files:

  • test/js/node/util/node-inspect-tests/parallel/util-inspect.test.js
📚 Learning: 2025-11-24T18:35:50.422Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/writing-tests.mdc:0-0
Timestamp: 2025-11-24T18:35:50.422Z
Learning: Applies to test/**/*.{js,ts,jsx,tsx} : Use `test.each` and data-driven tests to reduce boilerplate when testing multiple similar cases

Applied to files:

  • test/js/node/util/node-inspect-tests/parallel/util-inspect.test.js
📚 Learning: 2025-11-24T18:36:33.069Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-24T18:36:33.069Z
Learning: Applies to src/bun.js/bindings/**/*.cpp : When implementing JavaScript classes in C++, define properties using HashTableValue arrays and add iso subspaces for classes with C++ fields, caching structures in ZigGlobalObject

Applied to files:

  • packages/bun-types/wasm.d.ts
📚 Learning: 2025-11-24T18:37:47.899Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: src/bun.js/bindings/v8/AGENTS.md:0-0
Timestamp: 2025-11-24T18:37:47.899Z
Learning: Applies to src/bun.js/bindings/v8/**/<UNKNOWN> : <UNKNOWN>

Applied to files:

  • packages/bun-types/wasm.d.ts
📚 Learning: 2025-11-24T18:35:39.205Z
Learnt from: CR
Repo: oven-sh/bun PR: 0
File: .cursor/rules/registering-bun-modules.mdc:0-0
Timestamp: 2025-11-24T18:35:39.205Z
Learning: Applies to src/bun.js/api/BunObject.zig : Implement getter functions in `src/bun.js/api/BunObject.zig` that return your feature, and export them in the `exportAll()` function

Applied to files:

  • packages/bun-types/wasm.d.ts
📚 Learning: 2025-10-03T18:29:20.173Z
Learnt from: alii
Repo: oven-sh/bun PR: 22504
File: src/bake/client/data-view.ts:4-4
Timestamp: 2025-10-03T18:29:20.173Z
Learning: In the Bun codebase, DataView<ArrayBuffer> is valid TypeScript syntax (supported since TypeScript 4.5+) and is used consistently across the bake client modules to provide type narrowing for DataView instances backed specifically by ArrayBuffer rather than SharedArrayBuffer.

Applied to files:

  • packages/bun-types/wasm.d.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants