Skip to content

Clean up CI rot: sorbet and vendored RBI noise#42

Open
justin-reid wants to merge 1 commit into
mainfrom
justin-reid/ci-hygiene
Open

Clean up CI rot: sorbet and vendored RBI noise#42
justin-reid wants to merge 1 commit into
mainfrom
justin-reid/ci-hygiene

Conversation

@justin-reid
Copy link
Copy Markdown
Contributor

@justin-reid justin-reid commented May 28, 2026

Summary

Clear the red typecheck job that has been pre-existing on main against current Sorbet. Rebased on top of #41 (now merged); the Lint/UselessAssignment fix that originally lived here landed independently in #41 (78e37f6) and was dropped on rebase, so this PR is sorbet/RBI-only.

After this PR, bin/srb tc reports 0 errors and bin/rubocop reports no offences. Existing tests unchanged (69 runs / 337 assertions, all pass on dev test).

Changes

  1. sorbet/typed_overrides.yaml (new) — downgrades 17 autogenerated sorbet/rbi/gems/*.rbi files that ship at # typed: strict / true but omit sigs on many methods (~4360 sig-less-method errors of pure vendored noise). Editing the sigil in place would be wiped on the next srb rbi gems regen; the yaml + --typed-override in sorbet/config survives regeneration.

  2. sorbet/config — adds --typed-override sorbet/typed_overrides.yaml.

  3. sorbet/rbi/shims/prism.rbi (new) — defines the Prism::LexCompat::Result namespace so a stale sig in prism-1.9.0's gem-shipped RBI (returns(Prism::LexCompat::Result)) resolves. LexCompat was renamed to LexResult upstream but the sig wasn't updated. Per @jose-shopify's review on r3350789249, this replaces an earlier --suppress-error-code=5002 in sorbet/config--suppress-error-code is global, so the shim is the narrower fix that keeps 5002 firing for our own lib//test/ code.

  4. sorbet/rbi/minitest.rbi — demotes # typed: stricttrue (it omits sigs on ~17 hand-written methods), and fixes two existing sigs that this repo's own tests exercise:

    • assert_includes's collection is T.untyped, not T::Enumerable[T.untyped] — Minitest dispatches via .include? and accepts String (used by redis_coordinator_integration_test.rb:362-364).
    • assert_raises takes a block; the sig was missing &blk (used by defined_runnable_test.rb:13).
  5. lib/minitest/distributed/coordinators/redis_coordinator.rbT::Array[Module] on the custom_middlewares accessor → T::Array[T.untyped]. Sorbet 5046 requires Module to carry type arguments; T::Module[…] would type-check but raises NameError: uninitialized constant T::Module at load time on sorbet-runtime 0.5.12443 (the version CI resolves), so T.untyped is the runtime-safe choice.

How to test

Manual validation:

  • dev up (boots redis service)
  • shadowenv exec -- bundle exec rake test → 69 runs / 337 assertions / 0 failures
  • shadowenv exec -- bin/srb tcNo errors! Great job.
  • shadowenv exec -- bin/rubocop58 files inspected, no offenses detected

CI: lint, typecheck, and tests (2.7/3/3.1/3.2) all green on the rebased branch.

@justin-reid justin-reid changed the title Clean up CI rot: lint, sorbet, vendored RBI noise Address CI failures Jun 2, 2026
@justin-reid justin-reid force-pushed the justin-reid/ci-hygiene branch from 192d2bc to ef7fcff Compare June 2, 2026 18:26
@justin-reid justin-reid changed the title Address CI failures Clean up CI rot: sorbet and vendored RBI noise Jun 2, 2026
@justin-reid justin-reid marked this pull request as ready for review June 2, 2026 18:28
@justin-reid justin-reid force-pushed the justin-reid/ci-hygiene branch from ef7fcff to 0a68715 Compare June 2, 2026 22:16
Copy link
Copy Markdown

@jose-shopify jose-shopify left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left a comment about suppressing the 5002 err

Comment thread sorbet/config Outdated
--ignore=vendor
--typed-override
sorbet/typed_overrides.yaml
--suppress-error-code=5002
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heads up: The flag isn't scoped to prism, it's global. It doesn't say "ignore this in prism's file," it says "ignore 5002 everywhere, forever." So if someone later writes a typo'd class name in this project's own lib/ or test/ code, Sorbet would normally catch it, but now it stays silent.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — fixed in 2d98516.

--suppress-error-code=5002 is gone from sorbet/config. Replaced it with a 13-line shim at sorbet/rbi/shims/prism.rbi that defines the missing Prism::LexCompat::Result namespace so prism-1.9.0's stale sig (the only 5002 source in the repo, verified with bin/srb tc --isolate-error-code 5002) resolves. 5002 is now back to firing for our own lib//test/ code — a typo'd class name will be caught again. Typecheck stays clean: No errors! Great job.

🤖 AE · ⚠️ unapproved by @justin-reid

The `typecheck` workflow job has been red on `main` against current
Sorbet for some time. `.github/workflows/ruby.yml` runs `on: push`
and main's last non-dependabot push pre-dates the versions bundler
now resolves, so the job had not run against current tooling until
PR #41 forced it.

This commit clears the remaining typecheck errors:

- Add `sorbet/typed_overrides.yaml` downgrading the 17 autogenerated
  `sorbet/rbi/gems/*.rbi` files that are shipped at `# typed: strict` /
  `# typed: true` but omit sigs on many methods (~4360 sig-less-method
  errors). Editing the sigil in place would be wiped on the next
  `srb rbi gems` regeneration; the yaml + `--typed-override` in
  `sorbet/config` survives regen.

- Demote `sorbet/rbi/minitest.rbi` from `strict` to `true` (it omits
  sigs on ~17 hand-written methods) and fix two existing sigs that
  this repo's own tests exercise:
  - `assert_includes`'s `collection` is `T.untyped`, not
    `T::Enumerable[T.untyped]`. Minitest dispatches via `.include?`
    and accepts `String` (used by
    `redis_coordinator_integration_test.rb:362-364`).
  - `assert_raises` takes a block. The sig was missing `&blk`, which
    rejected `defined_runnable_test.rb:13`.

- Replace `T::Array[Module]` on the `custom_middlewares` accessor in
  `redis_coordinator.rb` with `T::Array[T.untyped]`. Sorbet 5046
  requires `Module` to carry type arguments; `T::Module[…]` would
  type-check but raises `NameError: uninitialized constant T::Module`
  at load time on `sorbet-runtime` 0.5.12443 (the version CI
  resolves), so the broader `T.untyped` is the runtime-safe choice.

- Add `--suppress-error-code=5002` to `sorbet/config`. The remaining
  error is `prism-1.9.0`'s gem-shipped RBI referencing
  `Prism::LexCompat::Result`, a constant the gem removed in the same
  release. The RBI is auto-loaded via the bundler-gem discovery path
  (not the filesystem walk subject to `--ignore`), so the project
  can't filter it by path. `bin/srb tc --isolate-error-code 5002`
  confirms this is the only such error in the repo, so suppression
  has zero false-negative risk today. When prism's upstream RBI is
  fixed (or `rubocop-ast` stops depending on prism), this line
  should be removed.

After these changes, `bin/srb tc` reports 0 errors and `bin/rubocop`
reports no offences. All 69 existing test runs / 337 assertions still
pass.

The `Lint/UselessAssignment` fix originally bundled with this PR
landed independently in #41 (`78e37f6`) and was dropped on rebase.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Orchestrated-by: ae <noreply@shopify.com>
@justin-reid justin-reid force-pushed the justin-reid/ci-hygiene branch from 0a68715 to 2d98516 Compare June 3, 2026 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants