Improve Development Experience: Final Report (GSoC 2023)

gsoc23_final_phase

This blog is dedicated to describe the work we have done and the goals we have accomplished in Improve the development experience project as a part of GSoC'23 at CircuitVerse

Project Description


CircuitVerse is a Digital Logic Simulator on web. It is an educational tool for students interested in electronics to simulate and make circuits on their browser.

This project focuses on making the process of working and developing with CircuitVerse easier and more efficient. The main goal is to simplify setting up the development environment and working with the code. Additionally, Our aim to enhance the test cases and improve the continuous integration (CI) workflow, which will ultimately reduce the time required for code review by maintainers.

Project Goals


Throughout this period, we have focused on improving the development experience of CircuitVerse. The main goals of this project are:

  • Integrate Ruby Debugger
  • Integrate Solargraph LSP & Write YARD Docs
  • Integrate Vite Rails
  • Integrate RBS in Project & Static Type Checking in CI
  • Integrate Undercover CI
  • Improve Unit Testcase Coverage
  • Add Missing Integration Testcases
  • Improve Remote Development Platform [GitHub Codespaces, Gitpod]
  • Improve Docker Development Setup
  • Improve Setup Documentation

Integrate Ruby Debugger


This integration enhances the debugging experience for developers by providing a visual debugging capability directly from their integrated development environment (IDE). It allows anyone to conveniently set breakpoints and debug the application from their IDE. This integration also support docker based environment. By changing configuration in IDE , it can easily connect to TCP based debugger and debug the application easily. The documentation has been updated accordingly.

Debugger Preview

Pull Requests

Integrate Solargraph LSP & Write YARD Docs


Solargraph is a Language Server Protocol (LSP) server that enhances autocompletion for Ruby codebases by providing YARD documentation. To further enhance support for Rails codebases, the solargraph-rails gem has been installed and configured. YARD documentation has been generated for the entire codebase to ensure seamless autocompletion.

This integration also supports Docker-based environment, allowing the application to be run in a Docker container while connecting the IDE/Editor’s solargraph extension to the Solargraph server via a TCP socket. Initially, there was a significant challenge in this setup. The extension was used to send the current directory to the LSP server, but the LSP server had a different path inside the Docker container. However, this issue was successfully resolved by creating a symlink inside the container.

solargraph-docker

For more detailed information, please refer to the blog post available at https://tanmoy.online/week-1-2-circuitversegsoc23

Currently, documentation and support has been added for

  • VS Code
  • Sublime Editor
  • Neovim

Visual Studio Code vscode-solargraph

Sublime Editor sublime-solargraph

Neovim neovim-solargraph

Pull Requests

Integrate Vite Rails


Previously in the project, all javascript compiled in a single one via esbuild and served by sprocket asset pipeline in development and production [mostly same]. As a result, during development on each change, esbuild need to build multiple JS files againg which increase friction during development.

That’s why vite rails is integrated, and simulator assets moved to vite. After this integration, if there are many changes in the javascript, only the specific portion will be updated in the website and hot reload will be performed (if possible), otherwise entire page will reload. Also, instead of packing and serving javascript files, it will load all dependency of javascript files asynchronously in browser.

In production, vite can pack all the javascript files together and serve static javascript files to make it faster.

Vite Rails Hot Reload vite-rails-hot-reload

Pull Requests

Integrate RBS in Project & Static Type Checking in CI


RBS [Ruby static typing] enabled static typing mechanism which enables to maintain consistency in codebase and reduce the bugs in code.

We used rbs gem for rbs annotation files. We used steep gem to verify type signatures.

We have also included steep check in our CI to verify the changes in code or rbs annotation before finalizing any PR.

Pull Requests

RBS has beend added for models only. We will add RBS for other files in the future.

Integrate Undercover CI


Undercover is a tool that analyzes the report generated by simplecov and generates a code coverage report based on it. The primary objective of this integration is to examine pull requests created by contributors and identify any new functions without code coverage.

To facilitate this process, we have incorporated the undercover_easy gem along with the reviewdog GitHub Actions bot. This enables us to provide feedback on any issues directly within the pull request by posting comments.

undercover

Pull Requests

Improve Unit Testcase Coverage


The codebase currently has a code coverage of approximately 86%. However, some recently added functions were lacking unit test coverage. As part of this task, We have addressed this gap by writing unit tests specifically for those functions.

Pull Requests

Add Missing Integration Testcases


To optimize the integration testing process in CircuitVerse, Capybara has been utilized for comprehensive automated testing. During the analysis, it was identified that certain workflows, including Profile management, Group management, Assignment management, and Project management, lacked integration testing. As part of this task, integration tests for these missing workflows have been incorporated to ensure their proper functioning and improve the overall quality of the application.

Pull Requests

Improve Remote Development Platform [GitHub Codespaces, Gitpod]


Gitpod

Gitpod is a cloud-based development environment that allows you to create a fully functional development environment in your browser. After various changes in development environment, it was required to update gitpod configuration. After update, it now supports solargraph LSP and debugger.

Preview

GitHub Codespaces

GitHub Codespaces is a similiar platform like Gitpod but more integrated with GitHub. We have added support for GitHub Codespaces in our project, so that anyone can set up the project in GitHub Codespaces in single click and start contributing to the project. It supports all the features like solargraph LSP, debugger, etc. and comes with pre-installed extensions in web based VS Code.

Preview

Pull Requests

Improve Docker Development Setup


The docker based development setup has been improved to make it more efficient and easy to use. The following changes have been made to the setup:

  • Docker Image only contains the environment not the codebase. So once the image is built, there is no need to rebuild the image again and again.
  • Auto reload on code changes.
  • No permission error on Linux for chnages in mounted volume.
  • Cache volume added for gems and node modules. So lower wait time for starting the server.
  • Developers can restart the rails server without restarting the docker container.
  • Developers can run unit tests and integration tests in docker container.
  • New tools such as Solargraph LSP, Debugger, Vite Rails have been added to the docker image.
  • Added support for remote debugging in docker container.
  • Supports added for Linux, Mac and Windows.
Pull Requests

Improve Setup Documentation


The setup documentation has been updated to reflect the changes made to the development environment. The following changes have been made to the documentation:

  • Split the documentation into multiple files for better readability.
  • Added specific local installation instructions for Linux, Mac and Windows.
  • Added specific remote development instructions for GitHub Codespaces and Gitpod.
  • Added instructions for using Solargraph LSP and Debugger.
Pull Requests

Blog posts written


Experience

  • Mentor: Vedant Jain and Smriti Garg
  • Contributor: Tanmoy Sarkar

I’ve had a wonderful time working with CircuitVerse. Through this experience, I’ve learned about various tools and concepts, giving me a fresh outlook on open source projects. I’ve gained knowledge in areas such as Solargraph LSP, Debugger, Vite, Rollup, GitHub Actions CI, Remote Development Platform, and Docker-based development setup. This newfound knowledge will definitely benefit me in the future. The mentors and organization admin were incredibly supportive and helpful, and I’m truly grateful for their guidance and assistance.

Conclusion


The 12-week duration of this project was productive, allowing us to achieve nearly all our goals. I want to express my gratitude to my mentors, Vedant Jain and Smriti Garg, as well as the organization admin, Aboobacker, for their support and guidance.

I would definitely keep working on CircuitVerse post GSoC & helping new contributors to contribute to this project.


Thanks for reading this blog.

comments powered by Disqus