Share
Embed
Community-driven RBS repository
RubyKaigi 2024
One of the most significant problems of RBS was managing libraries' RBS files.
Libraries' RBS files are important for RBS to be widely used. I've developed an rbs collection for libraries in recent years. And it improved libraries' RBS management for RBS users. See my talk at RubyKaigi Takeout 2021.
However, there was still a problem if the users wanted to contribute RBS by writing libraries RBS.
Now, the third-party RBS file repository is based on a community-driven system. Anyone can contribute to the repository smoothly. I'll describe how I improved this problem, and request you open PRs to the repository!
pocke
May 16, 2024
Transcript
37 slides
-
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan Self introduction Mar. 2018 Shuri Castle -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan Masataka Pocke Kuwabara • Work for Money Forward, Inc. ◦ A half-time Ruby committer ◦ An RBS maintainer ◦ A Rails app engineer • Live in Okayama (countryside of Japan) • Long long hair Self-Introduction -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan My recent work for RBS Mar. 2018 Hamahiga Island -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan My recent work for RBS Work for making RBS more practical • Add `rbs collection` command (RubyKaigi Takeout 2021) • Add `rbs subtract` command (RubyKaigi 2023 in Matsumoto) • rbs_rails gem • Reduce memory usage • Community-driven ruby/gem_rbs_collection -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan My recent work for RBS Work for making RBS more practical • Add `rbs collection` command (RubyKaigi Takeout 2021) • Add `rbs subtract` command (RubyKaigi 2023 in Matsumoto) • rbs_rails gem • Reduce memory usage • Community-driven ruby/gem_rbs_collection -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan My recent work for RBS Work for making RBS more practical • Add `rbs collection` command (RubyKaigi Takeout 2021) • Add `rbs subtract` command (RubyKaigi 2023 in Matsumoto) • rbs_rails gem • Reduce memory usage • Community-driven ruby/gem_rbs_collection -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan My recent work for RBS Work for making RBS practical • Add `rbs collection` command (RubyKaigi Takeout 2021) • Add `rbs subtract` command (RubyKaigi 2023 in Matsumoto) • rbs_rails gem • Reduce memory usage • Community-driven ruby/gem_rbs_collection -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan My recent work for RBS Work for making RBS more practical • Add `rbs collection` command (RubyKaigi Takeout 2021) • Add `rbs subtract` command (RubyKaigi 2023 in Matsumoto) • rbs_rails gem • Reduce memory usage • Community-driven ruby/gem_rbs_collection -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan My recent work for RBS Work for making RBS more practical • Add `rbs collection` command (RubyKaigi Takeout 2021) • Add `rbs subtract` command (RubyKaigi 2023 in Matsumoto) • rbs_rails gem • Reduce memory usage • Community-driven ruby/gem_rbs_collection -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan Agenda May. 2024 あさひそば かつお 中 May. 2024 あさひそば ごまだれ 中 -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan Agenda I'll talk about how to manage ruby/gem_rbs_collection repository. • What is ruby/gem_rbs_collection • History of gem_rbs_collection ◦ from the aspect of managing this repository • The details of the Community driven solution ◦ Implementation ◦ Desgin • Future of the repository Note that using RBS, RBS feature, and static type checking are out of scope! -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan What is ruby/gem_rbs_co llection May. 2024 Okinawa World Turtles -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan What is ruby/gem_rbs_collection • This repository stores 3rd party RBSs ◦ such as rails, nokogiri, etc. • Similar to DefinitelyTyped for TypeScript. • Used via `rbs collection` command. -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan How to use ruby/gem_rbs_collection `bundle install` generates Gemfile.lock `rbs collection install` downloads RBS files for gems in Gemfile.lock from the repository -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan History of gem_rbs_collection from the aspect of managing it May. 2024 Valley of Gangala Ficus microcarpa -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan History of gem_rbs_collection Three stages of PR reviewing on this repository 1. Review and merge by the RBS team, mainly me 2. Code owners system (since Feb. 2022) • Introduced by #114 3. Community-driven (since Mar. 2024) • Introduced by #520 • Today's topic -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan • The RBS core team reviewed and merged all PRs. • It was the ordinary open source way. • The reviewing cost was too high. ◦ Many pull requests came. ◦ We needed to investigate source code of gem 1. Review and merge by the RBS team -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan • Delegate reviewing and merging to code owners • Use .github/CODEOWNERS file • They could merge PRs on behalf of the core team 2. Code owners system -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan However, it does not work well😭 • The core team still needed review most gems ◦ Many gems didn't have code owners ◦ The most active gems, rails gems, didn't have code owners • The code owners couldn't merge themselves ◦ The core team needed to merge PRs on behalf of the owner • We couldn't promote a contributor to a code owner automatically ◦ We needed to invite them to the repository as a collaborator 2. Code owners system - problem -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan Pass more privileges to the community • Introduce "gem reviewers" role instead of code owners ◦ It is for the same purpose, but it does not depends on CODEOWNERS ◦ Anyone can become a gem reviewer • Relax restrictions to merge PRs ◦ Gem reviewers can manage everything of responsible gems • Simple promotion process ◦ Write account name to `gems/_reviewers.yaml` 3. Community-driven -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan Contributor can merge a PR with /merge command Example pull request -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan Code owner and gem reviewer privileges Before: with code owner code owner ordinary contributor PR by code owner 🙅cannot merge 🙅cannot merge PR by ordinary contributor ✅can merge 🙅cannot merge PR for a gem w/o code owner N/A 🙅cannot merge After: with gem reviewer gem reviewer ordinary contributor PR by gem reviewer ✅can merge✨ 🙅cannot merge PR by ordinary contributor ✅can merge 🙅cannot merge PR for a gem w/o gem reviewer N/A ✅can merge✨ -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan The details of the Community driven solution May. 2024 Nahart Weird Code -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan Implementation • It uses GitHub Actions for the BOT • To avoid managing server💰 • It uses Ruby scripts • Because I love Ruby -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan It's constructed from four workflows for three situations. GitHub Actions Workflows -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan Design I want to describe two decisions of the design • Balance between contributor's experience of RBS and maintainability • Security -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan Balance between the contributor's experience and maintainability This change improves maintainability, but Good for maintainability👍 • The core team does not need to review RBS semantics Bad for the correctness👎 • Anyone does not review the RBS semantics except by the gem reviewers • The CI only checks syntax and test code written by the contributor -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan Security • Anyone can merge PR ◦ Therefore anyone can include arbitrary files ◦ We accept this risk • Anyone can NOT execute arbitrary code on CI and machines of RBS users ◦ `bin/test` command, the test helper of this repository, does not accept arbitrary code ◦ RBS, Steep, and so on do not execute code from this repository Please do NOT execute any code in this repository without paying attention -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan bin/test does not execute arbitrary code with the following techniques • Generate `Gemfile` and `Steepfile` ◦ Because they have Ruby DSL that can execute arbitrary code • Use `bundle lock` instead of `bundle install` ◦ Because a gem can execute arbitrary code during installation Security of bin/test -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan Future May. 2024 Shuri Castle Warehouse wall paint -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan Future • More information for RBS contributors • Rails maintainer -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan • RBS core team does not review PR, but actually contributors may need reviews • Because they are not familiar with RBS sometimes • Aid contributors by clarify what PRs do. For example: • Check the RBS semantics with the source code of g • probably automation is difficult… • Test on reverse dependency gems • e.g. Test on `rubocop` when `parser` RBS is updated More information for RBS contributors -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan • Rails gems don't have gem reviewers • These gems are widely used • These types are complicated • We need maintainers of RBS of Rails gems! • If you want to become the maintainer, please tell me🙏 • You will develop RBS Rails too • I'll teach you RBS💪 Rails maintainer -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan • Treat inactive gem reviewer ◦ Currently, a pull request will be stuck if the gem reviewer is inactive ◦ We need to implement promotion process for gem rewviers • GitHub Issues ◦ The core team couldn't respond all of issues • Fixing minor known bugs ◦ noisy messages on reviewing ◦ /merge command bug Other improvements -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan Conclusion May. 2024 The official party venue -
May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt,
Okinawa, Japan Conclusion I shared the recent update of management strategy for ruby/gem_rbs_collection • It's a "Community-Driven" repository • We still need help, especially for Rails gems Thanks for your listening! Feel free to ask me in this Kaigi or the internet. We have discussion time at the hackspace this afternoon break, from 15:20 Note that probably we have 5 minutes, let me do a demo!