Repository navigation
test: Run the HTTP VFS tests for real, and make their errors fail the check - #832
Conversation
|
Review of this PR at 7d6d556, by a Claude Code reviewer with clean context that read the description, the diff and the parts of Setup. Linux with R 4.5.3, libcurl 8.5.0, httpuv 1.6.17, callr 3.8.0, testthat 3.3.2 and withr 3.0.3. The environment sets What was run. The HTTP tests ran 30 times in fresh processes, 15 times within one process and 3 times with the dead proxies, with What holds.
HighNone. Medium1. The description says this PR's CI is the helper's first run outside Linux, but CI on this PR ran only the Linux smoke test; the macOS and Windows jobs were skipped. By reading the check runs of 7d6d556 and the workflow: for a 2. The VFS sets no libcurl timeouts, and this PR is what makes CI depend on its transfers, so a server that stops answering blocks Low3. 4. Each killed server child leaves its empty 5. 6. If libcurl stops arriving on a runner, these tests turn into a silent skip. By reading: 7. testthat still hides an error that is followed by any other result, so the trap remains for future tests. The scan above is Confirmed; the rest is by reading the testthat 3.3.2 source. This PR removes the trigger in Generated by Claude Code |
Superseded: Accepted limitationsSuperseded by this comment. The clean review of 7d6d5563 found no High issue, two Medium and five Low ones. Being fixed: libcurl timeouts, so a stalled server cannot hang
Generated by Claude Code |
|
Review of the fixes at 4beb1b3 (the three commits after 7d6d556), by a Claude Code reviewer with clean context that read the pull request description, the first review and the "Accepted limitations" comment, the diff Setup. Linux with R 4.5.3, libcurl 8.5.0 (threaded resolver), httpuv 1.6.17, callr 3.8.0 and testthat 3.3.2. As in the first review, the environment sets only What was run. The three What holds.
HighNone. MediumNone. Low1. No test triggers an interrupt, so the abort path is untested on every platform. The matrix shows that the callback in 2. The stall test passes just as well when nothing is listening. Confirmed: 3. The new variables quietly turn odd values into something else. 4. 5. Pre-existing: a HEAD that fails with an HTTP status or a reset leaves the size unknown, and the open succeeds on an empty database. Confirmed at both commits: with a server that answers the HEAD with 503, or resets it, and serves the GETs normally, Generated by Claude Code |
Superseded: Accepted limitationsSuperseded by this comment. The first clean review found two Medium and five Low issues; both Medium and four Low ones are fixed up to 4beb1b3, which the second clean review confirmed without High or Medium findings, and the full check matrix on this branch (run 42858776332) is green on all 15 jobs, macOS and Windows included. Four of the second review's Low findings are fixed in 2dde544 and 2d62a02: a test of the interrupt, a request count in the stall test, clamped timeout values, and a fallback for libcurl older than 7.32.0; the request count proves the HEAD reached a live server, but cannot show that the GET is skipped after it times out, since the test server stops reading requests while it stalls. These remain:
Generated by Claude Code |
|
Review of the fixes at 2d62a02 (the two commits after 4beb1b3), by a Claude Code reviewer with clean context that read the pull request description, the second review and the "Accepted limitations" comment, the diff What was run. The three What holds.
HighNone. MediumNone. Low1. The interrupt test assumes the session reaches the transfer within one second. Confirmed. Here the session needs 0.45 to 0.51 s from 2. The interrupt test fails instead of skipping when the session cannot use the package under test. Confirmed: with RSQLite loaded from a library that is not on 3. A handle whose options cannot be set fails the open with "SQL logic error". Confirmed with the shim. When it has no handle, the probe, 4. The documentation of the timeout values does not quite match the code. Generated by Claude Code |
Superseded: Accepted limitationsSuperseded by this comment. The first clean review found two Medium and five Low issues, the second and the third none above Low. All of their Low findings are fixed up to fa0b234, except the two below; the request count of the stall test proves the HEAD reached a live server, but cannot show that the GET is skipped after it times out, since the test server stops reading requests while it stalls. The full check matrix on this branch was green on all 15 jobs, macOS and Windows included, at 4beb1b3, at 2d62a02 and at fa0b234. These remain:
Generated by Claude Code |
|
Split the PR. Scoped follow-up PRs and issues for the discovered problems. |
fa0b234 to
7ff6e79
Compare
|
CI note for the whole stack: the smoke test of #832, #839, #840, #841, #842 and #843 failed before any R code ran. The shared install step could not resolve the Ubuntu package mirrors ( Generated by Claude Code |
Superseded: Accepted limitationsSuperseded by this comment. The first clean review found two Medium and five Low issues, the second and the third none above Low. All of their Low findings are fixed up to fa0b234, except the two below; the request count of the stall test proves the HEAD reached a live server, but cannot show that the GET is skipped after it times out, since the test server stops reading requests while it stalls. The full check matrix on this branch was green on all 15 jobs, macOS and Windows included, at 4beb1b3, at 2d62a02 and at fa0b234. These remain:
Generated by Claude Code |
|
Review of the split stack #832 → #839 → #840 → #841 → #842 → #843 at heads 7ff6e79, 6b8bc7d, a8a25db, 98af1cb, b9e1533 and 6514b4f, by a Claude Code reviewer with clean context that read the six descriptions and commit messages, the three earlier clean reviews and the "Accepted limitations" comment on #832, each layer's diff, and the parts of What was run.
What holds.
HighNone. MediumNone. Low1. Until #842 merges, the HTTP tests that #832 turns on make network transfers with no libcurl timeout, so a stalled server would hang 2. No layer below the top has a CI run of its own tree, and the matrix result the descriptions cite covers only the top. By reading the check runs: the smoke test failed on all six heads before any R code ran, and a pull request from a non-fork branch never builds the matrix ( 3. 4. #832 adds the request log and 5. #839 has no regression test, although the stack already runs the package in a second process. By reading: the description says the headers go to C-level stdout, which only a second process could capture; #843's Generated by Claude Code |
Accepted limitationsThe clean review of the split found nothing above Low. Its finding 3 is fixed in #842 and carried into #843; its finding 2, a CI run of this layer's own tree, is done: the full check matrix on this branch, macOS, Windows and arm64 included, is green on all 15 jobs (run); its finding 5 concerns #839. These remain here, together with what the reviews of the combined version left:
Generated by Claude Code |
… check The three tests in `test-httpvfs.R` that start a local server failed on every CI run, yet `R CMD check` passed. Each test's cleanup disconnected a fixture connection that was already closed, and testthat counts a test as errored only when the error is its last result, so the "Already disconnected" warning that followed hid the error. The fixture database is now built and closed in its own scope, `http_test_db()`, and the remote connection's cleanup is registered with `withr::defer()` only once it has opened, so an error stays the last result and fails the check. The URL now carries the `file:` prefix, through `http_vfs_uri()` or `sqliteRemote()`, without which SQLite ignores `vfs=http` and opens a local file of that name. The server runs in a separate process started with `callr::r_bg()`, by `local_http_server()` in the new `helper-httpvfs.R`, because the VFS blocks the R process while it waits for a response, so an httpuv server in the same process never answers. The server gets the test's temporary directory as its `TMPDIR`, so the session directory it leaves behind when killed is removed with it, and it logs the bytes it sends and the method of each request it receives. It answers HEAD requests without a body, which httpuv would otherwise send and so corrupt the next response on the kept-alive connection. The Range test compares the process-wide counters of `sqliteHttpStats()` with their values before the query, checks that the server sent less than the whole file, and pads the database so that the query reads only a fraction of it. The test for a server without Range support expects the "disk I/O error" that the open reports. The HTTP VFS cannot load the default extensions yet, so the test that opens the database with `dbConnect()` passes `default.extensions = FALSE`. The tests skip with a reason when the HTTP VFS is not compiled in, and fail instead when `RSQLITE_TEST_HTTPVFS=true` is set, which the custom after-install step of CI now does, so that losing libcurl on a runner is noticed. They also fail when the VFS is compiled in but cannot be registered. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd3gjmufoKCWVDBPCgE
7ff6e79 to
39f0ce4
Compare
Brings in #832, #839, #840, #841 and the workflow sync #912; adds the HTTP VFS fixes to NEWS, and declares rmarkdown as a vignette builder, as #915 does on main. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd6znpbaJUu6TJLjgQC
The three tests in
tests/testthat/test-httpvfs.Rthat start a local httpuv server have failed on every CI run,mainincluded, whileR CMD checkreportedStatus: OK. The testthat summary in the logs reads[ FAIL 3 | ... ], but each test's cleanup then disconnected a fixture connection that was already closed, and testthat only counts a test as errored when the error is its last result (summarize_one_test_results()), so the "Already disconnected" warning recorded after the error hid it fromtest_check(); #837 tracks that trap. This came up on #829, where the maintainer asked for a fix frommainthat makes such errors fail loudly. This pull request makes those errors fail the check and makes the tests run for real against the HTTP VFS onmain. The fixes for what they found are stacked on top of it, as listed below.Masking. The fixture database is built and closed in its own scope (
http_test_db()), and the remote connection's cleanup is registered withwithr::defer()only once the connection has opened. An error therefore stays the last result of the test. With only this change,test_local(stop_on_failure = TRUE)on the old tests stops with "Test failures."The tests themselves. The URL now carries the
file:prefix (viahttp_vfs_uri()orsqliteRemote()); without it SQLite ignoresvfs=httpand opens a local file of that name. The server runs in a separate R process started withcallr::r_bg()(local_http_server()in the newhelper-httpvfs.R): the VFS performs blocking libcurl requests on the main R thread, so an httpuv app in the same process can never answer. The child gets the test's temporary directory as itsTMPDIR, so the session directory it leaves behind when killed is removed with it, and it logs each request it receives. The test server answers HEAD without a body; httpuv otherwise sends the body for HEAD too, which corrupts the next response on the kept-alive connection and made some runs fail with libcurl's "HTTP/0.9 not allowed" error. The Range test compares therange_requestsandbytes_fetchedcounters ofsqliteHttpStats()with their values before the query, because they are process-wide, checks that the server sent less than the whole file, and pads the database so that the query reads only a fraction of it. The test for a server without Range support expects the "disk I/O error" that the open actually reports. The first test passesdefault.extensions = FALSE, since the default extensions cannot load over the HTTP VFS onmain; #840 removes that. The tests skip with "HTTP VFS not compiled in (configure did not find libcurl)" when the VFS is not built, unlessRSQLITE_TEST_HTTPVFS=trueis set, in which case they fail; they also fail if the VFS is built but cannot be registered.Until #842. These tests now make real transfers, and the HTTP VFS sets no libcurl timeout until #842, so a server that accepts a connection and never answers would hang the check; the test server answered in every run so far. Merge #832 through #842 together, or at least without a release in between.
CI coverage. No workflow installs libcurl headers for RSQLite on purpose, and
DESCRIPTIONdeclares noSystemRequirementsfor it. They arrive anyway:libcurl4-openssl-devis the system requirement of thecurlpackage, which the suggested packages gh, gert and rvest pull in, and macOS and Windows find libcurl on their own. The custom after-install step now setsRSQLITE_TEST_HTTPVFS=true, so losing libcurl on a runner fails the tests instead of skipping them. On this pull request, CI runs only the Linux smoke test, since the versions matrix is built for pull requests only from forks orcran-*branches; the full matrix (macOS, Windows, arm64, R 4.2 to devel) ran green on all 15 jobs, with the HTTP tests on each, at fa0b234, the last head of the earlier combined version of this pull request (run).The stack. As the maintainer asked, the earlier combined version is split into scoped pull requests, each based on the one before:
sqliteRemote()loads the default extensions #841:sqliteRemote()loads the default extensions;The top of the stack has the same tree as fa0b234 merged with
main, apart from a corrected sentence in?sqliteHttpConfig. The problems found along the way that none of these fix are #834, #835, #836 and #837.Reviews. Three clean reviews of the combined version (first, second, third) found no High issue, and their Medium and Low findings are fixed in the layers they concern. A clean review of the split found nothing above Low; its documentation finding is fixed in #842, the full check matrix on this branch is green on all 15 jobs (run), and what remains is under Accepted limitations.
https://claude.ai/code/session_01Hr1rd3gjmufoKCWVDBPCgE
Generated by Claude Code