opensafely / research-template

The template for new research projects that use the OpenSAFELY framework.
MIT License
16 stars 13 forks source link

Remove repository name from workspace folder path #133

Closed Jongmassey closed 4 months ago

Jongmassey commented 4 months ago

research-template ADR#3 states:

One element of the dev container configuration which cannot easily be set in the docker image build is that of setting working directories for R/RStudio to the workspace folder which is (by default) not known until container creation time.

This is because we are using the default workspace folder pattern of /workspace/{repo_name}.

The setting of the RStudio working directory in the onCreate command is known to be problematic.

It is possible to set the workspaceFolder property of devcontainer.json to a fixed value, such that it can be known at docker image build time, and those working directory preferences can be set at docker image build time.

With this, we could remove the problematic R setting lines from the postCreate.sh script.

One potential downside is that the user will no longer see the repository name in either the file explorer pane or the terminal and so will no longer have immediate visibility of which repository a given codespace pertains to.

I have tried this setting in a draft PR and it appears to work as stated.

iaindillingham commented 4 months ago

We talked about this issue in today's standup. I think we agreed that from a technical perspective, using a fixed working directory is a great idea. However, from a user perspective, context is important: the repository and branch should be displayed somewhere in the UI. Whilst we would normally lean on a Git integration for this (RStudio's version control feature; VS Code's source control feature), RStudio makes this hard (opensafely-core/research-template-docker#48).

Before implementing a fixed working directory, we should identify how a user would know which repository and branch a Codespace is associated with. Users can have up to three Codespaces, and following the "Co-Piloting in Codespaces" meeting, we should assume that they will make use of them, either associated with different repositories, or different branches within the same repository.

One means by which a user would know which repository a Codespace was associated with would be to open README.md, as the repository name is the heading.

Thanks for describing the issue clearly, @Jongmassey.

lucyb commented 4 months ago

We've decided not to fix this for now, but will add something into the troubleshooting guide.

iaindillingham commented 4 months ago

Unless I've misunderstood, I don't think we need to add an entry to the troubleshooting guide, because we're not going to remove the repository name from the workspace directory name, and so the repository name will be visible in the UI.

Jongmassey commented 4 months ago

I think it's #130 that needs to go in the troubleshooting guide, not this as we're not going to make this change