I have read the documentation on how collaborative publishing is supposed to work:
But in practice I'm facing some frustrating hurdles. I'm hoping to find some help here.
The example scenario:
- Tom (me) and Andy want to collaborate on a markdown file, MyDoc.md, which is stored in a git repo.
- Both Tom and Andy are set up as Publishers in their Posit Connect instance.
Steps I take:
- Open MyDoc.md, render it, and click Publish
- The content is successfully published to our Posit Connect instance
- Using the access controls in Connect, I add Andy as a Collaborator for the MyDoc content
- I commit and push MyDoc.md as well as the entire contents of the rsconnect folder
Now Andy wants to make changes to MyDoc.md, so he:
- Does a git pull to get my changes
- Makes edits to MyDoc.md using RStudio
- Previews the document, and clicks Republish in the preview window
- He sees a "Publish to Server" dialog indicating he will be replacing existing content:
- In the "Publish From Account" box, Andy's account is selected
- In the "Publish To Account" box, Tom's account is shown
- In the "Update" box, the name and url of the existing document is shown
- Andy clicks Publish and is disappointed to find that a new document has
been created in Connect!
- Andy emails me about this problem, and I waste hours trying to figure out
what is going wrong (and coming up with a workaround).
I'll pause here to ask... What on earth are we doing wrong???
RStudio version we are using: 2023.09.1 Build 494
I have found a workaround, but it's quite ugly. I only mention it in hopes that it will prevent someone from replying to this message suggesting it as a viable solution.
I have carefully set up a dcf file in the
rsconnect hierarchy for Andy's account (which basically mimics what a RStudio would have established if Andy had published the document).
This allows Andy to republish MyDoc as intended. It wouldn't be so bad if we had just one document and two collaborators. But we will have multiple documents and eventually more collaborators, so manually setting this up over and over is a pain and error prone. A more reasonable solution is desired.
In RStudio, the "Publish to Server" dialog very clearly indicates that existing content will be updated. If RStudio cannot perform that action, an error should be shown to the user with enough information for the user to correct the issue. It is an all too common anti-pattern for software to swallow errors. Errors are feedback and feedback is essential! (With great humility, I acknowledge that swallowing an error might not be what is going on in this case, but it sure smells of it).
I'd like to point out that the rsconnect command line tool does this correctly. Specifying
--app-id ensures that content will be updated. If it can't do it, it shows an error.