-
Notifications
You must be signed in to change notification settings - Fork 82
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
republishing and collaborating #1021
Conversation
prioritized set of deployment considerations: 1. appId used above all else, and may be owned by a non-local account. 2. appName can identify local or remote content, owned by a local account. 3. locally available deployments are preferred when other identifiers not provided. 4. fall-back on generated name (based on path) and user-chosen local account.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will need NEWS ahead of merge.
R/deploymentTarget.R
Outdated
} | ||
# Discover the deployment target given appId. | ||
# | ||
# When appId is provided, all other information is secondary. An appId is an indication from the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found this comment very useful for understand the problem and where I went wrong previously.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. It took so much code-reading and reasoning about the previous workflow to see it. I'm hoping that being much more explicit will help us in the future.
R/deploymentTarget.R
Outdated
appName = application$name, | ||
appTitle = application$title %||% appTitle, | ||
appId = application$id, | ||
envVars = NULL, | ||
envVars = envVars, | ||
username = application$owner_username %||% accountDetails$name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we change the arguments to createDeploymentTarget()
to more clearly differentiate the username of the current user vs. the username of the account owner? Might need to be in a separate PR to avoid cluttering this one, but I think it's likely to make understanding the code easier in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deployment record has the account+server corresponding to local account record for the user responsible for creating the deployment record on disk. This is usually the creator, but not always (e.g. collaborator publish using appId
). The username is associated with the creating user (unsure if we get this back from shinyapps.io).
I'm not sure how to best represent this possible inconsistency. Happy to file an issue for further discussion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking maybe we could rename username
to something like owner_account
to make it clear that this is also an account name, but it's the account name for the original author.
R/deploymentTarget.R
Outdated
} | ||
# Discover the deployment target given appId. | ||
# | ||
# When appId is provided, all other information is secondary. An appId is an indication from the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. It took so much code-reading and reasoning about the previous workflow to see it. I'm hoping that being much more explicit will help us in the future.
R/deploymentTarget.R
Outdated
appName = application$name, | ||
appTitle = application$title %||% appTitle, | ||
appId = application$id, | ||
envVars = NULL, | ||
envVars = envVars, | ||
username = application$owner_username %||% accountDetails$name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deployment record has the account+server corresponding to local account record for the user responsible for creating the deployment record on disk. This is usually the creator, but not always (e.g. collaborator publish using appId
). The username is associated with the creating user (unsure if we get this back from shinyapps.io).
I'm not sure how to best represent this possible inconsistency. Happy to file an issue for further discussion.
deploymentTarget ==> findDeploymentTarget deploymentTargetFromAppId ==> findDeploymentTargetByAppId deploymentTargetFromAppName ==> findDeploymentTargetByAppName updateDeploymentTarget ==> updateDeployment createDeploymentTarget ==> createDeployment
This rewrite showed that from-disk deployment records had different field names than the records created on-the-fly. In particular, "appName" and "appTitle" were used by the "deployment target", while "name" and "title" were used for on-disk deployment records. This made it challenging to use the same helpers. All deployment objects, either read from disk or created in-memory now use "name" and "title". This is a step towards always using deployment records.
32b66af
to
e97ab2b
Compare
)) | ||
}) | ||
|
||
test_that("updateDeployment ignores NULL updates", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding these tests let me see that we were mixing records from disk which used name
and records created on-the-fly which used appName
. We are now consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a nice improvement to code clarity!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. A lot clearer for posterity too.
Verified the fix for #1013 Before the fix, when using CRAN Version 1.1.1
Using the development version from GitHub, the existing app can be redeployed and replaced without any issue.
|
@aronatkins the error message 39] in it does not make sense. See for image #1021 (comment) this is an edge case though |
I have filed #1026 to track the escape codes that are presented by the IDE when the target content has been deleted (or is not visible to the user). |
Revisit how the deployment target is selected.
Use 0.8.29 implementation when reviewing this work. In particular, that version of
deploymentTarget()
did not offer any separation between the "owning" account and the "deploying" account. Details recorded in the in-memory deployment record were not necessarily consistent with the on-disk deployment record. Additionally, resolving that deployment record to an actual remote application occurred much later, inapplicationForTarget()
.https://github.com/rstudio/rsconnect/blob/v0.8.29/R/deployApp.R
The implementation available in 1.0.0 until now did a good job consolidating this logic, but lost track of the fact that we may have a local user attempting to re-use deployment records created by some other user.
This change sees us use the following prioritized techniques to locate a deployment record:
appId
is provided, it must be used to locate the target content. A target (local) account is required to make this determination. When a local deployment record is not available, the application is loaded from the server. The target deployment record does not need to be owned by the local target account.appName
is provided withoutappId
, it must be used to locate the target content or create a new deployment target.appName
norappId
is provided, the user is asked to choose from the available deployment records (which must correspond to a locally available account).Some collaboration instructions from the Connect user guide: https://docs.posit.co/connect/user/publishing/#publishing-collaboration
Related issues: #1019, #1013, #1007, #981 along with multiple internal reports.
This change may fix each of those issues, but they need more review to be sure.