Shopify / Shopify/tapioca

Missing RBI declarations for APIs made by `gobject-introspection`

Open
#2,598 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Ruby
Stars
873
Forks
164
Avg merge
4d 27m
Merged PRs (30d)
9

Description

TL;DR: tapioca dsl misses modules created for GObject interfaces, and maybe other types, too.

Cause

gobject-introspection is a gem brigding to GObject APIs.

For example, GObject interfaces get modelled via Ruby Modules, created here, and set via const_set here. Every such interface will have its const_source_location point to gobject-introspection/lib/gobject-introspection/loader.rb#L618.

When other gems (like gio2) import GObject interfaces, their const_source_location will always point to gobject-introspection/lib/gobject-introspection/loader.rb#L618. Since this location is outside the gem (and in gobject-introspection), Tapioca will skip those module, because it's not defined_in_gem?:

https://github.com/Shopify/tapioca/blob/b8161b8dc60f3208261579bcb3aeed017e60483b/lib/tapioca/gem/pipeline.rb#L449-L455

As a result, the generated gio2.rbi will be missing some interface declaration. It will still include lines that rely on them, leading to type errors.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/tapioca/gem/pipeline.rb around lines 449-455 and reproduce RBI generation for the gio2 gem. Trace how const_source_location and defined_in_gem? cause GObject interface modules to be skipped; done means the generated gio2.rbi includes the missing interface declarations without producing type errors from its include lines.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.