Skip to content

Commit

Permalink
Guard against possible nil before the actual nil inevitably stops exe…
Browse files Browse the repository at this point in the history
…cution (#10396)

This commit addresses type issue that the introduction of type has brought about.

The PR #9929 has introduced a regression in which the type check stops execution.
It is apparently unexpected as the final message results in "unknown_error" and
the backtrace appended to this message is the only clue to debug with.

However once you take a look inside the root of the error is rather expectable
so let's not overwhelm those who might encounter from this time on.

```
2024/08/09 12:24:28 INFO Checking if faraday-httpclient 1.0.1 needs updating
2024/08/09 12:24:28 INFO Latest version is 2.0.1
2024/08/09 12:24:39 INFO Requirements to unlock all
2024/08/09 12:24:39 INFO Requirements update strategy bump_versions
2024/08/09 12:24:39 ERROR Passed `nil` into T.must
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/vendor/ruby/3.3.0/gems/sorbet-runtime-0.5.11444/lib/types/_types.rb:222:in `must'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/lib/dependabot/updater/group_update_creation.rb:92:in `block in compile_all_dependency_changes_for'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/lib/dependabot/updater/group_update_creation.rb:56:in `each'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/lib/dependabot/updater/group_update_creation.rb:56:in `compile_all_dependency_changes_for'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/vendor/ruby/3.3.0/gems/sorbet-runtime-0.5.11444/lib/types/private/methods/call_validation_2_7.rb:968:in `bind_call'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/vendor/ruby/3.3.0/gems/sorbet-runtime-0.5.11444/lib/types/private/methods/call_validation_2_7.rb:968:in `block in create_validator_method_medium1'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/lib/dependabot/updater/operations/create_group_update_pull_request.rb:97:in `dependency_change'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/vendor/ruby/3.3.0/gems/sorbet-runtime-0.5.11444/lib/types/private/methods/call_validation_2_7.rb:919:in `bind_call'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/vendor/ruby/3.3.0/gems/sorbet-runtime-0.5.11444/lib/types/private/methods/call_validation_2_7.rb:919:in `block in create_validator_method_medium0'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/lib/dependabot/updater/operations/create_group_update_pull_request.rb:61:in `perform'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/vendor/ruby/3.3.0/gems/sorbet-runtime-0.5.11444/lib/types/private/methods/call_validation_2_7.rb:919:in `bind_call'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/vendor/ruby/3.3.0/gems/sorbet-runtime-0.5.11444/lib/types/private/methods/call_validation_2_7.rb:919:in `block in create_validator_method_medium0'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/lib/dependabot/updater/operations/group_update_all_versions.rb:117:in `run_grouped_update_for'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/vendor/ruby/3.3.0/gems/sorbet-runtime-0.5.11444/lib/types/private/methods/call_validation_2_7.rb:968:in `bind_call'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/vendor/ruby/3.3.0/gems/sorbet-runtime-0.5.11444/lib/types/private/methods/call_validation_2_7.rb:968:in `block in create_validator_method_medium1'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/lib/dependabot/updater/operations/group_update_all_versions.rb:103:in `block in run_grouped_dependency_updates'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/lib/dependabot/updater/operations/group_update_all_versions.rb:102:in `each'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/lib/dependabot/updater/operations/group_update_all_versions.rb:102:in `run_grouped_dependency_updates'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/vendor/ruby/3.3.0/gems/sorbet-runtime-0.5.11444/lib/types/private/methods/call_validation.rb:270:in `bind_call'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/vendor/ruby/3.3.0/gems/sorbet-runtime-0.5.11444/lib/types/private/methods/call_validation.rb:270:in `validate_call'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/vendor/ruby/3.3.0/gems/sorbet-runtime-0.5.11444/lib/types/private/methods/_methods.rb:277:in `block in _on_method_added'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/lib/dependabot/updater/operations/group_update_all_versions.rb:64:in `perform'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/vendor/ruby/3.3.0/gems/sorbet-runtime-0.5.11444/lib/types/private/methods/call_validation.rb:270:in `bind_call'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/vendor/ruby/3.3.0/gems/sorbet-runtime-0.5.11444/lib/types/private/methods/call_validation.rb:270:in `validate_call'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/vendor/ruby/3.3.0/gems/sorbet-runtime-0.5.11444/lib/types/private/methods/_methods.rb:277:in `block in _on_method_added'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/lib/dependabot/updater.rb:45:in `run'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/lib/dependabot/update_files_command.rb:44:in `block in perform_job'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/vendor/ruby/3.3.0/gems/opentelemetry-api-1.2.3/lib/opentelemetry/trace/tracer.rb:37:in `block in in_span'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/vendor/ruby/3.3.0/gems/opentelemetry-api-1.2.3/lib/opentelemetry/trace.rb:70:in `block in with_span'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/vendor/ruby/3.3.0/gems/opentelemetry-api-1.2.3/lib/opentelemetry/context.rb:87:in `with_value'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/vendor/ruby/3.3.0/gems/opentelemetry-api-1.2.3/lib/opentelemetry/trace.rb:70:in `with_span'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/vendor/ruby/3.3.0/gems/opentelemetry-api-1.2.3/lib/opentelemetry/trace/tracer.rb:37:in `in_span'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/lib/dependabot/update_files_command.rb:18:in `perform_job'
2024/08/09 12:24:39 ERROR /home/dependabot/dependabot-updater/lib/dependabot/base_command.rb:37:in `run'
2024/08/09 12:24:39 ERROR bin/update_files.rb:46:in `<main>'
2024/08/09 12:24:39 INFO Results:
Dependabot encountered '1' error(s) during execution, please check the logs for more details.
+---------------+
|    Errors     |
+---------------+
| unknown_error |
+---------------+
```

Co-authored-by: AbdulFattaah Popoola <abdulapopoola@github.com>
  • Loading branch information
sato11 and abdulapopoola authored Aug 12, 2024
1 parent 2691f1b commit 5a291e4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions updater/lib/dependabot/updater/group_update_creation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ def compile_all_dependency_changes_for(group)
dep.name.casecmp(dependency.name)&.zero?
end

next unless lead_dependency

dependency_change = create_change_for(T.must(lead_dependency), updated_dependencies, dependency_files, group)

# Move on to the next dependency using the existing files if we
Expand Down

0 comments on commit 5a291e4

Please sign in to comment.