Conversation
9baa4df to
6732de2
Compare
a0c7ce7 to
a13a794
Compare
6732de2 to
f8f2fa2
Compare
There was a problem hiding this comment.
🤔 Would it make sense to expose a method that signals that parsing has completed? I understand defining @dependencies signals this internally, and that we may not want to have collaborators checking this externally. Maybe something like a result object would be appropriate, given your note about handling parse errors.
None of this is necessary, but maybe it would be useful? I'm interested in your thoughts as we're still paving the path for further changes.
There was a problem hiding this comment.
we may not want to have collaborators checking this externally.
I think the call order we have right now means we can proceed if parsing fails, but from reasoning through the code I don't think we ever actually should? i.e. there shouldn't be any collaboration if parsing fails, it's always a sign to stop the job.
dependabot-core/updater/lib/dependabot/updater.rb
Lines 71 to 77 in 8f9e473
In the existing behaviour, if parsing fails, we get an empty value for "dependencies" at the code above.
For a new update, [] means we don't iterate and the job silently ends.
For updating an existing PR, we end up here:
dependabot-core/updater/lib/dependabot/updater.rb
Lines 134 to 146 in 8f9e473
This will nearly always result in [] != [$at_least_one_dep], so we exit. We don't close the PR as the parser failure has placed an error on the job, but we could have the same outcome by stopping if the parse fails.
This is feels an awful lot like cleanly closing the job accidentally/on a weak signal. If we stop immediately when parsing fails, it isn't actually a behaviour change, but it does mean reshuffling a lot of tests around so I'm reluctant to follow through for now.
There was a problem hiding this comment.
I think a no-op of sorts, probably in the shape of error forwarding, makes sense here.
There was a problem hiding this comment.
👍 This feels like a solid place for this logic 🏡
There was a problem hiding this comment.
I'm appreciating this as a place to put error handling. The reasons for it to change will be limited to new errors and new requirements to handle those errors. That feels right to me, especially compared to the previous location 🙂
a13a794 to
870b293
Compare
Follows up on #6847 which must merge first
This is small and somewhat imperfect extract-to-class refactor to move aside some long methods we use for presenting
Dependabot::Errorsvia theDependabot::Serviceand/or logging.As we split out distinct operator classes, duplicating these methods is really undesirable as they have a lot of specific behaviour that would be hard to keep in alignment.
I think there's a deeper refactor to be had here since methods ultimately derive an "error detail" hash based on the subclass of
Dependabot::Errorbeing handled, e.g.I think this could just become a method on each
Dependabot::Errorsubclass, but that would require a significant change in core with substantial testing to be confident.Likewise, I think the
handle_dependabot_errorandhandle_parser_errorcould be DRY'd out, but the parsing itself should be pulled up out of the Updater so doing a deeper change at this time might be counter-productive.