From a8e4afcf936df0d368cca3d29df1b49d1c358a15 Mon Sep 17 00:00:00 2001 From: ksss Date: Thu, 8 Oct 2026 22:53:13 +0900 Subject: [PATCH 1/2] Declare `pp` dependency of RBS signatures in `sig/manifest.yaml` The generated RBS files refer to `PP` in `pretty_print: (PP q) -> void`, but `PP` is defined in the `pp` standard library, not in core. Without a declaration, loading the signatures of the prism gem alone fails: $ rbs -r prism validate ...: Could not find PP (RBS::NoTypeFoundError) `sig/manifest.yaml` is where rbs looks for dependencies of a gem's signatures on standard libraries. With it, `rbs -r prism` and `rbs collection` resolve `pp` automatically. Co-Authored-By: Claude Fable 5.1 --- prism.gemspec | 1 + sig/manifest.yaml | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 sig/manifest.yaml diff --git a/prism.gemspec b/prism.gemspec index c5fa776f83..fc2c944d3b 100644 --- a/prism.gemspec +++ b/prism.gemspec @@ -200,6 +200,7 @@ Gem::Specification.new do |spec| "sig/generated/prism/parse_result/comments.rbs", "sig/generated/prism/parse_result/errors.rbs", "sig/generated/prism/parse_result/newlines.rbs", + "sig/manifest.yaml", "src/arena.c", "src/buffer.c", "src/char.c", diff --git a/sig/manifest.yaml b/sig/manifest.yaml new file mode 100644 index 0000000000..9751a2213e --- /dev/null +++ b/sig/manifest.yaml @@ -0,0 +1,2 @@ +dependencies: + - name: pp From 3e9f395aa88eef05a651d10dda48d759ac02e301 Mon Sep 17 00:00:00 2001 From: ksss Date: Thu, 8 Oct 2026 23:02:49 +0900 Subject: [PATCH 2/2] Validate the RBS signatures shipped with the gem in CI Steep type-checks the implementation with `library "pp"` and `sig/_shims`, so it never notices when `sig/generated` refers to a type that users of the gem cannot resolve. That is how `PP` slipped in unnoticed. Add `rake typecheck:rbs`, which runs `rbs validate` on `sig/generated` with only the standard libraries declared in `sig/manifest.yaml`, i.e. exactly what users of the gem get, and run it in the typecheck job. Co-Authored-By: Claude Fable 5.1 --- .github/workflows/main.yml | 2 ++ rakelib/typecheck.rake | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 782afad346..936ab9823e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -55,6 +55,8 @@ jobs: run: bundle exec rake typecheck:tapioca typecheck:sorbet - name: Check Steep run: bundle exec rake typecheck:steep + - name: Validate RBS + run: bundle exec rake typecheck:rbs - name: Check field kinds run: rm lib/prism/node.rb && CHECK_FIELD_KIND=true bundle exec rake diff --git a/rakelib/typecheck.rake b/rakelib/typecheck.rake index 5db244b973..4eaf0974ce 100644 --- a/rakelib/typecheck.rake +++ b/rakelib/typecheck.rake @@ -337,6 +337,21 @@ namespace :typecheck do end end + desc "Validate the RBS signatures shipped with the gem" + task rbs: :templates do + with_gemfile do + require "yaml" + + # Load only what users of the gem get: sig/generated and the standard + # libraries declared in sig/manifest.yaml. sig/_shims is not shipped + # with the gem, so it must not be used here. + dependencies = YAML.safe_load_file("sig/manifest.yaml").fetch("dependencies", []) + libraries = dependencies.flat_map { |dependency| ["-r", dependency.fetch("name")] } + + sh "bundle", "exec", "rbs", "-I", "sig/generated", *libraries, "validate" + end + end + desc "Generate RBIs with Tapioca" task tapioca: :templates do Rake::Task["compile:prism"].invoke