fix: harden the curator loop and how bots reach their Matrix client - #63
Merged
Conversation
A rebuild that wedges is killed, and a child that cannot start at all is reported instead of taking the sidecar's loop down with it. Pins both in tests, since the loop calling it has no exception handling of its own.
Each of these read a variable that is only assigned under an earlier branch. Safe today because the same flag guards both ends, one edit away from a NameError. No behaviour change.
Everything after start() went through an optional _client, so each of the 39 uses read as "might be None". A connected() property states the precondition once: use it and a mistake reports itself, instead of an AttributeError on None further downstream. Teardown and the paths that degrade without a connection still check _client themselves.
Contributor
Author
|
Reviewer note on the curator commit: both of its tests pass against the old code too. The old ordering was safe by accident, because the timeout always came from the Verified on this branch: basedpyright 145 (from 183), ruff clean, 2316 passed / 8 skipped. |
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.
The first findings from the type checker landing in #62, in three commits.
while Truethat has no exception handling of its own. Two tests pin that contract.stck,edits,doc_typewere each read under a branch that only assigned them under an earlier one. Safe today, one edit from aNameError.start()reached the Matrix client through an optional_client, so 39 uses read as "might be None". Aclientproperty states the precondition once. Teardown and the paths that degrade without a connection still check_clientthemselves.Takes the tree from 183 to 145, with
microbot.pygoing 38 -> 4.