r-lib / covr

Test coverage reports for R
https://covr.r-lib.org
Other
335 stars 115 forks source link

Error in exclude() 'from must be a finite number' for seq() usage #576

Open MichaelChirico opened 1 month ago

MichaelChirico commented 1 month ago

Same error as old #322, but not related; this is coming from a different stack trace entirely:

9: stop("'from' must be a finite number")
8: seq.default(df[i, "first_line"], df[i, "last_line"])
7: seq(df[i, "first_line"], df[i, "last_line"])
6: seq(df[i, "first_line"], df[i, "last_line"]) %in% excl[[file]]
5: FUN(X[[i]], ...)
4: vapply(X, FUN, ..., FUN.VALUE = logical(1))
3: vlapply(seq_len(NROW(df)), function(i) {
       file <- df[i, "full_name"]
       which_exclusion <- match(file, names(excl))
       !is.na(which_exclusion) && (identical(excl[[which_exclusion]], 
           Inf) || all(seq(df[i, "first_line"], df[i, "last_line"]) %in% 
           excl[[file]]))
   })
2: exclude(coverage, line_exclusions = line_exclusions, function_exclusions = function_exclusions, 
       path = root)
1: covr::package_coverage()

Most likely this is related to #567. I am trying to reproduce the CI error locally, to no avail.

I will note that package_coverage() felt interminable -- the execution took at least 40 minutes. There was no segfault, though it did not succeed.

I'll try and debug the error but given the run times it's very hard to reproduce; filing first.

MichaelChirico commented 1 month ago

OK, there's a missing row in df

subset(df, is.na(first_line))
#           filename    functions first_line first_byte last_line last_byte first_column last_column first_parsed
# 135 R/data.table.R [.data.table         NA         NA        NA        NA           NA          NA           NA
#     last_parsed value                                      full_name
# 135          NA     1 /home/michael/github/data.table/R/data.table.R

That's correctly copied over from the coverage object:

coverage[[135L]]
# $value
# [1] 1

# $srcref
# <srcref: file "/home/michael/github/data.table/R/data.table.R" chars NA:NA to NA:NA>

# $functions
# [1] "[.data.table"

I see the same in the trace_files and that's about as far into the weeds as I'll get for now.