Repository navigation
Conversation
apiology
marked this pull request as draft
August 2, 2026 15:51
apiology
commented
Aug 2, 2026
This was referenced Aug 2, 2026
Closed
apiology
marked this pull request as ready for review
August 3, 2026 00:07
Contributor
Author
|
@castwide - ready for review |
apiology
added a commit
to apiology/solargraph
that referenced
this pull request
Aug 12, 2026
Re-enables `solargraph typecheck --level strong` as an enforced CI gate - removes `continue-on-error: true` from .github/workflows/typecheck.yml. Most of the diff is @sg-ignore comments documenting type gaps strong mode can't resolve on its own (flow-sensitive-typing limits, the nil-vs-NilClass representation mismatch, guard-then-fetch patterns that don't narrow, RBS overload/ type-alias gaps). A handful of real fixes are included (missing/wrong @return/@PARAM tags). This branch's own lib/ tree has diverged substantially from castwide#1240's target (39+ merged PRs' worth of independent work), so merging this required a full annotation sweep on top of the mechanical merge to actually make the newly-hard CI gate pass - see below. Conflicts (20 files) fell into two categories: 1. Genuine competing logic, where incoming's branch (based directly on castwide/master) predated work already merged into this branch. Kept this branch's side throughout: doc_map.rb's entire in-memory pin-cache architecture (superseded by the PinCache instance-based rewrite from castwide#1252, same pattern already identified during the castwide#1239 investigation earlier this session), rbs_translator.rb's compound-type-as-ComplexType-graph architecture (from castwide#1281, predates incoming's tag-string type_to_tag reintroduction), flow-sensitive-typing/node_chainer additions (rhs_never_returns tracking from castwide#1259), base_variable.rb's definite/narrowed_return_type naming (from castwide#1282), node_methods.rb's ENSURE handling (from castwide#1285), chain.rb/call.rb's receiver_path threading, and workspace.rb/pin_cache.rb duplicate method definitions incoming reintroduced that already exist elsewhere in this branch's own `class << self` blocks. 2. Pure annotation differences (add/adjust an @sg-ignore comment) where kept whichever side matched this branch's actual code structure. 2. Annotation sweep: after resolving conflicts, this branch's strong typecheck still reported 289 problems (down from 547 pre-merge, since castwide#1240's own annotations covered about half). 194 were "Unneeded @sg-ignore comment" (incoming's own ignore comments, correct on castwide#1240's target tree, landing on lines this branch's independent fixes already resolve) - removed mechanically by scanning upward from each flagged line for its comment. The remaining 95 were genuine new gaps on this branch's own code paths (mostly not exercised by castwide#1240's target tree at all) - added one @sg-ignore per flagged line, matching the established message-as-comment convention used throughout this codebase (@sg-ignore matches by string presence, not exact message, so one comment per line suffices even where a line has multiple flagged sub-expressions). Spot-checked the ones that looked most like real bugs rather than static-analysis gaps (BigDecimal-typed values in Integer-declared contexts, an Array#push type mismatch) against already-documented, already-tracked false-positive patterns in this codebase (the known BigDecimal-contamination artifact from earlier PR work, and a known is_a?-narrowing gap) - none were new bugs. Also fixed one new Style/Next rubocop offense the sweep introduced. Verified: full local `bundle exec rspec` (1826 examples, 0 failures, 51 pending - the only local-environment-dependent example, 'ignores undefined method calls from external sources', a pre-existing order-dependent kramdown-parser-gfm gem-cache flake already confirmed unrelated to this session's work, passed in this run), `solargraph typecheck --level strong` (0 problems, confirming the now-hard-gated CI job will pass), and `rubocop lib/` (13 offenses, matching this branch's pre-existing baseline exactly - none newly introduced by this merge).
apiology
added a commit
to apiology/solargraph
that referenced
this pull request
Aug 12, 2026
#49 CI (commit c53789b) failed two checks after castwide#1240 turned Solargraph/strong from advisory into a hard gate: - Solargraph/strong: this job runs Ruby 4.0 with the `vernier` gem installed (appended to .Gemfile in the workflow itself) and a freshly-installed RBS collection, none of which match this session's local verification environment (Ruby 3.2.6, no vernier). Three `# @sg-ignore Unresolved constant Vernier` comments in shell.rb and one `# @sg-ignore Declared return type ::Integer does not match inferred type ::BigDecimal` in source_chainer.rb (the known BigDecimal-contamination artifact from earlier PR work) were "Unneeded" there since Vernier resolves and the BigDecimal gap doesn't reproduce on Ruby 4.0 - removed. A new gap CI's fresh RBS install surfaces that this session's local environment didn't - `Unresolved constant Gem::StubSpecification` in workspace/gemspecs.rb - added. Since this job runs a single fixed Ruby/RBS combination (not a matrix) and is now the actual enforced gate, resolved these in favor of matching CI's environment exactly rather than this session's local one - local `solargraph typecheck --level strong` now shows the mirror-image gaps (Vernier unresolved x3, BigDecimal x1, since local lacks vernier and has the BigDecimal artifact), which is expected and matches this project's established pattern for environment-dependent typecheck gaps. - rubocop (reviewdog, filter_mode: added): flags any rubocop offense falling within the diff's changed hunks, not just genuinely new ones. Removing the 3 Vernier ignore-comment lines from inside Shell#profile touched that method's hunk, pulling its pre-existing (already at 110.1/110 before this session touched it) Metrics/AbcSize offense into scope. Added lib/solargraph/shell.rb to .rubocop_todo.yml's existing Metrics/AbcSize exclusion list, matching the pattern already used for api_map/source_to_yard.rb/node_chainer.rb/source_chainer.rb/clip.rb/ mapper.rb. Verified: spec/shell_spec.rb, spec/source/source_chainer_spec.rb, spec/workspace/gemspecs_resolve_require_spec.rb, spec/workspace/gemspecs_fetch_dependencies_spec.rb (87 examples, 0 failures), and `rubocop lib/solargraph/shell.rb` (0 offenses, previously 1).
apiology
added a commit
to apiology/solargraph
that referenced
this pull request
Aug 12, 2026
… stub A class defined in a gem and re-opened elsewhere via @!parse to add @Generic tags produced two pins for the same namespace/method path. ApiMap picked whichever pin loaded first - a gem's own pins load before workspace pins, so the annotation's @Generic declaration and overridden return types were silently ignored regardless of file naming/order. - ApiMap#namespace_pin_for_generics prefers the pin that actually declares generics over an arbitrary .first, used at the three call sites that resolve generic type parameters (get_methods, inner_get_methods, inner_get_methods_from_reference). - ApiMap::Store#get_methods combines same-path method pins into one, so a @!parse override's return type isn't shadowed by the plain, undocumented definition. Aliases are excluded from this combination: combining a MethodAlias pin with a non-alias pin at the same path produced a :combined pin that #resolve_method_alias couldn't trace back to its target, raising under SOLARGRAPH_ASSERTS=on. Fixes castwide#1286 Conflict in spec/source_map/clip_spec.rb: both sides independently added a new spec adjacent to the same insertion point - no real overlap, kept both. Verified: spec/source_map/clip_spec.rb, spec/api_map/store_spec.rb, spec/api_map_spec.rb, spec/api_map_method_spec.rb (284 examples, 0 failures, 11 pending), SOLARGRAPH_ASSERTS=on solargraph typecheck --level strong (4 problems, all in lib/solargraph/shell.rb and lib/solargraph/workspace/gemspecs.rb - the same Vernier-gem/ Gem::StubSpecification local-vs-CI environment split already established during the castwide#1240 merge, not new here), and a broader safety net - spec/type_checker, spec/source, spec/pin (612 examples, 0 failures, 18 pending).
apiology
added a commit
to apiology/solargraph
that referenced
this pull request
Aug 12, 2026
…wide#1281 fix #49 CI (commit a6942fc, merge of latest castwide#1281 - resolve type alias names against RBS core) failed Solargraph/strong: 9 "Unneeded @sg-ignore comment" problems, all wrapping FileUtils.rm_rf/rm_f/mkdir_p calls in Rakefile, lib/solargraph/pin_cache.rb, and lib/solargraph/shell.rb. Each ignore was covering "Wrong argument type for FileUtils.*: list expected FileUtils::path, ..., received String" - exactly the FileUtils::path alias-resolution gap the just-merged fix closes, so on CI's Ruby 4.0 + fresh RBS collection environment these calls now typecheck cleanly without the ignore. Confirmed genuinely environment-dependent, not a stale local cache: cleared ~/.cache/solargraph/ruby-3.2.6/rbs-4.1.2/solargraph-* and reran - 4 of the 9 removed comments (3 in pin_cache.rb, 1 in shell.rb) are still needed on this local environment (Ruby 3.2.6, RBS 4.1.2). Matches the same Ruby/RBS-version-dependent FileUtils::path resolution pattern already established for the Vernier-gem and Gem::StubSpecification gaps during the castwide#1240 merge - kept the removal as-is to match CI (the actual enforced gate) rather than restoring for local parity. Verified: spec/pin_cache_spec.rb, spec/shell_spec.rb (44 examples, 0 failures), and `rubocop lib/solargraph/pin_cache.rb lib/solargraph/shell.rb Rakefile` (0 offenses).
apiology
added a commit
to apiology/solargraph
that referenced
this pull request
Aug 19, 2026
apiology
added a commit
to apiology/solargraph
that referenced
this pull request
Aug 26, 2026
# Conflicts: # lib/solargraph/workspace/gemspecs.rb
apiology
force-pushed
the
consolidate-type-annotation-cleanup
branch
from
September 16, 2026 23:56
ed70026 to
44c0203
Compare
Merging castwide#1338 into this branch made the three api_map.rb markers Unneeded; the other 14 issue-1250 markers stay. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAm8uhPDwH4Vst3uzZtHU6
These 15 cleared in a scratch merge of castwide#1258 plus the bare implicit-self narrowing now being added to it (attr_reader only). The 7 that nothing cleared keep the issue URL. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAm8uhPDwH4Vst3uzZtHU6
castwide#1399 adds Pin::Base#location! and uses it at these twelve sites, whose pins come from parsed source. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAm8uhPDwH4Vst3uzZtHU6
castwide#1366 validates config values instead of ignoring bad ones, which these ten markers wait on. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAm8uhPDwH4Vst3uzZtHU6
Merging castwide#1400 into this branch made all sixteen issue-1108 markers Unneeded. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAm8uhPDwH4Vst3uzZtHU6
A scratch merge of castwide#1399 made this marker Unneeded. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAm8uhPDwH4Vst3uzZtHU6
Each of these readers or methods can return nil (a nil default in initialize, Array#first/#last, Hash#[], out-of-range slicing), but its @return said otherwise, and a "Need to add nil check here" marker hid the mismatch. Add nil to the declared type and drop the marker. Problem#location is left as is: widening it surfaces 8 problems on 6 unguarded callers, too broad for now. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAm8uhPDwH4Vst3uzZtHU6
Adding nil to the declarations in the previous commit surfaced problems at callers that do guard against nil, in forms flow sensitive typing does not follow: a repeated call to the same attr_reader after a nil check (pin.path, block, overload.block, Method#node) and Array#compact. Cite the existing PR and label for each. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAm8uhPDwH4Vst3uzZtHU6
These five errors come from match[0]/match[1] on a successful match, not from the Range slice their label named. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAm8uhPDwH4Vst3uzZtHU6
castwide#1245 rewrites these slices to delete_prefix and sub, which return String. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAm8uhPDwH4Vst3uzZtHU6
castwide#1245 adds explicit || fallbacks to these slices, whose start an earlier step already keeps in range. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAm8uhPDwH4Vst3uzZtHU6
Replace the copied error text on the sg-ignore with links to the PRs that clear it: castwide#1438 and castwide#1392.
#385 (array literal element inference) is closed; its upstream copy castwide#1481 and castwide#1223 were closed as not planned. castwide#1500, merged to master, clears these six lines with @type declarations, but master is not merged here yet and no open castwide PR fixes them. Each sg-ignore now carries its verbatim typecheck error, and the pin/base.rb "also needs castwide#1458" lines go with the old label. Count the six labels in rules.rb.
apiology
marked this pull request as draft
November 17, 2026 21:29
sg-ignores cite the open castwide PR that fixes their line, else the verbatim typecheck error, never an apiology PR. - definition.rb code_location: castwide#1478 rewrites it. - conversions.rb rebound_alias?: castwide#1491 removes it. - to_method.rb arg_name a[0] calls: castwide#1474 picks the Integer Array#[] overload, which clears all five. - namespace_node.rb parameters_from_inline_rbs: castwide#1344 replaces the MatchData code with trailing_rbs_type_args. - conversions.rb convert_decl_to_pin call: no castwide PR carries #427, so it takes the verbatim error. - rbs_collection.rb best_key: its label did not match its error, and castwide#1474 does not clear it, so it takes the verbatim error. Update the label counts in rules.rb.
#193 will not go upstream, and no open castwide PR touches these two lines, so each sg-ignore carries its verbatim typecheck error. Count both labels in rules.rb.
apiology
marked this pull request as ready for review
November 18, 2026 02:06
Labels cite the open castwide PR that clears the line, else the verbatim typecheck error. Of the 24 sg-ignores citing apiology PRs: - store.rb:35 cites castwide#1474; its overload loop change clears the error in a local run. - external.rb x2 cite castwide#1477, which deletes both. - delegated_method.rb:78 cites castwide#1338, which drops the same resolve_method sg-ignore on master. - active_support.rb classmethod_pins x2 cite castwide#1476, which rewrites the method. - The other 18 take their verbatim errors; no open castwide PR changes those lines or carries the apiology change. The keyword.rb and symbol.rb continuation lines pointed at an apiology branch and go with the old label. Update rules.rb counts.
Each label now cites the open castwide PR that clears its line, else its verbatim typecheck error. Sites where the checker is right and the code needs a fix cite castwide#1494, which takes such fixes: rbs_map/conversions.rb, host/dispatch.rb, comment_ripper.rb, node_chainer.rb, pin/method.rb, pin/namespace.rb, chain/parameter.rb and type_checker/problem.rb. pin/parameter.rb cites castwide#1258, whose head clears it. Prose labels and PR citations whose PR does not clear the line take the verbatim error. Update the label counts in rules.rb.
apiology
marked this pull request as draft
November 18, 2026 03:30
17b8ed7 pointed sg-ignores at PRs by mechanism without checking that the PR clears the line. Re-checked each surviving label: the PR must change the line, or clear the error when its change is applied. - LSP best_location sites: castwide#1478 rewrites them; castwide#1399 does not touch these files. - NodeProcessor::Base closure lookups: castwide#1399 changes them to location!. - Pin::Block receiver_pin: castwide#1393 passes closure!. - castwide#1394 sites in location.rb, class_methods.rb, source.rb and change.rb: with its from_node! change applied, the errors remain, so they take the verbatim error. castwide#1452 guards range in inner_folding_ranges, but result.last.start still fails. - Remaining castwide#1392, castwide#1393 and castwide#1395 sites: no open PR changes the line, and castwide#1395 covers only zero-start slices. Count the new labels in rules.rb.
A rescued exception is typed <class> & _Raised once intersection types land, which makes its backtrace non-nil, so the six e.backtrace.join sg-ignores take the intersection label instead of the verbatim error. Move their count in rules.rb.
apiology
marked this pull request as ready for review
November 18, 2026 15:49
Rename the '&' label to "Need intersection type support" and move the three sg-ignores that need RBS record types (Metagem.new(**data) and the Keyword/Symbol super calls) to "Need record type support". Point the library.rb match-in-condition site at PR 1338 and find_var's if/else block-call return at PR 1397, the open PRs that clear them. Update the rules.rb counts to match; the intersection count is the eight sites that carry it.
The two rest-param .name sites fail because the earlier defined?(RBS::Types::UntypedFunction) guard does not narrow method_type.type; name the missing feature instead of the symptom.
The merged Repo#build_from_directory rewrite makes the three pull/1479 sg-ignores on bundled? and bundled unneeded. Metagem#initialize now declares spec_file as String, so path_gem_from_lock passing a possibly nil Dir[].first gets a nil-check sg-ignore.
Repo#path_gem_from_lock passes Dir[].first, which is nil when no gemspec matches. The only consumer, to_specification, already returns nil via Gem::Specification.load(nil), so declare String, nil instead of suppressing the finding.
The seven sg-ignores this PR clears now point at the PR instead of its branch URL. completion_item/resolve.rb keeps the branch URL: a pins.reject between guard and use drops the narrowing there.
Strong typecheck reports it Unneeded on this branch and on castwide master d09aaff with a fresh cache.
The signatures.first sg-ignore clears with castwide#1258 and #175 merged, so cite the PR instead of its branch. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguFV8m5C72EvjeEFx96
The second line of an sg-ignore that cites two PRs is the URL alone. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguFV8m5C72EvjeEFx96
castwide#1258 does not narrow node from a truthy node&.loc chain; the narrow-pure-rbs-calls branch is already part of it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguFV8m5C72EvjeEFx96
apiology
marked this pull request as draft
November 18, 2026 20:50
support_workspace_folders? and dynamic_registration_for? cannot be
inferred because Message::Base#params is Hash{String => undefined}:
LSP params need record types. Their boolish todos named the wrong
cause.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LTpguGB46zNTu6pFX7VfZV
Strong typecheck reports missing @param/@return tags on Metagem.parse_require_paths (its @parse tag was a typo for @PARAM), Repo#build_from_bundler_definition, Repo#build_from_gemfile_lock and Shell#bundle, which came in from master. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguGB46zNTu6pFX7VfZV
Metagem.parse_require_paths reads children off a node found in a flattened Array, which RBS types as Array[untyped], and Repo#build_from_bundler_definition maps values of a Hash built by Array#to_h with a block, whose generic parameters are not resolved from the block. Mark them with the existing rules.rb labels and update the counts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguGB46zNTu6pFX7VfZV
Repo's calls on Gem::Specification.find_all_by_name results, Gem::Platform.local and Bundler::Source::Rubygems#remotes resolve only once castwide#1494 types those RBS fills. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LTpguGB46zNTu6pFX7VfZV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was written by Claude Code on behalf of @apiology.
Regressed on: 2026-05-20, by castwide/solargraph#1200, Temporary job stubs, which stopped typecheck failures from failing CI
Problem
CI passes even when strong typechecking finds problems:
Type errors in Solargraph's own code merge unnoticed.
Solution
Re-enables
solargraph typecheck --level strongas an enforced CI gate in all four places it runs, and marks each remaining problem with an@sg-ignorecomment naming its cause, with no changes to Ruby code.Depends on
With asserts on, the check still crashes inside Solargraph. These PRs fix those crashes and must merge first:
class << self@!attributedirective pins (after [regression fix] Stop closure asserts on methods in class << self and Struct.new blocks #1433)module_functionmethodsNil-safety fixes are deferred to #1245; markers citing it name the deferred fix.