Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify Compatibility with network 1.19.0 #10

Open
CarterButts opened this issue Dec 4, 2024 · 7 comments
Open

Verify Compatibility with network 1.19.0 #10

CarterButts opened this issue Dec 4, 2024 · 7 comments

Comments

@CarterButts
Copy link

Hi, folks. I'm about to push network 1.19.0 (see the current github for the latest version), and revdep check suggests that there could be an issue with networkLite. The issues seem to arise in test-all.R, calling test-networkLite.R. It looks to be arising from the tibble-based methods. The output is such:

R version 4.4.2 (2024-10-31) -- "Pile of Leaves"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-redhat-linux-gnu

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(testthat)
> test_check("networkLite")
Loading required package: networkLite
Loading required package: network

'network' 1.19.0 (2024-12-04), part of the Statnet Project
* 'news(package="network")' for changes since last version
* 'citation("network")' for citation information
* 'https://statnet.org' for help, support, and other information

[ FAIL 12 | WARN 7 | SKIP 0 | PASS 3034 ]

══ Failed tests ════════════════════════════════════════════════════════════════
── Failure ('test-networkLite.R:683:11'): network and networkLite produce identical matrices, edgelists, and tibbles ──
`tbl` not identical to tibble::as_tibble(nwL, attrname = attrname, na.rm = na.rm).
Attributes: < Names: 4 string mismatches >
Attributes: < Length mismatch: comparison on first 4 components >
Attributes: < Component 1: Modes: logical, character >
Attributes: < Component 1: Lengths: 1, 3 >
Attributes: < Component 1: target is logical, current is character >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: Lengths: 3, 1 >
Attributes: < Component 2: target is character, current is numeric >
Attributes: < Component 3: Numeric: lengths (1, 94) differ >
...
── Failure ('test-networkLite.R:683:11'): network and networkLite produce identical matrices, edgelists, and tibbles ──
`tbl` not identical to tibble::as_tibble(nwL, attrname = attrname, na.rm = na.rm).
Attributes: < Names: 4 string mismatches >
Attributes: < Length mismatch: comparison on first 4 components >
Attributes: < Component 1: Modes: logical, character >
Attributes: < Component 1: Lengths: 1, 3 >
Attributes: < Component 1: target is logical, current is character >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: Lengths: 3, 1 >
Attributes: < Component 2: target is character, current is numeric >
Attributes: < Component 3: Numeric: lengths (1, 43) differ >
...
── Failure ('test-networkLite.R:683:11'): network and networkLite produce identical matrices, edgelists, and tibbles ──
`tbl` not identical to tibble::as_tibble(nwL, attrname = attrname, na.rm = na.rm).
Attributes: < Names: 4 string mismatches >
Attributes: < Length mismatch: comparison on first 4 components >
Attributes: < Component 1: Modes: logical, character >
Attributes: < Component 1: Lengths: 1, 3 >
Attributes: < Component 1: target is logical, current is character >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: Lengths: 3, 1 >
Attributes: < Component 2: target is character, current is numeric >
Attributes: < Component 3: Numeric: lengths (1, 94) differ >
...
── Failure ('test-networkLite.R:683:11'): network and networkLite produce identical matrices, edgelists, and tibbles ──
`tbl` not identical to tibble::as_tibble(nwL, attrname = attrname, na.rm = na.rm).
Attributes: < Names: 4 string mismatches >
Attributes: < Length mismatch: comparison on first 4 components >
Attributes: < Component 1: Modes: logical, character >
Attributes: < Component 1: Lengths: 1, 3 >
Attributes: < Component 1: target is logical, current is character >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: Lengths: 3, 1 >
Attributes: < Component 2: target is character, current is numeric >
Attributes: < Component 3: Numeric: lengths (1, 43) differ >
...
── Failure ('test-networkLite.R:683:11'): network and networkLite produce identical matrices, edgelists, and tibbles ──
`tbl` not identical to tibble::as_tibble(nwL, attrname = attrname, na.rm = na.rm).
Attributes: < Names: 4 string mismatches >
Attributes: < Length mismatch: comparison on first 4 components >
Attributes: < Component 1: Modes: logical, character >
Attributes: < Component 1: Lengths: 1, 3 >
Attributes: < Component 1: target is logical, current is character >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: Lengths: 3, 1 >
Attributes: < Component 2: target is character, current is numeric >
Attributes: < Component 3: Numeric: lengths (1, 94) differ >
...
── Failure ('test-networkLite.R:683:11'): network and networkLite produce identical matrices, edgelists, and tibbles ──
`tbl` not identical to tibble::as_tibble(nwL, attrname = attrname, na.rm = na.rm).
Attributes: < Names: 4 string mismatches >
Attributes: < Length mismatch: comparison on first 4 components >
Attributes: < Component 1: Modes: logical, character >
Attributes: < Component 1: Lengths: 1, 3 >
Attributes: < Component 1: target is logical, current is character >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: Lengths: 3, 1 >
Attributes: < Component 2: target is character, current is numeric >
Attributes: < Component 3: Numeric: lengths (1, 43) differ >
...
── Failure ('test-networkLite.R:683:11'): network and networkLite produce identical matrices, edgelists, and tibbles ──
`tbl` not identical to tibble::as_tibble(nwL, attrname = attrname, na.rm = na.rm).
Attributes: < Names: 4 string mismatches >
Attributes: < Length mismatch: comparison on first 4 components >
Attributes: < Component 1: Modes: logical, character >
Attributes: < Component 1: Lengths: 1, 3 >
Attributes: < Component 1: target is logical, current is character >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: Lengths: 3, 1 >
Attributes: < Component 2: target is character, current is numeric >
Attributes: < Component 3: Numeric: lengths (1, 98) differ >
...
── Failure ('test-networkLite.R:683:11'): network and networkLite produce identical matrices, edgelists, and tibbles ──
`tbl` not identical to tibble::as_tibble(nwL, attrname = attrname, na.rm = na.rm).
Attributes: < Names: 4 string mismatches >
Attributes: < Length mismatch: comparison on first 4 components >
Attributes: < Component 1: Modes: logical, character >
Attributes: < Component 1: Lengths: 1, 3 >
Attributes: < Component 1: target is logical, current is character >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: Lengths: 3, 1 >
Attributes: < Component 2: target is character, current is numeric >
Attributes: < Component 3: Numeric: lengths (1, 41) differ >
...
── Failure ('test-networkLite.R:683:11'): network and networkLite produce identical matrices, edgelists, and tibbles ──
`tbl` not identical to tibble::as_tibble(nwL, attrname = attrname, na.rm = na.rm).
Attributes: < Names: 4 string mismatches >
Attributes: < Length mismatch: comparison on first 4 components >
Attributes: < Component 1: Modes: logical, character >
Attributes: < Component 1: Lengths: 1, 3 >
Attributes: < Component 1: target is logical, current is character >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: Lengths: 3, 1 >
Attributes: < Component 2: target is character, current is numeric >
Attributes: < Component 3: Numeric: lengths (1, 98) differ >
...
── Failure ('test-networkLite.R:683:11'): network and networkLite produce identical matrices, edgelists, and tibbles ──
`tbl` not identical to tibble::as_tibble(nwL, attrname = attrname, na.rm = na.rm).
Attributes: < Names: 4 string mismatches >
Attributes: < Length mismatch: comparison on first 4 components >
Attributes: < Component 1: Modes: logical, character >
Attributes: < Component 1: Lengths: 1, 3 >
Attributes: < Component 1: target is logical, current is character >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: Lengths: 3, 1 >
Attributes: < Component 2: target is character, current is numeric >
Attributes: < Component 3: Numeric: lengths (1, 41) differ >
...
── Failure ('test-networkLite.R:683:11'): network and networkLite produce identical matrices, edgelists, and tibbles ──
`tbl` not identical to tibble::as_tibble(nwL, attrname = attrname, na.rm = na.rm).
Attributes: < Names: 4 string mismatches >
Attributes: < Length mismatch: comparison on first 4 components >
Attributes: < Component 1: Modes: logical, character >
Attributes: < Component 1: Lengths: 1, 3 >
Attributes: < Component 1: target is logical, current is character >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: Lengths: 3, 1 >
Attributes: < Component 2: target is character, current is numeric >
Attributes: < Component 3: Numeric: lengths (1, 98) differ >
...
── Failure ('test-networkLite.R:683:11'): network and networkLite produce identical matrices, edgelists, and tibbles ──
`tbl` not identical to tibble::as_tibble(nwL, attrname = attrname, na.rm = na.rm).
Attributes: < Names: 4 string mismatches >
Attributes: < Length mismatch: comparison on first 4 components >
Attributes: < Component 1: Modes: logical, character >
Attributes: < Component 1: Lengths: 1, 3 >
Attributes: < Component 1: target is logical, current is character >
Attributes: < Component 2: Modes: character, numeric >
Attributes: < Component 2: Lengths: 3, 1 >
Attributes: < Component 2: target is character, current is numeric >
Attributes: < Component 3: Numeric: lengths (1, 41) differ >
...

[ FAIL 12 | WARN 7 | SKIP 0 | PASS 3034 ]
Error: Test failures
Execution halted

We need to push network in the next three days, so it would be great if you could check this - don't want to cause issues when we push! Thanks!!

@krivit
Copy link
Collaborator

krivit commented Dec 5, 2024

Is this against the CRAN version or the https://github.com/EpiModel/networkLite version?

@CarterButts
Copy link
Author

This is against the CRAN version of networkLite. I just tried testing the github version, but it requires a statnet.common version that is greater than the version that is on CRAN. (Probably best not to put hard dependencies on packages that are not available, since no one can then use this package. I try to avoid version constraints unless absolutely necessary.)

@CarterButts
Copy link
Author

OK, I manually updated statnet.commons to the latest github version, and installed the github version of networkLite. With network 1.19, running local tests gives me the following:

R version 4.4.2 (2024-10-31) -- "Pile of Leaves"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-redhat-linux-gnu

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(testthat)
> test_local()
✔ | F W  S  OK | Context
✔ |   7    3581 | networkLite [7.0s]                                            
────────────────────────────────────────────────────────────────────────────────
Warning (test-networkLite.R:106:3): net_attr overrides attributes(x)
first element used of 'length.out' argument
Backtrace:
    ▆
 1. ├─testthat::expect_error(...) at test-networkLite.R:106:3
 2. │ └─testthat:::quasi_capture(...)
 3. │   ├─testthat (local) .capture(...)
 4. │   │ └─base::withCallingHandlers(...)
 5. │   └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
 6. ├─networkLite::networkLite(el, net_attr = list(newattr = "val"))
 7. └─networkLite:::networkLite.edgelist(el, net_attr = list(newattr = "val")) at networkLite/R/constructors.R:68:3
 8.   └─tibble::as_tibble(attr) at networkLite/R/constructors.R:97:3

Warning (test-networkLite.R:314:3): setting vertex and edge attributes in strange ways
number of items to replace is not a multiple of replacement length
Backtrace:
    ▆
 1. ├─network::set.edge.attribute(nwL, "ae1", 1:2, c(1, 2, 4)) at test-networkLite.R:314:3
 2. └─networkLite:::set.edge.attribute.networkLite(...)

Warning (test-networkLite.R:315:3): setting vertex and edge attributes in strange ways
number of items to replace is not a multiple of replacement length
Backtrace:
    ▆
 1. ├─network::set.edge.attribute(nwL, "ae2", 1:3, c(3, 1, 4, 2)) at test-networkLite.R:315:3
 2. └─networkLite:::set.edge.attribute.networkLite(...)

Warning (test-networkLite.R:317:3): setting vertex and edge attributes in strange ways
number of items to replace is not a multiple of replacement length
Backtrace:
    ▆
 1. ├─network::set.vertex.attribute(nwL, "av2", c("1", "2", "3"), 1:2) at test-networkLite.R:317:3
 2. └─networkLite:::set.vertex.attribute.networkLite(...)

Warning (test-networkLite.R:326:3): setting vertex and edge attributes in strange ways
number of items to replace is not a multiple of replacement length
Backtrace:
    ▆
 1. ├─network::set.edge.attribute(...) at test-networkLite.R:326:3
 2. └─networkLite:::set.edge.attribute.networkLite(...)

Warning (test-networkLite.R:327:3): setting vertex and edge attributes in strange ways
number of items to replace is not a multiple of replacement length
Backtrace:
    ▆
 1. ├─network::set.edge.attribute(...) at test-networkLite.R:327:3
 2. └─networkLite:::set.edge.attribute.networkLite(...)

Warning (test-networkLite.R:329:3): setting vertex and edge attributes in strange ways
number of items to replace is not a multiple of replacement length
Backtrace:
    ▆
 1. ├─network::set.vertex.attribute(...) at test-networkLite.R:329:3
 2. └─networkLite:::set.vertex.attribute.networkLite(...)
────────────────────────────────────────────────────────────────────────────────

══ Results ═════════════════════════════════════════════════════════════════════
Duration: 7.1 s

[ FAIL 0 | WARN 7 | SKIP 0 | PASS 3581 

I can't run it against the old network version, since it depends on 1.19, so there's no way to know if these are existing issues. But the warnings seem likely to set off CRAN. Anyway, the real question is whether this needs to be fixed right away, or whether I can tell CRAN that this is being worked on and will be corrected imminently. Since this version of networkLite is presumably waiting on the network release, I would presume that it's mostly ready to go? Just need to make sure I'm not creating more problems than I'm solving!

@krivit
Copy link
Collaborator

krivit commented Dec 5, 2024

This is against the CRAN version of networkLite. I just tried testing the github version, but it requires a statnet.common version that is greater than the version that is on CRAN. (Probably best not to put hard dependencies on packages that are not available, since no one can then use this package. I try to avoid version constraints unless absolutely necessary.)

This is for the modify_in_place() function, which uses a more elegant (in my opinion) implementation for modifying arguments in place, described at statnet/network#88 . In a pinch, it could probably be brought into networkLite for the time being.

@krivit
Copy link
Collaborator

krivit commented Dec 5, 2024

But the warnings seem likely to set off CRAN.

These warnings are internal to testthat, and they mostly stem from feeding the packages weird input to see if they respond in the same way. I'll wrap them in expect_warning(). On the other hand, the first one might indicate a bug.

krivit added a commit that referenced this issue Dec 5, 2024
…d be eliminated for consistency with 'network' (or added to 'network').

references #10
@CarterButts
Copy link
Author

Not sure. FWIW, I also tightened up some code (in both the R and the C side) that could in theory cause issues if abusive calls were made. (One of these was previously protected, but a change associated with the switch to generic functions exposed it.) Depending on what the weird inputs are, that could be pertinent. To meet the deadline, I've pushed the current version of network to CRAN, but we'll see if it makes it past the gauntlet.

@CarterButts
Copy link
Author

OK, I had an exciting issue with some code that caused massive issues with some packages (and that was not caught by revdepcheck), but I was able to remove it, and eventually got 1.19.0 through. So at this point, the 1.19.0 on github should be the compatibility target. I presume that the CRAN folks will be knocking ere long, but hopefully changing those test settings will have resolved the problem. Thanks!

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

No branches or pull requests

2 participants