Clean up CI rot: sorbet and vendored RBI noise#42
Conversation
192d2bc to
ef7fcff
Compare
ef7fcff to
0a68715
Compare
jose-shopify
left a comment
There was a problem hiding this comment.
left a comment about suppressing the 5002 err
| --ignore=vendor | ||
| --typed-override | ||
| sorbet/typed_overrides.yaml | ||
| --suppress-error-code=5002 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ·
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>
0a68715 to
2d98516
Compare
Summary
Clear the red
typecheckjob that has been pre-existing onmainagainst current Sorbet. Rebased on top of #41 (now merged); theLint/UselessAssignmentfix 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 tcreports 0 errors andbin/rubocopreports no offences. Existing tests unchanged (69 runs / 337 assertions, all pass ondev test).Changes
sorbet/typed_overrides.yaml(new) — downgrades 17 autogeneratedsorbet/rbi/gems/*.rbifiles that ship at# typed: strict/truebut omit sigs on many methods (~4360 sig-less-method errors of pure vendored noise). Editing the sigil in place would be wiped on the nextsrb rbi gemsregen; the yaml +--typed-overrideinsorbet/configsurvives regeneration.sorbet/config— adds--typed-override sorbet/typed_overrides.yaml.sorbet/rbi/shims/prism.rbi(new) — defines thePrism::LexCompat::Resultnamespace so a stale sig inprism-1.9.0's gem-shipped RBI (returns(Prism::LexCompat::Result)) resolves.LexCompatwas renamed toLexResultupstream but the sig wasn't updated. Per @jose-shopify's review on r3350789249, this replaces an earlier--suppress-error-code=5002insorbet/config—--suppress-error-codeis global, so the shim is the narrower fix that keeps 5002 firing for our ownlib//test/code.sorbet/rbi/minitest.rbi— demotes# typed: strict→true(it omits sigs on ~17 hand-written methods), and fixes two existing sigs that this repo's own tests exercise:assert_includes'scollectionisT.untyped, notT::Enumerable[T.untyped]— Minitest dispatches via.include?and acceptsString(used byredis_coordinator_integration_test.rb:362-364).assert_raisestakes a block; the sig was missing&blk(used bydefined_runnable_test.rb:13).lib/minitest/distributed/coordinators/redis_coordinator.rb—T::Array[Module]on thecustom_middlewaresaccessor →T::Array[T.untyped]. Sorbet 5046 requiresModuleto carry type arguments;T::Module[…]would type-check but raisesNameError: uninitialized constant T::Moduleat load time onsorbet-runtime0.5.12443 (the version CI resolves), soT.untypedis 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 failuresshadowenv exec -- bin/srb tc→No errors! Great job.shadowenv exec -- bin/rubocop→58 files inspected, no offenses detectedCI: lint, typecheck, and tests (2.7/3/3.1/3.2) all green on the rebased branch.