Slide 1

Slide 1 text

Community-driven RBS repository 16th May 2024 RubyKaigi 2024

Slide 2

Slide 2 text

May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt, Okinawa, Japan Self introduction Mar. 2018 Shuri Castle

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt, Okinawa, Japan My recent work for RBS Mar. 2018 Hamahiga Island

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt, Okinawa, Japan Agenda May. 2024 あさひそば かつお 中 May. 2024 あさひそば ごまだれ 中

Slide 12

Slide 12 text

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!

Slide 13

Slide 13 text

May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt, Okinawa, Japan What is ruby/gem_rbs_co llection May. 2024 Okinawa World Turtles

Slide 14

Slide 14 text

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.

Slide 15

Slide 15 text

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

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

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

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

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

Slide 21

Slide 21 text

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

Slide 22

Slide 22 text

May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt, Okinawa, Japan Contributor can merge a PR with /merge command Example pull request

Slide 23

Slide 23 text

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✨

Slide 24

Slide 24 text

May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt, Okinawa, Japan The details of the Community driven solution May. 2024 Nahart Weird Code

Slide 25

Slide 25 text

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

Slide 26

Slide 26 text

May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt, Okinawa, Japan It's constructed from four workflows for three situations. GitHub Actions Workflows

Slide 27

Slide 27 text

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

Slide 28

Slide 28 text

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

Slide 29

Slide 29 text

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

Slide 30

Slide 30 text

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

Slide 31

Slide 31 text

May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt, Okinawa, Japan Future May. 2024 Shuri Castle Warehouse wall paint

Slide 32

Slide 32 text

May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt, Okinawa, Japan Future ● More information for RBS contributors ● Rails maintainer

Slide 33

Slide 33 text

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

Slide 34

Slide 34 text

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

Slide 35

Slide 35 text

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

Slide 36

Slide 36 text

May 15th - 17th, 2024 NAHA CULTURAL ARTS THEATER NAHArt, Okinawa, Japan Conclusion May. 2024 The official party venue

Slide 37

Slide 37 text

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!