Skip to content

Integration batch 1240b: castwide/solargraph#1240 - #236

Merged
apiology merged 260 commits into
2026-10-19from
2026-10-19-batch-1240b
Oct 21, 2026
Merged

apiology merged 260 commits into
2026-10-19from
2026-10-19-batch-1240b

Conversation

@apiology

Copy link
Copy Markdown
Owner

Claude: CI for the castwide#1240 merge before it goes onto #213; closed once merged or superseded.

apiology and others added 30 commits August 2, 2026 11:32
Continues re-enabling `solargraph typecheck --level strong` in CI.

- lib/solargraph/convention/data_definition/data_assignment_node.rb:
  fully clean (7 -> 0).
- lib/solargraph/convention/struct_definition/struct_assignment_node.rb:
  fully clean (7 -> 0).
- lib/solargraph/convention/struct_definition/struct_definition_node.rb:
  fully clean (7 -> 0).

Real fix, applied identically across the two `*_assignment_node.rb`
files (they're structurally the same class, one for `Data.define`,
one for `Struct.new`): `node.children[2]` and `node.children[0]` were
each re-evaluated 2-3 times across a nil check and subsequent uses.
Solargraph doesn't narrow a repeated method-call expression the way
it narrows a plain local variable, so each re-access re-triggered the
same nilable warning even though the code was already guarded.
Extracting each into a local variable once, right after computing it,
lets Solargraph's ordinary local-variable nil-narrowing do its job
instead of suppressing each repeated access individually.

The remaining occurrences (mostly in `struct_node`/`data_node`
private helper methods that intentionally re-derive from `node`
without a preceding nil check, and a few multi-level `.children[0]`
chains) are `@sg-ignore`s matching this codebase's established
conventions.

Verified: full rspec suite (1618 examples, 0 failures, 60 pending)
and typecheck strong (197 -> 176 problems this batch; 497 -> 176
overall across eleven batches).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
(cherry picked from commit e51fe1f)
Continues re-enabling `solargraph typecheck --level strong` in CI.

- lib/solargraph/doc_map.rb: fully clean (8 -> 0 problems).
- lib/solargraph/pin/callable.rb: fully clean (7 -> 0 problems).
- lib/solargraph/source.rb: fully clean (7 -> 0 problems).

All `@sg-ignore`s matching this codebase's established conventions
from earlier batches: `Hash#key?`-guard/`Hash#[]=`-then-fetch not
narrowing, the `Open3.capture3` overload-resolution gap (a third
call site, same as batches 4 and 7), `||=` on a Hash key not
narrowing, and the `nil`-literal-vs-`NilClass` representation
mismatch. One case in `source.rb` also carries a real type-hierarchy
gap Solargraph can't see: `Parser::AST::Node` is a subclass of the
`ast` gem's `AST::Node`, but nothing tells Solargraph about that
relationship, so a method declared to return `AST::Node` that
actually returns a `Parser::AST::Node, nil` needs suppressing on both
counts.

Verified: full rspec suite (1618 examples, 0 failures, 60 pending)
and typecheck strong (176 -> 154 problems this batch; 497 -> 154
overall across twelve batches).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
(cherry picked from commit 287fff7)
Continues re-enabling `solargraph typecheck --level strong` in CI.

- lib/solargraph/complex_type.rb: fully clean (7 -> 0 problems).
- lib/solargraph/complex_type/unique_type.rb: fully clean (7 -> 0
  problems).

Real fix: `ComplexType#expand` and `UniqueType#expand` had no
`@param`/`@return` tags at all; added `@param named_types
[Hash{String => UniqueType}]` / `@return` tags matching how they're
actually used (`named_types[name] || self`).

The rest are `@sg-ignore`s matching established conventions:
`Array#first`/`Array#[]` on `@items` treated as guaranteed-present
(a ComplexType always wraps at least one UniqueType) but not
provable statically, and the `nil`-literal-vs-`NilClass`
representation mismatch.

Verified: full rspec suite (1618 examples, 0 failures, 60 pending)
and typecheck strong (154 -> 140 problems this batch; 497 -> 140
overall across thirteen batches).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
(cherry picked from commit 246d72b)
Continues re-enabling `solargraph typecheck --level strong` in CI.

- lib/solargraph/pin_cache.rb: fully clean (6 -> 0 problems).
- lib/solargraph/pin/base.rb: fully clean (6 -> 0 problems).
- lib/solargraph/yard_map/mapper/to_method.rb: fully clean (6 -> 0
  problems).
- lib/solargraph/shell.rb: fully clean (6 -> 0 problems).

Real fixes: `Pin::Base#macro_names` and `#collect_macro_names` had no
`@return` tag at all; added `@return [Array<String>]` matching their
actual behavior. `Shell#rbs` (a Thor CLI command) had no `@return`
tag either; added `@return [void]`.

The rest are `@sg-ignore`s matching established conventions,
including a new instance of the `FileUtils::path` RBS type-alias gap
(6 call sites across pin_cache.rb and shell.rb -- `FileUtils::path`
is an RBS type alias for a String/Pathname union, but Solargraph
doesn't resolve the alias against a literal String argument) and the
`choose_pin_attr_with_same_name` dynamic-`send`-based generic return
gap already seen for its sibling `choose_pin_attr` in batch 12.

Verified: full rspec suite (1618 examples, 0 failures, 60 pending)
and typecheck strong (140 -> 117 problems this batch; 497 -> 117
overall across fourteen batches).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
(cherry picked from commit 5f63ed2)
…specs

Continues re-enabling `solargraph typecheck --level strong` in CI.

- lib/solargraph/api_map/cache.rb: fully clean (5 -> 0).
- lib/solargraph/parser/parser_gem/node_processors/namespace_node.rb:
  fully clean (5 -> 0).
- lib/solargraph/parser/parser_gem/node_processors/resbody_node.rb:
  fully clean (5 -> 0).
- lib/solargraph/source_map/clip.rb: fully clean (5 -> 0).
- lib/solargraph/workspace/gemspecs.rb: fully clean (5 -> 0).

Real fixes:
- `Cache#get_methods`/`#get_constants`/`#get_receiver_definition` are
  Hash-backed cache lookups that can genuinely miss (declared
  non-nilable but a `Hash#[]` cache read can return nil) -- widened
  their `@return` tags to include `nil`, matching how their one
  caller (`ApiMap#get_methods`, `unless cached.nil?`) already treats
  them.
- `NamespaceNode#parameters_from_inline_rbs`: replaced a
  guard-then-repeated-access on `match[1]` with a local variable so
  Solargraph's ordinary nil-narrowing applies.
- `ResbodyNode#process`: same fix for `node.children[1]`, reused
  across four lines in the method.
- `Workspace::Gemspecs#gemspec_or_preference`: same `preference_map`
  `Hash#key?`-guard pattern already fixed in `DocMap` (batch 12) --
  this is a separate, similarly-named method in a different class.

The rest are `@sg-ignore`s matching established conventions,
including a fourth `Open3.capture3` overload-resolution gap site.

Verified: full rspec suite (1618 examples, 0 failures, 60 pending)
and typecheck strong (117 -> 92 problems this batch; 497 -> 92
overall across fifteen batches).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
(cherry picked from commit c1e5db8)
… nodes

Continues re-enabling `solargraph typecheck --level strong` in CI.

Note: this branch's original base already called simple_resolve(name,
mixin, internal) in Constants#complex_resolve's mixin-recursion
branch (a pre-existing bug: simple_resolve only resolves one gate,
unlike resolve(name, mixin), which recurses through resolve_and_cache
across all of mixin's own ancestry, so multi-hop transitive constant
resolution silently broke -- e.g. Module4 includes Module3 includes
Module2 includes Module1, with a constant assigned in Module2
referenced from Module4). castwide/master fixed this independently in
castwide#1234 ('resolves remote constants'), which also added a regression
test for it, after this branch was created. Since this consolidation
branch is built on current master, that fix is already present;
keeping master's resolve(name, mixin) as-is here rather than
reintroducing the stale simple_resolve call via this cherry-pick's
patch context. Kept the rest of this commit's sg-ignore comments and
annotation fixes elsewhere in this file/batch.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
(cherry picked from commit 035705ca4d2d7f00c5a67e0c9a24f81f14fa789e)
…, ParseDirective

Continues re-enabling `solargraph typecheck --level strong` in CI.

- lib/solargraph/parser/node_processor.rb: fully clean (3 -> 0).
- lib/solargraph/parser/parser_gem/node_processors/args_node.rb:
  fully clean (3 -> 0).
- lib/solargraph/source/chain.rb: fully clean (3 -> 0).
- lib/solargraph/source_map.rb: fully clean (3 -> 0).
- lib/solargraph/yard_map/directives/parse_directive.rb: fully clean
  (3 -> 0).

All `@sg-ignore`s matching established conventions from earlier
batches: `||=` on a class variable Hash not narrowing, `Array#last`
treated as guaranteed-present, generic-method (`_locate_pin`)
downcasts to specific return types, and the
`nil`-literal-vs-`NilClass` ternary mismatch.

Verified: full rspec suite (1618 examples, 0 failures, 60 pending)
and typecheck strong (72 -> 57 problems this batch; 497 -> 57
overall across seventeen batches).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
(cherry picked from commit 6d0b3ad)
…e hard-fail

Closes the last 41 problems, bringing `solargraph typecheck --level
strong` from 497 problems (when this PR started, method stubbed) to
0. Also removes `continue-on-error: true` from the typecheck CI step
(the `@todo Temporary, expect to revert in 0.60` this PR has been
working toward since batch 1) -- strong mode is now a real, enforced
gate again, not just informational.

18 files hit real fixes:
- `Workspace#source` / `#synchronize!`, `YardMap::Cache#get_path_pins`,
  `YardMap::Mapper#macros_for_method_object`: Hash-backed lookups
  declared non-nilable but genuinely can miss -- widened return types
  or added `|| []`/`|| default` fallbacks matching how callers
  already treat them.
- `Host::Message.select`, three `set_result nil` call sites,
  `RbsMap#short_name`, `Source::Chain::Literal#value`: missing or
  wrong `@return`/`@param` tags (a literal `[Bool]` typo, an
  `attr_reader` with no declared type at all).
- Five identical `closure_at` methods across
  yard_map/directives/{attribute,domain,method,override,visibility}_directive.rb
  shared the exact same `Array#select.last` pattern already root-caused
  and fixed once for parse_directive.rb in batch 17.

The remaining ~30 files are `@sg-ignore`s matching every convention
established across this PR's 18 batches: `Hash#[]`/`Array#last`
guard-then-fetch not narrowing, the `nil`-literal-vs-`NilClass`
mismatch, the `Open3.capture3` overload-resolution gap (two more
sites), and the `FileUtils::path` RBS type-alias gap (now also fixed
in this repo's own Rakefile, which the strong-mode target apparently
covers too).

Verified: full rspec suite (1618 examples, 0 failures, 60 pending)
and typecheck strong: 41 -> 0 problems in 250 files, exit code 0.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
(cherry picked from commit 1ecdfc7)
…-room verification

`Gem::StubSpecification` was unresolvable as a constant in a freshly
bundled, freshly `rbs collection install`-ed environment (Docker
ruby:4.0, matching the CI recipe exactly), even though this repo's
long-lived local development bundle didn't hit it -- this repo has
no committed Gemfile.lock or rbs_collection.lock.yaml (both
gitignored), so every fresh install resolves whatever gem/RBS
versions are current at that moment. `@sg-ignore` matching this
PR's established pattern for RBS-resolution gaps in `case`/`when`.

Caught by re-verifying the final batch in a brand-new Docker
container + fresh clone, rather than trusting the long-lived local
bundle this whole PR was developed against -- worth flagging as a
real (if narrow) source of CI flakiness independent of any code
change here, since a *different* constant could equally fail to
resolve on a different day depending on what gem_rbs_collection's
`main` branch or RubyGems' own RBS core sigs look like at that
moment.

Verified in a fresh Docker clean-room (bundle install + rbs
collection install from scratch, matching CI): typecheck strong
0 problems, exit 0. Full rspec suite: 1618 examples, 0 failures,
60 pending.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
(cherry picked from commit 6a4961f)
CI (Solargraph / strong, hard-fail since batch 18) found 4 problems
against current castwide/master that did not exist when this branch
was originally authored:

- lib/solargraph/api_map/constants.rb:162: batch 16's cherry-pick
  context assumed the old simple_resolve(name, mixin, internal) call
  this branch's base had; since this branch keeps master's corrected
  resolve(name, mixin) (see batch 16's message), the @sg-ignore that
  used to suppress an 'Unresolved call to +' on the idx + 1 access a
  few lines down (closure-captured from the outer with_index block)
  got dropped along with it. Restored it in its new spot.
- lib/solargraph/doc_map.rb:427, workspace/gemspecs.rb:213,
  workspace/require_paths.rb:84: three @sg-ignore comments that
  predate this branch (none of the 19 batches touch these lines) are
  now flagged unneeded -- upstream master's type inference improved
  enough since this branch was created that they're no longer
  required. Removed.

Verified: full rspec suite (1618 examples, only the 2 pre-existing
environment-dependent shell_spec.rb failures also present on
castwide/master), rubocop (no new offenses vs. baseline).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The 28 non-comment hunks that touched actual Ruby behavior (nil-guard
fixes, return-value corrections, dead duplicate method removal,
Sorbet-narrowing refactors) now live in castwide#1245. This branch reverts
those hunks back to their pre-cleanup form and marks each resulting
strong-typecheck gap with an @sg-ignore comment referencing castwide#1245, so
this PR stays annotation- and CI-gate-only as requested.

Verified via solargraph typecheck --level strong: normalized diff
against the pre-revert state of this branch shows zero net-new
problems introduced by the revert (all reverted spots are covered by
the new ignores; remaining diffs are pre-existing version-drift noise
already present on this branch). Full test suite: 1618 examples, 0
failures.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYQc4tRAkDEfp6vZsvHaXr
The comment block above require_all_unique_types_match_expected? was a
stale, hand-maintained tally of @sg-ignore reasons and counts. Recomputed
from a full grep over lib/**/*.rb: 745 total (was ~373), reflecting both
growth in the underlying campaign (e.g. "Need to add nil check here"
281 -> 465) and the new castwide#1245-deferred entries from this PR's split
(29 nil-check, 13 downcast, 6 return-value, 3 dead-code-removal).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYQc4tRAkDEfp6vZsvHaXr
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
Writing out '@sg-ignore' in prose (not as a real directive) made
Solargraph's ignore-scanner treat it as one, flagging require_all_unique_types_match_expected?
with a spurious Unneeded @sg-ignore comment warning. Switched to
'@ sg-ignore' (space), matching the existing convention already used
a few lines below in this same file.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYQc4tRAkDEfp6vZsvHaXr
Collapse the four different castwide#1245-deferred reason strings (nil-check,
downcast, return-value, dead-code-removal) down to one consistent
`# @sg-ignore https://github.com/castwide/solargraph/pull/1245`,
matching the castwide#1223 reference style and the repo's existing convention
of pointing an ignore straight at the PR that resolves it rather than
re-describing the reason inline.

Reverted the count doc in TypeChecker::Rules to the original flat
two-bucket format (no prose commentary) and regenerated the counts
using the actual ~/bin/solargraph-errors-group tool per the documented
recipe in ~/Dropbox/Shared/solargraph.md, rather than an ad-hoc filter.
The castwide#1223 and castwide#1245 buckets are now single flat count lines in
"pending code fixes," not broken out by what they used to be.

Verified: full test suite (1618 examples, 0 failures), rubocop clean,
and `solargraph typecheck --level strong` stable at 72 problems
(unchanged from before this commit).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYQc4tRAkDEfp6vZsvHaXr
The 28 "flow sensitive typing should support case/when" /
"flow based typing needs to understand case when class pattern"
ignores in rbs_translator.rb and rbs_map/conversions.rb all describe
the same gap: the type checker doesn't narrow a case/when subject's
type inside each branch. Filed and confirmed as
castwide#1241 - rewrote all 28
to point there instead of restating the reason inline, matching the
castwide#1223/castwide#1245 convention.

Checked for issue coverage on the other "flow sensitive typing could
handle" categories too (attrs, redefinition, ||= on lvars, .class ==
.class, boolish support, etc.) - no clear existing issue found for
those via search, so left as-is. Also checked "Need to handle
duck-typed method calls on union types": issues #453/#511 looked like
a match at first glance but describe a different mechanism (YARD
`@return [#call]` duck-type tags, not union-type method resolution)
so left unlinked rather than mis-attribute it.

Regenerated the count doc using solargraph-errors-group per the
documented recipe. Verified via a clean stash/restore comparison
(not just before/after diffing, since consecutive typecheck runs
have shown transient non-determinism this session) that this
comment-only change introduces zero new problems: full test suite
1618 examples/0 failures, rubocop clean, typecheck stable at 72.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYQc4tRAkDEfp6vZsvHaXr
Three of the largest remaining "flow sensitive typing could handle"
categories described coherent, reproducible gaps with no existing
tracking issue (searched castwide/solargraph issues first, no match):

- "flow sensitive typing needs to handle attrs" (30): a nil-guard on
  an attr_reader-style call doesn't narrow a later repeated call to
  the same accessor, since each call is treated as independent rather
  than as if it were a local variable. Filed as
  castwide#1249.
- "flow sensitive typing should be able to handle redefinition" (20):
  reassigning a variable to a value of a different (non-literal) type
  doesn't update its tracked type - distinct from castwide#1196/castwide#1223, which
  cover literal-value tracking through reassignment specifically for
  array/tuple indexing. Filed as
  castwide#1250.
- "flow sensitive typing needs to narrow down type with an if is_a?
  check" (12): narrower-scoped than castwide#1241 (case/when) - covers is_a?
  checks combined with && and elsif branches whose body doesn't see
  the narrowing established by its own condition. Filed as
  castwide#1251.

Rewrote all matching @sg-ignore comments to point at the new issues,
matching the castwide#1223/castwide#1245/castwide#1241 convention. Left the 4 sg-ignore notes
inside the disabled block in source/chain/literal.rb untouched (not
live directives) and the standalone @todo in shell.rb (different tag,
outside this doc's scope).

Regenerated the count doc via solargraph-errors-group. Verified: full
test suite (1618 examples, 0 failures), rubocop clean on all touched
files, and solargraph typecheck --level strong stable at 72 (checked
against a pre-edit baseline captured via stash, given transient
non-determinism observed between consecutive runs this session).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYQc4tRAkDEfp6vZsvHaXr
CI's strong-typecheck job flagged one problem this PR introduced:
reverting the found_versions extraction (deferred to castwide#1245) earlier
this session dropped the @sg-ignore Need a downcast here comment that
covered it, since CI's fresh gem install resolves Gem::Version
differently than my local (stale) gem cache did.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYQc4tRAkDEfp6vZsvHaXr
The ignore only associated with the raise statement's first line, not
the string-continuation line where the actual problem is reported.
Placing a comment between backslash-continued string literals silently
drops the second string at runtime (verified) rather than erroring, so
switched to + concatenation, which tolerates a comment between the
operands without changing behavior (verified the raised message is
byte-identical to before).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYQc4tRAkDEfp6vZsvHaXr
…notation-cleanup

# Conflicts:
#	lib/solargraph/rbs_map/conversions.rb
#	lib/solargraph/source.rb
…collection environment

Annotation-only: @sg-ignore comments and a few doc-type corrections
(Set vs Array, Thread::Mutex vs Mutex, Pin::Symbol vs ::Symbol
namespace collisions) for pre-existing gaps in already-annotated
files that this PR's local Ruby 3.2.6 testing didn't surface.
… Ruby patch

CI runs Ruby 4.0.6; my local verification used rbenv's 4.0.0, where this
constant resolved and the ignore looked unneeded. CI disagreed -- trusting
CI per this repo's convention for local/CI typecheck disagreements.
lib/solargraph/source/chain/literal.rb: attr_reader :word, :value stays
on one line as originally written; annotate the whole line with
@sg-ignore rather than splitting it to give :value its own @return tag.
The `regression`, `rails` and `rspec` jobs in plugins.yml each run
`solargraph typecheck --level strong` against this repo with a plugin
loaded, to catch a plugin breaking typechecking. All three carried
`continue-on-error: true` from 09be4a6 (castwide#1200),
so all three reported success while exiting 1.

They were exiting 1 for the same reason typecheck.yml was: at
8fda633 each reported "525 problems found in 90 of 250 files", the
identical count typecheck.yml reported. The annotations in this PR
resolve them. On this branch at 38abf73 all three report "0 problems
found in 0 of 250 files":

  regression https://github.com/castwide/solargraph/actions/runs/31549739327/job/93969644932
  rails      https://github.com/castwide/solargraph/actions/runs/31549739327/job/93969644920
  rspec      https://github.com/castwide/solargraph/actions/runs/31549739327/job/93969644939

Removing the flags here rather than in a follow-up keeps the fix and
the gates it restores in one change.

Left alone: run_solargraph_rails_specs, whose flag masks 18 failures
in iftheshoefritz/solargraph-rails and which no annotation here
touches.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CXmnT5gSB1PheL9UbiGEVA
Unmasking the typecheck steps makes two setup gaps visible to anyone
running the checker locally.

Rakefile: a checkout reports three Unresolved constant Vernier findings
until vernier is added to the gitignored .Gemfile. CI appends it before
every typecheck run, so CI is always clean while every new worktree is
not. The command is now next to the typecheck task.

gemspecs.rb: whether Gem::StubSpecification resolves varies by Ruby
patch release, and CI runs a newer one than most worktrees, so the
suppression there reports as Unneeded locally while CI needs it. It has
been removed and restored twice on local verdicts alone. A warning now
sits above it.
Range#to_hash builds its result from Position#to_hash for both the
start and end keys. Position#to_hash returns Hash{Symbol => Integer}
(line/character), not a Position object, so the tag was documenting
a type the method never produces.
Shorten the vernier setup comment to one line plus the code
sample. Replace the two "Need a downcast here" placeholders above
FileUtils.rm_rf/mv with the real cause: castwide#1255,
where typecheck rejects a String against the pathlist alias
because RBS aliases are not expanded before comparison.
rubocop-yard 1.3 fixes the YARD CollectionStyle crash seen with yard
0.9.44, but it requires Ruby 3.3 or newer. This repo supports Ruby 3.1
and up and runs specs on 3.1 and 3.2, so the dependency has to be
version-gated: 3.3 and newer take 1.3, older Rubies keep 1.0.x.

A gemspec cannot express a conditional dependency, and a gem cannot be
declared in both the gemspec and the Gemfile, so rubocop-yard alone
moves. The other RuboCop gems have no such condition and stay put.

Cherry-picked from #30, which cannot land as a whole.
apiology and others added 28 commits October 16, 2026 14:56
castwide#1245 types the loaded cache and checks it at runtime.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GgkyXKEZWpEFXo6ceA5MSw
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GgkyXKEZWpEFXo6ceA5MSw
castwide#1420 accepts an explicit @return [undefined] as declared.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GgkyXKEZWpEFXo6ceA5MSw
The ** splat checking is #63, stacked on castwide#1231; each marker
notes the branch.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GgkyXKEZWpEFXo6ceA5MSw
#139 is now open on castwide as castwide#1421.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GgkyXKEZWpEFXo6ceA5MSw
#185 is now open on castwide as castwide#1422.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GgkyXKEZWpEFXo6ceA5MSw
#182 is now open on castwide as castwide#1423.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GgkyXKEZWpEFXo6ceA5MSw
Plugin CI (rspec, rails, regression) reports JSON.parse receiving
String, nil at repo.rb:106 and require_paths.rb:83 without them;
they were unneeded only in the local environment.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GgkyXKEZWpEFXo6ceA5MSw
The typed Builders::Default#value is proposed upstream there.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GgkyXKEZWpEFXo6ceA5MSw
#189 is now open on castwide as castwide#1424.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GgkyXKEZWpEFXo6ceA5MSw
#181 is now open on castwide as castwide#1425.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GgkyXKEZWpEFXo6ceA5MSw
castwide#1245 switches to filter_map, whose nil-free element type castwide#1299 binds.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GgkyXKEZWpEFXo6ceA5MSw
#191 is now open on castwide as castwide#1426.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GgkyXKEZWpEFXo6ceA5MSw
Brings in castwide#1378, castwide#1306, castwide#1427, castwide#1317, castwide#1316, castwide#1314, castwide#1311, castwide#1309 and
castwide#1269. Master's code wins in every conflict; this branch's ignore
markers and YARD tags are re-applied on the lines that still exist.
External drops the old rbs collection loader in favor of master's
RbsCollection, and node_methods drops the :or branch castwide#1309 removed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SEntZKsZwQHhzqcwG7MTqn
After merging master, CI's strong typecheck no longer flags the lines
behind 50 @sg-ignore markers, so they are removed. Re-add the castwide#1400
and castwide#1258 markers in External.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SEntZKsZwQHhzqcwG7MTqn
After the castwide/master merge, strong typecheck reports these markers
as "Unneeded @sg-ignore comment" both locally (Ruby 4.0.6, rbs 4.2.0)
and in all three Plugin CI typecheck jobs on Linux (Ruby 4.0.7 and
3.4.11). Removing each one adds no new problem. Thirteen are the
two-line castwide#1418/castwide#1416 child-node markers; one is "child node types
depend on parent node type" in NodeMethods.
Strong typecheck reported missing @param/@return tags on master's
RbsCollection and External methods; each tag states the type the
method body already returns. Typing deep_clone's copy block parameter
as Index lets strong resolve its protected writers and #send.
The master merge brought strong findings that every CI typecheck job
reports. Each marker reuses a label already on this branch or in the
rules.rb catalogue, or the PR fixing the mechanism:

- RbsCollection#raw_data is YAML.load_file, which has no usable type,
  so every raw_data[:gems] chain and Source.parse_docstring /
  SourceToYard#root_code_object (YARD::Docstring.parser and
  RootObject.new) are marked "Library method has no usable type".
- Hash#find with a destructured |key, _| block (castwide#1231), anonymous
  forwarding into RbsMap::Base.pins (castwide#1400), and the include/extend
  receiver check castwide#1418 rewrites as a pattern.
- SendNode's class_attribute and qualified-mixin code: children[2..]
  slices, and locals behind Parser.is_ast_node? or a derived-name guard
  that flow-sensitive typing does not follow.
- Definition#code_location reads best_location after a reject block.
No existing label or open castwide PR covers these, so each gets a
label naming the defect:

- Global variables from core RBS are untyped (9): every call on
  $stdout, $stderr or $PROGRAM_NAME is unresolved, even though rbs
  core declares $stderr: IO. Reproduced in a one-method file.
- Accept NilClass where nil is declared (3): a literal nil argument or
  branch infers NilClass, which a declared nil rejects
  (EnvironmentLoader.new(core_root: nil), RbsCollection#best_key).
- Define the missing read_rbs_collection_paths (2): master's
  External#rbs_collection_paths calls a method nothing defines.
- Skip collection gems that have no source path (1):
  RbsCollection#gem_source_path returns nil without a root path, and
  that nil reaches RbsMap::Path.pins.
rbs collection picks the ast/2.4 shim for ast 2.4.3, so the precise
children type in ast/0 never applied and Array[self] told strong that
every child is a node. Children also hold literals, names and nil, so
the 2.4 shim now declares the same union as the 0 shim.
With AST::Node#children typed as its real union, these lines are
flagged again: the code still assumes every child is a node, which
castwide#1418 rewrites with patterns and castwide#1416 types. Reverts 9a58560.
Typing AST::Node#children as its union surfaces 49 more lines that
use a child, or a local read from one, as a node. castwide#1418 rewrites
each of those reads with a typed pattern and castwide#1416 types the
captures, so they get the same two-line marker as the existing ones.
ClassAssignmentNode's 8 findings are left unmarked: castwide#1418 does not
touch that file.
Each comment that named its defect in words now links the open PR
that fixes it, so the comment can be removed once that PR merges.
Index#deep_clone gets a new marker for the strong finding that
#207 fixes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SEntZKsZwQHhzqcwG7MTqn
castwide#1223 is closed. Merging #225 onto this
branch makes 22 of its 86 markers, and the root_code_object one,
Unneeded under strong typecheck, so those now cite #225. The other
64 markers stay: neither #225 nor #227 clears them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SEntZKsZwQHhzqcwG7MTqn
The regression check strong typecheck on Ruby 4.0 reports the
marker on Index#deep_clone as an unneeded ignore comment.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SEntZKsZwQHhzqcwG7MTqn
Typing AST::Node#children as its union surfaces 8 findings in
ClassAssignmentNode. castwide#1418 rewrites these reads with typed patterns;
merged onto this branch it clears all 8, so each read gets a marker
citing it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SEntZKsZwQHhzqcwG7MTqn
…typechecking in CI

castwide#1240 and castwide#1245 both branch from c961a9d; castwide#1245 carries the code
fixes castwide#1240 had pointed its markers at. Conflicts resolved by intent,
starting from the earlier castwide#1240 merge (0b3a1c2) for the hunks castwide#1245
does not touch: keep castwide#1245's code, and keep castwide#1240's marker labels
where castwide#1245 left a marker in place (host.rb predicates, node_chainer,
namespace_node, resbody_node, block.rb, rbs_map/conversions.rb), plus
castwide#1240's Repo#bundle_script @return tag. Keep castwide#1245's deletion of
YardMap::Cache and DomainDirective. rules.rb keeps castwide#1240's @todo list
plus the two castwide#1245 labels still in use. .rubocop_todo.yml regenerated
with RuboCop 1.92.0.

Combination markers: castwide#1240's AST::Node#children union makes child
reads in castwide#1245's rewritten code fail, so those get castwide#1240's
1418/1416 child-node marker (Data/Struct assignment nodes,
NodeMethods.drill_signature, CasgnNode, SendNode#process_attribute).
Lines castwide#1245 rewrote get the marker castwide#1240 had on the same expression:
#225 in Constants#resolve_and_cache, castwide#1223 and castwide#1259
in Library, castwide#1258 in Callable, #178 on Method's
attr_writer, and castwide#1400 on uncache/load in
Collection::Gem.load_all. castwide#1240's pull/1245 markers stay on
CheckGemVersion's show_message, Repo's bundled_group_map and
Chain::Parameter#current_index, where castwide#1245 does not clear the
finding.

Remove 41 markers strong reports as unneeded: 30 cite castwide#1245, whose
fixes are now in; the other 11 are cleared by castwide#1245's code and
castwide#1240's annotations combined.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SEntZKsZwQHhzqcwG7MTqn
@apiology
apiology merged commit da71471 into 2026-10-19 Oct 21, 2026
16 checks passed
@apiology

Copy link
Copy Markdown
Owner Author

Claude: Merged into #213 as da71471.

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