Report type check progress to master even when a worker job fails - #2244
Open
soutaro wants to merge 1 commit into
Open
Report type check progress to master even when a worker job fails#2244soutaro wants to merge 1 commit into
soutaro wants to merge 1 commit into
Conversation
The master waits for a `$/steep/typeCheck/progress` notification of every file it assigned to workers, and the type check session never finishes if a worker skips reporting a file. Type checking a file can raise an error outside of the signature validation path, for example when building a definition from the RBS environment fails with `RBS::DuplicatedMethodDefinitionError`. This happens easily after upgrading to RBS 4, whose core signatures added methods (like `Module#ruby2_keywords`) that conflict with method definitions in the project's own signatures with a different visibility. The error was rescued in `BaseWorker#run`, so the worker survived, but the progress notification for the file was never sent and `steep check` would hang forever waiting for it. Wrap the progress-reporting jobs in `#reporting_typecheck_progress`, which reports the file to the master with `diagnostics: nil` and re-raises the error, keeping the existing error logging behavior while letting the type check session finish. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019d8VZ7KWvCH1otxL7KEEf5
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.
Problem
steep checkhangs forever (all processes idle at 0% CPU) when type checking a file raises an error outside of the signature validation path.The master waits for a
$/steep/typeCheck/progressnotification for every file it assigned to workers. WhenServices::TypeCheckService#typecheck_source(or#validate_signature) raises — for example when building a definition from the RBS environment fails withRBS::DuplicatedMethodDefinitionError— the error is rescued inBaseWorker#run, so the worker survives, but the progress notification for that file is never sent and the type check session never finishes.This is easy to hit after upgrading to Steep 2.0 / RBS 4, whose core signatures added methods (like
private def ruby2_keywordsonModule) that conflict with method definitions in a project's own signatures with a different visibility. Minimal reproduction:steep checkon this project (with rbs 4.x) hangs forever. Type checking the RBS gem's own v3.10.4 source tree with Steep 2.0 hangs the same way, because itssig/unit_test/spy.rbsdefinesModule#ruby2_keywords.Fix
Wrap the four progress-reporting jobs in
TypeCheckWorker#handle_job(ValidateAppSignatureJob,ValidateLibrarySignatureJob,TypeCheckCodeJob,TypeCheckInlineCodeJob) with#reporting_typecheck_progress, which reports the file to the master withdiagnostics: niland re-raises the error. The existing error logging andwindow/showMessagebehavior inBaseWorkeris unchanged, and the session now finishes:steep checkprintsUnexpected error reported. 🚨and exits with status 1 instead of hanging.Tests
$/steep/typeCheck/progressnotification is sent even whenhandle_jobraisesRBS::DuplicatedMethodDefinitionError.test/type_check_worker_test.rb(19 runs) andtest/master_test.rb(19 runs) pass.steep checkon the reproduction projects above completes with exit status 1 instead of hanging; healthy projects report identical diagnostics as before.🤖 Generated with Claude Code
https://claude.ai/code/session_019d8VZ7KWvCH1otxL7KEEf5
Generated by Claude Code