rstudio / pins-r

Pin, discover, and share resources
https://pins.rstudio.com
Other
312 stars 63 forks source link

`pin_write()` cannot set `access_type` on an update for Connect #760

Closed colearendt closed 1 year ago

colearendt commented 1 year ago

If a pin already exists, update fails when setting access_type, presumably because find() or some other method is called with the argument, and the argument is not used.

2023/07/31 2:37:38 PM: Quitting from lines 13-18 [unnamed-chunk-1] (rmd_document.Rmd)
2023/07/31 2:37:38 PM: Error in `pin_write()`:
2023/07/31 2:37:38 PM: ! Arguments in `...` must be used.
2023/07/31 2:37:38 PM: ✖ Problematic argument:
2023/07/31 2:37:38 PM: • access_type = "logged_in"
2023/07/31 2:37:38 PM: ℹ Did you misspell an argument name?
2023/07/31 2:37:38 PM: Backtrace:
2023/07/31 2:37:38 PM: 1. global refresh_pin()
2023/07/31 2:37:38 PM: 3. pins::pin_write(., leads_with_eval, name = "jss/pin_name", access_type = "logged_in")
2023/07/31 2:37:38 PM: Execution halted

@jspiewak

jspiewak commented 1 year ago

Possible this was introduced by #735, where if the hash is the same the function returns before consuming the .... Except the error with the ellipsis obscures the message about the hash being the same. On the other hand, my R is only so so, so perhaps I am misreading the code.

jspiewak commented 1 year ago

Seems like my read is accurate. I passed force_identical_write = TRUE in additional to the access_type and the error goes away.

juliasilge commented 1 year ago

Here is a reprex (this pin already exists):

library(pins)
b <- board_connect()
#> Connecting to Posit Connect 2023.05.0 at <https://colorado.posit.co/rsc>

b |> pin_write(
  1:10, 
  "julia.silge/some-amazing-numbers",
  access_type = "all"
)
#> Guessing `type = 'rds'`
#> ! The hash of pin "julia.silge/some-amazing-numbers" has not changed.
#> • Your pin will not be stored.
#> Error in `pin_write()`:
#> ! Arguments in `...` must be used.
#> ✖ Problematic argument:
#> • access_type = "all"
#> ℹ Did you misspell an argument name?
#> Backtrace:
#>     ▆
#>  1. └─pins::pin_write(b, 1:10, "julia.silge/some-amazing-numbers", access_type = "all")
#>  2.   └─rlang (local) `<fn>`()
#>  3.     └─rlang:::check_dots(env, error, action, call)
#>  4.       └─rlang:::action_dots(...)
#>  5.         ├─base (local) try_dots(...)
#>  6.         └─rlang (local) action(...)

Created on 2023-08-07 with reprex v2.0.2

Here I see the "better" message (The hash of pin "julia.silge/some-amazing-numbers" has not changed.) before the less helpful one about not using the access_type argument.

juliasilge commented 1 year ago

Except the error with the ellipsis obscures the message about the hash being the same

Are you saying you didn't see the message about the hash being the same at all? Or rather that it was hard to pick out what was going on with multiple messages here?

For folks who may be interested, we wrote about the duplicate writing behavior in this blog post.

github-actions[bot] commented 1 year ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.