Mirror changes from Web IDE to CI runner

Problem to solve

CI runners checkout code from Git, but when being used with the Web IDE local changes should be mirrored to the runner so that builds and tests run against the state in the Web IDE. It is confusing to have a terminal next to an editor interacting with different versions of the code.

Target audience

As a software engineer, when I am viewing or editing a repository in the Web IDE I want to be able to make changes and test them using the Web Terminal before committing them, so that I know that I am committing code that works.

Further details

This also significantly improves the ability of people to contribute to projects they don't contribute to regularly, by allowing them to view, edit, and test without install local dependencies.

Proposal

Implement a method for mirroring changes from the Web IDE to the runner. The editor will establish a websocket connection to the mirroring service running in the CI build, using an event-based messaging protocol. In this communication, the editor will send diffs from the current changes to the service.

Editor contents will be saved to the development environment when the editor loses focus or is closed. The Save keyboard shortcut (CTRL+s, Command+s) can be used to save your changes immediately.

What does success look like, and how can we measure that?

This feature improves the utility of the Web Terminal in the Web IDE, and should increase the use of the Web IDE for Ultimate users. This can be monitored through the existing Web IDE usage ping.

Links / references

Development Workflow

In order to implement these services and the other ones related to services in CI build we need to implement some foundations which we'll reuse in each of them. This way we won't need to reinvent the wheel every time and manage them in a homogenized way.

There are three places where we have to make modifications:

Rails: we need to update the Web IDE config yaml to accept a new ports section. We also need add a new endpoint and a way to handle the communication from/to Workhorse

Followups

webide-file-sync#1 (closed) Binary files changes don't generate diffs. Therefore, we have to upload the whole file and this is inefficient. We should explore again other options like using the rsync protocol.