fix: Add abs() guard to Tymist.tock setter for consistency with Doer#7
Open
Nicholas-Keystate wants to merge 1 commit intoWebOfTrust:masterfrom
Open
Conversation
Tymist.tock.setter was missing abs() guard that Doer.tock.setter has. Since Doist inherits from Tymist (not Doer), a Doist(tock=-X) would cause tyme to decrement on each tick(), breaking all scheduling: - Tyme monotonicity violated - Tymers never expire (comparing against retreating tyme) - Periodic Doers' retymes never reached - Potential infinite loops This change: - Adds abs() to Tymist.tock setter (line 80) - Updates constructor to use setter (inherits abs() guard) - Adds test_tymist_tock_abs_guard test Matches existing pattern in: - Doer.tock setter: abs(float(tock)) (doing.py:569) - Doist.limit: abs(float(limit)) (doing.py:110)
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.
Summary
Add
abs()guard toTymist.tocksetter for consistency withDoer.tocksetter.Problem
Tymist.tock.setter(tyming.py:78) did not applyabs():But
Doer.tock.setter(doing.py:569) does:Since
Doistinherits fromTymist(notDoer), aDoist(tock=-X)would causetymeto decrement on eachtick(), breaking all scheduling invariants:Fix
abs()toTymist.tocksettertest_tymist_tock_abs_guardtestConsistency
Other parameters already have sign guards:
Doist.limit:abs(float(limit))(doing.py:110)Doer.tock:abs(float(tock))(doing.py:569)This PR extends that pattern to
Tymist.tock.Test