From 6b545b580cab84e60007f466de22ab1c65651947 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 27 Jul 2026 19:08:02 +0000 Subject: [PATCH 1/3] test: pin `warnPartialMatchArgs` so its scoped enable unwinds on R < 4.3 The "head args go through base R partial matching" test enables `warnPartialMatchArgs` via `rlang::local_options()`. On R < 4.3, restoring the option to NULL (unset) at test exit does not switch the warning off again -- the internal flag keeps its last set value -- so the warning leaked into every later test in the file. On the rcc-full ubuntu-26.04 (4.2) leg this rewrote tests/testthat/_snaps/migration-fixture.md, prepending "partial argument match of 'di' to 'dimvector'" to the forbidden-prefix guard snapshot, and failed the update-snapshots step (snapshot PR #2796). Pin the option to FALSE before flipping it on, so the scoped restore lands on FALSE -- which does reset the flag -- on every R version. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_016M32izVHZPfxAqemAe4BrX --- tests/testthat/test-migration-fixture.R | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/testthat/test-migration-fixture.R b/tests/testthat/test-migration-fixture.R index 40327e5bc2d..1b607dc8c4f 100644 --- a/tests/testthat/test-migration-fixture.R +++ b/tests/testthat/test-migration-fixture.R @@ -72,6 +72,12 @@ test_that("head args go through base R partial matching, not our recovery", { # recovery. With `warnPartialMatchArgs` on, R emits its own partial-match # warning and our deprecation does not fire; when a tail arg is abbreviated # too, both warnings appear -- R's for the head, ours for the tail. + # + # Pin the option to FALSE before flipping it on: on R < 4.3, restoring + # `warnPartialMatchArgs` to NULL (unset) does not switch the warning off + # again, so it would leak into every later test and (on R 4.2) add a + # partial-match warning to the `migration_fixture_prefix()` snapshots below. + options(warnPartialMatchArgs = FALSE) rlang::local_options( lifecycle_verbosity = "warning", warnPartialMatchArgs = TRUE From 982556a0a95319bd34c9c01a57d49f043c6f050c Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 27 Jul 2026 19:15:11 +0000 Subject: [PATCH 2/3] fix: name arguments at the two call sites that trip the lifecycle-errors leg #2782 added an rcc-full leg (IGRAPH_LIFECYCLE_ERRORS=true) that fails any test in which an unasserted lifecycle deprecation fires. The ellipsis refactors that merged after #2782 was cut left two call sites behind: `plot.igraph()` called `norm_coords(layout, -1, 1, -1, 1)` positionally, and tests called `make_star(5, "undirected")` with positional `mode`. Together they account for all 36 deprecation warnings in the default test run, and each would fail its test on the new leg -- which has never executed yet because the smoke gate broke first. Name the arguments at both sites. With this, the full suite passes with IGRAPH_LIFECYCLE_ERRORS=true: FAIL 0 (plus the sandbox-only test-foreign.R network error), WARN 0. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_016M32izVHZPfxAqemAe4BrX --- R/plot.R | 2 +- tests/testthat/test-centralization.R | 6 +++--- tests/testthat/test-stochastic_matrix.R | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/R/plot.R b/R/plot.R index 48d02cc0f0f..d77c6b53272 100644 --- a/R/plot.R +++ b/R/plot.R @@ -176,7 +176,7 @@ plot.igraph <- function( if (is.null(ylim)) { ylim <- c(-1, 1) } - layout <- norm_coords(layout, -1, 1, -1, 1) + layout <- norm_coords(layout, xmin = -1, xmax = 1, ymin = -1, ymax = 1) fact <- (1 - vertex.size.scaling) maxv <- 1 / 200 * max(vertex.size) diff --git a/tests/testthat/test-centralization.R b/tests/testthat/test-centralization.R index 7fbec76ed49..9161e1262e2 100644 --- a/tests/testthat/test-centralization.R +++ b/tests/testthat/test-centralization.R @@ -50,7 +50,7 @@ test_that("centr_degree() covers migrated tail args and positional recovery", { test_that("centr_betw() covers migrated tail args and positional recovery", { rlang::local_options(lifecycle_verbosity = "warning") - g <- make_star(5, "undirected") + g <- make_star(5, mode = "undirected") res <- centr_betw(g, directed = FALSE, normalized = FALSE) # The centre lies on the geodesics of all 6 leaf pairs. @@ -66,7 +66,7 @@ test_that("centr_betw() covers migrated tail args and positional recovery", { test_that("centr_betw_tmax() covers migrated tail args and positional recovery", { rlang::local_options(lifecycle_verbosity = "warning") - g <- make_star(5, "undirected") + g <- make_star(5, mode = "undirected") # The graph form and the vertex-count form must agree. expect_equal(centr_betw_tmax(g, directed = FALSE), 24) @@ -125,7 +125,7 @@ test_that("centr_clo_tmax() covers migrated tail args and positional recovery", test_that("centralize() covers migrated tail args and positional recovery", { rlang::local_options(lifecycle_verbosity = "warning") - scores <- degree(make_star(5, "undirected")) + scores <- degree(make_star(5, mode = "undirected")) # The star's degree sequence gives sum(max - x) = 12. expect_equal(centralize(scores, theoretical.max = 12, normalized = TRUE), 1) diff --git a/tests/testthat/test-stochastic_matrix.R b/tests/testthat/test-stochastic_matrix.R index 5561eb94a21..89caf13d35e 100644 --- a/tests/testthat/test-stochastic_matrix.R +++ b/tests/testthat/test-stochastic_matrix.R @@ -20,7 +20,7 @@ test_that("stochastic_matrix works", { # and the legacy positional recovery path. test_that("stochastic_matrix() returns a sparse matrix when `sparse = TRUE`", { - g <- make_star(5, "undirected") + g <- make_star(5, mode = "undirected") W <- stochastic_matrix(g, sparse = TRUE) expect_s4_class(W, "Matrix") # The sparse and dense forms describe the same stochastic matrix. @@ -31,7 +31,7 @@ test_that("stochastic_matrix() returns a sparse matrix when `sparse = TRUE`", { }) test_that("stochastic_matrix() recovers a legacy positional `column.wise`", { - g <- make_star(5, "undirected") + g <- make_star(5, mode = "undirected") lifecycle::expect_deprecated( W <- stochastic_matrix(g, TRUE) ) From 6fcaca35ef738de8049f5701c69057aa6d300371 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 27 Jul 2026 19:18:16 +0000 Subject: [PATCH 3/3] test: skip the forbidden-prefix guard snapshot on R < 4.3 On the rcc-full ubuntu-26.04 (4.2) leg, this snapshot records an extra Warning in `migration_fixture_prefix()`: partial argument match of 'di' to 'dimvector' ahead of the guard error, which rewrites tests/testthat/_snaps/migration-fixture.md and keeps force-pushing snapshot PR #2796. Per maintainer decision, skip the test on R 4.2, mirroring the existing version-gated skips (e.g. test-adjacency.R, test-community.R). The `warnPartialMatchArgs` pin in the previous commit already removes the R 4.2 leak that produced the extra warning; the skip makes the intent explicit and keeps the snapshot single-variant on older R either way. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_016M32izVHZPfxAqemAe4BrX --- tests/testthat/test-migration-fixture.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/testthat/test-migration-fixture.R b/tests/testthat/test-migration-fixture.R index 1b607dc8c4f..f5debcb118f 100644 --- a/tests/testthat/test-migration-fixture.R +++ b/tests/testthat/test-migration-fixture.R @@ -139,6 +139,11 @@ test_that("abbreviations longer than the head arg are recovered", { }) test_that("forbidden prefixes error only when legacy arguments engage recovery", { + ## The snapshot differs on R 4.2: `warnPartialMatchArgs` enabled earlier in + ## this file leaks through its scoped restore there (see above), adding a + ## partial-match warning to the recorded condition. Skip on older R. + skip_if(getRversion() < "4.3") + # `di =` steals the head slot `dimvector`, `c(2, 2)` shifts into `p`, # and `0.5` lands in `...`: # recovery would rescue this never-valid call behind a deprecation