Skip to content

Ignore literal values in type inference - #1201

Merged
castwide merged 11 commits into
masterfrom
no-inference-from-literals
May 21, 2026
Merged

Ignore literal values in type inference#1201
castwide merged 11 commits into
masterfrom
no-inference-from-literals

Conversation

@castwide

Copy link
Copy Markdown
Owner

ref #1196

Typing does not assume parameter types from literal arrays.

Storing of literal values in complex types is disabled for now.

@castwide
castwide changed the base branch from master to yard-macros May 21, 2026 22:53
@castwide
castwide changed the base branch from yard-macros to master May 21, 2026 22:53
@castwide
castwide merged commit 8c40692 into master May 21, 2026
31 of 32 checks passed
lekemula added a commit to lekemula/solargraph that referenced this pull request Jul 11, 2026
Resolve 14 conflicts: adopt upstream refactors (macro cleanup castwide#1191,
literal-value inference castwide#1201, closure rename, *p.gates, dropped
namespaces/map_include_pins) while preserving the factory-parameter
feature. Fix specs to use Convention.unregister (was deregister).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
lekemula added a commit to lekemula/solargraph that referenced this pull request Jul 11, 2026
Resolve 14 conflicts: adopt upstream refactors (macro cleanup castwide#1191,
literal-value inference castwide#1201, closure rename, *p.gates, dropped
namespaces/map_include_pins) while preserving the factory-parameter
feature. Fix specs to use Convention.unregister (was deregister).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
apiology added a commit to apiology/solargraph that referenced this pull request Jul 30, 2026
This reverts commit 8c40692.

Restoring as a base to fix the specious-inference bugs from castwide#1196
directly instead of leaving literal/tuple inference disabled.
apiology added a commit to apiology/solargraph that referenced this pull request Jul 30, 2026
Fixes castwide#1196. PR castwide#1201 disabled all array/tuple element-type inference
after finding several cases of specious (wrong-looking-precise)
results. This restores the inference but reworks tuple indexing to
avoid the specious cases instead of giving up on element typing
altogether:

- UniqueType#resolve_generics: fixed ancestor-generics resolution so
  that methods inherited from Array/Enumerable (e.g. #last, #first,
  #each) resolve their generic (e.g. Elem) to the union of a tuple's
  element types, instead of incorrectly indexing into the tuple's own
  positional generics. This also fixes generic defaults (e.g. Tuple's
  C = A | B) being returned as unresolved placeholders instead of
  being resolved against the same context.

- rbs/fills/tuple/tuple.rbs: dropped the literal-indexed overloads for
  #[], #at, and #fetch. Precise positional access (e.g. array[0] ->
  exactly the first element's type) depends on tracking a variable's
  literal value through reassignment, non-literal indices, and
  mutating calls like #unshift - which is exactly what produced the
  wrong answers in castwide#1196. All indexed access now returns the union of
  the tuple's element types instead, which is less precise but never
  wrong.

Verified against all four repro cases from the issue: each now
returns a safe union type instead of an incorrect specific type.

Two pre-existing, unrelated spec failures remain (both
"Hash superclass with untyped value and alias finds superclass method
pin parameter type", expecting Symbol but getting ::Hash::_Key) -
confirmed present on stock master prior to this change, likely from an
RBS version drift in Hash's core signatures.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014cK1bh4FZiYhuVZUt3H9L8
apiology added a commit to apiology/solargraph that referenced this pull request Aug 2, 2026
PR castwide#1201 disabled tuple/literal element-type inference wholesale to
fix specious-inference reports (castwide#1196). That's the root cause of a
broad swath of downstream nil-check/downcast/overload-resolution gaps
across the codebase, not just tuple indexing. Open PR castwide#1223 restores
the capability properly (with real reassignment tracking) rather than
leaving it off.

Determined the exact set empirically: test-merged castwide#1223's branch onto
this one and diffed `solargraph typecheck --level strong` output
before/after (line numbers stripped to avoid false positives from
line-count shifts). Every one of the 79 lines flagged "Unneeded
@sg-ignore comment" in that diff had its comment rewritten to
`# @sg-ignore https://github.com/castwide/solargraph/pull/1223`,
replacing whatever specific reason (or blank comment) was there
before - including one of this branch's own castwide#1245-deferred entries
(pin/block.rb), which turns out to be downstream of the same root
cause.

Updated the @sg-ignore count doc in TypeChecker::Rules to add this as
a third bucket and adjust the other two accordingly.

Verified: full test suite (1618 examples, 0 failures) and
`solargraph typecheck --level strong` both unchanged from before this
commit (comment-only diff, confirmed via normalized before/after
output comparison). Rubocop offenses on touched files identical
before and after (36, all pre-existing).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYQc4tRAkDEfp6vZsvHaXr
apiology added a commit to apiology/solargraph that referenced this pull request Aug 6, 2026
Applied the same fix as castwide#1273 (order-dependent
generic resolution for same-class union receivers) to
Call#method_stack_pins Intersection branch: both conjunct dedup
points now key on [path, return_type.tag] instead of path alone, so
a same-class intersection (e.g. Hash{K1=>V1} & Hash{K2=>V2}) no
longer silently drops every conjunct but the first.

This makes Hash#fetch dispatch order-independent and sound (returns
the union of every conjunct plausible result), but not yet precise -
true per-key narrowing needs the literal Hash key ("Index" vs
"Triggers") to survive Pin::Parameter#typify, and
UniqueType#qualify unconditionally widens literal types to their
base class. Attempted gating that on a corrected #literal? check
(the existing one is unconditionally disabled by castwide#1201, for an
unrelated array/tuple-inference reason) but reverted it: the same
code path is load-bearing for other tested behavior (RBS
`NilClass#to_s: () -> ""` widening to String, true/false -> Boolean
consolidation), which broke under the naive fix
(spec/rbs_map/core_map_spec.rb:102,114 and
spec/parser/flow_sensitive_typing_spec.rb:644). A real fix needs
qualify/transform to distinguish a key_types position from a
general return-type position, which is a larger change than this
commit attempts.

Updated the two affected pending specs to describe the current,
accurate remaining gap (union-not-precise-narrowing + castwide#1266) instead
of the now-fixed order-dependence.

Verified: full suite 1688 examples, 1 pre-existing unrelated
failure, 0 regressions; rubocop clean (pre-existing offenses
untouched).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TZme4n9mb8hGU8mrw94NAV
apiology added a commit to iftheshoefritz/solargraph-rails that referenced this pull request Aug 19, 2026
castwide/solargraph#1201 stopped storing literal values in complex types,
so 0.59.2 onward widens `true` to `Boolean`, `:activerecord` to `Symbol`
and `-1|0|1` to `Integer`. Upstream describes this as disabled for now
while castwide/solargraph#1196 is open, so these are skips rather than a
rewrite of the shared `types:` list, which the 0.48-0.58.2 cells still
need. When 1201 is reverted, a FORCE_UPDATE run removes the skips again
via Definitions#remove_skip.

Two entries get the type itself corrected instead. `undefined` there was
solargraph declining to answer; `void` is the return type, and every
version that still answers `undefined` moves into the skip list:

  ActionController::Base.method_added
  Rails::Application.inherited

ActionController::Base#authenticate_with_http_token infers BasicObject,
which Definitions#process_potential_update treats as no better than
undefined, so it is skipped.

Generated with FORCE_UPDATE=true against solargraph 0.60.3 on Rails 8.0,
Ruby 3.2.8. Verified: 0 type mismatches and 0 stale skips on re-run.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TY8B7iFysoEXhFF3fbrgrK
apiology added a commit to iftheshoefritz/solargraph-rails that referenced this pull request Aug 19, 2026
Adds branch-castwide-master to the skip list of 89 definitions whose
recorded type is a literal that castwide/solargraph#1201 no longer stores
(`true`, `false`, `:activerecord`, `-1|0|1`). The key also covers every
other `branch-` version via Definitions#process_single_definition.

Five entries had a recorded type that was simply out of date, so they get
the type corrected and the versions that still disagree skipped:

  Module.constants        Array<Integer> -> Array<Symbol>
  Enumerable#sum          generic<Elem>  -> generic<E>
  Array#compact_blank     Array          -> Array<generic<Elem>>
  File#compact_blank      Array<String>  -> Array<generic<Elem>>

Module.constants returns symbols; Array<Integer> came from the literal
inference 1201 removed. The generics are unresolved because Definitions
calls Pin#typify without binding a receiver, so Elem has nothing to
resolve against - Enumerable.yml and Hash.yml already record them that
way, and Array.yml and File.yml were the outliers.

Verified against solargraph 0.60.3 and castwide/solargraph master
(8fda633) on Rails 8.0, Ruby 3.2.8: 0 type mismatches, 0 stale skips.
Both still fail rails_spec.rb:100, which is unrelated to definitions.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TY8B7iFysoEXhFF3fbrgrK
apiology added a commit to iftheshoefritz/solargraph-rails that referenced this pull request Aug 20, 2026
solargraph_version returned MATRIX_SOLARGRAPH_VERSION, so branch-castwide-master
was its own key and the 89 skips added for castwide/solargraph#1201 applied to a
moving ref forever. Nothing would have lifted them if 1201 were reverted, and
@allow_improvements is true for branch- keys, so a stale skip there prints a
congratulation rather than failing - it could not report itself.

Return Solargraph::VERSION instead. A branch build reports the version it was cut
from, so master matches the 0.60.3 entries today and stops matching when castwide
bumps the version, at which point a still-broken version fails the assertions.

The branch- conditionals in the skip matching and in @allow_improvements are now
unreachable and are removed. The branch- entries in spec/definitions/*.yml are
likewise dead; leaving those for a separate pass since it touches 1,513 lines.

Verified on Rails 8.0 / Ruby 3.2.8:
  branch-castwide-master  43 examples, 0 failures, 4 pending
  0.60.3                  43 examples, 0 failures, 4 pending
  0.58.2                  43 examples, 1 failure  (Date#<=>, pre-existing)
  0.48.0                  42 examples, 0 failures, 4 pending

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TY8B7iFysoEXhFF3fbrgrK
apiology added a commit to iftheshoefritz/solargraph-rails that referenced this pull request Aug 20, 2026
…x cells (#208)

* Add 0.60.3 skip definitions

Generated with:

  ruby script/copy_definitions.rb branch-castwide-master 0.60.3

spec/definitions.rb keys skip lists by MATRIX_SOLARGRAPH_VERSION when set
and by Solargraph::VERSION otherwise, so a run against a local solargraph
checkout keys on 0.60.3. No definitions file listed 0.60.3, so every
method skipped under branch-castwide-master was reported as missing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F1B9SLWrXrKL9SNGy7SXot

* Exclude Ruby 3.0 x castwide/solargraph master from CI matrix

castwide/solargraph master raised required_ruby_version to '>= 3.1', so
`bundle lock` fails version solving on the two Ruby 3.0 matrix rows before
any spec runs.

Verified required_ruby_version for every solargraph version in the matrix:
0.48.0 (>= 2.4), 0.49.0/0.50.0/0.51.2/0.52.0 (>= 2.6),
0.56.2/0.57.0/0.58.1/0.58.2/0.59.0.dev.1/0.59.0.dev.2 (>= 3.0), and
castwide/solargraph branch v0.59 (>= 3.0). All of those still resolve on
Ruby 3.0 and keep running.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F1B9SLWrXrKL9SNGy7SXot

* Test the released 0.60.3 in CI; drop the superseded v0.59 branch cell

Nothing in the matrix ran with MATRIX_SOLARGRAPH_VERSION=0.60.3, so the
0.60.3 skip lists added in the previous commit were exercised only on a
local checkout. Adding the version to the matrix makes them checkable:
Definitions#assert_matches_definitions leaves @allow_improvements off for
any non-`branch-` key, so an entry skipped for 0.60.3 that in fact
resolves correctly is reported rather than passing silently.

Released 0.60.3 sets required_ruby_version '>= 3.1', so the two Ruby 3.0
cells get the same exclusion castwide/solargraph master already has.

branch-castwide-v0.59 is pinned at 735eaa5d (2026-03-26), which is the
reproducer commit in castwide/solargraph#1235: the spec suite hangs
between core/Hash and core/Integer, and both Ruby 3.0 cells burned ~2h
of runner time before being cancelled. The fix, castwide/solargraph#1238,
merged to master on 2026-08-03 and was never backported to the v0.59
branch. The `branch-castwide-v0.59` keys left in spec/definitions/*.yml
are now unread; removing them is a separate change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TY8B7iFysoEXhFF3fbrgrK

* Record what solargraph 0.60.3 infers for 91 method definitions

castwide/solargraph#1201 stopped storing literal values in complex types,
so 0.59.2 onward widens `true` to `Boolean`, `:activerecord` to `Symbol`
and `-1|0|1` to `Integer`. Upstream describes this as disabled for now
while castwide/solargraph#1196 is open, so these are skips rather than a
rewrite of the shared `types:` list, which the 0.48-0.58.2 cells still
need. When 1201 is reverted, a FORCE_UPDATE run removes the skips again
via Definitions#remove_skip.

Two entries get the type itself corrected instead. `undefined` there was
solargraph declining to answer; `void` is the return type, and every
version that still answers `undefined` moves into the skip list:

  ActionController::Base.method_added
  Rails::Application.inherited

ActionController::Base#authenticate_with_http_token infers BasicObject,
which Definitions#process_potential_update treats as no better than
undefined, so it is skipped.

Generated with FORCE_UPDATE=true against solargraph 0.60.3 on Rails 8.0,
Ruby 3.2.8. Verified: 0 type mismatches and 0 stale skips on re-run.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TY8B7iFysoEXhFF3fbrgrK

* Record what castwide/solargraph master infers, and fix five stale types

Adds branch-castwide-master to the skip list of 89 definitions whose
recorded type is a literal that castwide/solargraph#1201 no longer stores
(`true`, `false`, `:activerecord`, `-1|0|1`). The key also covers every
other `branch-` version via Definitions#process_single_definition.

Five entries had a recorded type that was simply out of date, so they get
the type corrected and the versions that still disagree skipped:

  Module.constants        Array<Integer> -> Array<Symbol>
  Enumerable#sum          generic<Elem>  -> generic<E>
  Array#compact_blank     Array          -> Array<generic<Elem>>
  File#compact_blank      Array<String>  -> Array<generic<Elem>>

Module.constants returns symbols; Array<Integer> came from the literal
inference 1201 removed. The generics are unresolved because Definitions
calls Pin#typify without binding a receiver, so Elem has nothing to
resolve against - Enumerable.yml and Hash.yml already record them that
way, and Array.yml and File.yml were the outliers.

Verified against solargraph 0.60.3 and castwide/solargraph master
(8fda633) on Rails 8.0, Ruby 3.2.8: 0 type mismatches, 0 stale skips.
Both still fail rails_spec.rb:100, which is unrelated to definitions.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TY8B7iFysoEXhFF3fbrgrK

* Keep compact_blank's resolved types; skip the versions that lost them

Array#compact_blank and File#compact_blank now report
Array<generic<Elem>>, and recording that would have encoded a regression.
Elem is not a type parameter of either class:

  core/enumerable.rbs:274   module Enumerable[unchecked out E]
  core/io.rbs:618           include Enumerable[String]   (class File < IO)
  activesupport-7.0.rbs:97  module Enumerable[unchecked out Elem]
                            def compact_blank: () -> Array[Elem]

Substitution still works when the parameter name matches core's. File
declares no to_a of its own, and `solargraph pin File#to_a --stack
--typify` resolves E to String, giving ::Array<::String>. The same
command for compact_blank leaves Elem unbound, because gem_rbs_collection
reopens Enumerable under a different parameter name than core uses.

So Array<String> stays the recorded type for File and Array stays Array,
with 0.60.3 and branch-castwide-master skipped until the substitution is
fixed.

Verified against solargraph 0.60.3 and castwide/solargraph master
(8fda633) on Rails 8.0, Ruby 3.2.8: 0 type mismatches, 0 stale skips.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TY8B7iFysoEXhFF3fbrgrK

* Skip migration block param assertions on known-broken solargraph versions

t in create_table :things do |t| stopped resolving to TableDefinition in
solargraph 0.59.2. The type comes from this gem's create_table annotation,
which used to be folded into activerecord's pin for the same path; since
castwide/solargraph#1195 removed GemPins.combine_method_pins_by_path from
Store#get_methods, both pins survive and activerecord's untyped block wins.

Which pin wins is not defined. ApiMap#inner_get_methods sorts method pins by
name, and Ruby's sort is unstable, so pins sharing a name compare equal and
their order varies with the array. The same annotation wins in a reduced
workspace and loses here.

Bisected to a4a4d475 (09be4a68, immediately before it, passes). First released
in 0.59.2; 0.59.1 passes, and the guard leaves the assertions running there.

The versions are listed rather than bounded with >=, so a later release that
still has the bug runs the assertions and fails instead of being skipped
silently. castwide/solargraph#1288 restores the merge and was verified to make
this example pass again.

Not pending: branch-castwide-master reports Solargraph::VERSION as 0.60.3, so
an unexpectedly-passing example would fail this repo's CI as soon as the fix
merges upstream, before any version bump.

Verified on Rails 8.0 / Ruby 3.2.8: 0.60.3 and branch-castwide-master give
43 examples, 0 failures; 0.59.1 and 0.58.2 still run the assertions.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TY8B7iFysoEXhFF3fbrgrK

* Scope the migration skip to released versions only

Keying the guard on Solargraph::VERSION skipped branch-castwide-master too,
since master reports 0.60.3. That cell would have stayed skipped after
castwide/solargraph#1288 lands, hiding the fix instead of reporting it.

Use the CI matrix key the way spec/definitions.rb does, and list only frozen
releases. 0.59.2 and 0.60.3 will never gain the fix, so skipping them states a
fact; branch keys are absent, so branch-castwide-master runs and fails until
the upstream merge, which is the signal we want.

Also satisfies Style/IfUnlessModifier, which the previous form tripped.

Verified on Rails 8.0 / Ruby 3.2.8:
  0.60.3                  1 example, 0 failures, 1 pending
  branch-castwide-master  1 example, 1 failure
  0.59.1                  1 example, 0 failures

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TY8B7iFysoEXhFF3fbrgrK

* Exclude generated config files from the rails new typecheck

ENV[] and ENV.fetch stopped resolving in solargraph 0.59.0.dev.1, so
`solargraph typecheck --level strong` reports 10 problems across config/boot.rb,
config/puma.rb and config/environments/*.rb in a stock rails new project. Last
good release was 0.58.3.

YARD derives a Class<ENV> namespace pin from `class << ENV` in pp, which reaches
every Rails app via railties -> irb -> pp. That pin shadows the RBS constant, so
neither [] nor fetch dispatches. castwide/solargraph#1279 fixes it; verified
against this workspace, where its branch reports 0 problems on an ENV probe that
gives 2 on released 0.60.3.

The job pins castwide master and has no version dimension, so the exclusion is
by file rather than by version. Master reports 0.60.3 until the next release, so
this will not lift itself when 1279 merges - it has to be removed by hand.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TY8B7iFysoEXhFF3fbrgrK

* Add min_rbs to gate a definition on the rbs version

rbs 4.0 renamed Enumerable's type parameter from Elem to E, so Enumerable#sum
infers generic<Elem> under rbs 3.x and generic<E> under 4.x. The matrix hits
both: the workflow runs `bundle update rbs`, which resolves to the newest rbs
the cell's Ruby allows, and rbs 4.1.3 requires Ruby >= 3.2. Ruby 3.1 cells stay
on rbs 3.10.4.

added_in/removed_in gate on Rails and mean the method does not exist there, so
neither states this constraint. min_rbs does, and keeps the assertion live on
every cell with rbs 4.x instead of dropping it everywhere via skip.

Verified on Rails 8.0 / Ruby 3.2.8 / rbs 4.1.3: 43 examples, 0 failures. The
rbs 3.x path is unverified locally - spec/rails7 does not reproduce CI's
results here, with 12 unrelated core-extension examples failing on undefined.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TY8B7iFysoEXhFF3fbrgrK

* Declare return types for inherited and method_added

Both inferred void on Rails 8.0 and undefined on Rails 7.x, so recording either
in the yml fails half the matrix. Declaring them here makes the type uniform
across Rails versions rather than depending on what each one happens to infer.

Verified under solargraph 0.60.3 on Rails 7.2 and 8.0: both typify as void.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TY8B7iFysoEXhFF3fbrgrK

* Stop skipping inherited and method_added by solargraph version

Declaring the return types in the annotations makes both resolve on every
solargraph version, so their skip lists - added when older versions genuinely
could not infer them - now describe something untrue. The suite flags that
deliberately: "marked as skipped ... but is actually present and correct",
across 20 cells from 0.48.0 through 0.59.0.dev.2.

Also moves the min_rbs gate out of process_single_definition, which was already
at its Metrics limits, and silences Lint/MissingSuper on the two callback stubs.

Verified on Rails 8.0 / Ruby 3.2.8, full suite:
  0.58.2   3 failures before, 1 after (the remaining one is Date#<=>, pre-existing)
  0.60.3   0 failures

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TY8B7iFysoEXhFF3fbrgrK

* Handle solargraph versions that ship no rbs

0.48.0 predates solargraph's rbs dependency, so RBS::VERSION is undefined and
the min_rbs gate raised NameError on four cells.

Fall through rather than skipping when the constant is missing, and list 0.48.0
in the entry's skip. A silent skip on undefined would drop the assertion
whenever RBS::VERSION goes missing for any reason; listing the one version that
has no rbs keeps that case loud.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TY8B7iFysoEXhFF3fbrgrK

* Gate compact_blank and Module.constants on rbs 4

Under rbs 3.10.4 the generic substitution in Enumerable#compact_blank works,
giving ::Array[untyped] on Array and ::Array[::String] on File, and
Module.constants still infers Array<Integer>. Under rbs 4.x those become
Array<generic<Elem>> and Array<Symbol>, which is what the entries record.

The recorded values were measured on Ruby 3.2 only. The single Ruby 3.1 cell
running 0.60.3 is the only one on rbs 3.x, so it was the only one to disagree.

min_rbs states the constraint the entries actually carry rather than skipping
the solargraph version outright, so every cell with rbs 4.x keeps asserting.

Verified on Rails 8.0 / Ruby 3.2.8 / rbs 4.1.3: 43 examples, 0 failures.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TY8B7iFysoEXhFF3fbrgrK

* Key the bug allow-lists on the reported solargraph version

The migration guard read MATRIX_SOLARGRAPH_VERSION, so branch-castwide-master
was a distinct key and never matched the list, leaving that cell red until the
upstream fix lands.

Read Solargraph::VERSION instead. Master reports 0.60.3 today, so it is covered
now and leaves the list the moment castwide bumps the version - at which point
a version that still has the bug fails the assertions rather than skipping them.

Same treatment for the rails new ENV exclusion, which was unconditional.

Verified on Rails 8.0 / Ruby 3.2.8:
  branch-castwide-master  43 examples, 0 failures, 4 pending
  0.58.2                  43 examples, 1 failure  (Date#<=>, pre-existing)

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TY8B7iFysoEXhFF3fbrgrK

* Exclude routes and schema files from the rails new typecheck

Removing the ENV errors uncovered the next ones, which the job had been exiting
before it reached:

  config/routes.rb:6                        Unresolved call to get
  db/{cable,cache,queue}_schema.rb:2,14,22  Unresolved call to create_table

Same cause as the migration spec. This gem annotates ActiveRecord::Schema.define
and the routes mapper with @yieldreceiver, and since castwide/solargraph#1195
those annotations are a second pin for the same path and lose to the gem's own,
so the block parameter has no type.

Verified on castwide/solargraph#1288's branch: ActiveRecord::Schema.define goes
from three pins with an untyped rbs pin first to two with the annotation folded
into the winner.

Gated on Solargraph::VERSION like the other allow-lists, so master is covered
while it reports 0.60.3 and the exclusion lifts when that is bumped.

Rails 7.0 was already passing - it generates no Solid Cable/Cache/Queue schema
files.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TY8B7iFysoEXhFF3fbrgrK

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
apiology added a commit to apiology/solargraph that referenced this pull request Sep 6, 2026
BaseVariable#probe selects a single position out of a tuple for a
non-splat multiple-assignment target, and drops the target when its
index runs past the end. No source reaches that branch:
ComplexType#tuple? returns false unconditionally on master, a shim
added by "Ignore literal values in type inference" (castwide#1201) and removed
again by the open castwide#1223.

A comment recording that would go stale silently once castwide#1223 lands. The
pending spec asserts the behaviour that PR makes correct instead, so it
fails today and breaks the build the day it starts passing, forcing
whoever lands castwide#1223 to delete the pending line.

Undercover still reports the enclosing block at 83.33 percent, with
[type.all_params[index]].compact at zero hits. Closing that needs
castwide#1223, not another example.

spec/pin/base_variable_spec.rb: 10 examples, 0 failures, 1 pending.
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.

1 participant