Repository navigation
Conversation
…[ci skip] Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd4HRcA4823NuBCC8TS
The `DBIConnection` class gains a `.dbi_state` slot that holds an environment, with `emptyenv()` as prototype so that no two objects share mutable state. After the method returns, the `dbConnect()` generic records the arguments passed in `...` in a fresh environment in that slot. `dbGetConnectArgs()` gains a `DBIConnection` method that returns them, evaluating function arguments as for connectors. Through a `DBIConnector`, the connector's arguments are recorded unevaluated. The slot is read and written with `attr()`, so that backends installed against an older DBI keep working without reinstalling, as do objects deserialized from an older DBI. Recording never fails `dbConnect()`. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd4HRcA4823NuBCC8TS
Resolved: Name and scope of the new slot on
|
Resolved: Store the driver object along with the arguments?
Kirill decides. If nobody decides, only the arguments are stored. Generated by Claude Code |
Resolved: How to capture arguments that the backend's method did not evaluate?The generic calls
Kirill decides. If nobody decides, Generated by Claude Code |
Resolved: Should passwords and other secrets passed to
|
Superseded: In nested
|
Superseded: How do DBI-level settings reach the connection without breaking strict backends?Reposted for the The motivating use case is a DBI-level per-connection setting such as
Kirill decides. If nobody decides, nothing is stripped and no DBI-level argument is defined yet. Generated by Claude Code |
Clean review, round 1 (at b57cd87)Reviewed by an agent without context from the work, briefed with S4 class caching across old and new DBI, serialization, secrets, argument forcing, robustness, downstream impact, and tests. High
Medium
Low
Checked and correct
Tests: Not checked: pool, odbc, RPostgres, mocking packages, otel, the RStudio and Positron connection panes, a reverse-dependency run, Note: the recommended options of the secrets and DBI-level settings questions together remove the High and both Medium findings: if DBI stores only its own reserved-prefix settings, backend arguments (and their secrets) are neither stored nor forced, and a connection made without such settings gets no state at all, so it stays Generated by Claude Code |
Resolved: Accept that connections no longer compare
|
A wrapper created with `new("Wrapper", inner_con)` copies the attribute,
so it shared the state environment of the inner connection.
The outer `dbConnect()` then overwrote the inner connection's stored arguments.
`set_connect_args()` now always creates a fresh environment
and copies over any other entries of the existing state.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Hr1rd4HRcA4823NuBCC8TS
This follows Kirill's decision on #794. The `.dbi_state` environment slot becomes a `.dbi` slot of class `list`, and the `dbConnect()` generic keeps only the arguments DBI itself needs. Their names live in `dbi_connect_arg_names()`, empty for now, where future DBI-level settings are added. Other arguments are neither evaluated nor kept, and a connection made without DBI-level arguments is left untouched. The `dbGetConnectArgs()` method for `DBIConnection` is gone, and the connector code is back to what `main` has. The docs say instead to read the slot with `attr(con, ".dbi", exact = TRUE)`, because objects from backends installed against an older DBI lack it. DBI's own methods read it with the internal `dbi_setting()`. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd4HRcA4823NuBCC8TS
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd4HRcA4823NuBCC8TS
Superseded: How do DBI-level arguments get past backends, and how are they named?Moved to the stacked PR #800 with the DBI-level arguments: #800 (comment) Reposted for the
Kirill decides. If nobody decides, arguments are passed through and no name is reserved; this only matters once the first DBI-level argument is added. Generated by Claude Code |
Superseded: In nested
|
dbConnect() in the connection objectdbConnect() in a .dbi slot
Its prototype is an empty, unnamed list. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd4HRcA4823NuBCC8TS
Clean review, round 2 (6dd0466 and the merge 68c1f92)Scope: the Medium
Low
Checked and correct
Results: Not checked: CRAN and reverse dependencies for existing Generated by Claude Code |
Question: Accept that a backend with its own
|
Superseded: Warn when a DBI-level argument fails to evaluate?Moved to the stacked PR #800 with the DBI-level arguments: #800 (comment) In
Kirill decides. If nobody decides, the argument is dropped silently. Generated by Claude Code |
Superseded: Accepted limitationsSuperseded by the current copy.
Generated by Claude Code |
Question: Document
|
Superseded: Accepted limitationsSuperseded by the current copy.
Generated by Claude Code |
Resolved: Formals after
|
Superseded: Accepted limitationsSuperseded by the current copy.
Generated by Claude Code |
`...names()` and `...elt()` need R 4.1.0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd4HRcA4823NuBCC8TS
`...names()` reads the names of the arguments without forcing them, and `...elt()` forces only the one asked for, replacing `substitute()` and the `..i` symbols. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd4HRcA4823NuBCC8TS
Resolved: Accept the extra copy of the connection in serialized results?The result generics now store the connection in every result. Serialized sizes, before and after (bytes): RSQLite connection 1051 → 1328, RSQLite result 1215 → 1922, duckdb connection 9070 → 9887, duckdb result 10000 → 20431. The duckdb result doubles because its own slot already holds the connection and serialization writes a second copy.
Kirill decides. If nobody decides, the copy is accepted. Generated by Claude Code |
dbConnect() in a .dbi slot
Clean review of "keep the driver in each connection and the connection in each result" (a8b440e..2bf79a5)Scope: the commits for this change, without the merge of High
Medium
Low
Checked and correct: return values and visibility unchanged when the bookkeeping fails; Tests: R 4.5.3: FAIL 0, WARN 0, SKIP 60, PASS 9832. R 4.1.3: no failures. Not checked: reverse dependencies; backends whose results don't already hold their connection (odbc, RPostgres, bigrquery not installed); otel. Generated by Claude Code |
`dbConnect(con)` kept `con` as the driver of the clone. The clone then kept the original connection alive, and clones of clones formed a chain. The clone now keeps the driver of the original connection, or none if that connection has none. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd4HRcA4823NuBCC8TS
`set_dbi_state()` runs once per call to `dbConnect()`, `dbSendQuery()`, `dbSendStatement()` and `dbSendQueryArrow()`. It now tests the class with one `inherits()` instead of up to three calls to `is()`. It returns early if the values are stored already, as on the default path from `dbSendStatement()` to `dbSendQuery()`. Only the write runs inside `tryCatch()`, so the function still never fails. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd4HRcA4823NuBCC8TS
The generics store the attribute even in objects whose class lacks the slot, so `attr()` returns `NULL` only when DBI has stored nothing. The documentation of `dbConnect()` also says which driver a clone keeps. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd4HRcA4823NuBCC8TS
Question: Keep the
|
A classed list would dispatch on `[` in the check for stored values, which can fail outside the guard, so the value is unclassed first. Also say what a clone keeps when the original connection keeps no driver. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd4HRcA4823NuBCC8TS
Clean review of the fixes (2bf79a5..04202a1)Scope: the three fix commits for the previous round. No High or Medium findings, so the review stops here. Low, both fixed in 5942375:
Checked and correct
Results: Not checked: objects deserialized from an older DBI, backends other than RSQLite, a benchmark on a quiet machine. Generated by Claude Code |
Superseded: Accepted limitationsSuperseded by the current copy.
Generated by Claude Code |
The record under experiments/2026-11-29-s7/ tests S7 1.0.0 base classes and S7 generics against installed S4 backends (RSQLite, duckdb, a minimal backend). It also tests whether S7 properties avoid the class caching that makes #794 read its slot with attr(). S7 base classes registered with S4 keep installed backends working, but give #794 nothing: backends see S4 classes, and new properties reach only reinstalled backends. S7 generics break installed backends that define methods. The scripts and their recorded output sit beside the record, and .Rbuildignore now excludes experiments/. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd4HRcA4823NuBCC8TS
|
Responded. The remaining question is only in scope for the follow-up. |
The capture of arguments that DBI itself needs moves to a stacked pull request, together with the R 4.1 requirement it introduced for `...names()` and `...elt()`. The `dbConnect()` generic now keeps only its `drv` argument. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd6RgjpQxckjWTEReje
A connection created from a `DBIConnector` now keeps the inner driver, so that every connection keeps a real driver and the connector's arguments, which may contain credentials, are not copied into connections and results. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd6RgjpQxckjWTEReje
Clean review of the merge of
|
Apply the unwrapping repeatedly, up to a small depth, so that a connector whose `.drv` is itself a connector or a connection does not keep credentials or a live connection. Add tests that a connector's credentials are not serialized with connections and results. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd6RgjpQxckjWTEReje
Question: For a connector subclass with its own
|
Superseded: Accepted limitationsSuperseded by the current copy.
The limitation about DBI-level arguments that fail to evaluate moved to #800 with that code. Generated by Claude Code |
Question: Accept that objects saved before a backend is reinstalled fail
|
Superseded: Accepted limitationsSuperseded by the current copy.
The limitation about DBI-level arguments that fail to evaluate moved to #800 with that code. Generated by Claude Code |
How the slot question interacts with a move to S7Kirill asked how the slot question interacts with the move to S7 investigated in #795, and whether there will be slots. From the two S7 records on the branch of #795 and the experiment in #802:
So the S7 move does not resolve the slot question: it inherits it. The recommendation on the slot question stands; the S7 investigation adds that keeping the slot aligns with how S7 would declare Generated by Claude Code |
Accepted limitations
The limitation about DBI-level arguments that fail to evaluate moved to #800 with that code. Generated by Claude Code |
Adds a
.dbislot to the virtual base classesDBIConnection,DBIResult, andDBIResultArrow, and lets DBI's generics fill it after dispatch, for every backend and without changes to backends. First use case, as decided by Kirill: keep the driver object in each connection, and the connection object in each result and Arrow result. The capture of DBI-level arguments todbConnect()moved to the stacked #800, as Kirill asked.Changes
DBIConnection,DBIResult, andDBIResultArrowget a slot.dbiof classlist, with prototypelist();DBIResultArrowDefaultinherits it.DBIObject, and with itDBIDriverandDBIConnector, does not get it.dbConnect()generic stores the driver;dbSendQuery(),dbSendStatement(), anddbSendQueryArrow()storeconn. In the defaultdbSendQueryArrow()method, both the wrapper and the wrapped result get the connection.DBIConnector, the connection keeps the connector's inner driver, so the connector's arguments, possibly with credentials, are not copied into connections and results. A clone made withdbConnect(con)keeps the original connection's driver, not the original connection. Nested connectors and connections are unwrapped, up to a small depth.attr(), never@, in a helper that never fails or changes the return value (R/dbi-state.R). Internal readersdbi_driver(),dbi_connection(), anddbi_setting()returnNULLor the default when absent..dbi, that code reads it withattr(x, ".dbi", exact = TRUE), and that backends must not write to it.Compatibility
dbConnect(),dbSendQuery(),dbSendQueryArrow(),dbFetch(),dbClearResult(),validObject(), and the attributes are set..dbi, soidentical()comparisons andstr()output change. Serialized results grow; a duckdb result doubles (10000 → 20431 bytes). The bookkeeping costs about 7 µs per call.devtools::test()on R 4.5.3: 0 failures.Status
.dbirework), round 3 and its fixes (driver and connection), and the review of the merge ofmain, the move to #800, and the connector change (only Low findings, three fixed in e8769ad).validObject()on objects saved before a backend is reinstalled, or no slot at all, connector subclass that ignores@.drv, thetryCatch()guard, a backend's own.dbislot,attr()or@in the docs.dbConnect()in the.dbislot #800 (DBI-level arguments todbConnect()) and docs: Record what fails for backends installed against DBI without the.dbislot #802 (an experiment showing what fails for backends installed against DBI without the slot). S7 is investigated separately in docs: Investigate a move of DBI's classes to S7 #795. Independent of feat: Add internal lazy Arrow fetching, gated by a nanoarrow capability check #783.https://claude.ai/code/session_01Hr1rd6RgjpQxckjWTEReje
Generated by Claude Code