Skip to content

test: Keep a pending leak warning a warning in the warn = 2 test - #654

Merged
krlmlr merged 1 commit into
mainfrom
claude/deferred-warn-flaky
Nov 29, 2026
Merged

krlmlr merged 1 commit into
mainfrom
claude/deferred-warn-flaky

Conversation

@krlmlr

@krlmlr krlmlr commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Fixes the first item of #653.

test-deferred-warnings.R:55 runs dbFetch() under options(warn = 2) and expects the "Use dbExecute()" error. If a connection from an earlier test has been garbage-collected, its queued leak warning surfaces with that same call, as designed in #632. Under warn = 2 the leak warning then becomes the error, and the test fails, as it did in the R 4.3 job of run 46293140156. A calling handler now muffles only that leak warning, so the warning under test still becomes the error. It is a test-only change.

Tests: the handler was checked under warn = 2 with a stand-in function that warns with the leak message and then errors. The local database server is down, so the suite runs in CI only. The flake depends on garbage-collection timing, so a green run can't show it is gone.

The second item of #653, finding the test that leaves a connection to the garbage collector, is still open.

Accepted limitations

https://claude.ai/code/session_01Hr1rd5PUWgaCJzotWt9NhJ


Generated by Claude Code

krlmlr commented Nov 29, 2026

Copy link
Copy Markdown
Member Author

Accepted limitations

The clean review found nothing above Low. It confirmed three things. Calling handlers run before the warn = 2 conversion of the leak warning, which comes from C++ through cpp11::warning. The warning under test is raised separately, after the leak warning, so the handler can't muffle it. And the other warn = 2 tests in the file aren't exposed.

  • tests/testthat/test-deferred-warnings.R: a leak warning can also surface in dbSendStatement() just before, outside the handler. There it is a plain warning under the default warn, so testthat reports a warning and the test still passes. Relevance: low. Reviewer confidence: high.

Generated by Claude Code

@krlmlr
krlmlr merged commit e5943fc into main Nov 29, 2026
9 checks passed
@krlmlr
krlmlr deleted the claude/deferred-warn-flaky branch November 29, 2026 18:42
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