rstudio / rsconnect

Publish Shiny Applications, RMarkdown Documents, Jupyter Notebooks, Plumber APIs, and more
http://rstudio.github.io/rsconnect/
129 stars 79 forks source link

serialize multi-value metadata entries as comma-separated values #1018

Closed aronatkins closed 8 months ago

aronatkins commented 8 months ago

fixes #1017

record <- rsconnect:::deploymentRecord(
    name = "the-name",
    title = "the-title",
    username = "the-username",
    account = "the-account",
    server = "the-server",
    metadata = list(quarto_engines = c("knitr","markdown"))
)
t <- tempfile()
rsconnect:::writeDeploymentRecord(record, t)
read.dcf(t)
#>      name       title       username       account       server       hostUrl
#> [1,] "the-name" "the-title" "the-username" "the-account" "the-server" ""     
#>      appId bundleId url version quarto_engines   
#> [1,] ""    ""       ""  "1"     "knitr, markdown"

This change does not adjust deployment records reads.

aronatkins commented 8 months ago

I don't know how what reads the quarto_engines fields from DCF files.

This is the real challenge. The IDE passes some fields as metadata to use when reconstructing the UI on subsequent deployments. Things like additional and ignored files.

https://github.com/rstudio/rstudio/blob/c8e95aa32165dc189a4718a838f9fc49b7e6f821/src/cpp/session/modules/SessionRSConnect.cpp#L293-L301

The Quarto metadata is not used for that purpose; it modifies how rsconnect treats the deployment. Quarto details are not used by the IDE on subsequent deployments.

All other information provided in metadata is passed-through.

The Quarto details probably should have been provided as explicit arguments to the rsconnect functions, but that would have introduced other difficulties, since that API change would have needed to propagate to CRAN, etc, etc. Reasons.

We could strip the Quarto fields before writing the deployment record, but it also feels like their presence is useful.

aronatkins commented 8 months ago

One additional note that came up during a discussion: We always use the incoming metadata object when considering the Quarto information. We never use the metadata from the deployment record.