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

1352 functions in data raise warnings #1353

Conversation

chlebowa
Copy link
Contributor

@chlebowa chlebowa commented Sep 26, 2024

Fixes #1352

One warning is removed by extending the defunction call in create_app_id to the data argument.
The other is removed by applying defunction to the contents of data when calculating hashes for the integrity check.

Improved recursion condition in function defunction.

@chlebowa
Copy link
Contributor Author

Tests pass locally now.

@m7pr
Copy link
Contributor

m7pr commented Oct 2, 2024

I see 58 issues in tests on local when I run tests for below dependencies. Those are the same as appear in GitHub Actions

devtools::test_file('tests/testthat/test-module_teal.R')
> packageVersion('teal.slice')
[1] '0.5.1.9011'
> packageVersion('teal.data')
[1] '0.6.0.9010'
> packageVersion('teal') #teal comes from this fork
[1] '0.15.2.9066'

Copy link
Contributor

@m7pr m7pr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@gogonzo gogonzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defunction is a private function. It can't be exposed in show R code!

@chlebowa
Copy link
Contributor Author

defunction is a private function. It can't be exposed in show R code!

It is not:

foo <- function() cat("hi\n")
mtcars <- mtcars
stopifnot(rlang::hash(foo) == "f5343390f4f30d7df3658452ee946a23")
stopifnot(rlang::hash(mtcars) == "d0487363db4e6cc64fdb740cb6617fc0")
.raw_data <- list2env(list(foo = foo, mtcars = mtcars))
lockEnvironment(.raw_data)

@gogonzo
Copy link
Contributor

gogonzo commented Oct 10, 2024

defunction is a private function. It can't be exposed in show R code!

It is not:

foo <- function() cat("hi\n")
mtcars <- mtcars
stopifnot(rlang::hash(foo) == "f5343390f4f30d7df3658452ee946a23")
stopifnot(rlang::hash(mtcars) == "d0487363db4e6cc64fdb740cb6617fc0")
.raw_data <- list2env(list(foo = foo, mtcars = mtcars))
lockEnvironment(.raw_data)

Yup. Is the hash in stopifnot matches rlang::hash? Because rlang::hash in show-r-code is evaluated on the foo while in a .get_hashes_code it is on defunction(foo).

Edit:

Running reproducible code fails in the line with rlang::hash(foo) - as stated above. There is a mismatch between provided hash from teal and this generated in src

@chlebowa
Copy link
Contributor Author

You're right, I didn't actually run the repro code 🤦

@gogonzo gogonzo added the core label Oct 22, 2024
@gogonzo
Copy link
Contributor

gogonzo commented Oct 22, 2024

Closing in favour of

@gogonzo gogonzo closed this Oct 22, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 22, 2024
@chlebowa chlebowa deleted the 1352_functions_raise_warnings@main branch October 22, 2024 13:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: functions in data raise warnings
3 participants