Skip to content

chore: Coordinate the review of the open pull requests - #829

Closed
krlmlr wants to merge 1 commit into
mainfrom
claude/lucid-allen-vz64mu
Closed

krlmlr wants to merge 1 commit into
mainfrom
claude/lucid-allen-vz64mu

Conversation

@krlmlr

@krlmlr krlmlr commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

This pull request carries no code, only an empty commit. It records the review of every open pull request in this repository: the state of each one, and the questions for the maintainer, each posted as its own comment below. It is closed once the open pull requests are resolved.

Reviews run on Opus from 2026-11-10 15:45 UTC on, as the maintainer asked; the earlier ones ran on Fable.

Arrow rework (current)

On 2026-11-12 the maintainer asked to rework the Arrow stack below from scratch into scoped, human-reviewable pull requests, starting with the less controversial changes; the plan lists 23 of them. The work moved to a fresh session on 2026-11-12, as asked; the handover comment has the state, the next steps and the open questions.

Arrow stack (superseded by the rework)

Each pull request of the stack was reviewed by a clean-context agent on 2026-09-27, then fixed and re-reviewed layer by layer, and merged bottom up so that every branch contains the final version of the one below. All review threads are answered and resolved, and every description is current. Two integration reviews of the whole stack at its top are posted below. The first (071560e) found one Medium and nine Low findings. The second (d451398) found one High, R's ISNAN() called on arrow's worker threads, and two Medium ones, the busy mark during arrow's read-ahead and a deferred release that kept a result locked. All are fixed in #795 up to 68a0575 and merged up the stack; AddressSanitizer is clean, and an interposer counts no R call off R's main thread. No further review round is planned for the stack. Every layer has a current "Accepted limitations" comment.

CI runs on every layer of the stack and is green on the newest heads, after the runners' network failure from about 14:00 to 17:00 UTC on 2026-11-11 (see #832).

Other pull requests by the maintainer

main was merged into each of them on 2026-11-10, so that CI runs on a current head.

After #788 and #820 were merged, every open branch still merges cleanly with main.

Every issue opened along the way has a reproducer, as the maintainer asked on 2026-11-11: #834, #835, #837, #838, #848 and r-dbi/DBI#773 with a reprex, #836 with the experiment record of #849. Every test_that() block that the open pull requests add or change runs on its own right after load_all(), with shared fixtures in tests/testthat/helper-*.R. On the Arrow stack, the move went into tests/testthat/helper-arrow.R and was merged up every layer; the top differs from its earlier head only in test files, and its tests pass as before. Test files on main that still define fixtures at the top level are left to a separate change.

External and stale pull requests

Found along the way

https://claude.ai/code/session_01Hr1rd3gjmufoKCWVDBPCgE


Generated by Claude Code

An empty commit that anchors the coordination pull request,
which records the state, the questions, and the decisions of the review.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Hr1rd3gjmufoKCWVDBPCgE

krlmlr commented Nov 10, 2026 •

Copy link
Copy Markdown
Member Author

Resolved: close the stale pull requests #437 and #465?

#437 (2022) is a work in progress generated by use_dbitest() for r-dbi/DBItest#267. #465 (2023) investigates a crash on a base from before cpp11 that showed only on macOS arm64. Neither has seen activity since May 2024, and both would need a full rebase to be of use.


Generated by Claude Code

krlmlr commented Nov 10, 2026 •

Copy link
Copy Markdown
Member Author

Moved: close #704?

Moved to #880: #880 (comment). Please answer there.

It edits the generated README.md instead of README.Rmd, cuts off the closing </pre> of the example above it, and describes an "Import Data" screen and an "import" button that RSQLite does not have. RSQLite imports a CSV file with dbWriteTable(con, "name", "file.csv"). A comment there notifies the contributor.

  • Close it with a short thank-you that points to README.Rmd and to dbWriteTable() with a file name (recommended)
  • Close it without a comment
  • Keep it open and ask for changes

Generated by Claude Code

krlmlr commented Nov 10, 2026

Copy link
Copy Markdown
Member Author

Review of #759, held here

Nothing has been posted on #759. The review below is for the maintainer to decide on; see the question that follows.

Review of #759 at 80c45ae, by a Claude Code reviewer with clean context that read the diff and checked it against the code on main, without running the fork's code, and posted nothing itself.

Medium

1. The new dbname text presents the explicit URI as sufficient on its own, but the http VFS is not registered until something calls initExtension(con, "http"), so the documented call fails in a fresh session even on a libcurl build. By reading: nothing on main registers the VFS at load time; registration happens only in sqlite3_http_init() (src/vendor/extensions/http.c:542-548 on main), which is reached through initExtension(db, "http") (R/initExtension.R), and dbConnect() calls initExtension(conn) only with the default "math" extension and only after the connection is already open (R/dbConnect_SQLiteDriver.R:141-143 on main). sqliteHasHttpVFS() registers it as a side effect on a throwaway in-memory connection (R/SQLite.R:82-105 on main), and sqliteRemote() does the same (R/httpvfs.R:35-40). So the if (sqliteHasHttpVFS()) guard in the README examples is load-bearing and those examples are correct, but R/dbConnect_SQLiteDriver.R:15-19 and man/SQLite.Rd:58-62 say only "if the optional HTTP VFS is available", and a reader who copies the URI and flags = SQLITE_RO from the help page into a new session gets Could not connect to database: no such vfs: http. Suggested fix: say in the dbname item that the VFS must first be registered in the session by calling sqliteHasHttpVFS() (or initExtension(con, "http") on any connection), and add half a sentence to README.Rmd:65-66 that the sqliteHasHttpVFS() call is what makes the explicit form work.

Low

2. The list is still introduced with "There are two exceptions:" but now has three items, and the third is not a special dbname value in the sense of the first two. R/dbConnect_SQLiteDriver.R:8 and man/SQLite.Rd:51. Suggested fix: move the remote-database sentence out of the list into its own paragraph after it, or reword the lead-in.

3. The PR rewraps two existing list items it does not otherwise change, and wraps the new prose mid-sentence, against the one-sentence-per-line style of both files. R/dbConnect_SQLiteDriver.R:11-14 (mirrored in man/SQLite.Rd:54-57), README.Rmd:55-56 and README.Rmd:65-66. Suggested fix: restore the two original items verbatim, put each new sentence on its own line, then regenerate.

4. The new text does not say what a user sees when the package was built without libcurl. Without libcurl, sqliteHasHttpVFS() returns FALSE so both guarded README examples silently do nothing, sqliteRemote() stops with HTTP VFS not available in this build (R/httpvfs.R:41-43), and the explicit form stops with no such vfs: http. Suggested fix: one sentence naming these outcomes, pointing to sqliteHttpVfsCompiled(), and saying that libcurl development files must be present when installing from source.

5. The README examples call dbDisconnect() and dbConnect() unqualified before the README attaches DBI, and mix RSQLite::SQLite() with unqualified SQLITE_RO and sqliteHasHttpVFS(). README.Rmd:61, README.Rmd:70-75; library(DBI) first appears at README.Rmd:85. Suggested fix: qualify consistently, or start each block with library(DBI) and library(RSQLite).

The format-suggest failure

The failure did not come from this PR, and it is already gone. The failed run was on the first commit (2026-09-25): under pull_request_target the workflow is taken from main, which then still pointed at a local style action that had been removed from the repository, so the job failed for every fork PR before any formatter ran. main fixed it on 2026-09-26 by switching to the central style action, and format-suggest on the current head 80c45ae succeeded on 2026-10-20 with no suggestions. No action is needed from the contributor.

Checked and found sound

  • sqliteRemote() and sqliteHasHttpVFS() exist and are exported; the README call sqliteRemote("https://example.org/db.sqlite") is valid.
  • The URI file:https://example.org/db.sqlite?vfs=http&immutable=1 is exactly what sqliteRemote() builds, the file: prefix is required, and flags = SQLITE_RO matches what sqliteRemote() passes.
  • "Read-only", "optional" and "when built with libcurl" agree with configure, src/Makevars and the VFS source.
  • man/SQLite.Rd corresponds to the roxygen source; README.md and index.md look rendered from README.Rmd, not hand-edited (not re-rendered to confirm byte equality).
  • The PR answers the question in Connect to remote sqlite database #505; the issue's bare-URL form still does not work, and a sentence saying so would close the loop.

Recommendation of the reviewer: merge after small changes, with finding 1 fixed before merging.


Generated by Claude Code

krlmlr commented Nov 10, 2026 •

Copy link
Copy Markdown
Member Author

Moved: how to proceed with #759?

Moved to #880: #880 (comment). Please answer there.

The review of #759 is in the comment above. Its one Medium finding is that the help page presents the explicit file:https://…?vfs=http form as working on its own, while the http VFS is registered only once something has called sqliteHasHttpVFS() or initExtension(con, "http") in the session. The format-suggest failure the contributor asked about came from main at the time and has passed on the current head since 2026-10-20. Any option that posts on #759 notifies the contributor.


Generated by Claude Code

krlmlr commented Nov 10, 2026 •

Copy link
Copy Markdown
Member Author

Resolved: close #806 as a no-op?

The clean review of #806 found that main already carries the identical change: the README re-render step in CI added the same four links in ccfe516 on 28 September, so after the merge of main the PR has no diff left (changed_files: 0).

  • Close it, with a one-line comment naming ccfe516 (recommended)
  • Keep it open

Done: closed with a comment.


Generated by Claude Code

krlmlr commented Nov 10, 2026 •

Copy link
Copy Markdown
Member Author

Resolved: where should the draft #791 go?

The clean review of #791 has one High finding (the new step is not continue-on-error, so any failure to fetch or patch roxygen2 skips R CMD check, coverage and pkgdown for every run) and four Medium ones (a mutable branch of a personal fork runs with a write token, upstream is taken at its tip within a 50-commit window, a DESCRIPTION conflict, and the step sits in the fleet-synced workflow instead of custom/after-install). The High finding and the conflict are being fixed now either way, together with pinning both refs and moving the call to the hook. The PR targets #788's branch, so CI does not run on it; nothing in it depends on #788.

  • Retarget it to main so CI exercises the patched install, and mark it ready for review once green (recommended)
  • Keep it a draft stacked on docs: State the goals and non-goals #788
  • Close it and stay with stock roxygen2

Done: closed with a comment; the branch claude/roxygen2-fork keeps the work at 5a0cb42.


Generated by Claude Code

krlmlr commented Nov 10, 2026 •

Copy link
Copy Markdown
Member Author

Resolved: fix the HTTP VFS integration tests on main?

The three tests in tests/testthat/test-httpvfs.R that start a local httpuv server (lines 39, 109, 162) fail on every CI run, main included, with "Could not connect to database: unable to open database file". CI stays green only because each test's cleanup records an "Already disconnected" warning after the error, and testthat counts a test as failed only when its last result is an error; the summary line in the logs does read [ FAIL 3 | ... ]. The likely cause: the tests open http://127.0.0.1:<port>/db.sqlite?vfs=http&immutable=1, and SQLite reads vfs= only from file: URIs, so the default VFS treats the URL as a file name. Adding the file: prefix reaches the http VFS, which then issues requests, but dbConnect() still fails, with "Failed to load extension:", so more is wrong than the prefix. This came up while fixing CI on #795 and is not caused by any open pull request.

  • Fix the tests (and whatever the VFS path needs) in a separate pull request from main, and make them fail loudly when they error (recommended)
  • Only make the masked failure visible for now, and leave the fix for later
  • Leave it as it is

Done in #832.


Generated by Claude Code

krlmlr commented Nov 10, 2026 •

Copy link
Copy Markdown
Member Author

Moved: move rsqlite_is_utf8_string() out of the header?

Moved to #880: #880 (comment). Please answer there.

Asked on #799: the UTF-8 validator is defined inline in a new src/utf8.h, which #799 and #795 both add, byte for byte the same. It does not need to be in a header; that only lets the two pull requests merge cleanly in either order. The reasoning is in the answer on #799.

Update 2026-11-11: #799 is being reimplemented from main as a stack, as asked there, and its first pull request, the UTF-8 infrastructure, defines the validator in a new src/utf8.cpp with only the declaration in utf8.h, as recommended above. When the Arrow stack switches to it is a new question.


Generated by Claude Code

krlmlr commented Nov 10, 2026 •

Copy link
Copy Markdown
Member Author

Resolved: fix the SQL text used as a warning format on main?

The review of #799 found that cpp11::warning() treats its message as a printf format, so a column name with % in it produces garbage or undefined behavior in the mixed-type warning; #799's fixes now cover both warnings in src/DbColumn.cpp. The same defect is on main in src/SqliteResultImpl.cpp#L94: "Ignoring remaining part of query: " is followed by the user's remaining SQL text, so dbGetQuery(con, "SELECT 1; SELECT '%n'") hands %n to R's printf. Confirmed by running it: dbGetQuery(con, "SELECT 1; SELECT '%d%d'") warns "Ignoring remaining part of query: SELECT '5627106080'" (cpp11's warning() passes the string as the format unless CPP11_USE_FMT is set).

The review of #830 found a second instance on main: raise_sqlite_exception() passes sqlite3_errmsg() to cpp11::stop() as the format, so dbGetQuery(con, 'SELECT * FROM "x%d%d%x"') fails with "no such table: x15669257920d8293280" (confirmed). #795 replaces that call with a std::runtime_error, so the stack fixes this one once it is merged; the separate pull request would fix both on main now.

The second review of #799 found that this is a crash, not only garbage: dbGetQuery(con, 'SELECT * FROM "x%n"') and dbGetQuery(con, "SELECT 1; SELECT '%n'") abort R with *** %n in writable segment detected *** on main (confirmed), so a mistyped table name is enough. It also found that fetch_blob() passes a NULL pointer from sqlite3_column_blob() to memcpy() (SELECT X'' AS x is undefined behavior, and a zeroblob() that runs out of memory segfaults, confirmed). The column-name variant of the crash is already fixed in #799.

  • Fix both format strings and fetch_blob() in a small separate pull request from main, with tests (recommended)
  • Fold it into the pull request for the error state of results, which also edits src/SqliteResultImpl.cpp
  • Leave it

Update 2026-11-11: #799 is being reimplemented from main, as asked there, and its fix of the two column warnings in src/DbColumn.cpp is not carried over, since it is a separate concern. The separate pull request recommended here would therefore fix the column warnings as well.


Generated by Claude Code

krlmlr commented Nov 10, 2026

Copy link
Copy Markdown
Member Author

Integration review of the Arrow stack at 071560e (#795 → #796 → #800 → #801 → #802 → #807), by a Claude Code reviewer with clean context that read the six PR descriptions, the earlier review comments, ?"sqlite-arrow" and the whole diff against main, ran R CMD check, the test suite and randomized comparisons under AddressSanitizer, compared the default path with main at 07129ce, and posted nothing itself. Line numbers refer to that commit. "Confirmed" means reproduced by running code.

Findings

Medium

1. With arrow = TRUE, dbColumnInfo() still runs the default path's peek, so it contradicts the data frames, ignores ptype, and changes what the next fetch returns (#796, ptype part #802). Confirmed. R/dbColumnInfo_SQLiteResult.R:4 calls result_column_info(), which goes through SqliteResultImpl::get_column_info() and peek_first_row() (src/SqliteResultImpl.cpp:211-213, 646-650) and knows nothing of the Arrow columns. Four effects: (a) on CREATE TABLE t (a, b TEXT) with rows (1,'x'), (2.5,'y'), ('z',NULL), after dbFetch(rs, 2) returned a numeric column a, dbColumnInfo(rs)$type is character (the type of the next row), where the default path says double; (b) with ptype = list(a = character()) on an INTEGER column it reports integer while dbFetch() returns character; (c) on the default path a dbColumnInfo() before the first fetch fixes the types, through Arrow it does not, so CREATE TABLE t (a INTEGER) with NULL, '12abc' gives integer NA, 12 on the default path and character NA, "12abc" through Arrow; (d) a second dbColumnInfo() converts the waiting row in place, so on a TEXT with 'x', x'410042', x'ff' the sequence info, dbFetch(rs, 1), info, dbFetch(rs) returns "A", NA instead of NA, NA and raises the default path's "mixed type" warning. None of this is in ?"sqlite-arrow", and the only test that touches it checks the names (tests/testthat/test-arrow-df.R:675). In the random comparison every table with a dbColumnInfo() call between fetches could differ for this reason. Suggested fix: with arrow = TRUE, answer from the Arrow columns and the result's ptype (create the columns, read the storage classes without converting, as fetch_arrow_df() does for n = 0), and add dbColumnInfo() to the fetch sequences of the comparison test.

Low

2. A number of days beyond 32 bits in a DATE column is NA with a warning through Arrow and a wrapped date on the default path, which the "Data frames" section does not list (#801). Confirmed: with extended_types = TRUE, CREATE TABLE t (d DATE) and values 18000, 4294967296 + 18000, 1e15 give 2019-04-14, 2019-04-14, -4188383-01-30 silently on the default path and 2019-04-14, NA, NA with "2 integer values out of range" with arrow = TRUE (src/SqliteArrowColumn.cpp:895-926, from b99d110). The new behaviour is the better one, but R/arrow.R:164 says "Three differences remain" and R/arrow.R:183 says the default path warns on the same fetches; in the random comparison this was the one value difference outside the documented list (about 100 fetches in 14,000 tables). Suggested fix: add it to the list of differences, and a DATE column with such a number to the comparison in test-arrow-df.R.

3. In a UTF-16 database, text in a binary column comes back as its UTF-16 bytes through Arrow and as UTF-8 bytes on the default path (#795). Confirmed: after PRAGMA encoding = 'UTF-16', CREATE TABLE t (x) with x'01', 'ab' returns the second blob as 61 62 on the default path and 61 00 62 00 with arrow = TRUE and in dbGetQueryArrow(). fetch_bytes() calls sqlite3_column_blob() before sqlite3_column_bytes() (src/SqliteArrowColumn.cpp:605-607), which keeps the database encoding, while fetch_blob() of the default path asks for the bytes first, which converts to UTF-8. R/arrow.R:105 only says "as its bytes". No test uses a UTF-16 database. Suggested fix: read a text value in a binary column with sqlite3_column_text(), or document the encoding.

4. dbBindArrow() trusts the indices of a dictionary column and the sizes of large values (#795). Confirmed for the indices: a dictionary<int32, string> parameter array whose index buffer holds 50000000 for a two-entry dictionary crashes R with a segfault in result_bind_arrow() (built with nanoarrow_array_modify(validate = FALSE)); src/SqliteParamSource.cpp:307-309 reads the dictionary at an unchecked index, and the validation at :210 is NANOARROW_VALIDATION_LEVEL_DEFAULT, which does not look at indices. By reading: :341 and :402 cast size_bytes to int, so a large_utf8 or large_binary value of 2 GiB or more passes a negative length to sqlite3_bind_text() or sqlite3_bind_blob(). Only a malformed or extreme stream gets there. Suggested fix: check 0 <= index < dictionary->length, and use sqlite3_bind_text64() and sqlite3_bind_blob64(), which return SQLITE_TOOBIG.

5. The row counter is a 32-bit int, and a stream reads past it (#795, row numbers of the warning #800). Confirmed: a stream over 2,148,000,000 rows from a recursive CTE (about 7.5 minutes) ends with dbGetRowCount() equal to -2146967296, and the coercion warning for its last rows lists rows -2146967305, .... int nrows_ (src/SqliteResultImpl.h:42) predates the stack, but ++nrows_ at src/SqliteResultImpl.cpp:728 is a signed overflow, and :723 derives the row numbers of #800 from it. Suggested fix: count in int64_t, and return the count as a double or saturate it.

6. dbSendQueryArrow() accepts ptype together with schema and leaves the two out of step (#802). Confirmed: ptype travels through ... to dbSendQuery() (R/dbSendQueryArrow_SQLiteConnection.R:14), which stores it on the result, and the schema then replaces the requested types. dbSendQueryArrow(con, "SELECT * FROM t", ptype = list(a = Sys.Date()), schema = list(a = nanoarrow::na_string())) followed by dbFetch() fails with "Can't convert a to R vector of type Date". Suggested fix: refuse the combination.

7. The description of #807 describes code that is gone (#807). By reading: it names db_arrow_column_streams_init() and result_fetch_arrow_chunk_columns(), says eager fetches convert column by column and that this "replaces the R-level copy loop of #796", and says the Arrow DBItest runs leave out the driver and transaction groups. At 071560e neither function exists, eager fetches use the copy loop again (R/arrow-df.R:165, 204, since de9734e), only a fetch with a lazy column is split (src/result.cpp:206), and tests/testthat/helper-DBItest-arrow.R:34-38 runs test_driver() and test_transaction(). The benchmark paragraph attributes the eager speed-up to the same removed conversion. ?"sqlite-arrow" itself matches the code. Suggested fix: rewrite the "Column by column", "DBItest" and "Benchmark" paragraphs.

8. ?SQLite says that fetching in chunks takes "much less" time through Arrow, which neither the stack's own record nor this run shows, and no help page mentions the cost of small fetches (#796). Confirmed on 3 million rows of integers, reals and two text columns: a full fetch takes 1.96 s through Arrow against 2.7 s on the default path, chunks of 10,000 rows 1.82 s against 2.2 s, and 20,000 calls of dbFetch(rs, 1) 2.4 s against 0.7 s (5.0 s with lazy_strings). The description of #796 has the same shape (7.1 against 9.5 s in chunks, 12.1 against 17.8 s in full, 2.3 against 0.66 s row by row). R/dbConnect_SQLiteDriver.R:48-49. Suggested fix: say "less" for both, and add a sentence that a fetch of a few rows costs more than on the default path.

9. dbBind() of an unnamed list to a query without placeholders reports another error than on main (#795). Confirmed, arrow = FALSE: rs <- dbSendQuery(con, "SELECT 1 AS a"); dbBind(rs, list(1)) says "Named parameters not used in query: " on main and "Query does not require parameters." here, because match_placeholders() counts the names and no longer the parameters (R/db_bind.R:73). The new message is the right one; it is the only change in the output of the default path that the stack does not mention. Suggested fix: none needed beyond a line in the description of #795.

10. arrow_prepare_df() can never reach its POSIXlt branch (#796). Confirmed: a POSIXlt column is a list, so the check at R/arrow-df.R:309-316 fails with "Can only write lists of raw vectors (or NULL)" before R/arrow-df.R:318-319 would convert it. The default path fails on such a column too, with "Parameter 2 does not have length 1.", so only the message differs. Suggested fix: convert POSIXlt first, or drop the two lines.

The default path

With arrow = FALSE the top branch behaves as main in everything measured: 3,000 random tables with 12,586 operations (dbFetch(n) for n in 0, 1, 2, 3, 5, -1, Inf, dbBind() with one or two parameter rows, dbColumnInfo(), dbHasCompleted(), dbGetRowCount(); mixed storage classes, NULL-first columns, thirteen declared types, blobs, 64-bit integers, dates and times with extended_types on and off, invalid UTF-8 and NUL in text, four bigint settings) gave identical values, classes, warning texts, error texts and result state on both builds; the pre-existing tests pass unchanged apart from the DBItest skips; and the timings on 3 million rows are the same within noise (full fetch 2.75 to 2.86 s on main, 2.65 to 2.79 s here; chunks of 10,000 rows 2.23 against 2.14 to 2.25 s; row by row 0.70 to 0.77 against 0.68 to 0.72 s). The differences found are the intended ones plus finding 9: a result used from a handler of a warning of its own fetch now gets an error where main let the nested fetch run (#795); dbDisconnect() with a result in use has a new warning text (#795); a cloned connection keeps bigint and extended_types, which main dropped (#796, tested in test-dbConnect.R); dbSendQuery(), dbGetQuery() and dbReadTable() take ptype and refuse it without arrow = TRUE (#802). Outside the data frame path, the DBI Arrow generics no longer go through data frames, as #795 documents: dbReadTableArrow() of an R integer column is int64 where main gave int32, a TIME column is time64[us] where main gave time32[ms], an integer64 written with dbWriteTableArrow() is stored exactly in an INTEGER column where main stored a rounded REAL, and an unread stream holds its statement at dbDisconnect().

Checked and found sound

  • R CMD build and R CMD check --no-manual with NOT_CRAN=true: Status 1 NOTE (the hidden .git of the worktree); the tests end with FAIL 3 | WARN 6 | SKIP 182 | PASS 26333, the three failures being the known test-httpvfs.R ones.
  • AddressSanitizer (package, bundled SQLite and vendored nanoarrow built with -fsanitize=address -fno-omit-frame-pointer): all 37 test files pass without a report, among them the six test-arrow*.R files (1,171 expectations) and the three DBItest runs (24,579 expectations); so do 1,500 random tables in each of six configurations (default, Arrow, lazy strings, ptype, and the Arrow ones again with the chunk size of data frame fetches forced to 2 rows) and 1,200 tables in UTF-16 databases. The sanitizer was live: releasing a stream from a handler of the warning of its own get_schema(), which the accepted limitations of feat: Implement the DBI Arrow interface natively #795 list, gives a heap-use-after-free report at src/DbArrowStream.cpp:152.
  • arrow = TRUE against arrow = FALSE on 3,000 tables with every kind of value and 14,000 more with reduced value sets: every difference in values, classes or warnings is one of the documented exceptions (a real after an integer beyond 32 bits, text or a blob converted to such an integer, -2147483648, a blob in a text column that is not valid UTF-8, the silent conversions, the warnings of a fetch of no rows and of truncated reals), or finding 1 or 2. On 6,000 tables without integers beyond 32 bits, invalid blobs and dbColumnInfo(), values, classes and result state are identical on every fetch, and the 371 fetches of rows that warn only on the default path all name a silent conversion.
  • lazy_strings = TRUE returns data frames identical to the eager ones on all 3,000 tables, with and without ptype, and with the chunk size forced to 2, which exercises the split by column and the concatenation.
  • ptype on a random half of the columns (ten prototypes, including integer64, Date, POSIXct, hms, blob and a factor without levels): 12,849 columns over 7,831 fetches had the class of their prototype in every fetch, also for n = 0 and after dbBind(), and the other columns were identical to the run without ptype.
  • dbWriteTable() and dbAppendTable() through Arrow leave the same table definition, storage classes and values as the default path for twelve data frames (logical, integer, double with NaN and Inf, strings with NA and Latin-1 encoding, factor, Date, POSIXct, difftime, hms, integer64, blob, lists of raw vectors, all-NA columns, no rows), with extended_types on and off, and the same errors for an unknown column or table.
  • Spot checks of ?"sqlite-arrow" and ?SQLite that hold: a coercion warning turned into an error by options(warn = 2) leaves the result usable; a handler of the dbFetch() warning can fetch from, clear and disconnect its result, while a handler of a stream warning gets the busy error; a statement through dbGetQueryArrow(), dbFetchArrowChunk() and dbFetch(); the empty array after the end and the chunk_size checks; a POSIXct prototype with a time zone, also as a stream (tsu:Europe/Zurich); ptype with params and n; rows kept for a schema handed out by dbFetch() with arrow = TRUE and refused without; lazy columns that outlive the connection and a garbage collection and serialize as plain strings; the validation of arrow and lazy_strings.
  • A small integer followed by a real in a later fetch widens to double on both paths alike.
  • gctorture(TRUE) around result_fetch_arrow_df(), arrow_split_columns() and arrow_concat_strings() returned the expected values; the run over the remaining entry points did not finish in the time available.

Generated by Claude Code

krlmlr commented Nov 10, 2026

Copy link
Copy Markdown
Member Author

Integration review of the Arrow stack at d451398 (#795 → #796 → #800 → #801 → #802 → #807 → #831), by a Claude Code reviewer with clean context that read the integration review at 071560e, the descriptions of the seven pull requests and their latest review and "Accepted limitations" comments, ?"sqlite-arrow", ?SQLite and the diff since 071560e; built the top and main (cd1fed9); ran R CMD check --no-manual with NOT_CRAN=true, the full test suite under AddressSanitizer, the large tests once in one process, randomized comparisons of both data frame paths and of the default path with main, and worker-thread scenarios with arrow 26.0.1 under an LD_PRELOAD interposer that logs every R API call made off R's main thread; and posted nothing itself. Line numbers refer to d451398 unless a link says otherwise. "Confirmed" means reproduced by running code.

High

1. The stream's date and time parsers call R's R_isnancpp() on arrow's worker threads (#795, carried into #801's rewrite of the parsers). Confirmed. In C++, R's ISNAN() expands to R_isnancpp(), which is R API; append_date() and append_time() call it for every date, time or timestamp parsed from text (SqliteArrowColumn.cpp#L930, #L1022; in #795 at SqliteArrowColumn.cpp#L404, L437 and L440). The interposer counted 3,767,710 such calls on arrow's worker threads, from Acero, the scanner and write_dataset() reading DATE, TIME and TIMESTAMP columns with extended_types = TRUE, and no call of any other R function. The function is isnan() and touches no R state, so nothing broke; it is High only by the rule that no R API is called off R's main thread, which the description of #795 states. Suggested fix: std::isnan(), and keep R's macros out of code that can run on a worker thread.

Medium

2. Arrow's scanner and Acero read the stream ahead in the background while R goes on running (#795). Confirmed. With 300,000 rows, chunk_size = 1000 and rdr <- as_record_batch_reader(dbFetchArrow(rs, chunk_size = 1000)) |> dplyr::filter(a > 0) |> as_record_batch_reader(), dbGetRowCount(rs) is 61,154 right after the first batch of 1,000 rows and 300,000 half a second later; Scanner$create(...)$ToRecordBatchReader() has read 6,124 rows before any batch is requested, and dropping the reader does not stop the reading. On a query of 3 million generated rows read with chunk_size = 5000, right after the first batch dbClearResult(rs) fails in 4 of 5 runs, and an unrelated dbGetQuery(con, "SELECT 42") on the same connection, which first clears the open result (dbSendQuery_SQLiteConnection_character.R#L21-L25), fails in 5 of 5, both with "Can't clear a result while one of its fetches or binds is running, as from a handler of a warning that it raised", which points to a handler that does not exist; in the other direction, a loop of dbFetchArrowChunk(rs, chunk_size = 7) in R fails on part of its calls, and the Acero stream then fails with "IOError: Can't use a result while one of its fetches or binds is running". By reading, run_guarded() (DbResult.cpp#L45-L73) checks and then sets a plain bool busy_ (DbResult.h#L27) from both threads in two steps, so both can enter the result at once, a data race on the column builders, the kept chunk and the row counter (AddressSanitizer reported nothing in 10 runs of 2,000 interleaved fetches; the window is a few instructions wide). R/arrow.R#L282-L294 says these consumers read "while R waits". Results from dbGetQueryArrow() are cleared at once and are not affected. Suggested fix: an atomic busy mark that records the owning thread; result_release() drops R's share instead of refusing when another thread holds the mark; fetch, bind and dbColumnInfo() either wait for the worker's call to return or fail with a message that names the stream being read on another thread; correct the "Threads" section; add a test that takes the first batch of an Acero reader before dbClearResult() and before another query.

3. A stream released on a worker thread while its R result object is alive keeps the statement and its read transaction open after dbClearResult() (#795). Confirmed. drop_result() (DbArrowStream.cpp#L54-L67) finalizes the statement only when the stream holds the last share, and otherwise parks the share in the deferred list, which is emptied only from the stream callbacks on R's main thread, db_arrow_stream_init() and connection_release(); result_release() drops R's share but not the parked one. With a file database of 2 million rows, reading the first batch through an Acero reader and then rm(rdr, b); gc(), an INSERT from a second connection still fails with "database is locked" a second later in 3 of 3 runs, until dbGetQueryArrow(con, "SELECT 1") runs on R's main thread; a 30-line C consumer that reads two chunks on its own pthread and releases the stream there reproduces it deterministically, while a release on R's main thread does not. A stream read to the end holds no lock. This contradicts "after its statement has been finalized right away" in the description of #795 and the "Chunking" section of ?"sqlite-arrow". Suggested fix: drain the deferred list in result_release() and at the other entry points on R's main thread (result_create(), the fetches), and add the two-connection lock test.

Low

None, beyond the documentation parts of findings 2 and 3.

The default path

With arrow = FALSE the top behaves as main (cd1fed9) in everything measured: 16,000 tables (6,000 with every kind of value, 8,000 without the values behind the documented differences, 2,000 in UTF-16 databases) with 67,094 operations (dbFetch(n) for n in 0, 1, 2, 3, 5, -1 and Inf, dbBind() with one or two rows, dbColumnInfo(), dbHasCompleted(), dbGetRowCount(); thirteen declared types, mixed storage classes, NULL-first columns, blobs, 64-bit integers, dates and times with extended_types on and off, invalid UTF-8 and NUL bytes, four bigint settings) gave identical values, classes, warning texts, error texts and result state, 8,357 warning fetches among them. All 29 of main's test files pass against the top build, apart from the 12 Arrow round-trip specs of DBItest that the stack skips with a reason in #795 and the callr test that needs an installed RSQLite. Timings on 1 million rows are within noise of main for full fetches, chunks of 10,000 rows, 20,000 single-row fetches and 5,000 rounds of bind and fetch. The known differences are the new text of the dbDisconnect() warning and ptype being refused without arrow = TRUE.

Checked and found sound

  • R CMD check --no-manual with NOT_CRAN=true: Status 1 NOTE (the hidden .git of the worktree); tests FAIL 3 | WARN 6 | SKIP 183 | PASS 26521, the three failures being the known test-httpvfs.R ones (test: Run the HTTP VFS tests for real, and make their errors fail the check #832); the man pages match a fresh roxygenise().
  • AddressSanitizer (the package, the bundled SQLite and the vendored nanoarrow): all 37 test files and all worker-thread scenarios run without a report; the known use-after-free from feat: Implement the DBI Arrow interface natively #795's accepted limitations still reports, so the sanitizer was live.
  • The large tests: the six test-arrow*.R files with RSQLITE_TEST_LARGE_ARROW=true in one process pass 1,364 expectations, none skipped, in 22 s, at a peak RSS of 2.63 GB.
  • Worker threads, apart from findings 1 to 3: Acero, the scanner and write_dataset() to Parquet, each over 150,000 rows in three chunks and in chunks of 1,000, with requested schemas (int32, large_utf8, date32, time32[ms], timestamp[ns, Europe/Zurich], float; uint64, bool, large_binary, int64) read correctly; a mixed type in a late chunk, invalid UTF-8, a time outside a day, unparsable dates and timestamps, text in an integer column, and out-of-range int8 and timestamp[ns] values each fail the stream with the warning's text and "(an error instead of a warning, …)"; dbBind() parameters work with one row and fail at the second as documented; dbBindArrow() parameters work; an early stop with head(5), a failed stream held across dbDisconnect(), statement errors before and after dbDisconnect(), and a release whose R result is already cleared all behave as documented; during Acero's read-ahead of a dbGetQueryArrow() stream, 500 INSERT/SELECT pairs and four dbDisconnect() calls on the same connection ran without error; arrow::as_arrow_table() reads on R's main thread, where the mixed-type warning stays a warning. boost's shared_ptr counts are atomic in this build.
  • arrow = TRUE against arrow = FALSE: on 8,000 tables without documented triggers (33,552 operations) values, classes and result state are identical, and warnings differ only as documented; dbColumnInfo() differs from the default path only in tables that hold -2147483648.
  • dbColumnInfo() with schema (25 requested formats) and with ptype (1,390 calls on random tables, fourteen prototypes checked one by one) names what dbFetch() returns; 25,534 columns with a prototype over 15,594 fetches have the prototype's class; lazy_strings = TRUE gives the same data frames as eager fetches on 6,000 tables, also with two-row chunks.
  • The previous integration findings 1, 3, 4, 6, 8 and 10 are fixed as described; uint64 beyond 2^63 becomes double in data frames and stays exact in the stream.

Generated by Claude Code

krlmlr commented Nov 10, 2026 •

Copy link
Copy Markdown
Member Author

Moved: should R wait for a stream read on another thread (#795)?

Moved to #880: #880 (comment). Please answer there.

The second integration review found that arrow's scanner and Acero read an RSQLite stream ahead in the background on worker threads while R goes on running. Right after the first batch, R's own calls on the same result run into the stream's busy mark. The clear part of the fix is under way on #795: the mark becomes an atomic owned by one thread, so two threads can never be in the result at once; dbClearResult() and the clearing of an open result by the next query always work, by dropping R's share and leaving the stream its own; and the error names the real cause instead of a warning handler.

What remains is what an R fetch, bind or dbColumnInfo() on that result does while a worker is in the middle of reading it. Mixing R fetches with an Arrow stream that a background consumer is reading is unusual, and the DBI specification does not cover mixing at all (r-dbi/DBI#773).

  • Fail at once with a clear error naming the stream read on another thread; the user retries later (recommended: simple, no blocking, and the case is rare)
  • Wait until the worker's current call returns (a per-result mutex; cannot deadlock, since the worker never waits for R), then proceed

Generated by Claude Code

krlmlr commented Nov 11, 2026 •

Copy link
Copy Markdown
Member Author

Resolved: how should the UTF-8 checks of text columns be switched on?

Asked on #799: the checks are a breaking change, so they go behind an option that defaults to the current behavior, reimplemented from main as a stack, the UTF-8 infrastructure first and then the fixes. When the checks are on, a text or blob value read into a character column that is not valid UTF-8, or holds a NUL byte, becomes NA, with one warning per column and fetch that counts the replaced values. When they are off, fetches behave exactly as on main: text with a NUL byte is cut, invalid UTF-8 is returned marked as UTF-8, and a blob is read as a C string.

RSQLite already keeps settings like this on the connection: extended_types and bigint are dbConnect() arguments. An R option lets code that opens connections indirectly, through dbplyr or pool for example, turn the checks on without changing each call.

  • A dbConnect() argument check_utf8, kept with the connection like extended_types, whose default comes from the R option RSQLite.check_utf8 and is FALSE when that is unset (recommended)
  • A dbConnect() argument check_utf8 = FALSE only
  • An R option RSQLite.check_utf8 only, read at each fetch

The fixes pull request starts with the recommended form; another choice changes only how the setting reaches the fetch.


Generated by Claude Code

krlmlr commented Nov 11, 2026 •

Copy link
Copy Markdown
Member Author

Superseded: when should the Arrow stack use the new UTF-8 infrastructure?

Superseded by the plan to rework the Arrow stack: the new stack sits on #830, and its text-column pull request uses #845's validator, merging claude/utf8-infra if #845 has not landed by then.

Asked on #799: the UTF-8 infrastructure comes first, in its own pull request from main, also because the Arrow stack needs it. Today #795 carries its own copy of the validator (src/utf8.h, plus an ASCII fast path in src/SqliteArrowColumn.cpp). The infrastructure pull request takes both into a shared src/utf8.cpp, and #795 would then drop its copy.

GitHub stacks are linear, so the Arrow stack and the UTF-8 fixes cannot both sit directly on top of the infrastructure pull request in one stack.


Generated by Claude Code

krlmlr commented Nov 12, 2026 •

Copy link
Copy Markdown
Member Author

Plan: rework the Arrow stack (#795 to #831) into scoped pull requests

Asked in the session: rework the long stack from scratch into a new stack of scoped, human-reviewable pull requests, starting with the less controversial changes. Each pull request below gets a fresh branch with a clean history, its own description, tests whose every test_that() block runs on its own after load_all(), and its own clean review. The old stack carries about 10.4k hand-written lines (src 4.7k, R 1.4k, tests 4.2k) plus 10.5k vendored nanoarrow lines; the target is at most about 600 hand-written lines per pull request, not counting vendored and generated files. The old pull requests stay open as the reference until their replacements land.

Base. The new stack goes on top of #830 (on #850). The fetch loop, bind() and the busy guard there are the code the Arrow stack rewrites: a trial merge of #831's head into #830 conflicts in 20 hunks over five files, while building on #850's step_error and #830's error semantics avoids redoing them later. #845 merges cleanly with #830; if it has not landed when the text-column pull request is due, that pull request merges claude/utf8-infra. This supersedes the UTF-8 sequencing question.

A. No change of behavior

  1. refactor: Bind list parameters through a parameter source (~350 lines)
  2. refactor: Own results through a shared pointer, as connections are (~60)
  3. build: Vendor the nanoarrow C library, as feat: Implement the DBI Arrow interface natively #795 does (~30 plus the vendored sources; nothing calls it yet)

B. Internal engine behind unexported entry points; the default path stays unchanged unless noted

  1. feat: Build Arrow arrays from the integer, real and NULL columns of a result
  2. feat: Build Arrow arrays from text and blob columns (uses feat: Add a UTF-8 validator for strings read from SQLite #845's validator)
  3. feat: Build Arrow date, time and timestamp arrays with extended_types (splits the parse_*() helpers from their warnings)
  4. feat: Report values converted to an Arrow column's type once per chunk, with their rows
  5. feat: End Arrow chunks before string offsets overflow (the 64-bit row count moved to a separate pull request from main)
  6. feat: Read a result as a lazy Arrow array stream
  7. feat: Let Arrow streams outlive dbClearResult() and dbDisconnect()
  8. feat: Bind the rows of an Arrow stream to a statement
  9. feat: Check dictionary indices, 64-bit lengths and self-binding of Arrow parameters
  10. feat: Build Arrow arrays of requested integer, unsigned, boolean and float types
  11. feat: Build requested large, date64, time and timestamp arrays in any unit and time zone
  12. feat: Read Arrow streams on worker threads, as arrow's scanner and Acero do (depends on the stream-read question)

C. Replacing DBI's default Arrow methods

  1. feat: Implement dbSendQueryArrow(), dbFetchArrow() and dbFetchArrowChunk() natively
  2. feat: Implement dbBindArrow(), dbAppendTableArrow(), dbCreateTableArrow() and dbWriteTableArrow() natively
  3. feat: Request Arrow types for result columns with schema

D. Opt-in data-frame path through Arrow

  1. feat: Build data frame columns from Arrow arrays, typed like the default path
  2. feat: Add arrow argument to dbConnect() to fetch data frames through Arrow
  3. feat: Append data frames through Arrow with dbConnect(arrow = TRUE)
  4. feat: Request R types for result columns with ptype
  5. feat: Keep strings as nanoarrow views with dbConnect(lazy_strings = TRUE)

Separate pull requests from main, since they do not depend on the rest: keeping system headers out of the generated .dd files on gcc's continuation lines (#853, part of #836), dbConnect() on a connection keeping bigint and extended_types (#852), declaring DBItest 1.8.3.6 (#854, #831's default context), and counting rows in 64 bits, so that dbGetRowCount() and dbGetRowsAffected() stay right beyond INT_MAX (#858, split from pull request 8, since main overflows there too).

Opened so far: group A as #855 (1), #856 (2) and #857 (3), stacked on #830; pull request 4 is being written.

Dropped: src/utf8.h and is_utf8_text() (#845 replaces them), the experiments/ records (they collide with #849's registry), vctrs in Suggests (two test calls), the result_rethrown_unwinds() test hook, and the copies of the guard and the step error that #830 and #850 already carry.

Order of work: A and the three separate pull requests start now. Each later pull request starts once the one below it is pushed, and the questions that follow decide C and D before those are due.


Generated by Claude Code

krlmlr commented Nov 12, 2026 •

Copy link
Copy Markdown
Member Author

Resolved: should RSQLite's own Arrow methods replace DBI's default ones, with faithful types?

For the Arrow rework, pull requests 16 to 18. Today main uses DBI's default Arrow methods, which wrap dbSendQuery() and dbFetch(), so integer columns arrive as int32. #795's native methods return int64 for integer columns, binary for blobs, and NULL with a warning for invalid UTF-8, which makes twelve DBItest round-trip specs skip. Pull requests 4 to 15 only pay off if 16 lands.

  • Yes, native methods with int64, binary and the UTF-8 check, as feat: Implement the DBI Arrow interface natively #795 does; ask DBItest for a tweak that accepts 64-bit integers instead of skipping specs locally (recommended)
  • Yes, but narrow integer columns to int32 where every value fits, to match DBI's default methods
  • No: keep DBI's default methods, and stop the new stack after the separate pull requests and group A

Kirill decides. Until then, pull requests 4 to 15 keep building the engine behind internal entry points, which costs nothing for users; if nobody decides, the stack stops before pull request 16 and DBI's default methods stay.


Generated by Claude Code

krlmlr commented Nov 12, 2026 •

Copy link
Copy Markdown
Member Author

Resolved: may one result mix data-frame and Arrow fetches?

For the Arrow rework, pull requests 9, 10 and 16. #795 and #796 let dbFetch() and dbFetchArrowChunk() alternate on one result: rows read ahead for an Arrow chunk are handed to the next data-frame fetch, and column types carry over between the two. The DBI specification does not say whether mixing is allowed (r-dbi/DBI#773).

Kirill decides, and r-dbi/DBI#773 may settle it for all backends. Until then, the internal entry points stay neutral: #859 lets the two kinds of fetch alternate without losing or repeating rows, and #862 refuses dbFetch() only while a chunk whose warning failed is kept. If nobody decides, pull request 9 goes ahead with the recommended refusal, which is easy to relax later.


Generated by Claude Code

krlmlr commented Nov 12, 2026

Copy link
Copy Markdown
Member Author

Handover: the Arrow rework continues in a fresh session

Kirill asked to move this work to a fresh session once the work in flight was done. This comment is the starting point for it; the plan and the pull requests hold everything else.

Ready for the maintainer (clean reviews posted, findings fixed or listed in each pull request's last "Accepted limitations" comment, CI green):

In progress: #863 (pull request 8, Arrow chunks end before string and binary offsets overflow, plus a fix that keeps the storage classes of the read-ahead row; head 06df15e, merged with #862's head, no conflict). Its first clean review has not run yet.

Next steps:

  1. Run the clean review of feat: End Arrow chunks before string and binary offsets overflow #863 (risks: the held-back row with fix: A fetch returns its rows when the step past its last row fails #850's read-ahead, fix: Never restart a statement after an error in dbFetch() or dbBind() #830's errors and feat: Report values converted to an Arrow column's type once per chunk, with their rows #862's coercion log; dbFetch() after a held-back row relying on SQLite keeping a number's type after conversion; the CI hook that runs a 2.5 GB test in every hosted job that calls it; the per-row cost), then fix, review once more after any Medium, and post its "Accepted limitations".
  2. Continue the plan with pull request 9 (a lazy Arrow array stream), one implementing subagent per pull request in its own worktree, each stacked on the one below and added to GitHub stack 851 (gh api -X POST repos/r-dbi/RSQLite/stacks/851/add --input - with {"pull_requests":[N]}). If nobody decides the mixed-fetch question by then, pull request 9 refuses mixing, as that question says.
  3. Resolve merge conflicts through the conflicting pull request's own subagent; leave branches without conflicts alone. CI's "Auto-update from GitHub Actions" commits absolute paths into src/*.dd on stacked branches until build: Keep system headers out of the generated .dd files on gcc's continuation lines #853 is merged; restore those files in a follow-up commit (as e6c6f7e on feat: Build Arrow date, time and timestamp arrays with extended_types #861 did).
  4. For a pull request that touches the build, dispatch the full matrix by hand, since same-repository pull requests only get the smoke test: gh api -X POST repos/r-dbi/RSQLite/actions/workflows/R-CMD-check.yaml/dispatches with {"ref": "<branch>", "inputs": {"ref": "<branch>", "versions-matrix": true}}.
  5. Pull request bodies are reflowed paragraphs, not semantic line breaks.

Open questions (each states what happens if nobody decides):

Check-ins on this pull request continue in the new session, as Kirill's rules describe: read every open pull request of this work for comments and reviews without the Claude Code footer, mergeable_state, failing checks, unchecked accepted limitations, and ticked questions here.

Brief given to every implementing subagent
# Rules for implementing one pull request of the Arrow rework in r-dbi/RSQLite

You implement exactly one pull request. Do the work yourself; do not start subagents.

## Context

- r-dbi/RSQLite is public. Write nothing private into code, commits or the description.
- The plan for the whole rework is the comment https://github.com/r-dbi/RSQLite/pull/829#issuecomment-6830171193 (read it with `gh api repos/r-dbi/RSQLite/issues/comments/6830171193 --jq .body`).
  Only `gh api` works here, not `gh pr` or `gh issue`.
- The old Arrow stack is the reference, not something to rebase:
  #795 head 43db19f5, #796 92b3e736, #800 ef68461a, #801 6bb1e8c3, #802 019fbf65, #807 c70faa2f, and the top #831 34363581.
  The old stack forks from 07129cea, not from `main`, so compare with three dots (`git diff 07129cea...34363581`).
  Each old pull request's last comment, headed "Accepted limitations", and its review comments name known problems; do not carry those over where the new scope makes a fix easy.
- The new stack sits on #830 (`claude/fix-error-mid-result`), which sits on #850 (`claude/fetch-row-ahead`).
  Keep their behavior: the one-row read-ahead cache, `step_error` carrying the SQLite result code, kept errors raised by the next fetch,
  any error leaving a fetch completing the result, and the busy guard that makes `dbClearResult()` refuse while a fetch or bind runs.
- The main checkout is `/home/user/RSQLite`. Create your worktree from there:
  `git -C /home/user/RSQLite fetch origin <base>` and `git -C /home/user/RSQLite worktree add -b <branch> <worktree> origin/<base>`.
  If the branch or worktree already exists, reuse it and say so.

## Code

- Keep the change to the scope you were given; mention anything else you notice in your report instead of fixing it.
- Do not merge the base branch into yours unless the coordinator asks or a conflict needs it.
- In R code, where the package already uses cli, stop with `cli::cli_abort()` when a required input is missing or inconsistent, rather than substituting a default.
- Every `test_that()` block must pass on its own right after `pkgload::load_all()`:
  inline its fixture, or define the fixture in a `tests/testthat/helper-*.R` file. A fixture at the top level of a test file does not count.
- Test what the change does, and for a refactor pin the behavior it must keep (messages, classes, results) with tests that also pass on the base.
- After changing C++ entry points, run `cpp11::cpp_register()`. After changing roxygen comments, run `devtools::document()`,
  and revert unrelated churn it causes in files you did not mean to touch.
- `src/*.dd` files are checked-in dependency lists. gcc writes their continuation lines with one leading space and absolute system header paths,
  which the filter in `src/Makevars.deps` does not drop (#836). Never commit a `.dd` file that gains absolute paths:
  restore it with `git checkout`, or edit it by hand to list only package-relative dependencies in the style of the existing files.
  A new source file gets a new `.dd` file in that style only if the other source files have one.
- Code comments follow the file's conventions and use semantic line breaks: break at sentence or clause boundaries, never mid-phrase.
- There is no `air.toml`, so do not reformat R code wholesale; match the surrounding style.
- Build and test: `R CMD INSTALL` or `pkgload::load_all()`, the changed test files, then `devtools::test()` with `NOT_CRAN=true`.
  The three errors in `test-httpvfs.R` happen on `main` as well (#832, #837) and are not yours.
  Run `R CMD check --no-manual` once at the end when the change touches the build, DESCRIPTION, NAMESPACE or documentation.

## Commits and push

- One or a few commits with a Conventional Commits subject; code in backticks, function names with `()`.
  Commit bodies use semantic line breaks. End every commit message with these two lines, after a blank line:

  ```
  Co-Authored-By: Claude Opus 5.5 <[email protected]>
  Claude-Session: https://claude.ai/code/session_01Hr1rd3gjmufoKCWVDBPCgE
  ```

- Push with `git push -u origin <branch>`. On a network error retry up to four times, waiting 2, 4, 8 and 16 seconds.
  Never force-push, and never push to any other branch.
- Do not open the pull request, and post nothing on GitHub; the coordinator does that.

## Deliverables

- A description draft at the path you were given, in Markdown with reflowed paragraphs (no line breaks inside a paragraph, since GitHub renders them).
  Say what changes and why, what is deliberately left out and where it comes later, how it was tested, and where it sits in the stack.
  Name pull requests as `#123`, and never write a bare `@` mention. No title line and no footer.
- Your final report, terse and without a narrative of your steps: the branch and head SHA, what changed (files with hand-written line counts),
  the tests run and their results, any deviation from the scope, the risks a reviewer should look at, and what is left.

## Disk

The disk is shared with other agents and filled up once.
Install test builds into libraries under the scratchpad, and delete those libraries, extra worktrees and large logs when you finish; keep only your own branch's worktree.
Brief given to every reviewing subagent (clean context, Opus)
# Rules for a clean review of one pull request in r-dbi/RSQLite

You review with a clean context: form your own view from the code, the description and running it, not from anyone's summary.
Post nothing on GitHub and change no branch; work in a detached worktree of your own under `/home/user/wt/review-<name>`
(`git -C /home/user/RSQLite worktree add --detach <path> <sha>`), and build into a separate library so that you do not disturb other worktrees.
Only `gh api` works here, not `gh pr` or `gh issue`.

## What to do

- Read the description, the diff against its base, the code around the change, and the tests.
- Build the pull request and its base. Run the changed tests against both, and every changed or added `test_that()` block on its own right after `pkgload::load_all()`.
- Run `devtools::test()` with `NOT_CRAN=true`; the three `test-httpvfs.R` errors happen on `main` too (#832, #837).
  Run `R CMD check --no-manual` when the change touches the build, DESCRIPTION, NAMESPACE or documentation.
- Write your own reproducers for what could go wrong, especially on the risks named in your brief, and run them.
  Use AddressSanitizer or valgrind where memory is a risk.
- Check that the description says what the code does, that the scope matches the title, and that no `src/*.dd` file gains absolute paths.

## The report

Write it to the path you were given, in Markdown with reflowed paragraphs (no line breaks inside a paragraph), in this shape:

1. A first paragraph that starts "Review of this pull request at <short sha>, by a Claude Code reviewer with clean context that ..." and says what you read, built and ran, and that you posted nothing yourself.
2. **What was run**, as a short list.
3. **What holds**, as a short list of what you verified.
4. `### High`, `### Medium`, `### Low`, each with numbered findings or "None.".
   Each finding: a bold one-line claim, a link to the line pinned to the commit (`https://github.com/r-dbi/RSQLite/blob/<full sha>/<path>#L<a>-L<b>`),
   the evidence with "(Confirmed)" when you reproduced it by running code or "(by reading)" otherwise, and a "Suggested fix:".
   High means wrong results, a crash, data loss or a security problem on a path users reach; Medium means a real defect or a gap that matters but is not High;
   Low means everything else worth fixing or noting.
5. End with a blank line, `---`, and `_Generated by [Claude Code](https://claude.ai/code)_`.

Name pull requests as `#123`, never write a bare `@` mention, and keep the report under about 1200 words.
Your final answer, terse and without a narrative of your steps: the path of the report and one line per finding with its severity.

## Disk

The disk is shared with other agents and filled up once.
When you finish, remove your worktrees with `git -C /home/user/RSQLite worktree remove --force <path>` and delete the libraries and large logs you created; keep only the report and small reproducer scripts.

Generated by Claude Code

krlmlr commented Nov 13, 2026 •

Copy link
Copy Markdown
Member Author

Resolved: fix dbBind() ignoring SQLite's bind return codes, in a pull request from main?

Found by the clean review of #867. On main, the data-frame path of dbBind() ignores the return codes of sqlite3_bind_text() and sqlite3_bind_blob() (src/SqliteResultImpl.cpp#L276). A text or blob value over SQLite's length limit (2147483647 bytes by default, lower if a connection sets SQLITE_LIMIT_LENGTH) therefore binds NULL without an error, so the row is written with NULL in its place. The Arrow path of #866 and #867 checks every return code and fails with the parameter and row.

  • Yes: a small pull request from main that checks the return codes of every sqlite3_bind_*() call of the data-frame path and fails with SQLite's message, with a test that lowers the length limit (recommended)
  • No: leave main as it is

Kirill decides. If nobody decides, nothing changes on main, and the limitation stays recorded in #867's "Accepted limitations".


Generated by Claude Code

krlmlr commented Nov 13, 2026 •

Copy link
Copy Markdown
Member Author

Resolved: merge #853 ahead of the Arrow stack?

#853 stops gcc's continuation lines from writing absolute paths into src/*.dd (#836). Until it is on main, CI's "Auto-update from GitHub Actions" commits such files on every stacked branch whose change touches a C++ file's formatting or adds an entry point; each time, a follow-up commit restores them (#863 twice, #865, #866, #867 so far). A dispatched full matrix fails on the same files instead of committing them, so #864 to #867 have only had the smoke test on hosted runners (#864).

Kirill decides, since merging is his. If nobody decides, the restores continue and the full matrix waits.


Generated by Claude Code

@krlmlr

krlmlr commented Nov 13, 2026

Copy link
Copy Markdown
Member Author

Merged #853 and responded to questions.

krlmlr commented Nov 13, 2026

Copy link
Copy Markdown
Member Author

Handed over to a fresh session, as asked: the coordination continues on #880, whose description records the state and the open questions. The plan and the answered questions here still hold. New questions go to #880.


Generated by Claude Code

krlmlr commented Nov 13, 2026

Copy link
Copy Markdown
Member Author

Closing this pull request: the coordination of the Arrow rework continues in #880, whose description records the state and links each open question. All questions still open here, and the open ones from the stack's pull requests that awaited the maintainer, are reposted there as their own comments; the originals are marked "Moved:" and link to their new place. The plan stays the reference for the rework, and the questions resolved here still hold.


Generated by Claude Code

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